diff --git a/#ThirdParty/FreeImage/Dist/x32/FreeImage.lib b/#ThirdParty/FreeImage/Dist/x32/FreeImage.lib deleted file mode 100644 index 28071aa..0000000 Binary files a/#ThirdParty/FreeImage/Dist/x32/FreeImage.lib and /dev/null differ diff --git a/#ThirdParty/FreeImage/Dist/x64/FreeImage.lib b/#ThirdParty/FreeImage/Dist/x64/FreeImage.lib deleted file mode 100644 index 59e3d84..0000000 Binary files a/#ThirdParty/FreeImage/Dist/x64/FreeImage.lib and /dev/null differ diff --git a/#ThirdParty/FreeImage/Examples/Generic/BatchLoad.cpp b/#ThirdParty/FreeImage/Examples/Generic/BatchLoad.cpp deleted file mode 100644 index d1c80b4..0000000 --- a/#ThirdParty/FreeImage/Examples/Generic/BatchLoad.cpp +++ /dev/null @@ -1,214 +0,0 @@ -// ========================================================== -// Batch loader -// -// Design and implementation by -// - Floris van den Berg -// - Hervé Drolon -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at own risk! -// ========================================================== - -// -// This example shows how to easily batch load a directory -// full of images. Because not all formats can be identified -// by their header (some images don't have a header or one -// at the end of the file) we make use of the -// FreeImage_GetFIFFromFilename function. This function -// receives a file name, for example 'myfile.bmp', and returns -// a FREE_IMAGE_TYPE enum which identifies that bitmap. -// -// Functions used in this sample : -// FreeImage_GetFileType, FreeImage_GetFIFFromFilename, FreeImage_FIFSupportsReading, -// FreeImage_Load, FreeImage_GetBPP, FreeImage_FIFSupportsWriting, FreeImage_GetFormatFromFIF -// FreeImage_FIFSupportsExportBPP, FreeImage_Save, FreeImage_Unload, -// FreeImage_SetOutputMessage, FreeImage_GetVersion, FreeImage_GetCopyrightMessage -// -// ========================================================== - -#include -#include -#include -#include -#include - -#include "FreeImage.h" - -// ---------------------------------------------------------- - -/** Generic image loader - @param lpszPathName Pointer to the full file name - @param flag Optional load flag constant - @return Returns the loaded dib if successful, returns NULL otherwise -*/ -FIBITMAP* GenericLoader(const char* lpszPathName, int flag) { - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - - // check the file signature and deduce its format - // (the second argument is currently not used by FreeImage) - fif = FreeImage_GetFileType(lpszPathName, 0); - if(fif == FIF_UNKNOWN) { - // no signature ? - // try to guess the file format from the file extension - fif = FreeImage_GetFIFFromFilename(lpszPathName); - } - // check that the plugin has reading capabilities ... - if((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) { - // ok, let's load the file - FIBITMAP *dib = FreeImage_Load(fif, lpszPathName, flag); - // unless a bad file format, we are done ! - return dib; - } - return NULL; -} - -/** Generic image writer - @param dib Pointer to the dib to be saved - @param lpszPathName Pointer to the full file name - @param flag Optional save flag constant - @return Returns true if successful, returns false otherwise -*/ -bool GenericWriter(FIBITMAP* dib, const char* lpszPathName, int flag) { - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - BOOL bSuccess = FALSE; - - if(dib) { - // try to guess the file format from the file extension - fif = FreeImage_GetFIFFromFilename(lpszPathName); - if(fif != FIF_UNKNOWN ) { - // check that the plugin has sufficient writing and export capabilities ... - WORD bpp = FreeImage_GetBPP(dib); - if(FreeImage_FIFSupportsWriting(fif) && FreeImage_FIFSupportsExportBPP(fif, bpp)) { - // ok, we can save the file - bSuccess = FreeImage_Save(fif, dib, lpszPathName, flag); - // unless an abnormal bug, we are done ! - } - } - } - return (bSuccess == TRUE) ? true : false; -} - -// ---------------------------------------------------------- - -/** - FreeImage error handler - @param fif Format / Plugin responsible for the error - @param message Error message -*/ -void FreeImageErrorHandler(FREE_IMAGE_FORMAT fif, const char *message) { - printf("\n*** "); - if(fif != FIF_UNKNOWN) { - printf("%s Format\n", FreeImage_GetFormatFromFIF(fif)); - } - printf(message); - printf(" ***\n"); -} - -// ---------------------------------------------------------- - -#ifndef MAX_PATH -#define MAX_PATH 260 -#endif - -int -main(int argc, char *argv[]) { - - const char *input_dir = "d:\\images\\"; - FIBITMAP *dib = NULL; - int id = 1; - - // call this ONLY when linking with FreeImage as a static library -#ifdef FREEIMAGE_LIB - FreeImage_Initialise(); -#endif // FREEIMAGE_LIB - - // initialize your own FreeImage error handler - - FreeImage_SetOutputMessage(FreeImageErrorHandler); - - // print version & copyright infos - - printf(FreeImage_GetVersion()); - printf("\n"); - printf(FreeImage_GetCopyrightMessage()); - printf("\n"); - - // open the log file - - FILE *log_file = fopen("log_file.txt", "w"); - - // batch convert all supported bitmaps - - _finddata_t finddata; - long handle; - char image_path[MAX_PATH]; - - // scan all files - strcpy(image_path, input_dir); - strcat(image_path, "*.*"); - - if ((handle = _findfirst(image_path, &finddata)) != -1) { - do { - // make a path to a directory - - char *directory = new char[MAX_PATH]; - strcpy(directory, input_dir); - strcat(directory, finddata.name); - - // make a unique filename - - char *unique = new char[128]; - itoa(id, unique, 10); - strcat(unique, ".png"); - - // open and load the file using the default load option - dib = GenericLoader(directory, 0); - - if (dib != NULL) { - // save the file as PNG - bool bSuccess = GenericWriter(dib, unique, PNG_DEFAULT); - - // free the dib - FreeImage_Unload(dib); - - if(bSuccess) { - fwrite(unique, strlen(unique), 1, log_file); - } else { - strcpy(unique, "FAILED"); - fwrite(unique, strlen(unique), 1, log_file); - } - fwrite(" >> ", 4, 1, log_file); - fwrite(directory, strlen(directory), 1, log_file); - fwrite("\n", 1, 1, log_file); - - id++; - } - - delete [] unique; - delete [] directory; - - } while (_findnext(handle, &finddata) == 0); - - _findclose(handle); - } - - fclose(log_file); - - // call this ONLY when linking with FreeImage as a static library -#ifdef FREEIMAGE_LIB - FreeImage_DeInitialise(); -#endif // FREEIMAGE_LIB - - return 0; -} diff --git a/#ThirdParty/FreeImage/Examples/Generic/CloneMultiPage.cpp b/#ThirdParty/FreeImage/Examples/Generic/CloneMultiPage.cpp deleted file mode 100644 index bbeef58..0000000 --- a/#ThirdParty/FreeImage/Examples/Generic/CloneMultiPage.cpp +++ /dev/null @@ -1,112 +0,0 @@ -// ========================================================== -// Multipage functions demonstration -// -// Design and implementation by -// - Hervé Drolon -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at own risk! -// ========================================================== - -// This sample shows how to clone a multipage TIFF -// -// Functions used in this sample : -// FreeImage_OpenMultiBitmap, FreeImage_GetPageCount, FreeImage_LockPage, -// FreeImage_AppendPage, FreeImage_UnlockPage, FreeImage_CloseMultiBitmap; -// FreeImage_SetOutputMessage -// -// ========================================================== - -#include -#include -#include - -#include "FreeImage.h" - -// ---------------------------------------------------------- - -/** - FreeImage error handler -*/ -void MyMessageFunc(FREE_IMAGE_FORMAT fif, const char *message) { - cout << "\n*** " << message << " ***\n"; - cout.flush(); -} - -// ---------------------------------------------------------- - -bool CloneMultiPage(FREE_IMAGE_FORMAT fif, char *input, char *output, int output_flag) { - - BOOL bMemoryCache = TRUE; - - // Open src file (read-only, use memory cache) - FIMULTIBITMAP *src = FreeImage_OpenMultiBitmap(fif, input, FALSE, TRUE, bMemoryCache); - - if(src) { - // Open dst file (creation, use memory cache) - FIMULTIBITMAP *dst = FreeImage_OpenMultiBitmap(fif, output, TRUE, FALSE, bMemoryCache); - - // Get src page count - int count = FreeImage_GetPageCount(src); - - // Clone src to dst - for(int page = 0; page < count; page++) { - // Load the bitmap at position 'page' - FIBITMAP *dib = FreeImage_LockPage(src, page); - if(dib) { - // add a new bitmap to dst - FreeImage_AppendPage(dst, dib); - // Unload the bitmap (do not apply any change to src) - FreeImage_UnlockPage(src, dib, FALSE); - } - } - - // Close src - FreeImage_CloseMultiBitmap(src, 0); - // Save and close dst - FreeImage_CloseMultiBitmap(dst, output_flag); - - return true; - } - - return false; -} - - -int -main(int argc, char *argv[]) { - - char *input_filename = "images\\input.tif"; - char *output_filename = "images\\clone.tif"; - - // call this ONLY when linking with FreeImage as a static library -#ifdef FREEIMAGE_LIB - FreeImage_Initialise(); -#endif // FREEIMAGE_LIB - - // initialize our own FreeImage error handler - - FreeImage_SetOutputMessage(MyMessageFunc); - - // Copy 'input.tif' to 'clone.tif' - - CloneMultiPage(FIF_TIFF, input_filename, output_filename, 0); - - // call this ONLY when linking with FreeImage as a static library -#ifdef FREEIMAGE_LIB - FreeImage_DeInitialise(); -#endif // FREEIMAGE_LIB - - return 0; -} diff --git a/#ThirdParty/FreeImage/Examples/Generic/CreateAlpha.cpp b/#ThirdParty/FreeImage/Examples/Generic/CreateAlpha.cpp deleted file mode 100644 index 48b3e29..0000000 --- a/#ThirdParty/FreeImage/Examples/Generic/CreateAlpha.cpp +++ /dev/null @@ -1,181 +0,0 @@ -// ========================================================== -// Alpha channel manipulation example -// -// Design and implementation by -// - Hervé Drolon -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at own risk! -// ========================================================== - -// This example shows how to create a transparent image from any input image -// using the greyscale version of the input image as the alpha channel mask. -// The alpha channel is set using the FreeImage_SetChannel function. -// -// -// ========================================================== - -#include -#include "FreeImage.h" - -// ---------------------------------------------------------- - -/** Generic image loader - @param lpszPathName Pointer to the full file name - @param flag Optional load flag constant - @return Returns the loaded dib if successful, returns NULL otherwise -*/ -FIBITMAP* GenericLoader(const char* lpszPathName, int flag) { - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - - // check the file signature and deduce its format - // (the second argument is currently not used by FreeImage) - fif = FreeImage_GetFileType(lpszPathName, 0); - if(fif == FIF_UNKNOWN) { - // no signature ? - // try to guess the file format from the file extension - fif = FreeImage_GetFIFFromFilename(lpszPathName); - } - // check that the plugin has reading capabilities ... - if((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) { - // ok, let's load the file - FIBITMAP *dib = FreeImage_Load(fif, lpszPathName, flag); - // unless a bad file format, we are done ! - return dib; - } - return NULL; -} - -/** Generic image writer - @param dib Pointer to the dib to be saved - @param lpszPathName Pointer to the full file name - @param flag Optional save flag constant - @return Returns true if successful, returns false otherwise -*/ -bool GenericWriter(FIBITMAP* dib, const char* lpszPathName, int flag) { - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - BOOL bSuccess = FALSE; - - if(dib) { - // try to guess the file format from the file extension - fif = FreeImage_GetFIFFromFilename(lpszPathName); - if(fif != FIF_UNKNOWN ) { - // check that the plugin has sufficient writing and export capabilities ... - WORD bpp = FreeImage_GetBPP(dib); - if(FreeImage_FIFSupportsWriting(fif) && FreeImage_FIFSupportsExportBPP(fif, bpp)) { - // ok, we can save the file - bSuccess = FreeImage_Save(fif, dib, lpszPathName, flag); - // unless an abnormal bug, we are done ! - } - } - } - return (bSuccess == TRUE) ? true : false; -} - -// ---------------------------------------------------------- - -/** - FreeImage error handler - @param fif Format / Plugin responsible for the error - @param message Error message -*/ -void FreeImageErrorHandler(FREE_IMAGE_FORMAT fif, const char *message) { - printf("\n*** "); - if(fif != FIF_UNKNOWN) { - printf("%s Format\n", FreeImage_GetFormatFromFIF(fif)); - } - printf(message); - printf(" ***\n"); -} - -// ---------------------------------------------------------- - - -/** - Creates a 32-bit transparent image using the black channel of the source image - @param src Source image - @return Returns a 32-bit transparent image -*/ -FIBITMAP* CreateAlphaFromLightness(FIBITMAP *src) { - // create a 32-bit image from the source - FIBITMAP *dst = FreeImage_ConvertTo32Bits(src); - - // create a 8-bit mask - FreeImage_Invert(src); - FIBITMAP *mask = FreeImage_ConvertTo8Bits(src); - FreeImage_Invert(src); - - // insert the mask as an alpha channel - FreeImage_SetChannel(dst, mask, FICC_ALPHA); - - // free the mask and return - FreeImage_Unload(mask); - - return dst; -} - -int -main(int argc, char *argv[]) { - - // call this ONLY when linking with FreeImage as a static library -#ifdef FREEIMAGE_LIB - FreeImage_Initialise(); -#endif // FREEIMAGE_LIB - - // initialize your own FreeImage error handler - - FreeImage_SetOutputMessage(FreeImageErrorHandler); - - // print version & copyright infos - - printf("FreeImage version : %s", FreeImage_GetVersion()); - printf("\n"); - printf(FreeImage_GetCopyrightMessage()); - printf("\n"); - - - if(argc != 3) { - printf("Usage : CreateAlpha \n"); - return 0; - } - - // Load the source image - FIBITMAP *src = GenericLoader(argv[1], 0); - if(src) { - // Create a transparent image from the lightness image of src - FIBITMAP *dst = CreateAlphaFromLightness(src); - - if(dst) { - // Save the destination image - bool bSuccess = GenericWriter(dst, argv[2], 0); - if(!bSuccess) { - printf("\nUnable to save %s file", argv[2]); - printf("\nThis format does not support 32-bit images"); - } - - // Free dst - FreeImage_Unload(dst); - } - - // Free src - FreeImage_Unload(src); - } - - // call this ONLY when linking with FreeImage as a static library -#ifdef FREEIMAGE_LIB - FreeImage_DeInitialise(); -#endif // FREEIMAGE_LIB - - return 0; -} diff --git a/#ThirdParty/FreeImage/Examples/Generic/FIFImportExport.cpp b/#ThirdParty/FreeImage/Examples/Generic/FIFImportExport.cpp deleted file mode 100644 index f78c054..0000000 --- a/#ThirdParty/FreeImage/Examples/Generic/FIFImportExport.cpp +++ /dev/null @@ -1,149 +0,0 @@ -// ========================================================== -// Plugin functions demonstration -// -// Design and implementation by -// - Hervé Drolon -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at own risk! -// ========================================================== - -// This example shows how to use Plugin functions to explore FreeImage capabilities. -// Whenever an external plugin is added to the library, it is automatically loaded -// with FreeImage and can be asked for its capabilities via the plugin functions. -// -// Functions used in this sample : -// FreeImage_FIFSupportsExportBPP, FreeImage_FIFSupportsICCProfiles, FreeImage_FIFSupportsReading, -// FreeImage_FIFSupportsWriting, FreeImage_GetFIFCount, FreeImage_GetFIFDescription, -// FreeImage_GetFIFExtensionList, FreeImage_GetFormatFromFIF, -// FreeImage_GetVersion, FreeImage_GetCopyrightMessage, FreeImage_SetOutputMessage -// -// ========================================================== - -#include -#include -#include -#include - -#include "FreeImage.h" - -// ---------------------------------------------------------- - -/** - FreeImage error handler -*/ -void MyMessageFunc(FREE_IMAGE_FORMAT fif, const char *message) { - cout << "\n*** " << message << " ***\n"; -} - -// ---------------------------------------------------------- - -/** - Print plugins import capabilities -*/ -void PrintImportFormats(iostream& ios) { - int count = FreeImage_GetFIFCount(); - if(count) - ios << "FORMAT;DESCRIPTION;EXTENSIONS;ICC PROFILES\n"; - for(int i = 0; i < count; i++) { - FREE_IMAGE_FORMAT fif = (FREE_IMAGE_FORMAT)i; - - if(FreeImage_FIFSupportsReading(fif)) { - const char * format = FreeImage_GetFormatFromFIF(fif); - const char * description = FreeImage_GetFIFDescription(fif); - const char * ext = FreeImage_GetFIFExtensionList(fif); - const char * icc = "*"; - if(FreeImage_FIFSupportsICCProfiles(fif)) { - ios << format << ";" << description << ";" << ext << ";" << icc << "\n"; - } else { - ios << format << ";" << description << ";" << ext << "; \n"; - } - } - } -} - -/** - Print plugins export capabilities -*/ -void PrintExportFormats(iostream& ios) { - int count = FreeImage_GetFIFCount(); - if(count) - ios << "FORMAT;DESCRIPTION;EXTENSIONS;BITDEPTH;ICC PROFILES\n"; - for(int i = 0; i < count; i++) { - FREE_IMAGE_FORMAT fif = (FREE_IMAGE_FORMAT)i; - - if(FreeImage_FIFSupportsWriting(fif)) { - const char * format = FreeImage_GetFormatFromFIF(fif); - const char * description = FreeImage_GetFIFDescription(fif); - const char * ext = FreeImage_GetFIFExtensionList(fif); - const char * icc = "*"; - - ios << format << ";" << description << ";" << ext << ";"; - if(FreeImage_FIFSupportsExportBPP(fif, 1)) - ios << "1 "; - if(FreeImage_FIFSupportsExportBPP(fif, 4)) - ios << "4 "; - if(FreeImage_FIFSupportsExportBPP(fif, 8)) - ios << "8 "; - if(FreeImage_FIFSupportsExportBPP(fif, 16)) - ios << "16 "; - if(FreeImage_FIFSupportsExportBPP(fif, 24)) - ios << "24 "; - if(FreeImage_FIFSupportsExportBPP(fif, 32)) - ios << "32 "; - if(FreeImage_FIFSupportsICCProfiles(fif)) { - ios << ";" << icc; - } else { - ios << "; "; - } - ios << "\n"; - } - } -} - -int -main(int argc, char *argv[]) { - // call this ONLY when linking with FreeImage as a static library -#ifdef FREEIMAGE_LIB - FreeImage_Initialise(); -#endif // FREEIMAGE_LIB - - // initialize FreeImage error handler - - FreeImage_SetOutputMessage(MyMessageFunc); - - // print version & copyright infos - - cout << "FreeImage " << FreeImage_GetVersion() << "\n"; - cout << FreeImage_GetCopyrightMessage() << "\n\n"; - - // Print input formats (including external plugins) known by the library - fstream importFile("fif_import.csv", ios::out); - PrintImportFormats(importFile); - importFile.close(); - - // Print output formats (including plugins) known by the library - // for each export format, supported bitdepths are given - fstream exportFile("fif_export.csv", ios::out); - PrintExportFormats(exportFile); - exportFile.close(); - - // call this ONLY when linking with FreeImage as a static library -#ifdef FREEIMAGE_LIB - FreeImage_DeInitialise(); -#endif // FREEIMAGE_LIB - - return 0; - -} diff --git a/#ThirdParty/FreeImage/Examples/Generic/FIIO_Mem.cpp b/#ThirdParty/FreeImage/Examples/Generic/FIIO_Mem.cpp deleted file mode 100644 index 33eea8a..0000000 --- a/#ThirdParty/FreeImage/Examples/Generic/FIIO_Mem.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/*--------------------------------------------------------------------------*\ -|| fiio_mem.cpp by Ryan Rubley || -|| || -|| (v1.02) 4-28-2004 || -|| FreeImageIO to memory || -|| || -\*--------------------------------------------------------------------------*/ - -#include -#include -#include "fiio_mem.h" - -#ifdef __cplusplus -extern "C" { -#endif - -FIBITMAP * -FreeImage_LoadFromMem(FREE_IMAGE_FORMAT fif, fiio_mem_handle *handle, int flags) { - FreeImageIO io; - SetMemIO(&io); - - if (handle && handle->data) { - handle->curpos = 0; - return FreeImage_LoadFromHandle(fif, &io, (fi_handle)handle, flags); - } - - return NULL; -} - -BOOL -FreeImage_SaveToMem(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, fiio_mem_handle *handle, int flags) { - FreeImageIO io; - SetMemIO(&io); - - if (handle) { - handle->filelen = 0; - handle->curpos = 0; - return FreeImage_SaveToHandle(fif, dib, &io, (fi_handle)handle, flags); - } - - return FALSE; -} - -// ---------------------------------------------------------- - -void -SetMemIO(FreeImageIO *io) { - io->read_proc = fiio_mem_ReadProc; - io->seek_proc = fiio_mem_SeekProc; - io->tell_proc = fiio_mem_TellProc; - io->write_proc = fiio_mem_WriteProc; -} - -// ---------------------------------------------------------- - -#define FIIOMEM(member) (((fiio_mem_handle *)handle)->member) - -unsigned -fiio_mem_ReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle) { - unsigned x; - for( x=0; x= FIIOMEM(datalen) ) { - //if we are at or above 1G, we cant double without going negative - if( FIIOMEM(datalen) & 0x40000000 ) { - //max 2G - if( FIIOMEM(datalen) == 0x7FFFFFFF ) { - return 0; - } - newdatalen = 0x7FFFFFFF; - } else if( FIIOMEM(datalen) == 0 ) { - //default to 4K if nothing yet - newdatalen = 4096; - } else { - //double size - newdatalen = FIIOMEM(datalen) << 1; - } - newdata = realloc( FIIOMEM(data), newdatalen ); - if( !newdata ) { - return 0; - } - FIIOMEM(data) = newdata; - FIIOMEM(datalen) = newdatalen; - } - memcpy( (char *)FIIOMEM(data) + FIIOMEM(curpos), buffer, size*count ); - FIIOMEM(curpos) += size*count; - if( FIIOMEM(curpos) > FIIOMEM(filelen) ) { - FIIOMEM(filelen) = FIIOMEM(curpos); - } - return count; -} - -int -fiio_mem_SeekProc(fi_handle handle, long offset, int origin) { - switch(origin) { //0 to filelen-1 are 'inside' the file - default: - case SEEK_SET: //can fseek() to 0-7FFFFFFF always - if( offset >= 0 ) { - FIIOMEM(curpos) = offset; - return 0; - } - break; - - case SEEK_CUR: - if( FIIOMEM(curpos)+offset >= 0 ) { - FIIOMEM(curpos) += offset; - return 0; - } - break; - - case SEEK_END: - if( FIIOMEM(filelen)+offset >= 0 ) { - FIIOMEM(curpos) = FIIOMEM(filelen)+offset; - return 0; - } - break; - } - - return -1; -} - -long -fiio_mem_TellProc(fi_handle handle) { - return FIIOMEM(curpos); -} - -#ifdef __cplusplus -} -#endif diff --git a/#ThirdParty/FreeImage/Examples/Generic/FIIO_Mem.h b/#ThirdParty/FreeImage/Examples/Generic/FIIO_Mem.h deleted file mode 100644 index e686b1c..0000000 --- a/#ThirdParty/FreeImage/Examples/Generic/FIIO_Mem.h +++ /dev/null @@ -1,74 +0,0 @@ -/*--------------------------------------------------------------------------*\ -|| fiio_mem.h by Ryan Rubley || -|| || -|| (v1.02) 4-28-2004 || -|| FreeImageIO to memory || -|| || -\*--------------------------------------------------------------------------*/ - -#ifndef _FIIO_MEM_H_ -#define _FIIO_MEM_H_ - -#include "freeimage.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct fiio_mem_handle_s { - long filelen,datalen,curpos; - void *data; -} fiio_mem_handle; - -/* it is up to the user to create a fiio_mem_handle and init datalen and data - * filelen will be pre-set to 0 by SaveToMem - * curpos will be pre-set to 0 by SaveToMem and LoadFromMem - * IMPORTANT: data should be set to NULL and datalen to 0, - * unless the user wants to manually malloc a larger buffer - */ -FIBITMAP *FreeImage_LoadFromMem(FREE_IMAGE_FORMAT fif, fiio_mem_handle *handle, int flags); -BOOL FreeImage_SaveToMem(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, fiio_mem_handle *handle, int flags); - -void SetMemIO(FreeImageIO *io); -unsigned fiio_mem_ReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle); -unsigned fiio_mem_WriteProc(void *buffer, unsigned size, unsigned count, fi_handle handle); -int fiio_mem_SeekProc(fi_handle handle, long offset, int origin); -long fiio_mem_TellProc(fi_handle handle); - -/*** Example Usage *** - -//variables -FIBITMAP *bitmap, *bitmap2; -fiio_mem_handle fmh; - -//important initialization -fmh.data = NULL; -fmh.datalen = 0; - -//load a regular file -bitmap = FreeImage_Load(FIF_PNG, "sample.png"); - -//save the file to memory -FreeImage_SaveToMem(FIF_PNG, bitmap, &fmh, 0); - -//at this point, fmh.data contains the entire PNG data in memory -//fmh.datalen is the amount of space malloc'd for the image in memory, -//but only fmh.filelen amount of that space is actually used. - -//its easy load an image from memory as well -bitmap2 = FreeImage_LoadFromMem(FIF_PNG, &fmh, 0); -//you could also have image data in memory via some other method, and just set -//fmh.data to point to it, and set both fmh.datalen and fmh.filelen to the -//size of that data, then FreeImage_LoadFromMem could load the image from that -//memory - -//make sure to free the data since SaveToMem will cause it to be malloc'd -free(fmh.data); - -*/ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/#ThirdParty/FreeImage/Examples/Generic/LoadFromHandle.cpp b/#ThirdParty/FreeImage/Examples/Generic/LoadFromHandle.cpp deleted file mode 100644 index d8e14e8..0000000 --- a/#ThirdParty/FreeImage/Examples/Generic/LoadFromHandle.cpp +++ /dev/null @@ -1,145 +0,0 @@ -// ========================================================== -// Load From Handle Example -// -// Design and implementation by -// - Hervé Drolon -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at own risk! -// ========================================================== - -// This example shows how to load a bitmap from a -// user allocated FILE pointer. -// -// Functions used in this sample : -// FreeImage_GetFormatFromFIF, FreeImage_GetFileTypeFromHandle, FreeImage_LoadFromHandle, -// FreeImage_GetFIFFromFilename, FreeImage_Save, FreeImage_Unload -// FreeImage_GetVersion, FreeImage_GetCopyrightMessage, FreeImage_SetOutputMessage -// -// ========================================================== - -#include -#include -#include - -#include "FreeImage.h" - -// ---------------------------------------------------------- - -/** - FreeImage error handler - @param fif Format / Plugin responsible for the error - @param message Error message -*/ -void FreeImageErrorHandler(FREE_IMAGE_FORMAT fif, const char *message) { - printf("\n*** "); - if(fif != FIF_UNKNOWN) { - printf("%s Format\n", FreeImage_GetFormatFromFIF(fif)); - } - printf(message); - printf(" ***\n"); -} - -// ---------------------------------------------------------- - -unsigned DLL_CALLCONV -myReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle) { - return fread(buffer, size, count, (FILE *)handle); -} - -unsigned DLL_CALLCONV -myWriteProc(void *buffer, unsigned size, unsigned count, fi_handle handle) { - return fwrite(buffer, size, count, (FILE *)handle); -} - -int DLL_CALLCONV -mySeekProc(fi_handle handle, long offset, int origin) { - return fseek((FILE *)handle, offset, origin); -} - -long DLL_CALLCONV -myTellProc(fi_handle handle) { - return ftell((FILE *)handle); -} - -// ---------------------------------------------------------- - -int -main(int argc, char *argv[]) { - - // call this ONLY when linking with FreeImage as a static library -#ifdef FREEIMAGE_LIB - FreeImage_Initialise(); -#endif // FREEIMAGE_LIB - - // initialize your own FreeImage error handler - - FreeImage_SetOutputMessage(FreeImageErrorHandler); - - // print version & copyright infos - - printf(FreeImage_GetVersion()); - printf("\n"); - printf(FreeImage_GetCopyrightMessage()); - printf("\n"); - - - if(argc != 2) { - printf("Usage : LoadFromHandle \n"); - return 0; - } - - // initialize your own IO functions - - FreeImageIO io; - - io.read_proc = myReadProc; - io.write_proc = myWriteProc; - io.seek_proc = mySeekProc; - io.tell_proc = myTellProc; - - FILE *file = fopen(argv[1], "rb"); - - if (file != NULL) { - // find the buffer format - FREE_IMAGE_FORMAT fif = FreeImage_GetFileTypeFromHandle(&io, (fi_handle)file, 0); - - if(fif != FIF_UNKNOWN) { - // load from the file handle - FIBITMAP *dib = FreeImage_LoadFromHandle(fif, &io, (fi_handle)file, 0); - - // save the bitmap as a PNG ... - const char *output_filename = "test.png"; - - // first, check the output format from the file name or file extension - FREE_IMAGE_FORMAT out_fif = FreeImage_GetFIFFromFilename(output_filename); - - if(out_fif != FIF_UNKNOWN) { - // then save the file - FreeImage_Save(out_fif, dib, output_filename, 0); - } - - // free the loaded FIBITMAP - FreeImage_Unload(dib); - } - fclose(file); - } - - // call this ONLY when linking with FreeImage as a static library -#ifdef FREEIMAGE_LIB - FreeImage_DeInitialise(); -#endif // FREEIMAGE_LIB - - return 0; -} diff --git a/#ThirdParty/FreeImage/Examples/Generic/LoadFromMemory-classified.cpp b/#ThirdParty/FreeImage/Examples/Generic/LoadFromMemory-classified.cpp deleted file mode 100644 index 7494ba9..0000000 --- a/#ThirdParty/FreeImage/Examples/Generic/LoadFromMemory-classified.cpp +++ /dev/null @@ -1,101 +0,0 @@ -// ========================================================== -// Classified FreeImageIO handler -// -// Design and implementation by -// - schickb (schickb@hotmail.com) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -class MemIO : public FreeImageIO { -public : - MemIO( BYTE *data ) : _start(data), _cp(data) { - read_proc = _ReadProc; - write_proc = _WriteProc; - tell_proc = _TellProc; - seek_proc = _SeekProc; - } - - void Reset() { - _cp = _start; - } - - static unsigned _ReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle); - static unsigned _WriteProc(void *buffer, unsigned size, unsigned count, fi_handle handle); - static int _SeekProc(fi_handle handle, long offset, int origin); - static long _TellProc(fi_handle handle); - -private: - BYTE * const _start; - BYTE *_cp; -}; - - -unsigned -MemIO::_ReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle) { - MemIO *memIO = (MemIO*)handle; - - BYTE *tmp = (BYTE *)buffer; - - for (unsigned c = 0; c < count; c++) { - memcpy(tmp, memIO->_cp, size); - - memIO->_cp = memIO->_cp + size; - - tmp += size; - } - - return count; -} - -unsigned -MemIO::_WriteProc(void *buffer, unsigned size, unsigned count, fi_handle handle) { - ASSERT( false ); - return size; -} - -int -MemIO::_SeekProc(fi_handle handle, long offset, int origin) { - ASSERT(origin != SEEK_END); - - MemIO *memIO = (MemIO*)handle; - - if (origin == SEEK_SET) - memIO->_cp = memIO->_start + offset; - else - memIO->_cp = memIO->_cp + offset; - - return 0; -} - -long -MemIO::_TellProc(fi_handle handle) { - MemIO *memIO = (MemIO*)handle; - - return memIO->_cp - memIO->_start; -} - -// ---------------------------------------------------------- -// PSEUDOCODE... HELPS TO UNDERSTAND HOW THE MEMIO CLASS WORKS -// ---------------------------------------------------------- - -int -main(int argc, char *argv[]) { - BYTE *data = loadimagesomehow(); - - MemIO memIO(data); - - FIBITMAP *fbmp = FreeImage_LoadFromHandle( fif, &memIO, (fi_handle)&memIO ); -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Examples/Generic/LoadFromMemory.cpp b/#ThirdParty/FreeImage/Examples/Generic/LoadFromMemory.cpp deleted file mode 100644 index f62e0b5..0000000 --- a/#ThirdParty/FreeImage/Examples/Generic/LoadFromMemory.cpp +++ /dev/null @@ -1,113 +0,0 @@ -// ========================================================== -// Load From Memory Example -// -// Design and implementation by Floris van den Berg -// -// This file is part of FreeImage 3 -// -// Use at own risk! -// ========================================================== -// -// This example shows how to load a bitmap from memory -// rather than from a file. To do this we make use of the -// FreeImage_LoadFromHandle functions where we override -// the i/o functions to simulate FILE* access in memory. -// -// For seeking purposes the fi_handle passed to the i/o -// functions contain the start of the data block where the -// bitmap is stored. -// -// ========================================================== - -#include -#include -#include - -#include "FreeImage.h" - -// ---------------------------------------------------------- - -fi_handle g_load_address; - -// ---------------------------------------------------------- - -inline unsigned _stdcall -_ReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle) { - BYTE *tmp = (BYTE *)buffer; - - for (unsigned c = 0; c < count; c++) { - memcpy(tmp, g_load_address, size); - - g_load_address = (BYTE *)g_load_address + size; - - tmp += size; - } - - return count; -} - -inline unsigned _stdcall -_WriteProc(void *buffer, unsigned size, unsigned count, fi_handle handle) { - // there's not much use for saving the bitmap into memory now, is there? - - return size; -} - -inline int _stdcall -_SeekProc(fi_handle handle, long offset, int origin) { - assert(origin != SEEK_END); - - if (origin == SEEK_SET) { - g_load_address = (BYTE *)handle + offset; - } else { - g_load_address = (BYTE *)g_load_address + offset; - } - - return 0; -} - -inline long _stdcall -_TellProc(fi_handle handle) { - assert((int)handle > (int)g_load_address); - - return ((int)g_load_address - (int)handle); -} - -// ---------------------------------------------------------- - -int -main(int argc, char *argv[]) { - FreeImageIO io; - - io.read_proc = _ReadProc; - io.write_proc = _WriteProc; - io.tell_proc = _TellProc; - io.seek_proc = _SeekProc; - - // allocate some memory for the bitmap - - BYTE *test = new BYTE[159744]; - - if (test != NULL) { - // load the bitmap into memory. ofcourse you can do this any way you want - - FILE *file = fopen("e:\\projects\\images\\money-256.tif", "rb"); - fread(test, 159744, 1, file); - fclose(file); - - // we store the load address of the bitmap for internal reasons - - g_load_address = test; - - // convert the bitmap - - FIBITMAP *dib = FreeImage_LoadFromHandle(FIF_TIFF, &io, (fi_handle)test); - - // don't forget to free the dib ! - FreeImage_Unload(dib); - - delete [] test; - } - - return 0; -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Examples/Generic/ShowMetadata.cpp b/#ThirdParty/FreeImage/Examples/Generic/ShowMetadata.cpp deleted file mode 100644 index 1df0af8..0000000 --- a/#ThirdParty/FreeImage/Examples/Generic/ShowMetadata.cpp +++ /dev/null @@ -1,317 +0,0 @@ -// ========================================================== -// Simple metadata reader -// -// Design and implementation by -// - Hervé Drolon -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at own risk! -// ========================================================== - -// -// This example shows how to easily parse all metadata -// contained in a JPEG, TIFF or PNG image. -// Comments, Exif and IPTC/NAA metadata tags are written to a HTML file -// for later reading, and Adobe XMP XML packets are written -// in a file whose extension is '.xmp'. This file can be later -// processed using a XML parser. -// -// Metadata functions showed in this sample : -// FreeImage_GetMetadataCount, FreeImage_FindFirstMetadata, FreeImage_FindNextMetadata, -// FreeImage_FindCloseMetadata, FreeImage_TagToString, FreeImage_GetMetadata -// -// ========================================================== - -#include -#include -#include - -using namespace std; - -#include "FreeImage.h" - -// ---------------------------------------------------------- - -/** Generic image loader - @param lpszPathName Pointer to the full file name - @param flag Optional load flag constant - @return Returns the loaded dib if successful, returns NULL otherwise -*/ -FIBITMAP* GenericLoader(const char* lpszPathName, int flag) { - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - - // check the file signature and deduce its format - // (the second argument is currently not used by FreeImage) - fif = FreeImage_GetFileType(lpszPathName, 0); - if(fif == FIF_UNKNOWN) { - // no signature ? - // try to guess the file format from the file extension - fif = FreeImage_GetFIFFromFilename(lpszPathName); - } - // check that the plugin has reading capabilities ... - if((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) { - // ok, let's load the file - FIBITMAP *dib = FreeImage_Load(fif, lpszPathName, flag); - // unless a bad file format, we are done ! - return dib; - } - return NULL; -} - -/** Generic image writer - @param dib Pointer to the dib to be saved - @param lpszPathName Pointer to the full file name - @param flag Optional save flag constant - @return Returns true if successful, returns false otherwise -*/ -bool GenericWriter(FIBITMAP* dib, const char* lpszPathName, int flag) { - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - BOOL bSuccess = FALSE; - - if(dib) { - // try to guess the file format from the file extension - fif = FreeImage_GetFIFFromFilename(lpszPathName); - if(fif != FIF_UNKNOWN ) { - // check that the plugin has sufficient writing and export capabilities ... - WORD bpp = FreeImage_GetBPP(dib); - if(FreeImage_FIFSupportsWriting(fif) && FreeImage_FIFSupportsExportBPP(fif, bpp)) { - // ok, we can save the file - bSuccess = FreeImage_Save(fif, dib, lpszPathName, flag); - // unless an abnormal bug, we are done ! - } - } - } - return (bSuccess == TRUE) ? true : false; -} - -// ---------------------------------------------------------- - -/** - FreeImage error handler - @param fif Format / Plugin responsible for the error - @param message Error message -*/ -void FreeImageErrorHandler(FREE_IMAGE_FORMAT fif, const char *message) { - cout << "\n*** "; - if(fif != FIF_UNKNOWN) { - cout << FreeImage_GetFormatFromFIF(fif) << " Format\n"; - } - cout << message; - cout << " ***\n"; -} - -// ---------------------------------------------------------- - -/** -Print a basic HTML header -*/ -void PrintHTMLHeader(iostream& ios) { - ios << "\n\n
\n"; - ios << "\n"; -} - -/** -Print a HTML footer -*/ -void PrintHTMLFooter(iostream& ios) { - ios << "
\n\n\n\n"; -} - -/** -Print a table header -*/ -void PrintTableHeader(iostream& ios, const char *title) { - ios << "\n"; - ios << "\n"; -} - -/** -Print a table section -*/ -void PrintTableSection(iostream& ios, const char *title) { - ios << "\n"; - ios << ""; -} - -/** -Print a table footer -*/ -void PrintTableFooter(iostream& ios) { - ios << "
" << title << "
" << title << "
Tag nameTag valueDescription
\n"; -} - - -/** -Print the metadata tags to a HTML file -*/ -void PrintMetadata(iostream& ios, const char *sectionTitle, FIBITMAP *dib, FREE_IMAGE_MDMODEL model) { - FITAG *tag = NULL; - FIMETADATA *mdhandle = NULL; - - mdhandle = FreeImage_FindFirstMetadata(model, dib, &tag); - - if(mdhandle) { - // Print a table section - PrintTableSection(ios, sectionTitle); - - do { - // convert the tag value to a string - const char *value = FreeImage_TagToString(model, tag); - - // print the tag - // note that most tags do not have a description, - // especially when the metadata specifications are not available - if(FreeImage_GetTagDescription(tag)) { - ios << "" << FreeImage_GetTagKey(tag) << "" << value << "" << FreeImage_GetTagDescription(tag) << "\n"; - } else { - ios << "" << FreeImage_GetTagKey(tag) << "" << value << "" << " " << "\n"; - } - - } while(FreeImage_FindNextMetadata(mdhandle, &tag)); - } - - FreeImage_FindCloseMetadata(mdhandle); -} - -int -main(int argc, char *argv[]) { - unsigned count; - - // call this ONLY when linking with FreeImage as a static library -#ifdef FREEIMAGE_LIB - FreeImage_Initialise(); -#endif // FREEIMAGE_LIB - - // initialize your own FreeImage error handler - - FreeImage_SetOutputMessage(FreeImageErrorHandler); - - // print version & copyright infos - - cout << "FreeImage " << FreeImage_GetVersion() << "\n"; - cout << FreeImage_GetCopyrightMessage() << "\n\n"; - - if(argc != 2) { - cout << "Usage : ShowMetadata \n"; - return 0; - } - - // Load the bitmap - - FIBITMAP *dib = GenericLoader(argv[1], 0); - if(!dib) - return 0; - - // Create a HTML file - std::string html_file(strtok(argv[1], ".") + std::string(".html")); - - fstream metadataFile(html_file.c_str(), ios::out); - - // Print the header - - PrintHTMLHeader(metadataFile); - PrintTableHeader(metadataFile, argv[1]); - - // Parse and print metadata - - if(count = FreeImage_GetMetadataCount(FIMD_COMMENTS, dib)) { - cout << "\nFIMD_COMMENTS (" << count << " data)\n-----------------------------------------\n"; - - PrintMetadata(metadataFile, "Comments", dib, FIMD_COMMENTS); - } - if(count = FreeImage_GetMetadataCount(FIMD_EXIF_MAIN, dib)) { - cout << "\nFIMD_EXIF_MAIN (" << count << " data)\n-----------------------------------------\n"; - - PrintMetadata(metadataFile, "Exif - main info", dib, FIMD_EXIF_MAIN); - } - if(count = FreeImage_GetMetadataCount(FIMD_EXIF_EXIF, dib)) { - cout << "\nFIMD_EXIF_EXIF (" << count << " data)\n-----------------------------------------\n"; - - PrintMetadata(metadataFile, "Exif - advanced info", dib, FIMD_EXIF_EXIF); - } - if(count = FreeImage_GetMetadataCount(FIMD_EXIF_GPS, dib)) { - cout << "\nFIMD_EXIF_GPS (" << count << " data)\n-----------------------------------------\n"; - - PrintMetadata(metadataFile, "Exif GPS", dib, FIMD_EXIF_GPS); - } - if(count = FreeImage_GetMetadataCount(FIMD_EXIF_INTEROP, dib)) { - cout << "\nFIMD_EXIF_INTEROP (" << count << " data)\n-----------------------------------------\n"; - - PrintMetadata(metadataFile, "Exif interoperability", dib, FIMD_EXIF_INTEROP); - } - if(count = FreeImage_GetMetadataCount(FIMD_EXIF_MAKERNOTE, dib)) { - cout << "\nFIMD_EXIF_MAKERNOTE (" << count << " data)\n-----------------------------------------\n"; - - // Get the camera model - FITAG *tagMake = NULL; - FreeImage_GetMetadata(FIMD_EXIF_MAIN, dib, "Make", &tagMake); - - std::string buffer((char*)FreeImage_GetTagValue(tagMake)); - buffer += " Makernote"; - - PrintMetadata(metadataFile, buffer.c_str(), dib, FIMD_EXIF_MAKERNOTE); - } - if(count = FreeImage_GetMetadataCount(FIMD_IPTC, dib)) { - cout << "\nFIMD_IPTC (" << count << " data)\n-----------------------------------------\n"; - - PrintMetadata(metadataFile, "IPTC/NAA", dib, FIMD_IPTC); - } - if(count = FreeImage_GetMetadataCount(FIMD_GEOTIFF, dib)) { - cout << "\nFIMD_GEOTIFF (" << count << " data)\n-----------------------------------------\n"; - - PrintMetadata(metadataFile, "GEOTIFF", dib, FIMD_GEOTIFF); - } - - // Print the footer - - PrintTableFooter(metadataFile); - PrintHTMLFooter(metadataFile); - - // close the HTML file - - metadataFile.close(); - - // print XMP data - - if(count = FreeImage_GetMetadataCount(FIMD_XMP, dib)) { - cout << "\nFIMD_XMP (" << count << " packet)\n-----------------------------------------\n"; - - std::string xmp_file(strtok(argv[1], ".") + std::string(".xmp")); - metadataFile.open(xmp_file.c_str(), ios::out); - - FITAG *tag = NULL; - FreeImage_GetMetadata(FIMD_XMP, dib, "XMLPacket", &tag); - if(tag) { - metadataFile << (char*)FreeImage_GetTagValue(tag); - } - - metadataFile.close(); - } - - - // Unload the bitmap - - FreeImage_Unload(dib); - - - // call this ONLY when linking with FreeImage as a static library -#ifdef FREEIMAGE_LIB - FreeImage_DeInitialise(); -#endif // FREEIMAGE_LIB - - return 0; -} - - - diff --git a/#ThirdParty/FreeImage/Examples/Linux/Makefile b/#ThirdParty/FreeImage/Examples/Linux/Makefile deleted file mode 100644 index 768e784..0000000 --- a/#ThirdParty/FreeImage/Examples/Linux/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -CC = gcc -CPP = g++ -COMPILERFLAGS = -O3 -INCLUDE = -I../../Dist -VGALIBRARIES = -lfreeimage -lvga -VGAINCLUDE = -I/usr/include/asm -GTKLIBRARIES = -lfreeimage `pkg-config --libs gtk+-2.0` -GTKINCLUDE = `pkg-config --cflags gtk+-2.0` -CFLAGS = $(COMPILERFLAGS) $(INCLUDE) - -all: default - -default: linux-svgalib linux-gtk - -linux-svgalib: linux-svgalib.c - $(CC) $(CFLAGS) $< -o $@ $(VGALIBRARIES) $(VGAINCLUDE) - strip $@ - -linux-gtk: linux-gtk.c - $(CC) $(CFLAGS) $< -o $@ $(GTKLIBRARIES) $(GTKINCLUDE) - strip $@ - -clean: - rm -f core linux-svgalib linux-gtk diff --git a/#ThirdParty/FreeImage/Examples/Linux/linux-gtk.c b/#ThirdParty/FreeImage/Examples/Linux/linux-gtk.c deleted file mode 100644 index e5cf51f..0000000 --- a/#ThirdParty/FreeImage/Examples/Linux/linux-gtk.c +++ /dev/null @@ -1,100 +0,0 @@ -#include -#include -#include - -void destroy(GtkWidget * widget, gpointer data) { - gtk_main_quit(); -} - -int main(int argc, char *argv[]) -{ - GtkWidget *window, *imagebox; - GdkVisual *visual; - GdkImage *image; - FIBITMAP *dib; - int y; - - // initialize the FreeImage library - FreeImage_Initialise(TRUE); - - dib = FreeImage_Load(FIF_PNG, "freeimage.png", PNG_DEFAULT); - - gtk_init(&argc, &argv); - - window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - - gtk_signal_connect(GTK_OBJECT(window), "destroy", - GTK_SIGNAL_FUNC(destroy), NULL); - - visual = gdk_visual_get_system(); - - image = gdk_image_new(GDK_IMAGE_NORMAL,visual, - FreeImage_GetWidth(dib),FreeImage_GetHeight(dib)); - - g_print("picture: %d bpp\n" - "system: %d bpp byteorder: %d\n" - " redbits: %d greenbits: %d bluebits: %d\n" - "image: %d bpp %d bytes/pixel\n", - FreeImage_GetBPP(dib), - visual->depth,visual->byte_order, - visual->red_prec,visual->green_prec,visual->blue_prec, - image->depth,image->bpp ); - - if (FreeImage_GetBPP(dib) != (image->bpp << 3)) { - FIBITMAP *ptr; - - switch (image->bpp) { - case 1: - ptr = FreeImage_ConvertTo8Bits(dib); - break; - - case 2: - if (image->depth == 15) { - ptr = FreeImage_ConvertTo16Bits555(dib); - } else { - ptr = FreeImage_ConvertTo16Bits565(dib); - } - - break; - case 3: - ptr = FreeImage_ConvertTo24Bits(dib); - break; - - default: - case 4: - ptr = FreeImage_ConvertTo32Bits(dib); - break; - } - - FreeImage_Unload(dib); - dib = ptr; - } - -//makes it upside down :( -// memcpy(image->mem, FreeImage_GetBits(dib), image->bpl * image->height); - - BYTE *ptr = FreeImage_GetBits(dib); - - for (y = 0; y < image->height; y++) { - memcpy(image->mem + (y * image->bpl), - ptr + ((image->height - y - 1) * image->bpl), - image->bpl); - } - - FreeImage_Unload(dib); - - imagebox = gtk_image_new_from_image(image, NULL); - gtk_container_add(GTK_CONTAINER(window), imagebox); - - gtk_widget_show(imagebox); - gtk_widget_show(window); - - gtk_main(); - - // release the FreeImage library - FreeImage_DeInitialise(); - - return 0; -} - - diff --git a/#ThirdParty/FreeImage/Examples/Linux/linux-svgalib.c b/#ThirdParty/FreeImage/Examples/Linux/linux-svgalib.c deleted file mode 100644 index 159a238..0000000 --- a/#ThirdParty/FreeImage/Examples/Linux/linux-svgalib.c +++ /dev/null @@ -1,96 +0,0 @@ -#include -#include "FreeImage.h" - -int main(void) -{ - FIBITMAP *dib,*ptr; - vga_modeinfo *inf; - int length,height,bpp,y; - - // initialize the FreeImage library - FreeImage_Initialise(); - - dib = FreeImage_Load(FIF_PNG, "freeimage.png", PNG_DEFAULT); - - vga_init(); - vga_setmode(vga_getdefaultmode()); - - inf = vga_getmodeinfo(vga_getcurrentmode()); - - switch(inf->colors) { - default: - printf("Must be at least 256 color mode!\n"); - return; - - case 1 << 8: - bpp = 8; - break; - - case 1 << 15: - bpp = 15; - break; - - case 1 << 16: - bpp = 16; - break; - - case 1 << 24: - if( inf->bytesperpixel == 3 ) { - bpp = 24; - } else { - bpp = 32; - } - break; - } - - if(FreeImage_GetBPP(dib) != bpp) { - switch(bpp) { - case 8: - ptr = FreeImage_ConvertTo8Bits(dib); - break; - - case 15: - ptr = FreeImage_ConvertTo16Bits555(dib); - break; - - case 16: - ptr = FreeImage_ConvertTo16Bits565(dib); - break; - - case 24: - ptr = FreeImage_ConvertTo24Bits(dib); - break; - - default: - case 32: - ptr = FreeImage_ConvertTo32Bits(dib); - break; - } - - FreeImage_Unload(dib); - dib = ptr; - } - - length = FreeImage_GetWidth(dib); - if( inf->width < length ) { - length = inf->width; - } - height = FreeImage_GetHeight(dib); - if( inf->height < height ) { - height = inf->height; - } - - for(y = 0; y < height; y++) { - vga_drawscansegment(FreeImage_GetScanLine(dib, y), 0, y, length); - } - - FreeImage_Unload(dib); - - vga_getch(); - vga_setmode(TEXT); - - // release the FreeImage library - FreeImage_DeInitialise(); - - return 0; -} diff --git a/#ThirdParty/FreeImage/Examples/OpenGL/TextureManager/TextureManager.cpp b/#ThirdParty/FreeImage/Examples/OpenGL/TextureManager/TextureManager.cpp deleted file mode 100644 index dfc0ed9..0000000 --- a/#ThirdParty/FreeImage/Examples/OpenGL/TextureManager/TextureManager.cpp +++ /dev/null @@ -1,145 +0,0 @@ -//********************************************** -//Singleton Texture Manager class -//Written by Ben English -//benjamin.english@oit.edu -// -//For use with OpenGL and the FreeImage library -//********************************************** - -#include "TextureManager.h" - -TextureManager* TextureManager::m_inst(0); - -TextureManager* TextureManager::Inst() -{ - if(!m_inst) - m_inst = new TextureManager(); - - return m_inst; -} - -TextureManager::TextureManager() -{ - // call this ONLY when linking with FreeImage as a static library - #ifdef FREEIMAGE_LIB - FreeImage_Initialise(); - #endif -} - -//these should never be called -//TextureManager::TextureManager(const TextureManager& tm){} -//TextureManager& TextureManager::operator=(const TextureManager& tm){} - -TextureManager::~TextureManager() -{ - // call this ONLY when linking with FreeImage as a static library - #ifdef FREEIMAGE_LIB - FreeImage_DeInitialise(); - #endif - - UnloadAllTextures(); - m_inst = 0; -} - -bool TextureManager::LoadTexture(const char* filename, const unsigned int texID, GLenum image_format, GLint internal_format, GLint level, GLint border) -{ - //image format - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - //pointer to the image, once loaded - FIBITMAP *dib(0); - //pointer to the image data - BYTE* bits(0); - //image width and height - unsigned int width(0), height(0); - //OpenGL's image ID to map to - GLuint gl_texID; - - //check the file signature and deduce its format - fif = FreeImage_GetFileType(filename, 0); - //if still unknown, try to guess the file format from the file extension - if(fif == FIF_UNKNOWN) - fif = FreeImage_GetFIFFromFilename(filename); - //if still unkown, return failure - if(fif == FIF_UNKNOWN) - return false; - - //check that the plugin has reading capabilities and load the file - if(FreeImage_FIFSupportsReading(fif)) - dib = FreeImage_Load(fif, filename); - //if the image failed to load, return failure - if(!dib) - return false; - - //retrieve the image data - bits = FreeImage_GetBits(dib); - //get the image width and height - width = FreeImage_GetWidth(dib); - height = FreeImage_GetHeight(dib); - //if this somehow one of these failed (they shouldn't), return failure - if((bits == 0) || (width == 0) || (height == 0)) - return false; - - //if this texture ID is in use, unload the current texture - if(m_texID.find(texID) != m_texID.end()) - glDeleteTextures(1, &(m_texID[texID])); - - //generate an OpenGL texture ID for this texture - glGenTextures(1, &gl_texID); - //store the texture ID mapping - m_texID[texID] = gl_texID; - //bind to the new texture ID - glBindTexture(GL_TEXTURE_2D, gl_texID); - //store the texture data for OpenGL use - glTexImage2D(GL_TEXTURE_2D, level, internal_format, width, height, - border, image_format, GL_UNSIGNED_BYTE, bits); - - //Free FreeImage's copy of the data - FreeImage_Unload(dib); - - //return success - return true; -} - -bool TextureManager::UnloadTexture(const unsigned int texID) -{ - bool result(true); - //if this texture ID mapped, unload it's texture, and remove it from the map - if(m_texID.find(texID) != m_texID.end()) - { - glDeleteTextures(1, &(m_texID[texID])); - m_texID.erase(texID); - } - //otherwise, unload failed - else - { - result = false; - } - - return result; -} - -bool TextureManager::BindTexture(const unsigned int texID) -{ - bool result(true); - //if this texture ID mapped, bind it's texture as current - if(m_texID.find(texID) != m_texID.end()) - glBindTexture(GL_TEXTURE_2D, m_texID[texID]); - //otherwise, binding failed - else - result = false; - - return result; -} - -void TextureManager::UnloadAllTextures() -{ - //start at the begginning of the texture map - std::map::iterator i = m_texID.begin(); - - //Unload the textures untill the end of the texture map is found - while(i != m_texID.end()) - UnloadTexture(i->first); - - //clear the texture map - m_texID.clear(); -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Examples/OpenGL/TextureManager/TextureManager.h b/#ThirdParty/FreeImage/Examples/OpenGL/TextureManager/TextureManager.h deleted file mode 100644 index 0afa4b1..0000000 --- a/#ThirdParty/FreeImage/Examples/OpenGL/TextureManager/TextureManager.h +++ /dev/null @@ -1,51 +0,0 @@ -//********************************************** -//Singleton Texture Manager class -//Written by Ben English -//benjamin.english@oit.edu -// -//For use with OpenGL and the FreeImage library -//********************************************** - -#ifndef TextureManager_H -#define TextureManager_H - -#include -#include -#include "FreeImage.h" -#include - -class TextureManager -{ -public: - static TextureManager* Inst(); - virtual ~TextureManager(); - - //load a texture an make it the current texture - //if texID is already in use, it will be unloaded and replaced with this texture - bool LoadTexture(const char* filename, //where to load the file from - const unsigned int texID, //arbitrary id you will reference the texture by - //does not have to be generated with glGenTextures - GLenum image_format = GL_RGB, //format the image is in - GLint internal_format = GL_RGB, //format to store the image in - GLint level = 0, //mipmapping level - GLint border = 0); //border size - - //free the memory for a texture - bool UnloadTexture(const unsigned int texID); - - //set the current texture - bool BindTexture(const unsigned int texID); - - //free all texture memory - void UnloadAllTextures(); - -protected: - TextureManager(); - TextureManager(const TextureManager& tm); - TextureManager& operator=(const TextureManager& tm); - - static TextureManager* m_inst; - std::map m_texID; -}; - -#endif \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Examples/OpenGL/TextureManager/readme.txt b/#ThirdParty/FreeImage/Examples/OpenGL/TextureManager/readme.txt deleted file mode 100644 index 7930599..0000000 --- a/#ThirdParty/FreeImage/Examples/OpenGL/TextureManager/readme.txt +++ /dev/null @@ -1,31 +0,0 @@ -Hello everyone, this is my 2D texture manager class for OpenGL using the FreeImage Library. - -Requirements: --------------------- -OpenGL -STL map class -FreeImage (included) - - -Usage --------------------- -To load a texture, simply call the LoadTexture function: - -TextureManager::Inst()->LoadTexture("img\\bg.jpg", BACKGROUND_IMAGE_ID); - -This also binds the loaded texture as the current texture, so after calling it you may make any calls to glTexParameter you may need to specify the properties of the texture. - -When you are rendering, just call the TextureManager's BindImage function instead of glBindImage: - -TextureManager::Inst()->BindImage(BACKGROUND_IMAGE_ID); - -and then do your rendering as normal. --------------------- - - -Feel free to distribute this as you like, but mind the FreeImage licence included in license-fi.txt, and please don't take credit for my code. If you modify it, be sure to mention me (Ben English) somewhere. - -Please send any comments or suggestions to me at benjamin.english@oit.edu - - -Thanks to Herve Drolon for the FreeImage library, I've found it to be very useful! \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Examples/Plugin/PluginCradle.cpp b/#ThirdParty/FreeImage/Examples/Plugin/PluginCradle.cpp deleted file mode 100644 index 10c363d..0000000 --- a/#ThirdParty/FreeImage/Examples/Plugin/PluginCradle.cpp +++ /dev/null @@ -1,253 +0,0 @@ -// ========================================================== -// Loader/Saver Plugin Cradle -// -// Design and implementation by -// - Floris van den Berg (flvdberg@wxs.nl) -// - Hervé Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#include -#include - -#include "FreeImage.h" -#include "Utilities.h" - -// ========================================================== - -BOOL APIENTRY -DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { - switch (ul_reason_for_call) { - case DLL_PROCESS_ATTACH : - case DLL_PROCESS_DETACH : - case DLL_THREAD_ATTACH : - case DLL_THREAD_DETACH : - break; - } - - return TRUE; -} - -// ========================================================== -// Plugin Interface -// ========================================================== - -static int s_format_id; - -// ========================================================== -// Plugin Implementation -// ========================================================== - -/** - Returns the format string for the plugin. Each plugin, - both internal in the DLL and external in a .fip file, must have - a unique format string to be addressable. -*/ - -static const char * DLL_CALLCONV -Format() { - return "CRADLE"; -} - -/** - Returns a description string for the plugin. Though a - description is not necessary per-se, - it is advised to return an unique string in order to tell the - user what type of bitmaps this plugin will read and/or write. -*/ - -static const char * DLL_CALLCONV -Description() { - return "Here comes the description for your image loader/saver"; -} - -/** - Returns a comma separated list of file extensions indicating - what files this plugin can open. no spaces or whatsoever are allowed. - The list, being used by FreeImage_GetFIFFromFilename, is usually - used as a last resort in finding the type of the bitmap we - are dealing with. Best is to check the first few bytes on - the low-level bits level first and compare them with a known - signature . If this fails, FreeImage_GetFIFFromFilename can be - used. -*/ - -static const char * DLL_CALLCONV -Extension() { - return "ext1,ext2"; -} - -/** - RegExpr is only needed for the Qt wrapper - It allows the Qt mechanism for loading bitmaps to identify the bitmap -*/ -static const char * DLL_CALLCONV -RegExpr() { - return NULL; -} - -/** - Returns a MIME content type string for that format (MIME stands - for Multipurpose Internet Mail Extension). -*/ -static const char * DLL_CALLCONV -MimeType() { - return "image/myformat"; -} - -/** - FreeImage's internal way of seeing if a bitmap is of the desired type. - When the type of a bitmap is to be retrieved, FreeImage runs Validate - for each registered plugin until one returns true. If a plugin doesn't - have a validate function, a return value of false is assumed. - - You can always force to use a particular plugin by directly specifying - it on the command line, but this can result in a dead DLL if the plugin - was not made for the bitmap. -*/ -static BOOL DLL_CALLCONV -Validate(FreeImageIO &io, fi_handle handle) { - return FALSE; -} - -/** - SupportsExportDepth is the first in a possible range of new plugin functions - to ask specific information to that plugin. This function returns TRUE if it - can save a bitmap in the required bitdepth. If it can't the bitmap has to be - converted by the user or another plugin has to be chosen. -*/ -static BOOL DLL_CALLCONV -SupportsExportDepth(int depth) { - return FALSE; -} - -/** - Returns TRUE if the plugin belonging to the given FREE_IMAGE_FORMAT can save a - bitmap in the desired data type, returns FALSE otherwise. Currently, TIFF is the only plugin - able to save all non-standard images. The PNG plugin is able to save unsigned 16-bit - images. -*/ -static BOOL DLL_CALLCONV -SupportsExportType(FREE_IMAGE_TYPE type) { - return (type == FIT_BITMAP) ? TRUE : FALSE; -} - -/** - SupportsICCProfiles informs FreeImage that a plugin supports ICC profiles. - This function returns TRUE if the plugin can load and save a profile. - ICC profile information is accessed via freeimage->get_icc_profile_proc(dib) -*/ -static BOOL DLL_CALLCONV -SupportsICCProfiles() { - return FALSE; -} - - -// ---------------------------------------------------------- - -/** - Loads a bitmap into memory. On entry it is assumed that - the bitmap to be loaded is of the correct type. If the bitmap - is of an incorrect type, the plugin might not gracefully fail but - crash or enter an endless loop. It is also assumed that all - the bitmap data is available at one time. If the bitmap is not complete, - for example because it is being downloaded while loaded, the plugin - might also not gracefully fail. - - The Load function has the following parameters: - - The first parameter (FreeImageIO *io) is a structure providing - function pointers in order to make use of FreeImage's IO redirection. Using - FreeImage's file i/o functions instead of standard ones it is garantueed - that all bitmap types, both current and future ones, can be loaded from - memory, file cabinets, the internet and more. The second parameter (fi_handle handle) - is a companion of FreeImageIO and can be best compared with the standard FILE* type, - in a generalized form. - - The third parameter (int page) indicates wether we will be loading a certain page - in the bitmap or if we will load the default one. This parameter is only used if - the plugin supports multi-paged bitmaps, e.g. cabinet bitmaps that contain a series - of images or pages. If the plugin does support multi-paging, the page parameter - can contain either a number higher or equal to 0 to load a certain page, or -1 to - load the default page. If the plugin does not support multi-paging, - the page parameter is always -1. - - The fourth parameter (int flags) manipulates the load function to load a bitmap - in a certain way. Every plugin has a different flag parameter with different meanings. - - The last parameter (void *data) can contain a special data block used when - the file is read multi-paged. Because not every plugin supports multi-paging - not every plugin will use the data parameter and it will be set to NULL.However, - when the plugin does support multi-paging the parameter contains a pointer to a - block of data allocated by the Open function. -*/ - -static FIBITMAP * DLL_CALLCONV -Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { - return NULL; -} - -static BOOL DLL_CALLCONV -Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void *data) { - return FALSE; -} - -// ========================================================== -// Init -// ========================================================== - -/** - Initialises the plugin. The first parameter (Plugin *plugin) - contains a pointer to a pre-allocated Plugin structure - wherein pointers to the available plugin functions - has to be stored. The second parameter (int format_id) is an identification - number that the plugin may use to show plugin specific warning messages - or other information to the user. The plugin number - is generated by FreeImage and can differ everytime the plugin is - initialised. - - If you want to create your own plugin you have to take some - rules into account. Plugin functions have to be compiled - __stdcall using the multithreaded c runtime libraries. Throwing - exceptions in plugin functions is allowed, as long as those exceptions - are being caught inside the same plugin. It is forbidden for a plugin - function to directly call FreeImage functions or to allocate memory - and pass it to the main DLL. Exception to this rule is the special file data - block that may be allocated the Open function. Allocating a FIBITMAP inside a - plugin can be using the function allocate_proc in the FreeImage structure, - which will allocate the memory using the DLL's c runtime library. -*/ - -void DLL_CALLCONV -Init(Plugin *plugin, int format_id) { - s_format_id = format_id; - - plugin->format_proc = Format; - plugin->description_proc = Description; - plugin->extension_proc = Extension; - plugin->regexpr_proc = RegExpr; - plugin->open_proc = NULL; - plugin->close_proc = NULL; - plugin->pagecount_proc = NULL; - plugin->pagecapability_proc = NULL; - plugin->load_proc = Load; - plugin->save_proc = Save; - plugin->validate_proc = Validate; - plugin->mime_proc = MimeType; - plugin->supports_export_bpp_proc = SupportsExportDepth; - plugin->supports_export_type_proc = SupportsExportType; - plugin->supports_icc_profiles_proc = SupportsICCProfiles; -} diff --git a/#ThirdParty/FreeImage/Examples/Plugin/PluginCradle.h b/#ThirdParty/FreeImage/Examples/Plugin/PluginCradle.h deleted file mode 100644 index b049efb..0000000 --- a/#ThirdParty/FreeImage/Examples/Plugin/PluginCradle.h +++ /dev/null @@ -1,45 +0,0 @@ -// ========================================================== -// JBIG Plugin -// -// Design and implementation by -// - Floris van den Berg (flvdberg@wxs.nl) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#ifndef PLUGINCRADLE_H -#define PLUGINCRADLE_H - -#ifdef PLUGINCRADLE_EXPORTS -#define PLUGIN_API __declspec(dllexport) -#else -#define PLUGIN_API __declspec(dllimport) -#endif - -// ---------------------------------------------------------- - -struct Plugin; - -// ---------------------------------------------------------- - -#define DLL_CALLCONV __stdcall - -// ---------------------------------------------------------- - -extern "C" { - PLUGIN_API void DLL_CALLCONV Init(Plugin *plugin, int format_id); -} - -#endif diff --git a/#ThirdParty/FreeImage/README.minGW b/#ThirdParty/FreeImage/README.minGW deleted file mode 100644 index 30195c3..0000000 --- a/#ThirdParty/FreeImage/README.minGW +++ /dev/null @@ -1,236 +0,0 @@ -===================================================================== -Using the FreeImage library with the MinGW Compiler Suite -===================================================================== - -This file describes how to use the precompiled FreeImage library -FreeImage.dll with the MinGW port of the GNU Compiler Collection -(GCC), how to build this library from source using MinGW and how -to use this MinGW-built library with Microsoft Visual Studio. - -Contents: - -I. Prerequisites - -1. Using the precompiled FreeImage library with MinGW - -2. Building the FreeImage library with MinGW - -3. Using the MinGW FreeImage library with Microsoft Visual Studio - -4. Useful links - - ---------------------------------------------------------------------- -I. Prerequisites -===================================================================== - -The procedures described in this document have been developed and -tested using the following free tools: - -1. MinGW GCC Version 4.4.0 (Core and C++ including required libs) -2. MinGW GNU Binutils Version 2.19.1 -3. MinGW GNU Make Version 3.81-20080326-3 -4. MinGW Runtime Version 3.15.2 -5. MinGW API for MS-Windows Version 3.13 -6. GnuWin32 Package CoreUtils Version 5.3.0 (only for building) -7. GnuWin32 Package Sed Version 4.2 (only for creating the GCC - import library)* - -* Sed is only needed to create a GCC-native import library from - the MSVC import library FreeImage.lib. However, since MinGW now - supports linking against MSVC lib files, this process seems to - be obsolete. See section 1. - -Basically, no version dependent capabilities are used so, this -should also work with older versions of the tools mentioned above. -Similarly, the GnuWin32 packages (which I just prefer over MSYS) -could likely be replaced by a properly installed MSYS environment. - -Furthermore, the following preconditions should be met: - -1. The folders 'bin' under both the MinGW and the GnuWin32 - installation directory should have been added to the PATH - environment variable. Likely it is best adding these - directories permanently to PATH through the System - Properties dialog on the Control Panel. - -2. The MinGW Make package only provides a 'mingw32-make.exe' - executable. There is no alias 'make.exe'. However, make is - preconfigured to use 'make' as the default $(MAKE) command. - This seems to be a bug in the MinGW GNU Make distribution. - Thus, a copy of 'mingw32-make.exe' named 'make.exe' should - be placed into MinGW's 'bin' directory. - - - ---------------------------------------------------------------------- -1. Using the precompiled FreeImage library with MinGW -===================================================================== - -When using functions from C/C++, that reside in a DLL, the linker -needs a so called import library, which specifies, how to -dynamically link these external functions during runtime. However, -different linkers use different types or formats of these import -libraries. - -Since the precompiled FreeImage library was build with Microsoft -Visual Studio, in the past, some extra work was required to use it -from MinGW. An import library, that was compatible with GNU ld, -must have been created first. - -However, for several MinGW versions, the GNU linker ld also -supports linking against Microsoft Visual C++ import libraries -directly. So, this effectively makes any circulating HOWTO's on -how to create a GCC-compatible import library from a MSVC lib file -more or less obsolete. Additionally, MinGW does not require the -GCC/Linux usual lib prefix for libraries, so linking with MinGW -against the precompiled FreeImage DLL is as easy as with MSVC: - -1.) Open a DOS shell (run application cmd.exe) - -2.) Ensure, that the 'bin' folder of MinGW is added to the PATH - environment variable (see Prerequisites). - -3.) Link directly against the supplied lib file: - - C:\>gcc -oFreeImageTest.exe FreeImageTest.c -lFreeImage - -Nonetheless, for the sake of completeness, the following steps -describe how to create a native GCC import library: - -1.) Open a DOS shell (run application cmd.exe) - -2.) Ensure, that the 'bin' folders of both MinGW and GnuWin32 are - added to the PATH environment variable (see Prerequisites). - -3.) Create a .def file 'libfreeimage.def', that contains all symbols - exported by the FreeImage library: - - C:\>pexports FreeImage.dll | sed "s/^_//" > libfreeimage.def - -4.) Create the GCC compatible import library 'libfreeimage.a': - - C:\>dlltool --add-underscore -d libfreeimage.def -l libfreeimage.a - -5.) Use this library to link against with GCC: - - C:\>gcc -oFreeImageTest.exe FreeImageTest.c -lfreeimage - - - ---------------------------------------------------------------------- -2. Building the FreeImage library with MinGW -===================================================================== - -You *do not* need to have any other third party library (like -libjpeg, libpng, libtiff, libmng and zlib and others) installed on -your system in order to compile and use the library. FreeImage uses -its own versions of these libraries. This way, you can be sure that -FreeImage will always use the latest and properly tested versions -of of these third party libraries. - -In order to build the FreeImage library under Windows with MinGW -(GCC), ensure that all the prerequisites mentioned above are met. -The MinGW makefile aims to build a Windows DLL, that differs as -least as possible from the precompiled library that comes with the -FreeImage distribution. Thus, the build process also includes the -DLL version resource as well as the __stdcall attribute for all the -exported functions, including the MSVC-like function decorations -_FuncName@nn. - -When building the FreeImage DLL, of course, an import library is -generated, too. However, this input library is not in GCC's native -format, but in MSVC lib format, which makes it usable from both -MinGW and Microsoft Visual Studio with no further processing. - -The MinGW makefile can also be used to build a static library. -However, due to the different function export attributes needed -for both the dynamic and the shared library (DLL), this requires -a separate invocation of make, which in turn needs to rebuild every -source file after switching from dynamic to static and vice versa. -So, a 'make clean' is required each time, the library type is -changed. - -The type of library to build is specified by a variable named -FREEIMAGE_LIBRARY_TYPE, which may either be set directly in the -Makefile.mingw near line 18 or may be specified as an environment -variable. This variable may either take SHARED or STATIC to build -a dynamic link library (DLL) or a static library respectively. -Since this value is used to dynamically form the actual make target -internally, only uppercase values are valid. Defaults to SHARED. - -The MinGW makefile also supports the 'install' target. However, -this only copies the FreeImage dynamic link library (DLL) from the -Dist folder into the %SystemRoot%\system32 folder. So, invoking this -target only makes sense, if the DLL has been built before. - -Since there is neither a common system wide 'include' nor a 'lib' -directory available under Windows, the FreeImage header file -FreeImage.h as well as both the static library and the DLL import -library FreeImage.lib just remain in the 'Dist' folder. - -The following procedure creates the FreeImage dynamic link library -(DLL) from the sources, installs it and also creates a static -FreeImage library: - -1.) Open a DOS shell (run application cmd.exe) - -2.) Ensure, that the 'bin' folders of both MinGW and GnuWin32 are - added to the PATH environment variable (see Prerequisites). - -3.) Create the FreeImage dynamic link library (DLL): - - C:\>make - -4.) Install the FreeImage dynamic link library (DLL): - - C:\>make install - -5.) Clean all files produced by the recent build process: - - C:\>make clean - -6.) Create a static FreeImage library: - - C:\>set FREEIMAGE_LIBRARY_TYPE=STATIC - C:\>make - -You should be able to link progams with the -lFreeImage option -after the shared library is compiled and installed. You can also -link statically against FreeImage.a from MinGW. - - - ---------------------------------------------------------------------- -3. Using the MinGW FreeImage library with Microsoft Visual Studio -===================================================================== - -Since the MinGW makefile creates an import library in MSVC's lib -format, the produced shared library (DLL) can be used from both -MinGW and Microsoft Visual Studio with no further adaption. Just -link to the import library FreeImage.lib from either MinGW or -Microsoft Visual Studio. - - - ---------------------------------------------------------------------- -4. Useful links -===================================================================== - -- The MinGW homepage: - http://www.mingw.org/ - -- The GnuWin32 homepage: - http://gnuwin32.sourceforge.net/ - -- The GCC homepage and online documentation: - http://gcc.gnu.org/ - http://gcc.gnu.org/onlinedocs/ - -- The GNU Binutils homepage and online documentation: - http://www.gnu.org/software/binutils/ - http://sourceware.org/binutils/docs-2.19/ - -- The GNU Make homepage and online documentation: - http://www.gnu.org/software/make/ - http://www.gnu.org/software/make/manual/make.html diff --git a/#ThirdParty/FreeImage/Whatsnew.txt b/#ThirdParty/FreeImage/Whatsnew.txt deleted file mode 100644 index 6e19915..0000000 --- a/#ThirdParty/FreeImage/Whatsnew.txt +++ /dev/null @@ -1,1258 +0,0 @@ -What's New for FreeImage - -* : fixed -- : removed -! : changed -+ : added - -Month day, 2015 - 3.17.0 -! FreeImage now uses LibPNG 1.6.16 -! FreeImage now uses LibWebP 0.4.2 (GIT patch 2015-03-03) -! FreeImage now uses LibRaw 0.17-Alpha1 -! FreeImage now uses LibTIFF 4.0.4 (CVS patch 2015-01-26) -! FreeImage now uses OpenEXR 2.2.0 -- [Herve Drolon] removed VS 2003 project files : this IDE is no longer supported because of its outdated C++ compiler -+ [Mihail Naydenov] added FreeImage_ConvertFromRawBitsEx -+ [Herve Drolon] added RAW_UNPROCESSED load flag to the RAW plugin -+ [Herve Drolon] added FreeImage_SetMetadataKeyValue -+ [Herve Drolon] added support for metadata writing to the JPEG-JXR plugin -+ [Herve Drolon] added VS 2013 project files -+ [Herve Drolon] added support for PNG tIME metadata (read/write, handle as Exif-TIFF DateTime) -+ [Carsten Klein] added explicit definition of endianness and color order in compiler options -+ [Carsten Klein] added FIQ_LFPQUANT quantizer algorithm -+ [Carsten Klein] added support for input 32-bit dib in Wu quantizer -+ [Tanner Helland] added FreeImage_ConvertToRGBAF and updated conversions in FreeImage_ConvertToType -+ [Herve Drolon] added FreeImage_ConvertToRGBA16 and updated conversions in FreeImage_ConvertToType -+ [Carsten Klein] added FreeImage_CreateView -+ [Carsten Klein] added FreeImage_RescaleRect -+ [Carsten Klein] added FreeImage_GetMemorySize -* [Tanner Helland] ICO plugin: improved support for Vista icons -* [fpgaminer] fixed a rounding error in RGB to greyscale conversion formula -* [Sven-Hendrik Haase] fixed Makefile.fip so that it installs symlinks -* [Joachim Reichel] fixed a potential memory access violation in PluginHDR Save function -* [Christian Schluchter] fixed a bug in FreeImage_LookupSVGColor ("green" color was not found) -* [Marco Altomonte] fixed TARGA signature validation for TARGA versions < 2.0 -* [Jeremy Reyniers] fixed FreeImage_GetScanLine not working with very large images on x64 platforms -* [Herve Drolon] improved PluginTIFF compatibility with LibTIFF 4 -* [Aaron Shumate] fixed a segfault occuring on a corrupted animated GIF -* [Herve Drolon] improved memory allocation in PluginRAW -* [Herve Drolon] fixed loading/saving of TIFF containing a GPS IFD inside the Exif-TIFF metadata segment (the solution is to ignore the tag) -* [Mihail Naydenov] fixed a bug in FreeImage_JPEGCrop*/_JPEGTransform* functions occuring when using the same source / destination filename -* [Herve Drolon] fixed a bug with output image quality in PluginJP2::Save & PluginJ2K::Save functions (regression from FI 3.15.4) -* [Herve Drolon] improved RAW file format detection -* [Aaron Shumate] fixed FreeImage_GetFileType behavior with ANI file formats -* [Herve Drolon] improved Exif reader so as to handle Exif IFD with a suspicious offset (can occur with maker notes) -* [Herve Drolon] fixed a memory leak in PluginPNG:Save occuring when dealing with invalid PNG files -* [Tanner Helland] fixed PNG plugin handling of 16-bit grayscale + 16-bit alpha images -* [Tanner Helland] fixed PNG plugin handling of 16-bit grayscale + tRNS chunk images -* [Tanner Helland] fixed PNG plugin handling of 24-bit RGB + tRNS chunk images -* [Tanner Helland] fixed PNG plugin handling of 1-,4-bit greyscale/palettized + tRNS chunk images -* [ekpyron] fixed invalid directory delimiter in include statement (mingw-w64) in Source/LibJXR/image/sys/strcodec.h -* [ekpyron] fixed Invalid condition for defining _byteswap_ulong (mingw-w64) in Source/LibJXR/image/sys/strcodec.c -* [tostercx] fixed FreeImage_Get*Mask not returning 0 for greyscale images -* [robpats] fixed loading of external plugins when using UNICODE directory names to store plugins -* [Herve Drolon] fixed loading of JXR files when using memory streams -* [Carsten Klein] added Dist/ directory creation in Makefiles (in case it is not already present) - -March 23rd, 2014 - 3.16.0 -! FreeImage now uses LibJPEG 9a -! FreeImage now uses LibPNG 1.6.10 -! FreeImage now uses LibTIFF 4.0.3 (CVS patch 2013-11-30) -! FreeImage now uses LibRaw 0.16.0 -! FreeImage now uses OpenJPEG 2.1.0 (SVN patch 2748) -! FreeImage now uses ZLib 1.2.8 -! FreeImage now uses LibWebP 0.4.0 (GIT patch 2014-03-21) -! FreeImage now uses LibJXR 1.1 (GIT patch 2014-01-31) -+ [Herve Drolon] added loading & writing support for the JPEG-XR image format (also support the FIF_LOAD_NOPIXELS flag) -+ [Herve Drolon] added loading & writing support for the WebP image format (also support the FIF_LOAD_NOPIXELS flag) -+ [Herve Drolon] added support for FIF_LOAD_NOPIXELS flag to JP2/J2K plugins -+ [Gaël Zimmermann] added basic support for BMP v4, v5 in BMP plugin (useful for drag and drop from another application such as Firefox) -+ [Mihail Naydenov] FreeImage_GetFIFFromFilename[U] : added support for *rgb,*rgba,*.bw extensions to the SGI plugin -+ [Mihail Naydenov] improved FreeImage_Rescale speed & spatial accuracy -+ [Mihail Naydenov] improved JPEG transform functions and added new functions (see below) : - added FreeImage_JPEGTransformFromHandle - added FreeImage_JPEGTransformCombined - added FreeImage_JPEGTransformCombinedU - added FreeImage_JPEGTransformCombinedFromMemory -* [Herve Drolon] fixed FreeImage_CloneTag behavior with ASCII data handling (regression that appeared in 3.15.2, affect metadata writing) -* [Carsten Klein] ICO plugin: avoid using the AND mask when loading a 32-bit (already transparent) icon -* [Andreas Baumann] HDR plugin: removed a comma at end of an enumerator list -* [mark] added missing in OpenEXR (needed with mingw) -* [Herve Drolon] added support for FIC_MINISWHITE color type inside FreeImage_GetColorType for FIT_UINT16 images -* [Takamasa Mitsuji] FreeImage_Rescale : fixed a NULL-pointer access bug occurring for transparent images with a linear palette -* [Herve Drolon] fixed PSD parser when reading PSD files with corrupted resources -* [Herve Drolon] fixed TIFF plugin truncating metadata tag on loading if type is ASCII and it's value is of variable size (TIFF_VARIABLE) -* [Herve Drolon] fixed loading of TGA 8-bit files with a palette size greater that 256 -* [Anton Kukoba] TIFF parser didn't initialize the memory with zeros in stripped mode. This caused random bitmap data if the tiff file was corrupted/invalid. -* [Herve Drolon] improved TGA file detection when the format version is < 2.0 -* [Christian Heimes] fixed compiler errors on 64bit Linux (INT64 / UINT64 type mismatches and missing prototype for memset) -* [Christian Heimes] fixed FreeImage_Get*Mask() returning 0 on 24-, -32-bit FIT_BITMAP images -* [Mihail Naydenov] fixed GIF plugin LZW decoder failing on some images -* [Herve Drolon] fixed the TIFF plugin against race condition when used simultaneously in multiple threads -* [Herve Drolon] fixed float <--> rgb[a]f conversions when pixels are out of [0..1] range - -October 27th, 2012 - 3.15.4 -! FreeImage now uses LibPNG 1.5.13 -! FreeImage now uses LibRaw 0.14.7 -! FreeImage now uses ZLib 1.2.7 -! FreeImage now uses LibTIFF 4.0.3 -! FreeImage now uses OpenJPEG 1.5.1 -! FreeImage now uses OpenEXR 1.7.1 -+ [Herve Drolon] improved the speed of RAW files detection in FreeImage_GetFileType* functions -+ [Herve Drolon] added JPEG_GREYSCALE load flag to the JPEG plugin (force to load as 8-bit greyscale) -+ [Herve Drolon] added 64-bit RGBA to 24-bit conversion support in FreeImage_ConvertTo24Bits -+ [Carsten Klein] improved the speed of FreeImage_Rescale for FIT_BITMAP & UINT16, RGB[A]16 types -+ [Carsten Klein] improved the speed of FreeImage_ConvertToGreyscale -* [Carsten Klein] updated makefile for building FreeImage with MinGW -* [Herve Drolon] fixed BigTIFF signature validation in FreeImage_GetFileType* functions -* [Carsten Klein] fixed handling of RGB-565 16-bit images (needed for conversion from HBITMAP to FIBITMAP) -* [Herve Drolon] fixed loading of JPEG with invalid IPTC marker -* [Herve Drolon] changed default TIF RowsPerStrips to image height when saving as TIF G3 or TIF G4 (improved compression) -* [Herve Drolon] improved the memory behavior of the RAW plugin (do not allocate huge variables on the stack) -* [Herve Drolon] fixed FreeImage_AllocateT so that it returns NULL with images with a zero width and/or height -* [Herve Drolon] replaced FIUINT64/FIINT64 with standard types UINT64/INT64 -* [Rustam Abdullaev] fixed PNG plugin with saving of transparent monochrome images -* [Floris van den Berg] improved plugin registering when replacing an existing internal plugin with a new equivalent plugin -* [Herve Drolon] fixed a crash when calling FreeImage_GetColorType on a 32-bit RGBA images loaded with the FIF_LOAD_NOPIXELS flag -* [Herve Drolon] fixed FreeImage_SetTransparencyTable falsely setting a dib to 'transparent' when called with a count of 0 -* [Carsten Klein] fixed storing of RGB masks for 16-bit RGB standard images in order to be in a MSDN compatible way -* [Herve Drolon] added an error handling message inside HDR plugin when trying to save an unsupported format -* [Corey Taylor] fixed DDS plugin color channel swapping for RGB color order, when using FREEIMAGE_COLORORDER_RGB color order -* [Herve Drolon] fixed internal TagLib singleton initialization against double-checked locking so that it is multi-thread safe - -March 17th, 2012 - 3.15.3 -! FreeImage now uses LibPNG 1.5.9 -! FreeImage now uses LibTIFF 4.0.1 -+ [Herve Drolon] added new 64-bit data types FIINT64, FIUINT64 -+ [Herve Drolon] added new 64-bit metadata types to FREE_IMAGE_MDTYPE (FIDT_LONG8, FIDT_SLONG8, FIDT_IFD8) -+ [Herve Drolon] added support for 64-bit metadata types to FreeImage_TagToString -* [Herve Drolon] fixed a regression with Fax3/Fax4 TIFF images on 64-bit OS (introduced with FI 3.15.2) -* [Herve Drolon] fixed some gcc 4.4.6 warnings -* [Petr Pytelka] refactored FreeImage_InsertPage and FreeImage_AppendPage -* [Herve Drolon] fixed JP2/J2K plugins with saving of 32-bit dib with a fully opaque layer -* [Herve Drolon] fixed loading of CMYK JPEG when using JPEG_CMYK load flag (need to invert pixels) -* [Herve Drolon] fixed loading of CMYK PSD when using PSD_CMYK load flag - -February 20th, 2012 - 3.15.2 -! FreeImage now uses LibRaw 0.14.5 -! FreeImage now uses LibPNG 1.5.8 -! FreeImage now uses LibJPEG 8d -! FreeImage now uses ZLib 1.2.6 -! FreeImage now uses OpenJPEG 1.5.0 (released version) -! FreeImage now uses LibTIFF 4.0.0 -- [Herve Drolon] removed dependency on LibMNG 1.0.10 (MNG and JNG files are now handled internally) -+ [Herve Drolon] replaced the MNG plugin with a new MNG internal FreeImage plugin (with read support) -+ [Herve Drolon] added a new JNG internal FreeImage plugin (with read/write support) -+ [Christian Heimes] added write support to the TIFF plugin for EXIF_MAIN tags -+ [Herve Drolon] added new Exif maker note tags -+ [Herve Drolon] added TAG_COMPRESSION conversion to FreeImage_TagToString -* [Mylek Grey] enabled the use of multi-component transforms (MCT) in J2K and JP2 saving -* [Herve Drolon] refactored PluginICO in order to correctly support Windows Vista 256x256 icons -* [Herve Drolon] added minor speed improvements to FreeImage_Rescale -* [Herve Drolon] fixed dib allocation failing with very large images (i.e. more than 4GB) -* [Herve Drolon] fixed FreeImage_CloneTag behavior with ASCII data handling -* [Herve Drolon] improved JPEG plugin behavior with very big images -* [Herve Drolon] improved JPEG plugin behavior with C++ exceptions -* [Herve Drolon] fixed loading of palettized PNG with more that 256 palette entries -* [Herve Drolon] fixed a bug inside IFF plugin occuring when loading a 24-bit dib with a palette -* [Herve Drolon] fixed a bug with loading of PNG images containing a cHRM chunk (regression introduced by LibPNG 1.5.4 and fixed by LibPNG 1.5.5) -* [Herve Drolon] allowed loading of PNG with benign errors (such as images with too many IDATs) -* [Mihail Naydenov] fixed some incorrect MIME types returned by FreeImage_GetFIFMimeType -* [Herve Drolon] fixed loading of Exif with bad thumbnail data or with a bad first offset size - -July 25th, 2011 - 3.15.1 -! FreeImage now uses LibRaw 0.13.7 -! FreeImage now uses LibPNG 1.5.4 -! FreeImage now uses LibTIFF 3.9.5 -! FreeImage now uses OpenJPEG 1.5.0 (SVN patch 2011-07-23) -+ [Herve Drolon] added FreeImage_ConvertToRGB16 and updated FreeImage_ConvertToType -+ [Herve Drolon] added RAW_HALFSIZE flag to RAW plugin -* [Herve Drolon] fixed a memory leak in JPEG plugin occuring when loading some corrupted images -* [Eberhard Mattes] improved thread safety behavior inside internal TagLib class -* [Hew How Chee] fixed a bug in FreeImage_EnlargeCanvas when called with negative left and right parameters and bpp <= 4 -* [Herve Drolon] improved memory allocation checking in FreeImage_ConvertTo[Float/RGBF/UINT16] -* [Herve Drolon] allowed loading of TIF with missing bitspersample/samplesperpixel/photometric tags -* [Herve Drolon] fixed FreeImage_AllocateHeaderT against possible malloc overflow -* [Herve Drolon] fixed CUT plugin against heap corruption vulnerability -* [Herve Drolon] fixed BMP plugin for images with a truncated input data stream -* [Herve Drolon] improved PCX format detection in FreeImage_GetFileType* functions -* [Christian Heimes] fixed a TIFF G4 compression bug occuring with gcc-Version 4.1.2 20080704 (Red Hat 4.1.2-50) - -January 24th, 2011 - 3.15.0 -! FreeImage now uses LibRaw 0.13-Beta3 -! FreeImage now uses LibPNG 1.4.5 -! FreeImage now uses LibTIFF 3.9.4 (CVS patch 2011-01-03) -! FreeImage now uses LibJPEG 8c -! FreeImage now uses OpenJPEG 1.4.0 (SVN patch 2011-01-18) -! [Herve Drolon] FreeImage_CloneMetadata now clone resolution info returned by FreeImage_GetDotsPerMeter(X / Y) -+ [Herve Drolon] added loading support for "half float" format to TIF plugin -+ [Herve Drolon] FreeImage_IsTransparent is now independant of FREE_IMAGE_TYPE -+ [Herve Drolon] added FIT_UINT16 to FIT_RGBF conversion to FreeImage_ConvertToRGBF & FreeImage_ConvertToType -+ [Herve Drolon] added FreeImage_ConvertToUINT16 and updated FreeImage_ConvertToType -+ [Mihail Naydenov] added FreeImage_GetThumbnail / FreeImage_SetThumbnail -+ [Mihail Naydenov] added thumbnail support to Exif, JPEG, EXR, PSD, TGA, TIF formats -+ [Mihail Naydenov] added JPEG_BASELINE save flag to the JPEG plugin -+ [Herve Drolon] added new Exif-TIFF tags (PageName, PageNumber, XPosition, YPosition) and Exif WinXP tags -+ [Herve Drolon] added support for 256x256 icon size to PluginICO:Save -* [Domingo Stephan] fixed a compilation error in TARGA plugin when using a big endian OS (OS X 10.6) -* [Christian Heimes] fixed a compilation error with gcc 4.3.x and OpenEXR -* [Eric Fruhinsholz] fixed a crash in JPEG plugin when reading a JPEG with corrupted XMP data -* [Herve Drolon] improved FreeImage_MultigridPoissonSolver for images whose size is a power-of-two -* [Herve Drolon] fixed a crash in PSD plugin when loading a PSD with a CMYK embedded thumbnail -* [Herve Drolon] fixed loading of JPEG images with a not null but zero length IPTC segment (bad files produced by Picasa) -* [Carsten Klein] fixed a bug in FreeImage_ColorQuantizeEx when using FIQ_WUQUANT quantizer -* [Herve Drolon] added support for RGBA[16][F] to FreeImage_IsTransparent -* [Herve Drolon] fixed loading of resolution info in TIFF CMYK images (bug introduced with 3.14.0) -* [Tom May] fixed JPEG plugin crashing on some Exif files containing tags with an invalid tag length -* [Herve Drolon] fixed a crash when loading TIFF images with a TIFFTAG_TRANSFERFUNCTION Exif tag -* [Tom May] removed assertions in PSD plugin, causing crashes on some malformed images in debug mode -* [Mihail Naydenov] fixed a crash in TIFF plugin when reading an uncommon 24-bit palettized file -* [Carsten Klein] fixed a bug in FreeImage_EnlargeCanvas when using the function as a FreeImage_Copy function -* [Herve Drolon] fixed a bug in PluginBMP with loading of OS/2 2.x palettized BMP -* [luispedro] fixed a bug in PluginBMP when reading malformed 16-bit RGB-555 BMP - -August 12th, 2010 - 3.14.1 -+ [Mihail Naydenov] added support for FIF_LOAD_NOPIXELS flag to EXR plugin -+ [Herve Drolon] added support for FIF_LOAD_NOPIXELS flag to CUT, HDR, RAS, ICO, PNM, RAW, BMP, PFM, XPM plugins -* [Eberhard Mattes] fixed memory allocation checking in multipage API -* [Herve Drolon] (compiler options) removed Win32 OpenMP support introduced in 3.14.0 - -August 9th, 2010 - 3.14.0 -! FreeImage now uses OpenEXR 1.7.0 -! FreeImage now uses ZLib 1.2.5 -! FreeImage now uses LibPNG 1.4.3 -! FreeImage now uses LibJPEG 8b -! FreeImage now uses LibTIFF 3.9.4 (CVS patch 2010-07-13) -! FreeImage now uses LibRaw 0.10-Beta3 -! FreeImage now uses OpenJPEG 1.4.0 (SVN patch 2010-04-16) -! [Herve Drolon] FreeImage_AllocateT now builds a default greyscale palette for 8-bit images -! [Volodymyr Goncharov] FreeImage_LoadMultiBitmapFromMemory now supports read/write operations -! [Herve Drolon] FreeImage_OpenMultiBitmapFromHandle now supports read/write operations -! [Herve Drolon] greyscale conversions now use the Rec. 709 formula -! [Mihail Naydenov] saving RGBF images to TIFF no longer use LogLuv encoding (unless you use the TIFF_LOGLUV save flag) -+ [Herve Drolon] added FIT_FLOAT to FIT_RGBF conversion to FreeImage_ConvertToRGBF & FreeImage_ConvertToType -+ [Herve Drolon] added VS 2008 project files -+ [Herve Drolon] added FreeImage_ConvertToFloat -+ [Mihail Naydenov] added RLE saving to the Targa plugin (see flag TARGA_SAVE_RLE) -+ [Volodymyr Goncharov] added FreeImage_SaveMultiBitmapToHandle -+ [Herve Drolon] added FreeImage_SaveMultiBitmapToMemory -+ [Herve Drolon] added new Exif maker note tags -+ [Lucian Sabo] added JPEG_OPTIMIZE to PluginJPEG:Save -+ [Mihail Naydenov] improved support for Exif tag reading in TIFF plugin -+ [Mihail Naydenov] allowed dataWindow with minimal bounds different from zero in OpenEXR plugin -+ [Herve Drolon] added FIMD_EXIF_RAW metadata model -+ [Herve Drolon] JPEG plugin can load & save raw Exif data (see FIMD_EXIF_RAW) -+ [Herve Drolon] added FIF_LOAD_NOPIXELS load flag constant - used to load header & metadata only -+ [Herve Drolon] added FreeImage_HasPixels -+ [Herve Drolon] added FreeImage_FIFSupportsNoPixels -+ [Herve Drolon] added support for FIF_LOAD_NOPIXELS flag to JPEG, PNG, PCD, PCX plugins -+ [Mihail Naydenov] added support for FIF_LOAD_NOPIXELS flag to TGA, PSD, TIFF plugins -+ [Mihail Naydenov] added support for 16-bit image types to FreeImage_Invert -+ [Mihail Naydenov] improved PSD plugin (faster code, added support for CMYK and LAB loading) + added load flags PSD_CMYK & PSD_LAB -+ [Mihail Naydenov] improved TIFF plugin (CMYK 16-bit loading and saving / RGBAF saving) + added TIFF_LOGLUV save flag -* [Herve Drolon] fixed FreeImage_GetFileType behavior with ANI file formats -* [Herve Drolon] fixed loading of JNG with progressive-JPEG formats -* [Mihail Naydenov] fixed loading of TGA with a corrupted rle count -* [Herve Drolon] fixed conversion formula in FreeImage_PreMultiplyWithAlpha -* [Christoph Brill] removed the use of libmng_data.h private API in MNG Plugin -* [phe02sf] fixed handling of bad Exif-GPS data in a Nikon D5000 image -* [Atsuhiro Igarashi] fixed handling of last data block in PluginGIF::Save (sometimes it saves corrupted images) -* [Christian Heimes] fixed saving of G3 & G4 compressed TIFF with 1bpp on 64bit Linux -* [Herve Drolon] fixed long data type being 64-bit on Unix/Linux platforms (use LONG/DWORD instead of long/unsigned long) -* [Herve Drolon] fixed a memory leak in FreeImage_DeletePage -* [Herve Drolon] fixed the loading of RGBZ images in OpenEXR plugin -* [Lucian Sabo] improved conversion from 1-, 4-, 8-bpp transparent images to 32-bpp -* [Roy F.] fixed a bug in FreeImage_EnlargeCanvas (unable to crop an image on the right) -* [Herve Drolon] fixed the loading of Exif with unusual IFD offset value -* [Eberhard Mattes] fixed page numbering info when saving multipage TIFF -* [Herve Drolon] fixed PluginPICT causing an infinite loop on a malformed PICT image -* [Eberhard Mattes] improved memory allocation checking when using the new operator -* [Herve Drolon] (multipage internals) fixed a potential buffer overflow in ReplaceExtension -* [Eberhard Mattes] improved error checking in FreeImage_CloseMultiBitmap - -December 22, 2009 - 3.13.1 -! FreeImage now uses libTIFF 3.9.2 -! FreeImage now uses OpenJPEG 1.3.0 (SVN patch 2009-11-05) -! FreeImage now uses libPNG 1.2.41 -+ [Berend Engelbrecht] added loading of Exif orientation tag in TIFF plugin -+ [Herve Drolon] added decoding support for the old and outdated JPEG-in-TIFF 6.0 format in TIFF plugin -+ [Herve Drolon] added new 'non standard' Exif tags -+ [Herve Drolon] added new Exif makernote tags -* [Herve Drolon] fixed TIF plugin crashing on a malformed TIFF-JPEG compressed image -* [Herve Drolon] fixed MNG plugin crashing on some old mng images -* [Herve Drolon] fixed handling of 2-bit grayscale transparent PNG -* [Herve Drolon] fixed a bug with the compression rate of JP2 and J2K encoders -* [zestony] fixed TIF plugin with the '65535 bytes' pitch size limitation on saving -* [Herve Drolon] fixed handling of PSD files with a non zero file header reserved member -* [Lucian Sabo] PNG plugin now keep transparency when saving 1- or 4-bit transparent images - -September 28th, 2009 - 3.13.0 -! FreeImage now uses LibJPEG 7 -! FreeImage now uses LibRaw-Lite 0.7.2 -! FreeImage now uses libPNG 1.2.40 -! FreeImage now uses libTIFF 3.9.1 -! FreeImage_RotateClassic is deprecated (use FreeImage_Rotate instead) -+ [Herve Drolon] added support for all Photoshop supported color modes to PSD plugin -+ [Herve Drolon] added support for 32-bit to JNG/MNG plugin -+ [Amir Ebrahimi] added loading support for the PICT format -+ [Herve Drolon] added loading support for camera RAW formats (using LibRawLite wrapper for dcraw) -+ [Mihail Naydenov] added UNICODE functions FreeImage_JPEGTransformU and FreeImage_JPEGCropU -+ [Carsten Klein] added FreeImage_OpenMultiBitmapFromHandle -+ [Carsten Klein] added FreeImage_FillBackground -+ [Carsten Klein] added FreeImage_EnlargeCanvas -+ [Carsten Klein] added FreeImage_AllocateEx / FreeImage_AllocateExT -+ [Mihail Naydenov/Herve Drolon] added FreeImage_TmoReinhard05Ex -+ [Herve Drolon] added FIT_RGBA16 to FIT_RGBF conversion to FreeImage_ConvertToRGBF -+ [Herve Drolon] added FreeImage_Rotate (support for most image types, support background color) -* [Christian Heimes] fixed function prototypes to use a void argument when no argument exist -* [Herve Drolon] fixed RGB color ordering on Intel macs -* [Herve Drolon] FreeImage_RotateClassic now keep transparency when applied to 8-bit images -* [Herve Drolon] fixed handling of transparency info in FreeImage_Copy -* [Herve Drolon] fixed a normalization error in FreeImage_GetAdjustColorsLookupTable -* [Herve Drolon] fixed invalid Exif rotation in PluginJPEG for orientation cases 2 and 4 -* [Mihail Naydenov / Carsten Klein] fixed compilation issues with MinGW32 -* [Mihail Naydenov] improved the loading speed of all targa images -* [Herve Drolon] FreeImage_TagToString now handles the Exif UserComment tag - -April 14th, 2009 - 3.12.0 -! FreeImage now uses libPNG 1.2.35 -! FreeImage now uses libTIFF 3.9.0beta (CVS patch 2009-02-12) -! FreeImage now uses OpenJPEG 1.3.0 (SVN patch 2008-08-21) -! [Herve Drolon] FreeImage_CloneMetadata no longer clone the FIMD_ANIMATION metadata (this was causing problems when saving to GIF format) -+ [Herve Drolon] added full support for the PFM format -+ [Herve Drolon] added JPEG_EXIFROTATE load flag to the JPEG plugin -+ [Herve Drolon] added 16-bit RGB(A) and float RGB(A)F support to FreeImage_GetChannel / FreeImage_SetChannel -+ [Herve Drolon] added src FIT_RGBA16 to dst 32-bit FIT_BITMAP conversion to FreeImage_ConvertToType -* [Carsten Klein] FreeImage_Copy now copies transparency info, resolution info, ICC profile and metadata -* [Carsten Klein] check for negative top/left values in FreeImage_Paste -* [Christian Heimes] changed exceptions with a "catch(char *text)" to a "catch(const char *text)" to make GCC 4.1 happy -* [Deif Lou] fixed a bug in FreeImage_SetTransparentIndex -* [Thomas Maiwald] BMP plugin: on saving, fixed correct setting of bfSize BMP file header for palettized images -* [Timothy Lee] fixed handling of frame disposal in GIF_PLAYBACK mode (GIF plugin) -* [Herve Drolon] fixed handling of Exif Olympus Type 2 maker notes (not yet supported but now safely ignored) -* [Rich Geldreich] fixed DXT1 color endpoint precision problem in DDS plugin -* [Mihail Naydenov] improved loading speed of 24-bit targa images -* [Eugene Golushkov] improved big endian / little endian swapping functions -* [Carsten Klein/Jean-Philippe Goerke] improved FreeImage_SetMetadata / FreeImage_GetMetadata accessors -* [Christian Ruppert] improved Linux Makefiles -* [Eugene Golushkov] fixed PluginBMP alignment bug while saving 16 or 24bit BMP on big endian or Apple machines - -July 28th, 2008 - 3.11.0 -! FreeImage now uses libTIFF 3.9.0beta (CVS patch 2008-05-24) -! FreeImage now uses OpenJPEG 1.3.0 (SVN patch 2008-05-22) -! FreeImage now uses libMNG 1.0.10 -! FreeImage now uses libPNG 1.2.29 -+ [Yves Schmid] added 48-bit RGB to 32-bit conversion support in FreeImage_ConvertTo32Bits -+ [Aaron Shumate] added RGB16-to-BITMAP and All-to-RGBF conversion support in FreeImage_ConvertToType -+ [Benjamin English] added a new OpenGL sample to FreeImage/Examples -+ [Lucian Sabo] added new compression flags to the PNG plugin -+ [Lucian Sabo] added new compression flags to the JPEG plugin (chroma subsampling options) -+ [Noam Gat] added support for SGI grayscale + alpha pics to SGI plugin -+ [Herve Drolon] added FreeImage_CloneMetadata -+ [Herve Drolon] added loading support for Windows Vista icons in ICO Plugin -+ [Herve Drolon] added loading and saving support for RGBF images to the TIF plugin (using the LogLuv codec) -* [Will Bryant] fixed makefile for MacOSX Tiger and Leopard -* [Maria Gullickson] fixed a 'divide by 0' error in PNM plugin and FreeImage_Rescale function -* [Yves Schmid] fixed a bug with Exif metadata reading in TIFF images -* [Herve Drolon] fixed some possible 64-bit portability issues with pointer calculations -* [wangyn] fixed a bug with transparency handling of indexed images in PNG plugin -* [Martin Dyring-Andersen] fixed a bug with GIFinfo structure initialization in GIF plugin -* [Noam Gat] fixed a bug in SGI plugin: when the file reports as two-dimensional, the height factor does not get loaded -* [Herve Drolon] added error messages in FreeImage_Load(U) / FreeImage_Save(U) in case of bad filenames -* [Scott Smith/Herve Drolon] added missing IPTC tags and renamed some tag names to be compatible with ExifTool naming convention -* [Martin Dyring-Andersen] fixed a crash problem with images containing exif data emitted by Picassa -* [Herve Drolon] removed RGBA to RGB transparent conversion in EXR plugin -* [Glenn Pierce] improved the speed of FreeImage_FlipHorizontal -* [Carsten Klein] fixed 65535 pixels width/height limitation in FreeImage_Paste - -November 19th, 2007 - 3.10.0 -! FreeImage now uses libTIFF 3.9.0beta (CVS patch 2007-10-05) -! FreeImage now uses OpenJPEG 1.2.0 (SVN patch 2007-07-13) -! FreeImage now uses OpenEXR 1.6.1 -! FreeImage now uses libPNG 1.2.23 -! FreeImage now hides its internal functions and internal libraries when compiled with gcc -- [Herve Drolon] removed VS C+ 6.0 project files : this IDE is no longer supported because of OpenEXR -+ [Herve Drolon] added VS 2005 project files -+ [Herve Drolon] added full support for the OpenEXR format -+ [Herve Drolon] added full support for the JPEG-2000 format -+ [Herve Drolon] added FreeImage_TmoFattal02 tone mapping operator -+ [Ryan Rubley] added support for RGB vs BGR regardless of endian -+ [Herve Drolon] added FreeImage_MultigridPoissonSolver -+ [Carsten Klein] added FreeImage_PreMultiplyWithAlpha -+ [Carsten Klein] added __stdcall version of FreeImage_OutputMessage -+ [Carsten Klein] added new palette and color manipulation functions (see below) : - added FreeImage_SetTransparentIndex - added FreeImage_GetTransparentIndex - added FreeImage_GetAdjustColorsLookupTable - added FreeImage_AdjustColors - added FreeImage_ApplyColorMapping - added FreeImage_SwapColors - added FreeImage_ApplyPaletteIndexMapping - added FreeImage_SwapPaletteIndices -* [Herve Drolon] fixed a bug in TIFF plugin when reading 8-bit + 8-bit alpha images -* [Herve Drolon] fixed a bug in TIFF plugin when reading images with uncommon bitdepths -* [rodrigo] fixed FreeImage exception handling under gcc (added -fexceptions to gcc compiler flags) -* [Martin Dyring-Andersen] fixed GIF plugin crashing on some corrupted files -* [Herve Drolon] fixed a bug with RLE encoding for 8-bit BMP images -* [Herve Drolon] fixed GPS metadata being skipped when reading metadata in Exif images -* [Herve Drolon] fixed a bug when reading OS/2 BMP images with a negative height -* [Ryan Rubley] fixed a bug with loading of GIFs with large amounts of solid color areas -* [Ryan Rubley] fixed OS X compile error in BitmapAccess.cpp -* [Herve Drolon] fixed a bug in FreeImage_Paste when pasting non-standard image types -* [Herve Drolon] saving 1-bit TIF with the TIFF_CCITTFAX3 flag is now compliant with the TIFF Class F specification -* [Carsten Klein] fixed topdown parameter in FreeImage_ConvertFromRawBits and FreeImage_ConvertToRawBits being handled in reverse -* [Herve Drolon] fixed a bug when reading some RLE-4 encoded BMP data -* [Carsten Klein] conversion from 1-bit to 32-bit now keep possibly present transparency - -February 11th, 2007 - 3.9.3 -! FreeImage now uses libPNG 1.2.16 -! [Ryan Rubley/Ryan Davis] reworked the MacOSX makefile in order to fully support Universal Binary builds of FreeImage -! [Herve Drolon] makefiles are now generated from VS2003 project files instead of VS6 project files -! [Herve Drolon] changed JPEG load/save flag option values -+ [Herve Drolon] added support for RGBAF images to FreeImage_ConvertToRGBF -+ [Herve Drolon] FreeImage_Paste now works with any bitmap type -+ [Herve Drolon] added full support for 64-bit RGBA images to the PNG and TIFF plugins -+ [Jascha Wetzel] added JPEG downsampling feature to PluginJPEG:Load -* [Thomas Chmielewski] fixed a bug in FreeImage_Dither and Bayer dithering, added FID_BAYER16x16 -* [Raphael Gaquer] greatly improved the speed of the GIF encoder -* [Herve Drolon] fixed saving of metadata in the PNG plugin -* [rampelstinskin] fixed transparency table to alpha channel conversion for 4-bit images in FreeImage_ConvertTo32Bits -* [Scott Smith] added missing IPTC tag named "Country/PrimaryLocationCode" -* [Herve Drolon] changed #include by #include in FreeImage.h (needed by Solaris 9) -* [Pierre Arnaud] fixed the use of FreeImage in low memory condition by checking some returned values of the malloc function -* [Pierre Arnaud] fixed TagLib::getTagFieldName not being thread safe - -October 30th, 2006 - 3.9.2 -! FreeImage now uses libTIFF 3.8.2 (with patch 2006-10-13) -+ [Herve Drolon] added full support for 16-bit greyscale and 48-bit RGB to the PNM plugin -+ [Herve Drolon] added IPTC writing support to JPEG & TIFF plugins -+ [Herve Drolon] added new Exif maker note tags -+ [Herve Drolon] added FreeImage_JPEGCrop -+ [Thorsten Radde] added support for 8-bit palettized bitmaps in FreeImage_RotateClassic -+ [Matt Rice] added automatic call to FreeImage_Initialise / FreeImage_DeInitialise when using FreeImage as a .so -+ [Martin Dyring-Andersen] added FreeImage_LoadMultiBitmapFromMemory to the multi-page API -+ [Herve Drolon] added support for tiled TIFF images -* [Carsten Klein] fixed a bug in FreeImage_SetMetadata occuring when deleting a tag -* [Herve Drolon] fixed a bug in PNG plugin when reading Macromedia 'false' PNG files -* [Thorsten Radde] added resolution support to PluginPSD -* [Ryan Rubley] fixed a bug in PluginGIF occuring with interlaced GIF -* [Ryan Rubley] fixed a bug in the multipage cache mechanism (internal FreeImage_FindBlock function) -* [Thorsten Radde] fixed a stack corruption in TIFF plugin occuring when reading exif tags -* [checkered] fixed a bug in the multipage cache mechanism causing VS2005 to crash on multipage files -* [Herve Drolon] fixed a bug with transparency support of 1- and 4-bit images -* [Roar Flolo] fixed a bug in PSD plugin when reading non compressed RGB images (alpha channel initialization) -* [Nicolas Hatier] fixed a bug in PluginGIF when using the GIF_PLAYBACK flag -* [Herve Drolon] fixed a bug in TIFF plugin when saving 8-bit images using LZW with differenciation -* [Herve Drolon] fixed 64-bit compilation issue with LibPNG and assembler code - -July 16th, 2006 - 3.9.1 -* [Ryan Rubley] fixed a bug in PluginGIF plugin causing FreeImage to crash on malformed GIF files - -July 6th, 2006 - 3.9.0 -! FreeImage now uses libPNG 1.2.12 -! FreeImage now uses libTIFF 3.8.2 (with patch 2006-06-24) -! FreeImage_Allocate/FreeImage_Allocate now set the resolution to 72 dpi instead of 0 -+ [Herve Drolon/Petr Pytelka] added a raw FAX G3 format loader -+ [Herve Drolon] added support for most image types to FreeImage_Rescale -+ [Herve Drolon] added FreeImage_MakeThumbnail -+ [Herve Drolon] added support for 64-bit images to FreeImage_ConvertTo32Bits -+ [Herve Drolon] added support for Exif tags to TIF plugin (read only) -+ [Herve Drolon] added FreeImage_ReadMemory -+ [Herve Drolon] added FreeImage_WriteMemory -+ [Herve Drolon] added new Exif maker note tags -+ [Sherman Wilcox] added a SGI file format loader -+ [Herve Drolon] added support for separated images to PluginTIFF -+ [Herve Drolon] added support for progressive-JPEG saving to PluginJPEG -* [Carsten Klein] FreeImage_Dither and FreeImage_Threshold now work with palettized 8-bit dib -* [Christophe Petit] fixed a bug in FreeImage_GetFIFFromFilenameU occuring with files without extension -* [Leigh Brasington] fixed a bug in PluginGIF causing FreeImage not working on Win/98/ME -* [Herve Drolon] fixed a bug in PluginTIFF with writing of JPEG-in-TIFF files -* [Jojakim Stahl] fixed a bug occuring with 4-bit PCX files -* [Sandor Szalacsi] fixed a bug in FreeImage_SetBackgroundColor (bkgnd clearing) -* [Petr Pytelka] fixed PluginTIFF::_tiffSizeProc failing on some images -* [Sherman Wilcox] fixed a bug in DDS plugin when loading images whose size is not a multiple of 4 -* [Sherman Wilcox] fixed a memory leak in PluginDDS::LoadDXT_Helper -* [Sherman Wilcox] fixed DDS plugin bad behavior with invalid DDS files (such as files with zero length) -* [Floris van den Berg] fixed a memory leak in the MultiPage cache mechanism -* [Herve Drolon] replaced WIN32 #define by _WIN32 #define as this is needed by VS2005 -* [Herve Drolon] fixed a VS2005 error in FreeImage_DeletePage -* [Petr Supina] fixed a pow(long,long) function not being standard ANSI C/C++ -* [Petr Supina] fixed FreeImage_FindBlock function not being standard ANSI C/C++ -* [Olaf Stoyke] added support for 64-bit Linux OS -* [Craig Stark] fixed FreeImage support on Intel based Mac OS -* [Herve Drolon] fixed PluginTIFF failing on bad fax tiff images (bad images are now loaded 'as is') -* [Zack Simpson] fixed a bug occuring in rare situations with FreeImage_Aligned_Malloc - -September 5, 2005 - 3.8.0 -! FreeImage now uses libTIFF 3.7.3 -! FreeImage now uses ZLib 1.2.3 -+ [Herve Drolon] added support for 48-bit images to FreeImage_ConvertTo24Bits -+ [Herve Drolon] added FreeImage_ConvertToGreyscale -+ [Herve Drolon] added support for 16-bit greyscale images to FreeImage_ConvertTo8Bits -+ [Petr Pytelka] added UNICODE functions (see below) - added FreeImage_LoadU - added FreeImage_SaveU - added FreeImage_GetFIFFromFilenameU - added FreeImage_GetFileTypeU -+ [Herve Drolon] FreeImage_Copy now works with any bitmap type -+ [Herve Drolon] added support for 1-bit images to FreeImage_Paste -* [Ryan Rubley] fixed PluginGIF failing to link on some broken gcc versions -* [Karl-Heinz Bussian] fixed a bug in LookupX11Color/LookupSVGColor with handling of grey color names -* [Herve Drolon] FreeImage_Dither now uses FreeImage_ConvertToGreyscale and handles 4/8-bit palletized images -* [Herve Drolon] FreeImage_Threshold now uses FreeImage_ConvertToGreyscale and handles 4/8-bit palletized images -* [Craig Hockenberry] fixed PluginGIF::Save swapping the byte order for the height on big endian machines (e.g. PPC on Mac OS X.) -* [Herve Drolon] fixed a bug in JPEG plugin when reading Exif maker notes from images produced by Nikon Editor -* [Herve Drolon] fixed a bug in BMP plugin when reading some malformed RLE8 bmp -* [Herve Drolon] fixed a bug in RAS plugin when loading 8-bit palettized images with less than 256 colors -* [Herve Drolon] fixed a bug in FreeImage_Rescale with 16-,48-,64-bit images -* [Herve Drolon] fixed a bug in the ICC profiles API when loading profile-less CMYK TIFF -* [Herve Drolon] 4-bit PNG are now loaded as 4-bit and no longer converted to 8-bit -* [Greg Ng] fixed a bug in FreeImage_ConvertToRGBF (FIT_BITMAP -> FIT_RGBF conversion) - -May 7, 2005 - 3.7.0 -! FreeImage now uses libTIFF 3.7.2 -! [Ryan Rubley] improved FreeImage_OpenMultiBitmap -+ [Detlev Vendt] added FreeImage_ZLibGUnzip -+ [Herve Drolon] added new image data types FIT_RGB16, FIT_RGBA16, FIT_RGBF, FIT_RGBAF -+ [Herve Drolon] FreeImage_FlipHorizontal & FreeImage_FlipVertical now work with any bitmap type -+ [Herve Drolon] added conversions to float and double in FreeImage_ConvertToType -+ [Herve Drolon] added FreeImage_ConvertToRGBF -+ [Herve Drolon] added support for 16-, 48- and 96-bit images to FreeImage_Rescale -+ [Ryan Rubley] added FreeImage_ColorQuantizeEx -+ [Ryan Rubley] added FIMD_ANIMATION and FIDT_PALETTE -+ [Ryan Rubley] added brand new PluginGIF with full animation multipage and metadata support -+ [Herve Drolon] added support for FIC_MINISWHITE 8-bit images to FreeImage_Rescale -+ [Herve Drolon] added HDR (High Dynamic Range) format (loader & writer) -+ [Herve Drolon] added support for 48-bit images in TIFF plugin -+ [Herve Drolon] added support for 48-bit images in PNG plugin -+ [Herve Drolon] added tone mapping operators (see below) -+ added FreeImage_ToneMapping -+ added FreeImage_TmoDrago03 -+ added FreeImage_TmoReinhard05 -+ [Petr Pytelka] added FreeImage_JPEGTransform -* [Herve Drolon] allowed loading of corrupted JPEG with a premature end of file -* [Herve Drolon] fixed a memory leak with loading of exif JPEG images -* [Detlev Vendt] changed some 'pointer-to-int' casts to 'pointer-to-long' for 64bit machines -* [Ryan Rubley] fixed a memory leak in the multipage API -* [Ryan Rubley] updated VB6 wrapper generation for new functions -* [Herve Drolon] fixed incorrect behavior when reading JPEG comments containing special characters -* [Herve Drolon] fixed incorrect behavior when reading JPEG ICC profiles with a size greater than 64 KB -* [Herve Drolon] fixed a bug in TIFF plugin when loading malformed multipage TIFF -* [Herve Drolon] fixed PluginTIFF not being thread safe - -February 20, 2005 - 3.6.1 -* [Ryan Rubley] fixed a memory leak in the metadata API -* [luedi] improved the robustness of FIBITMAP allocations - -February 13, 2005 - 3.6.0 -! FreeImage now uses libMNG 1.0.9 -! [Herve Drolon] improved the speed of FreeImage_Rescale -! [Herve Drolon] improved FreeImage_RotateClassic (more compact code, a little faster) -! [Herve Drolon] improved the metadata API using tag accessors -+ [Detlev Vendt] added LZW support to PluginGIF:Save -+ [Herve Drolon] added VS.Net 2003 project files -+ [Herve Drolon] added VERSIONINFO resource to the DLL -+ [Herve Drolon] added support for CMYK JPEG on loading -+ [Petr Supina] added 16-bytes alignment to FIBITMAP palette and pixels starting address -+ [Petr Supina] added support for MMX/SSE2 code in LibJPEG (based on Mozilla/Firefox code) -+ [Herve Drolon] added TIFF_JPEG compression flag to the TIFF plugin -+ [Detlev Vendt] added FreeImage_ZLibGZip -+ [Detlev Vendt] added FreeImage_ZLibCRC32 -* [Detlev Vendt] fixed PluginPNG not being thread safe -* [Herve Drolon] fixed compiler warning C4018 occuring with VS.Net 2003 - -December 29, 2004 - 3.5.3 -! FreeImage now uses ZLib 1.2.2 -! FreeImage now uses libPNG 1.2.8 -! FreeImage now uses libTIFF 3.7.1 -! [Herve Drolon] improved FreeImage_RotateClassic -! [Detlev Vendt] improved FreeImage_Rescale (more compact code, preserving 8-bpp colors) -+ [Herve Drolon] added support for transparency saving in ICO plugin -+ [Herve Drolon] added support for 1-bit images to FreeImage_RotateClassic -+ [Herve Drolon] added FreeImage_SetDotsPerMeterX and FreeImage_SetDotsPerMeterY -* [Nan Feng] fixed memory leak in FreeImage_DeleteTag (internal stuff) -* [Nigel Stewart] added conditional #pragma with #ifdef _MSC_VER / #endif -* [Herve Drolon] fixed the '65536 lines' limit on loading in PNM plugin - -November 27th, 2004 - 3.5.2 -* [Herve Drolon] fixed a second bug in FreeImage_Clone function - -November 26th, 2004 - 3.5.1 -+ [Riley McNiff] added FreeImage_ConvertTo4Bits -* [Herve Drolon] fixed a buffer overrun with some ILBM images -* [Riley McNiff] fixed a potential problem when reading TIFF resolution info -* [Dimitar Atanasov] fixed a bug in FreeImage_Clone function -* [Dimitar Atanasov] fixed several bugs in TIFF plugin - -November 1st, 2004 - 3.5.0 -! FreeImage now uses libPNG 1.2.7 -! FreeImage now uses libTIFF 3.7.0 -! FreeImage now uses libMNG 1.0.8 -! [Herve Drolon] improved TIFF LZW compression using a predictor -! [Detlev Vendt] FreeImagesPlus: corrected references to FreeImage.h and FreeImage.lib -+ [Herve Drolon] added support for loading/saving of 8-bit transparent TIFF -+ [Riley McNiff] added support for 4-bit dib in FreeImage_Paste -+ [Herve Drolon] added support for memory IO streams (see below) -+ added FreeImage_OpenMemory -+ added FreeImage_CloseMemory -+ added FreeImage_LoadFromMemory -+ added FreeImage_SaveToMemory -+ added FreeImage_TellMemory -+ added FreeImage_SeekMemory -+ added FreeImage_AcquireMemory -+ added FreeImage_GetFileTypeFromMemory -+ [Petr Pytelka] added FreeImage_GetFIFMimeType to the plugins function list -+ [Herve Drolon] added ICC profile support to JPEG plugin -+ [Herve Drolon] added support for metadata (see below) -+ added FreeImage_SetMetadata -+ added FreeImage_GetMetadata -+ added FreeImage_GetMetadataCount -+ added FreeImage_TagToString -+ added FreeImage_FindFirstMetadata -+ added FreeImage_FindNextMetadata -+ added FreeImage_FindCloseMetadata -* [Riley McNiff] fixed a bug with FreeImage_SetPixelIndex and 4-bit images -* [Petr Pytelka] fixed returned value in FreeImage_CloseMultiBitmap -* [Petr Pytelka] fixed index of new page in FreeImage_InsertPage -* [Aaron Shumate] fixed a minor bug in PNG plugin -* [Aaron Shumate] fixed a bug in IFF plugin (odd-length chunks) -* [Rupert Hewitt] fixed FreeImage not compiling on National Instruments Cvi Ccompiler -* [Herve Drolon] fixed a bug in IFF plugin (ILBM data) -* [Fred Harju] added a Makefile for Solaris 9 -* [Roddy Pratt] fixed FreeImage not linking under Borland C++ Builder -* [Vadim Alexandrov] fixed a memory leak in the multipage API -* [Herve Drolon] fixed a bug with DDS plugin behaviour on Big Endian OS -* [Herve Drolon] fixed a bug with conversion of JPEG resolution info on saving - -July 8th, 2004 - 3.4.0 -! [Jim Keir] improved FreeImage_FlipVertical function -! [Herve Drolon] LZW compression is now enabled in FreeImage -+ [Karl-Heinz Bussian] added constants to FreeImage.h to get at compile time the library version -+ [Karl-Heinz Bussian] added color lookup functions for X11 and SVG -+ [Herve Drolon] added TIFF tags TIFF_CCITTFAX3, TIFF_CCITTFAX4 and TIFF_LZW -+ [Detlev Vendt] added support for CMYK TIFF files with alpha channel -+ [Detlev Vendt] added (re-introduction of) PluginGIF -* [Herve Drolon] fixed a bug with loading of FAX TIFF images (introduced with LibTIFF 3.6.1) -* [Herve Drolon] fixed a bug in Floyd-Steinberg dithering algorithm -* [Herve Drolon] fixed a bug in Targa plugin save function -* [Herve Drolon] fixed a bug in FreeImage_AdjustCurve function -* [Ryan Rubley] fixed a bug with FreeImage_Rescale's filters accuracy -* [Ryan Rubley] fixed a bug in NN quantizer -* [Herve Drolon] fixed a bug with TIFF files containing additional Photoshop alpha channels -* [James Rossfeld] fixed a memory leak with some PSD images -* [Herve Drolon] fixed a bug with saving of 32-bit non transparent PNG images -* [Alexandr Zamaraev] fixed FreeImage not compiling with mingw32 -* [Herve Drolon] fixed FreeImage not compiling with VC.NET (pow function needs casts) - -May 2, 2004 - 3.3.0 -! [Ryan Rubley] FreeImage has been ported to MacOSX and should also work on other big endian processors -+ [Ryan Rubley] rewrote XPM plugin (better load support) and added save support -+ [Ryan Rubley] added ICO_MAKEALPHA flag to ICO plugin -+ [Ryan Rubley] Set/GetPixelColor now works with 16-bit pixels (555 or 565) -+ [Herve Drolon] PNG plugin now supports loading and saving of unsigned 16-bit greyscale images -* [Herve Drolon] fixed a bug with loading of 8-bit and 16-bit PNG with a 8-bit alpha channel -* [Herve Drolon] fixed a bug in NN quantizer algorithm with handling of 4-byte boundary alignment. -* [Herve Drolon] fixed a bug in PluginIFF Validate function -* [Herve Drolon] fixed a minor design issue in FreeImage_GetFIFFromFormat -* [Brad Schick] fixed some compiler warnings with VC++ 7.1 -* [Herve Drolon] fixed a bug with saving of 8-bit palettized images to 24-bit JPEG (channel inversion) - -March 16, 2004 - 3.2.1 -! [Volker Gärtner] improved the DDS plugin -! [Herve Drolon] FreeImage_Rescale now works on 8-, 24- and 32-bit images -! [Herve Drolon] FreeImage_Copy now works on 1-, 4-, 8-, 16-, 24- and 32-bit images -* [Floris van den Berg] fixed a bug in the MultiPage cache mechanism -* [Herve Drolon] fixed a bug with loading/saving of 8-bit transparent tga images -* [Herve Drolon] fixed a bug with loading of 1-bit TIFF (introduced with LibTIFF 3.6.1) - -February 18, 2004 - 3.2.0 -! FreeImage now uses libTIFF 3.6.1 -+ [Herve Drolon] added FreeImage_HasBackgroundColor -+ [Herve Drolon] added FreeImage_GetBackgroundColor -+ [Herve Drolon] added FreeImage_SetBackgroundColor -+ [Herve Drolon] added FreeImage_Composite -+ [Herve Drolon] added ICC profile support to PNG plugin -+ [Herve Drolon] added background color support to PNG plugin -+ [Volker Gärtner] added support for DDS format (loader) -* [Steve Johnson] improved FreeImage_OpenMultiBitmap/FreeImage_CloseMultiBitmap -* [Steve Johnson] fixed a bug in FreeImage_InsertPage -* [Herve Drolon] fixed a bug with JPEG compressed TIFF (red/blue swapping) -* [Herve Drolon] fixed a bug in PluginTarga where 8-bit images were saved incorrectly - -January 26, 2004 - 3.1.0 -! FreeImage now uses ZLib 1.2.1 -+ [Herve Drolon] added support for integer, real and complex image types (see below) -+ added FREE_IMAGE_TYPE enum -+ added FreeImage_AllocateT -+ added FreeImage_GetImageType -+ added FreeImage_FIFSupportsExportType -+ added FreeImage_ConvertToStandardType -+ added FreeImage_ConvertToType -+ added load/save support of all image types to TIFF plugin -+ [Peter Lemmens] added a Validate function to TARGA plugin -+ [Herve Drolon] added FreeImage_GetPixelIndex / FreeImage_SetPixelIndex -+ [Herve Drolon] added FreeImage_GetPixelColor / FreeImage_SetPixelColor -+ [Herve Drolon] added FreeImage_GetComplexChannel / FreeImage_SetComplexChannel -* [Serge Ivanchenko] TIFF_DEFLATE compression is now enabled in TIFF plugin -* [Herve Drolon] fixed a bug in NeuQuant color reduction algorithm - -November 16, 2003 - 3.0.4 -* [Tobias Persson] fixed FreeImage_GetChannel not working with FICC_ALPHA channel -* [Detlev Vendt] fixed a minor bug with PNG plugin and PNG_IGNOREGAMMA flag -* [Detlev Vendt] fixed a memory leak in PNG plugin save routine -* [Detlev Vendt] fixed JPEG validation problem with .jpe files -* [Ryan Rubley] added Source/LibTIFF/tif_extension.c to LibTIFF (needed for MacOSX) -* [Herve Drolon] improved error handling in TIFF plugin -+ [Karl-Heinz Bussian] added FreeImage_IsLittleEndian -+ [Karl-Heinz Bussian] added JPEG save support for 8-bit miniswhite bitmaps (transparent conversion to minisblack) -+ [Karl-Heinz Bussian] FreeImage_GetColorType now recognizes 8-bit FIC_MINISWHITE images -! [Herve Drolon] FreeImage_Rescale now supports rescaling of 32-bit images with alpha channel -! [Herve Drolon] FreeImage_Invert now supports inversion of 32-bit images with alpha channel -! [Herve Drolon] FreeImage_AdjustCurve now supports working with FICC_ALPHA channel - -November 2, 2003 - 3.0.3 -* [Ryan Rubley] improved makefile for Linux -* [Ryan Rubley] fixed FreeImage not compiling under MacOSX -* [Detlev Vendt] fixed still present inconsistancy with 32bpp transparency handling -* [Herve Drolon] fixed incorrect loading of 4-bit greyscale images in TIFF plugin - -October 27, 2003 - 3.0.2 -! FreeImage now uses libMNG 1.0.6 -* [Herve Drolon] fixed a boolean test in PluginCUT returning always false -* [Herve Drolon] fixed a warning in PluginIFF generated with g++ -* [Linus Tan] fixed a bug in FreeImage_Copy -* [Herve Drolon] fixed FreeImage not compiling under Linux (thanks to Michal) - -October 20, 2003 - 3.0.1 - -! FreeImage now uses libTIFF 3.6.0 -* [Detlev Vendt] fixed incorrect definition of the FREE_IMAGE_FORMAT enum -* [Detlev Vendt] fixed a potential crash problem with Load / Save routines -* [Herve Drolon] fixed incorrect loading of 16-bit greyscale images in TIFF plugin -* [Dennis Lim] fixed a memory leak in Floyd & Steinberg dithering routine -* [Herve Drolon] fixed a bug in BMP loader (incorrect loading of RLE4 bmp) -* [Detlev Vendt] fixed some inconsistancy with 32bpp transparency handling -+ [David Boland] added a C# wrapper -// Linux compatibility issues -- [Michal Novotny] removed the round function in Utilities.h -! [Herve Drolon] replaced the round routine by the clamp routine in PluginPCD -+ [Herve Drolon] added _itoa version in Utilities.h -* [Michal Novotny] fixed untyped consts not accepted by g++ in PluginBMP - -September 8, 2003 - 3.0.0 -- [Herve Drolon] removed deprecated functions -- [Herve Drolon] removed deprecated flags (TARGA_LOAD_RGB555, ICO_*, except ICO_DEFAULT) -- [Herve Drolon] removed the FreeImage pointer table (internal stuff) -+ [Herve Drolon] added a C++ wrapper -+ [Herve Drolon] added the FreeImage Toolkit (see below) -+ added FreeImage_Rescale -+ added FreeImage_RotateClassic -+ added FreeImage_RotateEx -+ added FreeImage_FlipHorizontal -+ added FreeImage_FlipVertical -+ added FreeImage_Invert -+ added FreeImage_AdjustCurve -+ added FreeImage_AdjustGamma -+ added FreeImage_AdjustBrightness -+ added FreeImage_AdjustContrast -+ added FreeImage_GetHistogram -+ added FreeImage_GetChannel -+ added FreeImage_SetChannel -+ added FreeImage_Copy -+ added FreeImage_Paste -+ [Karl-Heinz Bussian] added XPM loader -+ [Karl-Heinz Bussian] added flags parameter to FreeImage_CloseMultiBitmap -+ [Karl-Heinz Bussian] added JPEG save support for 8-bit palettized bitmaps (transparent conversion to 24-bit) -+ [Herve Drolon] added interface to ZLib compression functions -+ [Herve Drolon] added ICO format to the multipage API (loader & writer) -+ [Herve Drolon] added a MIME type to all plugins -* [Karl-Heinz Bussian] fixed incorrect conversion from 1-bit FIC_MINISWHITE bitmaps to 8-bit -* [Herve Drolon] fixed a bug in FreeImage_CloseMultiBitmap -* [Herve Drolon] fixed a potential memory leak in conversion functions (8-, 24-, 32-bit) -* [Robert Walker] fixed incorrect conversion from 16-bit to 24-bit and 16-bit to 32-bit -* [blurble] fixed TIFF validate signature problem (3DS files were recognized as TIFF) -* [Kurt Jankowski-Tepe] fixed FreeImage not compiling on MinGW / LCC WIN32 -* [Jani Peltonen] fixed bug in PluginTARGA where 32-bit bitmaps are not always correctly flipped -* [Detlev Vendt] fixed a bug with TIFF (memory leak with ICC profiles) - -May 25, 2003 - 2.6.1 -+ [Detlev Vendt] added FIC_CMYK to FREE_IMAGE_COLOR_TYPE -+ [Detlev Vendt] added ICC profile support to the library (see below) -+ added FreeImage_GetICCProfile -+ added FreeImage_CreateICCProfile -+ added FreeImage_DestroyICCProfile -+ added FIICCPROFILE & FIICCPROFILE flags -+ added plugin function FreeImage_FIFSupportsICCProfiles -+ [Detlev Vendt] added ICC profile support for TIFF -+ [Herve Drolon] added XBM (X11 Bitmap Format) support : loading -* [Herve Drolon] fixed incorrect IFF file detection (thanks Floris) -* [Herve Drolon] fixed incorrect conversion from 1/4-bit greyscale bitmaps to 8-bit -* [Herve Drolon] fixed a bug in TIFF writer when saving 1,4,8 bit dib (introduced in 2.6.0, sorry) -* [Herve Drolon] fixed a palette problem in TIFF loader when loading 1-bit b & w images -* [Herve Drolon] improved FreeImage_Dither to handle any bitdepth - -May 5th, 2003 - 2.6.0 -! FreeImage now uses libPNG 1.2.5 -! FreeImage now uses libMNG 1.0.5 -! [Markus Loibl] ActiveX wrapper is now distributed in a separate release (since 2.5.5) -! [Herve Drolon] the function FreeImage_Free is now deprecated : use FreeImage_Unload instead -! [Herve Drolon] updated the generic samples and removed deprecated functions -+ [Detlev Vendt] added CMYK support to TIFF save function -+ [Detlev Vendt] added TIFF_SAVE_CMYK flag constant -+ [Detlev Vendt] added 32-bit support (with transparency handling) to TIFF plugin -+ [Herve Drolon] added FreeImage_Threshold -+ [Herve Drolon] added FreeImage_Dither -+ [Herve Drolon] added FREE_IMAGE_DITHER parameter to FreeImage_Dither -* [Herve Drolon] improved error handling in PluginMNG -* [Herve Drolon] improved TIFF flags handling in TIFF save function -* [Herve Drolon] fixed a potential crash-problem in FreeImage_OutputMessage (in case of a null message) -* [Detlev Vendt] fixed a bug with the deprecated FreeImage_GetBitsRowCol (trailling backslash behind the DEPRECATE macro) - -July 24th, 2002 - 2.5.5 -! FreeImage now uses libPNG 1.2.4 -! FreeImage now uses libMNG 1.0.4 -+ [Markus Loibl] added ActiveX wrapper - -June 22th, 2002 - 2.5.4 -* [Timothy Roughton] fixed FreeImage not compiling on LCC WIN32 -* [Markus Loibl] fixed PluginTIFF sometimes saving with wrong X/Y resolution -* fixed crashbug when loading some RLE4 BMPs -! FreeImage now uses LibPNG 1.2.3 -! [Markus Loibl] improved startup plugin locate handling code -! [Gerhard Gruber] made some changes so that FreeImage compiles on VC5 -+ [Markus Loibl] added flags TIFF_PACKBITS, TIFF_DEFLATE, TIFF_ADOBE_DEFLATE and TIFF_NONE - -May 21th, 2002 - 2.5.3 -* fixed wrong colors when loading 16-bit grayscale TIFF -* fixed crash-problem with FreeImageQt -* fixed PluginTIFF saving some bitmaps flipped vertically -* [Laurent Rocher] fixed bug in FreeImage_GetLockedPageNumbers -* [Laurent Rocher] fixed bug in FreeImage_UnlockPage -! FreeImage now uses libpng 1.2.2 -+ added TARGA save support -+ added BMP RLE8 save support - -March 30th, 2002 - 2.5.2 -* fixed bug in PluginTARGA where 32-bit bitmaps are not always correctly flipped -* fixed FreeImage_GetLockedPageNumber being mentioned in FreeImage.h -* fixed crash bug when handling read-only multipage bitmaps -- removed internal function FreeImage_GetExtraDataPointer -! FreeImage now uses zlib 1.1.4 -+ added function FreeImage_GetLockedPageNumbers - -March 2nd 2002 - 2.5.1 -* fixed pluginTIFF not being able to save 32-bit bitmaps -* fixed not being able to save PNM bitmaps through the LoadXXX wrappers -* fixed a webcam generated BMP image being loaded with wrong colors -! FI_ReadProc, FI_WriteProc, etc. do now carry the DLL_CALLCONV flag -! the function FreeImage_GetBitsRowCol is now deprecated -! FreeImage_SetTransparencyTable now taken an integer as count parameter -! FreeImage_IsTransparent now always returns true for 32-bit bitmaps -! PluginPNG::Save now ignores the result of FreeImage_IsTransparent -! PluginTIFF now converts all 32-bit bitmaps to 24-bit, until our patch - to fully support alpha in TIFF is applied in libtiff -+ added full multi-paging support -+ added octal and hexadecimal number support to FreeImage_OutputMessage - -January 3rd 2002 - 2.5.0 -* fixed bug in FreeImage_SaveJPEG -* fixed bug in FreeImage_LoadMNG -* fixed bug in FreeImage_LoadPNG -* fixed small Visual C++ 5.0 compiler issue in PluginMNG.cpp -* fixed FreeImage crashing on JPEG 6.0 encoded TIFFs -! FreeImage now uses libTIFF 3.5.7 -! FreeImage now uses libPNG 1.2.1 -! all the FreeImage_LoadXXX and FreeImage_SaveXXX functions are now deprecated -+ added Dr. Halo (*.cut) support -+ added printf-like format string support to SetOutputMessage -+ added basic multi-paging support: open, close, counting and grabbing -+ added deprecation manager -+ added FreeImage_Clone function - -October 3rd 2001 - 2.4.2 -* fixed missing BI_BITFIELDS support for 32-bit BMPs -* fixed bug in FreeImage_ConvertLine16_555_To16_565 and vice versa -* fixed bug in FreeImage_ConvertToRawBits -* fixed PluginTIFF behaving incorrectly on PHOTOMETRIC_MASK images -* fixed 16 bit TIFFs not loading correctly -* fixed incorrect handling of CCITTFAX3 and CCITTFAX4 TIFFs -* fixed JPEG encoded TIFFs not being supported -! [Yours Detlev] patched libTIFF to handle EXTRASAMPLE_UNSPECIFIED -! [Juergen Riecker] improved speed of PCX loading a lot -! rewrote parts of FreeImage to improve support for c -! the internal RGB555 and RGB565 macros now read BGR instead of RGB -! FreeImage now uses libMNG 1.0.3 -! FreeImage now uses libPNG 1.2.0 -! FreeImage_Save now opens files with the "w+b" flag -! renamed internal macro CalculateUsedColors to CalculateUsedPaletteEntries -! enabling/disabling plugins no longer has effect on FIFSupportsReading -! enabling/disabling plugins no longer has effect on FIFSupportsWriting -+ added flag PNG_IGNOREGAMMA -+ added function FreeImage_FIFSupportsExportBPP - -July 30th 2001 - 2.4.1 -* [Jan Nauta] fixed some plugin ids not being passed to plugins -* [Jan Nauta] fixed some functions being natively called instead of indirect -* [Jan Nauta] fixed BMPs with signature BA not being regognised -* [Remo Eichenberger] fixed memory leak in the plugin system -* fixed seek bug in PluginIFF's Validate -* fixed transparency issue in PluginPNG -* fixed uncaught exceptions in WUQuantizer and NNQuantizer -* fixed some problems with PluginTARGA -* fixed some problems with PluginICO -* fixed some problems with PluginBMP -! improved FreeImageQt's load function a little -! tell/seek control for validation is now handled inside the plugin framework - -July 22th 2001 - 2.4.0 -* (Yours Detlev) fixed memory leak in FreeImage_GetFIFFromFilename -* (Yours Detlev) fixed memory leak in the ICO plugin -* (Yours Detlev) fixed memory leak in the PNG plugin -* fixed potential NULL-pointer access bug in Plugin::AddNode -* fixed problems with linking the static lib -- removed LBM plugin. Its functionality is placed in the IFF plugin now -- removed FreeImage_GetFIFByIndex -! FreeImage now uses LibMNG 1.0.2 -! FreeImage_SetTransparent now only enables alpha when the bitmap is 8 or 32 bit -! FreeImage_SetTransparencyTable now only enables alpha when the bitmap is 8 bit -! FreeImage_LoadLBM now uses Mark Sibly's IFF plugin -! FreeImage_SaveBMP now converts to 24-bit when bpp is 32 and transparency is off -! FreeImage_SaveJPEG now converts to 24-bit when bpp is 32 and transparency is off -! FreeImage_SavePNM now converts to 24-bit when bpp is 32 and transparency is off -! FreeImage_SaveTIFF now converts to 24-bit when bpp is 32 and transparency is off -+ [Mark Sibly] added IFF (ILBM) support -+ added basic support for Photoshop files -+ added mime type support (FreeImage_GetFIFFromMime) -+ added functions FreeImage_SetPluginEnabled and FreeImage_IsPluginEnabled - Disabling plugins modifies the behaviour of the following functions: - * FreeImage_LoadFromHandle - * FreeImage_SaveToHandle - * FreeImage_FIFSupportsReading - * FreeImage_FIFSupportsWriting - * FreeImage_GetFIFFromFormat - * FreeImage_GetFIFFromFilename - * FreeImage_GetFIFFromMime - * FreeImage_Validate - -June 30th 2001 - 2.3.2 -* fixed missing "targa" extension in targa extension list -* fixed small memory leak in PluginList::AddNode -* fixed 32 bit PNG saving suddenly disappeared from the distro? -* fixed 'black line' bug in LoadTARGA -- removed project FreeImageM2 -- removed FreeImage_Combine -! FreeImage_RegisterLocalPlugin now receives a FI_InitProc as first parameter -! FreeImage_GetFIFFromFilename now also takes the format id into account -! cleanup up the code a little for PluginPCD and PluginPCX -+ added static lib project - -June 11th 2001 - 2.3.1 -* [Machiel ten Brinke] fixed the loading of some 'ancient' TARGAs -* [Rui Lopes] fixed some bugs in the external plugin registration -* fixed the plugin system crashing when the init function isn't called -- removed project FreeImagePy -- removed 32 to 24 bit conversion while saving PNG in FreeImageQt -! the scanline convert functions are now accessable in plugins -! FreeImage now uses an STL map to store the plugin list -! PluginSDK.h is now integrated into FreeImage.h -! FreeImage_Register now receives the boolean parameter 'load_local_plugins_only' -! FreeImage now uses LibPNG 1.0.12 -+ [Rui Lopes] added plugin for GIF reading/writing support -+ added function FreeImage_SetTransparencyCount -+ added support for 32 bit PNG saving -+ added FreeImage_RegisterLocalPlugin to allow plugins inside apps -+ added FreeImage_RegisterExternalPlugin to manually load DLLs -+ added plugin for JBIG reading/writing support - -May 4th 2001 - 2.3.0 -* [Martin Weber] fixed some small bugs in the TARGA and BMP plugins -* [Martin Weber] fixed tiny bug in new 16 bit conversions -* [Martin Weber] fixed load flag inconsistency in the TARGA plugin -* [Martin Weber] fixed plugin id / load reference inconsistency for PNM -* [Jan Nauta] fixed bug in conversion 16 -> 16 -* [Herve Drolon] fixed small bug in 4-bit PCX loader -- removed code that loads BMPs renamed to ICO in PluginICO -! the flag TARGA_LOAD_RGB555 is now obsolete -! the plugin list is now sorted internally -! ConvertTo32Bits now stores the transparency table as alpha mask -! FreeImage now uses LibMNG 1.0,1 -! FreeImage now uses LibPNG 1.0.11 -+ added external plugin support via DLLs -+ added function FreeImage_GetFIFByIndex -+ added internal function CalculateScanLine -+ added transparency support for high-color PNGs -+ added transparency support for high-color TIFFs -+ added functions FreeImage_SetTransparent and FreeImage_IsTransparent -+ added constant FIC_RGBALPHA to FREE_IMAGE_COLOR_TYPE - -April 5th 2001 - 2.2.0 -* [Remo Eichenberger] fixed small bug concerning DLLMain and static LIB generation -* fixed 1-bit bitmaps not properly loading in FreeImageQt -* fixed bug in conversion 16->16 -* FreeImage now uses LibPNG 1.0.10 -! [Martin Weber] improved loading of BMP files -! [Martin Weber] improved loading of TARGA files -! [Dave Larson] improved visual appearance after 16 conversions -! FreeImageQt now converts 32-bit bitmaps to 24-bit when saving PNGs and JPEGs -+ added functions FreeImage_Initialise and FreeImage_DeInitialise -+ added internal plugins -+ re-added combine/alphablend functions - -March 8th 2001 - 2.1.0 -* [Martin Hemming] fixed bug in 16-bit TARGA loading code -* fixed PNG's with alpha masks not loading correctly -! FreeImage is now dual-licensed: the FI-License and the GPL license -! FreeImage now uses LibPNG 1.0.9 -! FreeImage now uses LibTIFF 3.5.6 Beta -! FreeImage now uses LiBMNG 1.0.0 -! changed the ordering of the FREE_IMAGE_FORMAT table -! improved linux support -! improved test script -+ added transparency table support to SavePNG -+ added BI_BITFIELDS support to LoadBMP and SaveBMP -+ added reading support for OS/2 2.x BMPs -+ added support for MNG and JNG reading using LibMNG -+ added support for Deluxe Paint reading -+ added 'hot swap' support to the Core DLL -+ added 'hot swap' support to FreeImage Qt -+ added functions GetFIFFromFormat and GetFIFFromFilename -+ added functions FIFSupportsReading and FIFSupportsWriting -+ added function GetFIFRegExpr - -January 14th 2001 - 2.0.0 -* [Herve Drolon] fixed a bug in the conversion 4->8 -* [Herve Drolon] fixed a bug in metrics handling in SaveJPEG -* [Herve Drolon] fixed a bug in the return value of the function SaveTIFF -* fixed the presence of two WuQuantizer.cpp files in the distribution -* fixed bug where a BMP renamed to ICO isn't loaded -- removed FreeImage_ConvertToGreyScale. Use FreeImage_ConvertTo8Bits instead. -- removed the boolean parameters from all conversion routines -- removed page handling in LoadTIFF. A new range of functions will be added. -! The void pointers used in FreeImage are now typed -! LoadBMP now takes palettes in 24/32 bit images in respect -! All effects and MMX functions are now stored in a new library (FreeEffects) -! [Herve Drolon] fixed bug in FreeImage_GetColorType -! [Herve Drolon] improved PCX loader. It can now read 1, 4, 8 and 24-bit images -! [Manfred Tausch] improved FreeImage_Rotate -! [Luca Piergentili] fixed crash bug when saving some 1-bit TIFFs -! rewrote all bitdepth conversion routines making use of the new scanline converters -! rewrote bitdepth conversion in FreeImageQt (uses less memory) -! FreeImage is now compiled __stdcall -+ [Herve Drolon] added WBMP (Wireless Bitmap Format) support: loading and saving -+ [Herve Drolon] added 4, 16 and 32 bitdepth handling in GetColorType -+ [Herve Drolon] added handling of 8-bit greyscale bitmaps in SaveJPEG -+ [Herve Drolon] added NeuQuant color reduction algorithm to ColorQuantize -+ added DLL_CALLCONV (calling convention) flag -+ added bitmask support to all bitmaps -+ added a series of functions converting scanlines from one bitdepth to another -+ added functions ConvertFromRawBits and ConvertToRawBits -+ added project FreeImageM2: Magenta II MMT bindings for FreeImage -+ added basic foundation for linux support - -December 2th 2000 - 1.4.4 -* fixed small bug related to TIFFSetDirectory in FreeImage_LoadTIFF -* fixed FreeImage_Rotate sometimes clipping too much pixels -* fixed other small bug in FreeImage_Rotate -* fixed FreeImage_Clone not taking the FREEIMAGEHEADER in account -* fixed bug in FreeImageQt where 1-bit images are not correctly allocated -* fixed FreeImage_Crop not copying the palette -* fixed message function pointer crash bug -* fixed bug where the palette wasn't copied when saving in FreeImageQt -* fixed FreeImage_Clone not copying the transparency table -- removed FreeImage_WritePaletteEntry -! [Adam Gates] rewrote parts of FreeImage so that c compilers can handle it better -! FreeImageQt doesn't statically link with the FreeImage lib anymore -! FreeImageQt now uses atexit() to automatically unregister -! rewrote parts of FreeImage_LoadBMP to increase speed -+ [Markus Loibl] added metrics handling code to LoadBMP, LoadJPEG, LoadTIFF and LoadPCX -+ added metrics handling code to FreeImageQt -+ added functions FIQT_IsLoaded, FIQT_GetVersion and FIQT_GetCopyrightMessage -+ added conversion 1 -> 16 -+ added FreeImage_SaveJPEG and JPEG quality settings -+ added FreeImage_GetBitsRowCol -+ added function FIQT_SetOutputMessage to FreeImageQt -+ added FreeImage_GetFileTypeFromExtension and FIQT_GetFileTypeFromFormat -+ added project FreeImagePy: python bindings for FreeImage - -November 7th 2000 - 1.4.3 -* fixed FreeImage_SavePNG crash bug -* fixed slighly corrupt size filter in FreeImage_Combine -* fixed FreeImage_SaveTIFF not saving 4-bit images -* [Herve Drolon] fixed bug in FreeImage_LoadTIFF -* [Herve Drolon] fixed bug in FreeImage_GetColorType -- removed fclose from FreeImage_SavePNM (who put it there?) -! rewrote FreeImage_Rotate -! FreeImageQt now automatically detects which formats are supported by Qt and which not -! FreeImage_Allocate now returns a void pointer -! FreeImage_Unload is now called FreeImage_Free -+ added 16-bit 5-5-5 support to FreeImage_LoadBMP -+ added RLE_DELTA support to FreeImage_LoadBMP -+ added directory support to FreeImage_LoadTIFF -+ added functions dealing with transparency -+ added transparency support to 8-bit PNG's in Qt -+ added FREE_IMAGE_QUANTIZE parameter to FreeImage_ColorQuantize -+ added custom FREEIMAGEHEADER header prepended to internal bitmaps -+ added new documentation - -October 18th 2000 - 1.4.2 -* fixed FreeImage_SaveBMP storing an incorrect bfSize value in the BITMAPFILEHEADER -* fixed bug where JPEG and PNG wouldn't load in FreeImageQt -* fixed FreeImage_Mirror mirroring one pixel less than needed -! FreeImage_MaskedCombine24 is now called FreeImage_MaskedCombine24Ex -! FreeImage_MaskedCombine32 is now called FreeImage_MaskedCombine32Ex -+ added 16-bit bitmap support to FreeImage_Mirror -+ added 16-bit bitmap support to FreeImage_ConvertTo8Bits -+ added simple version of FreeImage_MaskedCombine24 -+ added simple version of FreeImage_MaskedCombine32 - -October 17th 2000 - 1.4.1 -* [Herve Drolon] fixed bug in FreeImage_ConvertTo8Bits -* fixed bug in conversion with 16 -> 24 and 16 -> 32 -- removed static library support -- removed all unnecessary files from LibTIFF, LibPNG, LibJPEG and ZLib -- removed all absolute seeks from the library -! FreeImageQt now makes use of the DLL distro -! rebuilt the entire directory structure -! improved handling of BMP -! renamed FreeImage_MaskedCombine to FreeImage_MaskedCombine32 -+ [Alexander Dymerets] added 24-bit masked alpha blending with a seperate alpha mask -+ added FreeImage_Rotate (known bug in degrees 76 to 106) -+ added 4-bit bitmap support to FreeImage_ConvertTo16Bits -+ added 8-bit bitmap support to FreeImage_ConvertTo16Bits -+ added 32-bit bitmap support to FreeImage_ConvertTo16Bits -+ added 32-bit bitmap support to FreeImage_Mirror -+ added 16-bit 5-5-5 support to FreeImage_ConvertTo24Bits -+ added 16-bit 5-5-5 support to FreeImage_ConvertTo32Bits - -October 2th 2000 - 1.4.0 -* [Jani Kajala] fixed bug in conversion with 4 -> 24 and 8 -> 32 -* [Jani Kajala] fixed bug in FreeImage_Flip -* [Jani Kajala] fixed minor bug in FreeImage_LoadBMP -- [Herve Drolon] removed PBMFlags, PGMFlags and PPMFlags -- [Herve Drolon] removed FI_LoadGeneric -- removed FreeImage_Win32.h -! [Herve Drolon] changed FI_GetFileType -! [Herve Drolon] replaced FI_LoadPBM, FI_LoadPGM and FI_LoadPPM with FI_LoadPNM -! [Herve Drolon] improved FreeImage_LoadPNG -! FreeImage_WritePaletteEntry is now exported -+ [Herve Drolon] added FreeImage_SavePNG -+ [Herve Drolon] added FreeImage_SavePNM and PNMFlags -+ [Herve Drolon] added XXXFlags parameter to save functions -+ [Herve Drolon] added FreeImage_LoadRAS and FIF_RAS -+ added FreeImage_GetFileTypeFromExt - -September 7th 2000 - 1.3.5 -+ added conversion 4 -> 8 to FI_ConvertTo8Bits -+ added simple version of FI_GetFileType -+ added project FreeImageQt; a port of the library to the TrollTech library - -August 31th 2000 - 1.3.4 -* fixed 'ice effect' bug in new 24 bit PCX code -* fixed some bugs with the conversion 16 -> 24 and 16 -> 32 -! FI_Blur now returns void -! A debug build of the library now produces FreeImaged.dll and FreeImaged.lib -! TARGA_LOAD_ARGB8888 is now called TARGA_LOAD_RGB888 -! Alpha channels are now automatically loaded unless TARGA_LOAD_RGB888 is specified -! cleaned up the code a lot -+ added 32-bit bitmap support to FreeImage_ConvertToGreyscale -+ added support for 32-bit bottom-left TARGA images -+ added internal functions FreeImage_WritePaletteEntry() and FreeImage_GetScanLine() -+ added FreeImage_Win32.h, containing Windows functions needed to create DIBs -+ added documentation through Doxygen - -July 30th 2000 - 1.3.3 -* [Jani Kajala] fixed some bugs with the conversion 4 -> 24 and 8 -> 24 -* [Jani Kajala] fixed some bugs with the conversion 4 -> 32 and 8 -> 32 -* fixed bug in FI_LoadPNM's ASCII number loader -! [Herve Drolon] improved FI_LoadPNG -! [Herve Drolon] changed FI_ConvertToGreyScale (added changeable macro for conversion) -! improved FI_ConvertTo24Bits -! improved FI_ConvertTo32Bits -! freeImage now uses LibPNG 1.0.8 -+ [Herve Drolon] added FI_ColorQuantize, based on Wu's color quantizer -+ added the conversion 1 -> 24 -+ added the conversion 1 -> 32 -+ added FI_ConvertTo8Bits -+ added FI_Invert (very useful for image processing) -+ added FI_GetColorType and 'enum FREE_IMAGE_COLOR_TYPE' - -June 30th 2000 - 1.3.2 -- removed color reduction functions from the project -! [Herve Drolon] Improved FI_LoadTIFF code -! renamed FI_ToGrayscale to FI_ConvertToGreyScale -! renamed FI_IncreaseColors to FI_ConvertTo24Bits -! LoadBMP now supports 32-bit bitmaps -! [Jani Kajala] Improved FI_LoadTARGA and FI_LoadPCX code -+ added FI_ConvertTo32Bits to convert a bitmap to 32-bit -+ added FI_MaskCombine to combine two 32-bit bitmaps using a alpha mask -+ added FI_AddAlphaMask to enrich a 32-bit bitmap with an alpha mask -+ added FI_SaveTIFF -+ added 16-bit bitmap (565) support to the ConvertToXXX functions. -+ added FI_ConvertTo16Bits (555 and 565) - -June 1th 2000 - 1.3.1 -- removed Standard Template Library (STL) code -* [Jani Kajala] fixed minor bug in FI_LoadTARGA -* [Jani Kajala] fixed some minor bugs in FI_LoadPCX -! streamlined FI_LoadJPEG a little -! FreeImage now uses LibPNG 1.0.6 -! FreeImage now uses LibTIFF 3.5.5 -! FreeImage now uses malloc and free instead of new and delete -+ introduced compiler flags to disable certain features in the DLL -+ added experimental nearest color reduction (FI_ReduceColorsNearestColor) - -April 13th 2000 - 1.3.0 -* fixed some 8 bit PCX files loading incorrectly -* fixed tiny bug in internally used CalculateUsedColors function -- removed FI_SaveXPM. Only BMP is supported now. -- removed Windows dependencies for easier porting -! optimized FI_LoadKOALA a little -! optimized FI_Combine using MMX technology -! FI_Combine now receives an 'unsigned integer' as alpha blend parameter -! FI_InCreaseColors and FI_ReduceColors don't dispose the old bitmap anymore -+ added PNM support (PGM, PPM and PBM; both binary and ascii) -+ [Alexander Dymerets] added FI_EnableMMX and FI_DisableMMX -+ added various effect functions (FI_Blur, FI_Brighten and FI_Crop) - -March 1st 2000 - 1.2.1 -* fixed some 24 bit PCX files loading incorrectly - -February 8th 2000 - 1.2.0 -* fixed last bitmap data block in JPEG files being truncated -* fixed 4/8 bit BMP's incorrectly loading when the palette is smaller than the bitcount predicts -- removed FI_Load. There is no reliable way to identify all image formats -- removed FI_SetJpegDecodeMode. - Mode selection is now done using the 'DataEnum data' parameter of FI_LoadJPEG -! read_proc/write_proc/tell_proc in FreeImageIO now are same as fread/fwrite/ftell -+ added a 'DataEnum data' parameter to all FI_LoadXXX functions. -+ added 16 bit TARGA support -+ added RLE support for TARGA images -+ added FI_GetDIBSize to get the size of a DIB in bytes -+ added Kodak PhotoCD support (Base, Base/4 and Base/16 encoding) -+ added KOALA support -+ added FI_GetFileType. Note: there is no reliable way to identify TARGA, ICO and PCD. Therefore they have been excluded -In KOALA files only the files converted by a C64 emulator can be identified. -+ added FI_Combine to combine two 24-bit bitmaps with (optional) alpha blending - -January 15th 2000 - 1.1.1 -! FI_Copy is now called FI_Clone -+ added FI_ToGrayscale to convert a color bitmap to grayscale -+ added 32 bit TARGA support -+ added FI_IncreaseColors to increase the bitmap bitdepth from 4/8 bit to 24 bit - -January 14th 2000 - 1.1.0 -* FI_MIRROR: fixed nibbles not being mirrored in 4 bit images -* FI_MIRROR: fixed bits not being mirrored in 1 bit images -* fixed improper loading of 1, 4 and 8 bit OS/2 BMP's -* fixed some inconsistensies in the calculation of lines and pitches -* fixed incorrectly loading of Huffman and FAX encoded TIFFs -* fixed LoadTGA accepting 16 bit TGA's and returning corrupt DIB's -- removed LZW support for TIFFs -! FreeImage now uses LibTIFF 3.5.4 -+ added ICO support -+ added overridable file I/O support in the form of FreeImageIO and fi_handle -+ added FI_Load for generic image loading -+ added FI_ReduceColors for color reduction -+ added FI_Copy to copy a bitmap in memory - -January 5th 2000 - 1.0.0 diff --git a/#ThirdParty/FreeImage/Wrapper/Delphi/WhatsNew_Delphi.txt b/#ThirdParty/FreeImage/Wrapper/Delphi/WhatsNew_Delphi.txt deleted file mode 100644 index 5cce257..0000000 --- a/#ThirdParty/FreeImage/Wrapper/Delphi/WhatsNew_Delphi.txt +++ /dev/null @@ -1,117 +0,0 @@ -What's New for FreeImage Delphi Wrapper - -* : fixed -- : removed -! : changed -+ : added - -May 5, 2014 -+ [Lorenzo Monti] updated wrapper for FreeImage 3.16.1 -+ [Lorenzo Monti] added preprocessor tests for Delphi XE2..XE6 -+ [Lorenzo Monti] merged changes for OSX compatibility (submitted by Maurício) - -December 8, 2012 -+ [Lorenzo Monti] updated wrapper for FreeImage 3.15.4 - -June 4, 2012 -+ [Lorenzo Monti] updated wrapper for FreeImage 3.15.3 - -March 4, 2011 -* [Jean-Marc Bottura] some bugfixes in FreeBitmap.pas -+ [Jean-Marc Bottura] added support for 64 bit compilers - -February 15, 2011 -+ [Lorenzo Monti] updated wrapper for FreeImage 3.15.0 - -January 4, 2011 -+ [Lorenzo Monti] updated ImagePreview demo to support latest Graphics32 components (1.9) and Delphi 2010 / XE - -November 12, 2010 -+ [Lorenzo Monti] updated wrapper for FreeImage 3.14.1 -+ [Lorenzo Monti] added Delphi XE support - -July 29, 2010 -+ [Lorenzo Monti] added Free Pascal / Lazarus 32 bit support - -July 14, 2010 -+ [Lorenzo Monti] updated wrapper for FreeImage 3.13.1 -* [Lorenzo Monti] fixed declaration of FreeImageIO functions (FI_ReadProc, FI_WriteProc, FI_SeekProc, FI_TellProc) -! [Lorenzo Monti] renamed structure PluginStruct to Plugin, according to FreeImage.h -* [Lorenzo Monti] fixed declaration of JPEG_CMYK constant -* [Lorenzo Monti] fixed declaration of type FreeImage_OutputMessageFunction -* [Lorenzo Monti] fixed declaration of FreeImage_OutputMessageProc -+ [Lorenzo Monti] added wrapper for FreeImage_OutputMessageProc for older Delphi compilers (<6) not supporting varargs -* [Lorenzo Monti] fixed declaration of FreeImage_LookupX11Color and FreeImage_LookupSVGColor -! [Lorenzo Monti] changed declaration of FreeImage_GetPixelIndex, FreeImage_GetPixelColor, FreeImage_SetPixelIndex, FreeImage_SetPixelColor -! [Lorenzo Monti] changed declaration of FreeImage_GetInfo -! [Lorenzo Monti] changed declaration of FreeImage_GetICCProfile, FreeImage_CreateICCProfile, FreeImage_DestroyICCProfile -* [Lorenzo Monti] fixed declaration of FreeImage_SetComplexChannel -+ [Lorenzo Monti] added Delphi 2010 support -+ [Lorenzo Monti] added Version.inc to determine compiler version -! [Lorenzo Monti] moved all "external" definitions to implementation section -! [Lorenzo Monti] changed FreeBitmap.pas, FreeUtils.pas and TargaImage.pas to reflect changes in the FreeImage.pas unit - -July 17, 2006 -+ [Hervé Drolon] added FIF_FAXG3 and FIF_SGI definitions, added FreeImage_MakeThumbnail definition. - -January 20, 2006 -! [Anatoliy Pulyaevskiy] updated WinBitmap demo -* [Anatoliy Pulyaevskiy] fixed TFreeBitmap.ConvertToStandartType renamed to TFreeBitmap.ConvertToStandardType -* [Anatoliy Pulyaevskiy] fixed using of SetFreeImageMarker (only for HDR dib) - -October 19, 2005 -+ [Anatoliy Pulyaevskiy] updated wrapper for FreeImage 3.8.0 -+ [Anatoliy Pulyaevskiy] added Delphi 5 support -+ [Anatoliy Pulyaevskiy] added TFreeBitmap.OnChanging event -! [Anatoliy Pulyaevskiy] changed declaration of TFreeBitmap.Assign method -+ [Anatoliy Pulyaevskiy] added TFreeBitmap.CanSave function -! [Anatoliy Pulyaevskiy] property TFreeBitmap.Dib now have read/write access -+ [Anatoliy Pulyaevskiy] added TFreeTag class incapsulating FreeImage FITAG type - -August 5, 2005 -* [kaare-nysite] fixed the prototype of FreeImage_ConvertFromRawBits - -June 21, 2005 -* [Maarten Veerman] fixed the prototype of FreeImage_OpenMultiBitmap - -February 17, 2005 - Version 1.3.0 -+ [Anatoliy Pulyaevskiy] updated the wrapper for FreeImage 3.6.0 -! [Anatoliy Pulyaevskiy] FreeImage.pas unit has been reworked - -January 14, 2005 - Version 1.2.1 -+ [Anatoliy Pulyaevskiy] updated the wrapper for FreeImage 3.5.3 -+ [Anatoliy Pulyaevskiy] added TFreeBitmap.SetHorizontalResolution and TFreeBitmap.SetVerticalResolution -+ [Anatoliy Pulyaevskiy] added TFreeBitmap.MakeThumbnail procedure ( an adapted version of function given by Enzo Costantini) -+ [Enzo Costantini] added FIU_GetFIFType utility function -+ [Enzo Costantini] added TFreeWinBitmap.CopyToBitmapH function -* [Anatoliy Pulyaevskiy] fixed TFreeBitmap.Rotate (fix from FreeImage CVS) -+ [Anatoliy Pulyaevskiy] added TFreeBitmap.ConvertToStandartType - -December 20, 2004 - Version 1.2.0 -+ [Anatoliy Pulyaevskiy] added MultiBitmap Demo -* [Anatoliy Pulyaevskiy] fixed TFreeMultiBitmap.LockPage due to error with Locking/Unlocking pages -+ [Anatoliy Pulyaevskiy] added TFreeBitmap.ConvertTo4Bits -* [Anatoliy Pulyaevskiy] TFreeBitmap.ConvertToGrayScale fixed converting bitmaps with FIC_MINISWHITE color type -* [Anatoliy Pulyaevskiy] fixed TFreeWinBitmap.DrawEx FDisplayDib deleting -+ [Anatoliy Pulyaevskiy] updated the wrapper for FreeImage 3.5.2 - -November 12, 2004 - Version 1.1.0 -+ [Anatoliy Pulyaevskiy] added TFreeBitmap.Assign(Source: PFIBITMAP) -- [Anatoliy Pulyaevskiy] removed TFreeBitmap.SetDib -! [Anatoliy Pulyaevskiy] TFreeBitmap.Dib property now read-only -* [Anatoliy Pulyaevskiy] TFreeMultiBitmap.UnlockPage implemented -* [Anatoliy Pulyaevskiy] fixed TFreeBitmap.Rescale not applies changes - -November 8, 2004 - Version 1.0.0 -+ [Anatoliy Pulyaevskiy] added Delphi version of FreeImagePlus -+ [Anatoliy Pulyaevskiy] updated the wrapper for FreeImage 3.5.0 - -January 7, 2004 -+ [Tommy] added TargaImage unit - -October 28, 2003 -+ [Peter Byström] updated the wrapper for FreeImage 3.0.2 - -August 9, 2003 -+ [Simon Beavis] added a wrapper for FreeImage 2.6.1 - diff --git a/#ThirdParty/FreeImage/Wrapper/Delphi/_clean.bat b/#ThirdParty/FreeImage/Wrapper/Delphi/_clean.bat deleted file mode 100644 index 43924b0..0000000 --- a/#ThirdParty/FreeImage/Wrapper/Delphi/_clean.bat +++ /dev/null @@ -1,13 +0,0 @@ -del /S *.~* -del /S *.dcu -del /S *.dsk -del /S *.cfg -del /S *.dof -del /S *.obj -del /S *.hpp -del /S *.ddp -del /S *.mps -del /S *.mpt -del /S *.bak -del /S *.exe -del /S *.stat \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/ImagePreview/ImagePreview.dpr b/#ThirdParty/FreeImage/Wrapper/Delphi/demo/ImagePreview/ImagePreview.dpr deleted file mode 100644 index 79fc38b..0000000 --- a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/ImagePreview/ImagePreview.dpr +++ /dev/null @@ -1,13 +0,0 @@ -program ImagePreview; - -uses - Forms, - MainFrm in 'MainFrm.pas' {MainForm}; - -{$R *.res} - -begin - Application.Initialize; - Application.CreateForm(TMainForm, MainForm); - Application.Run; -end. diff --git a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/ImagePreview/ImagePreview.res b/#ThirdParty/FreeImage/Wrapper/Delphi/demo/ImagePreview/ImagePreview.res deleted file mode 100644 index b40deef..0000000 Binary files a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/ImagePreview/ImagePreview.res and /dev/null differ diff --git a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/ImagePreview/MainFrm.dfm b/#ThirdParty/FreeImage/Wrapper/Delphi/demo/ImagePreview/MainFrm.dfm deleted file mode 100644 index d8cf90f..0000000 --- a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/ImagePreview/MainFrm.dfm +++ /dev/null @@ -1,135 +0,0 @@ -object MainForm: TMainForm - Left = 304 - Top = 165 - Width = 467 - Height = 405 - Caption = 'Image Preview' - Color = clWhite - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'MS Sans Serif' - Font.Style = [] - KeyPreview = True - OldCreateOrder = False - Position = poDesktopCenter - OnCreate = FormCreate - OnDestroy = FormDestroy - OnKeyUp = FormKeyUp - OnMouseWheel = ScrollBoxMouseWheel - OnShow = FormShow - PixelsPerInch = 96 - TextHeight = 13 - object ImgView32: TImgView32 - Left = 0 - Top = 0 - Width = 459 - Height = 371 - Align = alClient - ParentShowHint = False - PopupMenu = PopupMenu - Scale = 1 - ScrollBars.Color = clScrollBar - ScrollBars.ShowHandleGrip = True - ScrollBars.Style = rbsDefault - ShowHint = True - SizeGrip = sgAuto - TabOrder = 0 - OnScroll = ImgView32Scroll - object AlphaView: TImgView32 - Left = 8 - Top = 8 - Width = 161 - Height = 145 - Scale = 1 - ScrollBars.Color = clScrollBar - ScrollBars.ShowHandleGrip = True - ScrollBars.Style = rbsDefault - SizeGrip = sgAuto - TabOrder = 2 - Visible = False - end - end - object PopupMenu: TPopupMenu - Left = 304 - Top = 28 - object ZoomInItem: TMenuItem - Caption = 'Zoom In' - OnClick = ZoomInItemClick - end - object ZoomOutItem: TMenuItem - Caption = 'Zoom Out' - OnClick = ZoomOutItemClick - end - object ActualSizeItem: TMenuItem - Caption = 'Actual Size' - OnClick = ActualSizeItemClick - end - object N1: TMenuItem - Caption = '-' - end - object RotateClockwiseItem: TMenuItem - Caption = 'Rotate Clockwise' - OnClick = RotateClockwiseItemClick - end - object RotateAntiClockwiseItem: TMenuItem - Caption = 'Rotate Anti-Clockwise' - OnClick = RotateAntiClockwiseItemClick - end - object N4: TMenuItem - Caption = '-' - end - object FlipHorizontalItem: TMenuItem - Caption = 'Flip Horizontal' - OnClick = FlipHorizontalItemClick - end - object FilpVerticalItem: TMenuItem - Caption = 'Filp Vertical' - OnClick = FilpVerticalItemClick - end - object N3: TMenuItem - Caption = '-' - end - object ShowAlphaItem: TMenuItem - Caption = 'Show Just Alpha Channel' - OnClick = ShowAlphaItemClick - end - object ShowWithAlphaItem: TMenuItem - Caption = 'Show With Alpha Channel' - OnClick = ShowWithAlphaItemClick - end - object N2: TMenuItem - Caption = '-' - end - object OpenImageItem: TMenuItem - Caption = 'Open New Image' - OnClick = OpenImageItemClick - end - end - object FilterTimer: TTimer - Interval = 500 - OnTimer = FilterTimerTimer - Left = 308 - Top = 84 - end - object OpenDialog: TOpenDialog - Filter = - 'All image files|*.bmp;*.cut;*.ico;*.iff;*.lbm;*.jng;*.jpg;*.jpeg' + - ';*.koa;*.mng;*.pbm;*.pcd;*.pcx;*.pgm;*.png;*.ppm;*.psd;*.ras;*.t' + - 'ga;*.tif;*.tiff;.wbmp;*.xbm;*.xpm)|Windows or OS/2 Bitmap File (' + - '*.BMP)|*.BMP|Dr. Halo (*.CUT)|*.CUT|Windows Icon (*.ICO)|*.ICO|A' + - 'miga IFF (*.IFF, *.LBM)|*.IFF;*.LBM|JPEG Network Graphics (*.JNG' + - ')|*.JNG|Independent JPEG Group (*.JPG)|*.JPG|Commodore 64 Koala ' + - '(*.KOA)|*.KOA|Multiple Network Graphics (*.MNG)|*.MNG|Portable B' + - 'itmap (*.PBM)|*.PBM|Kodak PhotoCD (*.PCD)|*.PCD|PCX bitmap forma' + - 't (*.PCX)|*.PCX|Portable Graymap (*.PGM)|*.PGM|Portable Network ' + - 'Graphics (*.PNG)|*.PNG|Portable Pixelmap (*.PPM)|*.PPM|Photoshop' + - ' (*.PSD)|*.PSD|Sun Rasterfile (*.RAS)|*.RAS|Targa files (*.TGA)|' + - '*.TGA|Tagged Image File Format (*.TIF)|*.TIF;*.TIFF|Wireless Bit' + - 'map (*.WBMP)|*.WBMP|X11 Bitmap Format (*.XBM)|*.XBM|X11 Pixmap F' + - 'ormat (*.XPM)|*.XPM' - Title = 'Open Image File' - Left = 328 - Top = 228 - end -end diff --git a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/ImagePreview/MainFrm.pas b/#ThirdParty/FreeImage/Wrapper/Delphi/demo/ImagePreview/MainFrm.pas deleted file mode 100644 index 1db403a..0000000 --- a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/ImagePreview/MainFrm.pas +++ /dev/null @@ -1,524 +0,0 @@ -unit MainFrm; - -interface - -uses - Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, - Dialogs, Menus, ExtCtrls, Math, GR32, GR32_Image, GR32_Transforms, - ExtDlgs; - -type - TMainForm = class(TForm) - PopupMenu: TPopupMenu; - ZoomInItem: TMenuItem; - ZoomOutItem: TMenuItem; - ActualSizeItem: TMenuItem; - ImgView32: TImgView32; - N1: TMenuItem; - AlphaView: TImgView32; - ShowAlphaItem: TMenuItem; - RotateClockwiseItem: TMenuItem; - RotateAntiClockwiseItem: TMenuItem; - N3: TMenuItem; - ShowWithAlphaItem: TMenuItem; - N4: TMenuItem; - FlipHorizontalItem: TMenuItem; - FilpVerticalItem: TMenuItem; - FilterTimer: TTimer; - OpenImageItem: TMenuItem; - N2: TMenuItem; - OpenDialog: TOpenDialog; - procedure FormCreate(Sender: TObject); - procedure FormDestroy(Sender: TObject); - procedure FormShow(Sender: TObject); - procedure ZoomInItemClick(Sender: TObject); - procedure ZoomOutItemClick(Sender: TObject); - procedure ActualSizeItemClick(Sender: TObject); - procedure ScrollBoxMouseWheel(Sender: TObject; Shift: TShiftState; - WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean); - procedure FormKeyUp(Sender: TObject; var Key: Word; - Shift: TShiftState); - procedure ShowAlphaItemClick(Sender: TObject); - procedure RotateClockwiseItemClick(Sender: TObject); - procedure RotateAntiClockwiseItemClick(Sender: TObject); - procedure ShowWithAlphaItemClick(Sender: TObject); - procedure FlipHorizontalItemClick(Sender: TObject); - procedure FilpVerticalItemClick(Sender: TObject); - procedure FilterTimerTimer(Sender: TObject); - procedure ImgView32Scroll(Sender: TObject); - procedure OpenImageItemClick(Sender: TObject); - private - { Private declarations } - OrigWidth : integer; - OrigHeight : integer; - BPP : longword; - - procedure LoadImage( Name : string); - procedure RecalcWindowSize; - public - { Public declarations } - end; - -var - MainForm: TMainForm; - -implementation - -{$R *.dfm} - -uses FreeImage, GR32_Resamplers; - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -procedure TMainForm.FormCreate(Sender: TObject); -begin - AlphaView.Visible := False; - AlphaView.Align := alClient; -end; -// ----------------------------------------------------------------------------- -procedure TMainForm.FormDestroy(Sender: TObject); -begin - // ... -end; -// ----------------------------------------------------------------------------- -procedure TMainForm.FormShow(Sender: TObject); -var - Resampler: TKernelResampler; -begin - Resampler := TKernelResampler.Create(ImgView32.Bitmap); - Resampler.Kernel := TSplineKernel.Create; - if ParamCount = 1 then - LoadImage(ParamStr(1)); -end; -// ----------------------------------------------------------------------------- -procedure TMainForm.LoadImage( Name : string); -var - dib : PFIBITMAP; - PBH : PBITMAPINFOHEADER; - PBI : PBITMAPINFO; - t : FREE_IMAGE_FORMAT; - Ext : string; - BM : TBitmap; - x, y : integer; - BP : PLONGWORD; - DC : HDC; -begin - try - t := FreeImage_GetFileType(PAnsiChar(AnsiString(Name)), 16); - - if t = FIF_UNKNOWN then - begin - // Check for types not supported by GetFileType - Ext := UpperCase(ExtractFileExt(Name)); - if (Ext = '.TGA') or(Ext = '.TARGA') then - t := FIF_TARGA - else if Ext = '.MNG' then - t := FIF_MNG - else if Ext = '.PCD' then - t := FIF_PCD - else if Ext = '.WBMP' then - t := FIF_WBMP - else if Ext = '.CUT' then - t := FIF_CUT - else - raise Exception.Create('The file "' + Name + '" cannot be displayed because SFM does not recognise the file type.'); - end; - - dib := FreeImage_Load(t, PAnsiChar(AnsiString(name)), 0); - if Dib = nil then - Close; - PBH := FreeImage_GetInfoHeader(dib); - PBI := FreeImage_GetInfo(dib); - - BPP := FreeImage_GetBPP(dib); - - ShowWithAlphaItem.Enabled := BPP = 32; - ShowAlphaItem.Enabled := BPP = 32; - - if BPP = 32 then - begin - ImgView32.Bitmap.SetSize(FreeImage_GetWidth(dib), FreeImage_GetHeight(dib)); - - BP := PLONGWORD(FreeImage_GetBits(dib)); - for y := ImgView32.Bitmap.Height - 1 downto 0 do - for x := 0 to ImgView32.Bitmap.Width - 1 do - begin - ImgView32.Bitmap.Pixel[x, y] := BP^; - inc(BP); - end; - end - else - begin - BM := TBitmap.Create; - - BM.Assign(nil); - DC := GetDC(Handle); - - BM.handle := CreateDIBitmap(DC, - PBH^, - CBM_INIT, - PChar(FreeImage_GetBits(dib)), - PBI^, - DIB_RGB_COLORS); - - ImgView32.Bitmap.Assign(BM); - AlphaView.Bitmap.Assign(BM); - - BM.Free; - ReleaseDC(Handle, DC); - end; - FreeImage_Unload(dib); - - OrigWidth := ImgView32.Bitmap.Width; - OrigHeight := ImgView32.Bitmap.Height; - - Caption := ExtractFileName( Name ) + ' (' + IntToStr(OrigWidth) + - ' x ' + IntToStr(OrigHeight) + ')'; - if BPP = 32 then - Caption := Caption + ' + Alpha'; - - AlphaView.Bitmap.SetSize(OrigWidth, OrigWidth); - - ImgView32.Hint := 'Name: ' + Name + #13 + - 'Width: ' + IntToStr(OrigWidth) + #13 + - 'Height: ' + IntToStr(OrigHeight) + #13 + - 'BPP: ' + IntToStr(BPP); - - RecalcWindowSize; - - Show; - except - on e:exception do - begin - Application.BringToFront; - MessageDlg(e.message, mtInformation, [mbOK], 0); - Close; - end; - end; -end; -// ----------------------------------------------------------------------------- -procedure TMainForm.ZoomInItemClick(Sender: TObject); -begin - FilterTimer.Enabled := False; - if not (ImgView32.Bitmap.Resampler is TNearestResampler) then - TNearestResampler.Create(ImgView32.Bitmap); - FilterTimer.Enabled := True; - - ImgView32.Scale := ImgView32.Scale * 2.0; - RecalcWindowSize; -end; -// ----------------------------------------------------------------------------- -procedure TMainForm.ZoomOutItemClick(Sender: TObject); -begin - FilterTimer.Enabled := False; - if not (ImgView32.Bitmap.Resampler is TNearestResampler) then - TNearestResampler.Create(ImgView32.Bitmap); - FilterTimer.Enabled := True; - - ImgView32.Scale := ImgView32.Scale / 2.0; - RecalcWindowSize; -end; -// ----------------------------------------------------------------------------- -procedure TMainForm.ActualSizeItemClick(Sender: TObject); -begin - FilterTimer.Enabled := False; - if not (ImgView32.Bitmap.Resampler is TNearestResampler) then - TNearestResampler.Create(ImgView32.Bitmap); - FilterTimer.Enabled := True; - - ImgView32.Scale := 1.0; - - RecalcWindowSize; -end; -// ----------------------------------------------------------------------------- -procedure TMainForm.RecalcWindowSize; -var - Rect : TRect; - CW, CH : integer; - WSH, WSW : integer; - TitleH : integer; - BorderY : integer; - BorderX : integer; -begin - CW := ImgView32.Bitmap.Width + GetSystemMetrics(SM_CXVSCROLL); - CH := ImgView32.Bitmap.Height + GetSystemMetrics(SM_CYVSCROLL); - - SystemParametersInfo( SPI_GETWORKAREA, 0, @Rect, 0); - - WSH := Rect.Bottom - Rect.Top; - WSW := Rect.Right - Rect.Left; - TitleH := GetSystemMetrics(SM_CYCAPTION); - BorderY := GetSystemMetrics(SM_CYSIZEFRAME) * 2; - BorderX := GetSystemMetrics(SM_CXSIZEFRAME) * 2; - - if (Top + CH + TitleH + BorderY > WSH) or (CH + TitleH + BorderY > WSH) then - begin - Top := Rect.Bottom - CH - BorderY; - if Top < 0 then - begin - Top := 0; - CH := WSH - TitleH - BorderY; - CW := CW + GetSystemMetrics(SM_CXVSCROLL); - - if CW + BorderX > WSW then - CH := CH - GetSystemMetrics(SM_CYVSCROLL); - end; - end; - - if (Left + CW + BorderX > WSW) or (CW + BorderX > WSW) then - begin - Left := Rect.Right - CW - BorderX; - if Left < 0 then - begin - Left := 0; - CW := WSW - BorderX; - CH := CH + GetSystemMetrics(SM_CYVSCROLL); - - if CH + TitleH + BorderY > WSH then - CW := CW + GetSystemMetrics(SM_CXVSCROLL); - end - end; - - ClientWidth := CW; - ClientHeight := CH; -end; -// ----------------------------------------------------------------------------- -procedure TMainForm.ScrollBoxMouseWheel(Sender: TObject; - Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint; - var Handled: Boolean); -begin - FilterTimer.Enabled := False; - if not (ImgView32.Bitmap.Resampler is TNearestResampler) then - TNearestResampler.Create(ImgView32.Bitmap); - FilterTimer.Enabled := True; - - if WheelDelta < 0 then - ImgView32.Scroll(0, 20) - else - ImgView32.Scroll(0, -20); - Handled := True; -end; -// ----------------------------------------------------------------------------- -procedure TMainForm.FormKeyUp(Sender: TObject; var Key: Word; - Shift: TShiftState); -var - Amount : integer; -begin - FilterTimer.Enabled := False; - if not (ImgView32.Bitmap.Resampler is TNearestResampler) then - TNearestResampler.Create(ImgView32.Bitmap); - FilterTimer.Enabled := True; - - if ssShift in Shift then - Amount := 20 * 2 - else - Amount := 20; - - case Key of - VK_ESCAPE: - Close; - VK_UP: - ImgView32.Scroll(0, -Amount); - VK_DOWN: - ImgView32.Scroll(0, Amount); - VK_LEFT: - ImgView32.Scroll(-Amount, 0); - VK_RIGHT: - ImgView32.Scroll(Amount, 0); - VK_HOME: - ImgView32.ScrollToCenter(0, 0); - VK_END: - ImgView32.ScrollToCenter(ImgView32.Bitmap.Width, ImgView32.Bitmap.Height); - VK_NEXT: - ImgView32.Scroll(0, (Trunc(ImgView32.Bitmap.Height div 4))); - VK_PRIOR: - ImgView32.Scroll(0, -(Trunc(ImgView32.Bitmap.Height div 4))); - end; -end; -// ----------------------------------------------------------------------------- -procedure TMainForm.ShowAlphaItemClick(Sender: TObject); -var - x, y : integer; - Col : TColor32; - Alpha : TColor; -begin - if ShowAlphaItem.Checked then - begin - AlphaView.Visible := False; - AlphaView.Bitmap.Delete; - end - else - begin - AlphaView.Bitmap.Width := ImgView32.Bitmap.Width; - AlphaView.Bitmap.Height := ImgView32.Bitmap.Height; - - for x := 0 to AlphaView.Bitmap.Width - 1 do - for y := 0 to AlphaView.Bitmap.Height - 1 do - begin - Col := ImgView32.Bitmap.Pixel[x, y]; - Alpha := Col shr 24; - AlphaView.Bitmap.Pixel[x, y] := Alpha + (Alpha shl 8) + (Alpha shl 16); - end; - AlphaView.Visible := True; - end; - ShowAlphaItem.Checked := not ShowAlphaItem.Checked; -end; -// ----------------------------------------------------------------------------- -procedure TMainForm.RotateClockwiseItemClick(Sender: TObject); -var - x : integer; - y : integer; - DestX : integer; - DestY : integer; - C : TColor32; -begin - AlphaView.Bitmap.Assign(ImgView32.Bitmap); - - ImgView32.BeginUpdate; - ImgView32.Bitmap.Width := AlphaView.Bitmap.Height; - ImgView32.Bitmap.Height := AlphaView.Bitmap.Width; - - for x := 0 to AlphaView.Bitmap.Width - 1 do - for y := 0 to AlphaView.Bitmap.Height - 1 do - begin - C := AlphaView.Bitmap.Pixel[x, y]; - - DestX := (ImgView32.Bitmap.Width - 1) - Y; - DestY := X; - - ImgView32.Bitmap.Pixels[DestX, DestY] := C; - end; - - ImgView32.EndUpdate; - ImgView32.Refresh; -end; - -// ----------------------------------------------------------------------------- -procedure TMainForm.RotateAntiClockwiseItemClick(Sender: TObject); -var - x : integer; - y : integer; - DestX : integer; - DestY : integer; - C : TColor32; -begin - AlphaView.Bitmap.Assign(ImgView32.Bitmap); - - ImgView32.BeginUpdate; - ImgView32.Bitmap.Width := AlphaView.Bitmap.Height; - ImgView32.Bitmap.Height := AlphaView.Bitmap.Width; - - for x := 0 to AlphaView.Bitmap.Width - 1 do - for y := 0 to AlphaView.Bitmap.Height - 1 do - begin - C := AlphaView.Bitmap.Pixel[x, y]; - - DestX := Y; - DestY := (ImgView32.Bitmap.Height - 1) -X; - - ImgView32.Bitmap.Pixels[DestX, DestY] := C; - end; - - ImgView32.EndUpdate; - ImgView32.Refresh; -end; -// ----------------------------------------------------------------------------- -procedure TMainForm.ShowWithAlphaItemClick(Sender: TObject); -begin - if ShowWithAlphaItem.Checked then - ImgView32.Bitmap.DrawMode := dmOpaque - else - ImgView32.Bitmap.DrawMode := dmBlend; - ShowWithAlphaItem.Checked := not ShowWithAlphaItem.Checked; -end; -// ----------------------------------------------------------------------------- -procedure TMainForm.FlipHorizontalItemClick(Sender: TObject); -var - x : integer; - y : integer; - DestX : integer; - DestY : integer; - C : TColor32; -begin - AlphaView.Bitmap.Assign(ImgView32.Bitmap); - - ImgView32.BeginUpdate; - ImgView32.Bitmap.Width := AlphaView.Bitmap.Width; - ImgView32.Bitmap.Height := AlphaView.Bitmap.Height; - - for x := 0 to AlphaView.Bitmap.Width - 1 do - for y := 0 to AlphaView.Bitmap.Height - 1 do - begin - C := AlphaView.Bitmap.Pixel[x, y]; - - DestX := (ImgView32.Bitmap.Width - 1) -X; - DestY := Y; - - ImgView32.Bitmap.Pixels[DestX, DestY] := C; - end; - - ImgView32.EndUpdate; - ImgView32.Refresh; -end; -// ----------------------------------------------------------------------------- -procedure TMainForm.FilpVerticalItemClick(Sender: TObject); -var - x : integer; - y : integer; - DestX : integer; - DestY : integer; - C : TColor32; -begin - AlphaView.Bitmap.Assign(ImgView32.Bitmap); - - ImgView32.BeginUpdate; - ImgView32.Bitmap.Width := AlphaView.Bitmap.Width; - ImgView32.Bitmap.Height := AlphaView.Bitmap.Height; - - for x := 0 to AlphaView.Bitmap.Width - 1 do - for y := 0 to AlphaView.Bitmap.Height - 1 do - begin - C := AlphaView.Bitmap.Pixel[x, y]; - - DestX := X; - DestY := (ImgView32.Bitmap.Height - 1) - Y; - - ImgView32.Bitmap.Pixels[DestX, DestY] := C; - end; - - ImgView32.EndUpdate; - ImgView32.Refresh; -end; - -// ----------------------------------------------------------------------------- -procedure TMainForm.FilterTimerTimer(Sender: TObject); -var - Resampler: TKernelResampler; -begin - FilterTimer.Enabled := False; - Resampler := TKernelResampler.Create(ImgView32.Bitmap); - Resampler.Kernel := TSplineKernel.Create; -end; -// ----------------------------------------------------------------------------- -procedure TMainForm.ImgView32Scroll(Sender: TObject); -begin - FilterTimer.Enabled := False; - if not (ImgView32.Bitmap.Resampler is TNearestResampler) then - TNearestResampler.Create(ImgView32.Bitmap); - FilterTimer.Enabled := True; -end; -// ----------------------------------------------------------------------------- -procedure TMainForm.OpenImageItemClick(Sender: TObject); -begin - if OpenDialog.Execute then - begin - try - Screen.Cursor := crHourGlass; - LoadImage(OpenDialog.FileName); - finally - Screen.Cursor := crDefault; - end; - end; -end; - -end. diff --git a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/ImagePreview/Readme.txt b/#ThirdParty/FreeImage/Wrapper/Delphi/demo/ImagePreview/Readme.txt deleted file mode 100644 index f7f1a7d..0000000 --- a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/ImagePreview/Readme.txt +++ /dev/null @@ -1,8 +0,0 @@ -This is a simple image viewing application that uses the FreeImage library to display images in many different formats. - -The app displays the image whose name is passed in as a command line argument. - - -To compile the app you will also need the Graphics32 library available from www.g32.org. It has been tested with version 1.5.1 of Graphics32. - -SJB. diff --git a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/ImagePreview/Tiger.jpg b/#ThirdParty/FreeImage/Wrapper/Delphi/demo/ImagePreview/Tiger.jpg deleted file mode 100644 index c152073..0000000 Binary files a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/ImagePreview/Tiger.jpg and /dev/null differ diff --git a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/MultiBitmap/MultiBitmap.dpr b/#ThirdParty/FreeImage/Wrapper/Delphi/demo/MultiBitmap/MultiBitmap.dpr deleted file mode 100644 index f435c14..0000000 --- a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/MultiBitmap/MultiBitmap.dpr +++ /dev/null @@ -1,13 +0,0 @@ -program MultiBitmap; - -uses - Forms, - mbMainForm in 'mbMainForm.pas' {MainForm}; - -{$R *.res} - -begin - Application.Initialize; - Application.CreateForm(TMainForm, MainForm); - Application.Run; -end. diff --git a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/MultiBitmap/MultiBitmap.res b/#ThirdParty/FreeImage/Wrapper/Delphi/demo/MultiBitmap/MultiBitmap.res deleted file mode 100644 index 1228533..0000000 Binary files a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/MultiBitmap/MultiBitmap.res and /dev/null differ diff --git a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/MultiBitmap/MultiBitmap.stat b/#ThirdParty/FreeImage/Wrapper/Delphi/demo/MultiBitmap/MultiBitmap.stat deleted file mode 100644 index 6e11772..0000000 --- a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/MultiBitmap/MultiBitmap.stat +++ /dev/null @@ -1,10 +0,0 @@ -[Stats] -EditorSecs=82 -DesignerSecs=5 -InspectorSecs=1 -CompileSecs=850 -OtherSecs=5 -StartTime=20.12.2004 11:40:22 -RealKeys=0 -EffectiveKeys=0 -DebugSecs=19 diff --git a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/MultiBitmap/mbMainForm.dfm b/#ThirdParty/FreeImage/Wrapper/Delphi/demo/MultiBitmap/mbMainForm.dfm deleted file mode 100644 index 5029ce7..0000000 --- a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/MultiBitmap/mbMainForm.dfm +++ /dev/null @@ -1,89 +0,0 @@ -object MainForm: TMainForm - Left = 203 - Top = 192 - Width = 696 - Height = 480 - Caption = 'MultiBitmap Demo' - Color = clBtnFace - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'MS Shell Dlg 2' - Font.Style = [] - OldCreateOrder = False - OnPaint = FormPaint - OnResize = FormResize - PixelsPerInch = 96 - TextHeight = 13 - object ToolBar: TToolBar - Left = 0 - Top = 0 - Width = 688 - Height = 25 - AutoSize = True - ButtonHeight = 21 - ButtonWidth = 33 - Caption = 'ToolBar' - EdgeBorders = [ebLeft, ebTop, ebRight, ebBottom] - Flat = True - Indent = 3 - ShowCaptions = True - TabOrder = 0 - object tbLoad: TToolButton - Left = 3 - Top = 0 - Caption = 'Load' - ImageIndex = 0 - OnClick = tbLoadClick - end - object ToolButton1: TToolButton - Left = 36 - Top = 0 - Width = 8 - Caption = 'ToolButton1' - ImageIndex = 1 - Style = tbsSeparator - end - object tbClose: TToolButton - Left = 44 - Top = 0 - Caption = 'Close' - ImageIndex = 1 - OnClick = tbCloseClick - end - object ToolButton2: TToolButton - Left = 77 - Top = 0 - Width = 8 - Caption = 'ToolButton2' - ImageIndex = 2 - Style = tbsSeparator - end - object Label1: TLabel - Left = 85 - Top = 0 - Width = 36 - Height = 21 - Caption = 'Pages: ' - Layout = tlCenter - end - object cbPages: TComboBox - Left = 121 - Top = 0 - Width = 60 - Height = 21 - Style = csDropDownList - DropDownCount = 15 - ItemHeight = 13 - TabOrder = 0 - OnChange = cbPagesChange - end - end - object OD: TOpenDialog - Filter = 'TIFF multibitmap (*.tiff, *.tif)|*.tiff; *.tif|ICO|*.ico' - Options = [ofHideReadOnly, ofPathMustExist, ofFileMustExist, ofEnableSizing] - Title = 'Open multibitmap..' - Left = 64 - Top = 96 - end -end diff --git a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/MultiBitmap/mbMainForm.pas b/#ThirdParty/FreeImage/Wrapper/Delphi/demo/MultiBitmap/mbMainForm.pas deleted file mode 100644 index 07fd997..0000000 --- a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/MultiBitmap/mbMainForm.pas +++ /dev/null @@ -1,150 +0,0 @@ -unit mbMainForm; - -interface - -uses - Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, - Dialogs, ComCtrls, ToolWin, StdCtrls, FreeBitmap; - -type - TMainForm = class(TForm) - ToolBar: TToolBar; - tbLoad: TToolButton; - ToolButton1: TToolButton; - tbClose: TToolButton; - ToolButton2: TToolButton; - cbPages: TComboBox; - Label1: TLabel; - OD: TOpenDialog; - procedure tbLoadClick(Sender: TObject); - procedure FormPaint(Sender: TObject); - procedure tbCloseClick(Sender: TObject); - procedure cbPagesChange(Sender: TObject); - procedure FormResize(Sender: TObject); - private - FMultiBitmap: TFreeMultiBitmap; - FPage: TFreeWinBitmap; - - procedure PageBitmapChangeHandler(Sender: TObject); - procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message WM_ERASEBKGND; - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - - procedure OpenMultiBitmap(const FileName: string); - procedure CloseMultiBitmap; - procedure OpenPage(Number: Integer); - end; - -var - MainForm: TMainForm; - -implementation - -{$R *.dfm} - -{ TMainForm } - -procedure TMainForm.CloseMultiBitmap; -begin - if FPage.IsValid then - FMultiBitmap.UnlockPage(Fpage, False); - FMultiBitmap.Close; - cbPages.Clear; -end; - -constructor TMainForm.Create(AOwner: TComponent); -begin - inherited; - FMultiBitmap := TFreeMultiBitmap.Create; - FPage := TFreeWinBitmap.Create; - FPage.OnChange := PageBitmapChangeHandler; -end; - -destructor TMainForm.Destroy; -begin - if FMultiBitmap.IsValid then - CloseMultiBitmap; - FMultiBitmap.Free; - inherited; -end; - -procedure TMainForm.OpenMultiBitmap(const FileName: string); -var - I, Cnt: Integer; -begin - if FMultiBitmap.IsValid then CloseMultiBitmap; - - FMultiBitmap.Open(FileName, False, True); - - Cnt := FMultiBitmap.GetPageCount; - cbPages.OnChange := nil; - cbPages.Clear; - for I := 0 to Cnt - 1 do - cbPages.Items.Add(IntToStr(I)); - cbPages.OnChange := cbPagesChange; -end; - -procedure TMainForm.OpenPage(Number: Integer); -begin - if not FMultiBitmap.IsValid then Exit; - - if FPage.IsValid then - FMultiBitmap.UnlockPage(FPage, False); - - FMultiBitmap.LockPage(Number, FPage); -end; - -procedure TMainForm.PageBitmapChangeHandler(Sender: TObject); -begin - Invalidate; -end; - -procedure TMainForm.tbLoadClick(Sender: TObject); -begin - if OD.Execute then - begin - try - OpenMultiBitmap(OD.FileName); - except - raise Exception.CreateFmt('Can not load file %s', [OD.FileName]); - end; - end; -end; - -procedure TMainForm.WMEraseBkgnd(var Message: TWMEraseBkgnd); -begin - Message.Result := 1; -end; - -procedure TMainForm.FormPaint(Sender: TObject); -begin - if not FPage.IsValid then - begin - Canvas.Brush.Color := clBtnFace; - Canvas.FillRect(ClientRect); - end - else - FPage.Draw(Canvas.Handle, ClientRect); -end; - -procedure TMainForm.tbCloseClick(Sender: TObject); -begin - if FMultiBitmap.IsValid then - CloseMultiBitmap; -end; - -procedure TMainForm.cbPagesChange(Sender: TObject); -var - Page: Integer; -begin - Page := StrToInt(cbPages.Text); - OpenPage(Page); -end; - -procedure TMainForm.FormResize(Sender: TObject); -begin - Invalidate; -end; - -end. diff --git a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/TargaUnit/Readme.txt b/#ThirdParty/FreeImage/Wrapper/Delphi/demo/TargaUnit/Readme.txt deleted file mode 100644 index 280c6d2..0000000 --- a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/TargaUnit/Readme.txt +++ /dev/null @@ -1,22 +0,0 @@ -TargaImage.pas is a TGraphic descendant for Delphi. Installing it -will allow Delphi TImage and TDBImage components to read Targa files -just like BMP & WMF files with no coding on your part. - -It also adds the TGA file type to the Delphi Open/Save Picture dialog -boxes. - -To install this unit, place it in your one of your library folders -and make it available to all your Delphi projects by using -Component>Install Component from the Delphi menus. - -NOTE: any Delphi applications using this *must* have FreeImage.dll -installed in your application's folder, or somewhere in the path. - ------------------------ - -Tommy -Edinburgh, Scotland -LeTene@battlefieldeurope.org - - - diff --git a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/TargaUnit/TargaImage.pas b/#ThirdParty/FreeImage/Wrapper/Delphi/demo/TargaUnit/TargaImage.pas deleted file mode 100644 index 3badc60..0000000 --- a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/TargaUnit/TargaImage.pas +++ /dev/null @@ -1,212 +0,0 @@ -unit TargaImage; - -// ========================================================== -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// -// ========================================================== - -interface - -uses - Windows, - Classes, - FreeImage, - Graphics, - Types; - -type - TTargaImage = class(TGraphic) - private - fImage: PFIBITMAP; - fWidth: Integer; - fHeight: Integer; - protected - procedure Draw(ACanvas: TCanvas; const ARect: TRect); override; - function GetEmpty: Boolean; override; - function GetHeight: Integer; override; - function GetWidth: Integer; override; - procedure SetHeight(Value: Integer); override; - procedure SetWidth(Value: Integer); override; - public - constructor Create; override; - destructor Destroy; override; - procedure Assign(Source: TPersistent); override; - procedure LoadFromClipboardFormat(AFormat: Word; AData: THandle; APalette: HPALETTE); override; - procedure LoadFromStream(Stream: TStream); override; - procedure SaveToClipboardFormat(var AFormat: Word; var AData: THandle; var APalette: HPALETTE); override; - procedure SaveToStream(Stream: TStream); override; - end; - - procedure Register; - -implementation - -{ Design-time registration } - -procedure Register; -begin - TPicture.RegisterFileFormat('tga', 'TARGA Files', TTargaImage); -end; - -{ IO functions } - -function FI_ReadProc(buffer : pointer; size : Cardinal; count : Cardinal; handle : fi_handle) : UInt; stdcall; -var - stream: TStream; - bytesToRead: Cardinal; -begin - stream := TStream(handle); - bytesToRead := size*count; - Result := stream.Read(buffer^, bytesToRead); -end; - -function FI_WriteProc(buffer : pointer; size, count : Cardinal; handle : fi_handle) : UInt; stdcall; -var - stream: TStream; - bytesToWrite: Cardinal; -begin - stream := TStream(handle); - bytesToWrite := size*count; - Result := stream.Write(buffer^, bytesToWrite); -end; - -function FI_SeekProc(handle : fi_handle; offset : longint; origin : integer) : Integer; stdcall; -begin - TStream(handle).Seek(offset, origin); - Result := 0; -end; - -function FI_TellProc(handle : fi_handle) : LongInt; stdcall; -begin - Result := TStream(handle).Position; -end; - -{ TTargaImage } - -constructor TTargaImage.Create; -begin - fImage := nil; - fWidth := 0; - fHeight := 0; - inherited; -end; - -destructor TTargaImage.Destroy; -begin - if Assigned(fImage) then - FreeImage_Unload(fImage); - inherited; -end; - -procedure TTargaImage.Assign(Source: TPersistent); -begin - if Source is TTargaImage then begin - fImage := FreeImage_Clone(TTargaImage(Source).fImage); - fWidth := FreeImage_GetWidth(fImage); - fHeight := FreeImage_GetHeight(fImage); - Changed(Self); - end else - inherited; -end; - -procedure TTargaImage.Draw(ACanvas: TCanvas; const ARect: TRect); -var - pbi: PBitmapInfo; -begin - if Assigned(fImage) then begin - pbi := FreeImage_GetInfo(fImage); - SetStretchBltMode(ACanvas.Handle, COLORONCOLOR); - StretchDIBits(ACanvas.Handle, ARect.left, ARect.top, - ARect.right-ARect.left, ARect.bottom-ARect.top, - 0, 0, fWidth, fHeight, - FreeImage_GetBits(fImage), pbi^, DIB_RGB_COLORS, SRCCOPY); - end; -end; - -function TTargaImage.GetEmpty: Boolean; -begin - Result := Assigned(fImage); -end; - -function TTargaImage.GetHeight: Integer; -begin - Result := fHeight; -end; - -function TTargaImage.GetWidth: Integer; -begin - Result := fWidth; -end; - -procedure TTargaImage.LoadFromClipboardFormat(AFormat: Word; AData: THandle; APalette: HPALETTE); -begin - if Assigned(fImage) then begin - end; -end; - -procedure TTargaImage.LoadFromStream(Stream: TStream); -var - io: FreeImageIO; -begin - with io do begin - read_proc := FI_ReadProc; - write_proc := FI_WriteProc; - seek_proc := FI_SeekProc; - tell_proc := FI_TellProc; - end; - fImage := FreeImage_LoadFromHandle(FIF_TARGA, @io, Stream); - if Assigned(fImage) then begin - fWidth := FreeImage_GetWidth(fImage); - fHeight := FreeImage_GetHeight(fImage); - end; -end; - -procedure TTargaImage.SaveToClipboardFormat(var AFormat: Word; var AData: THandle; var APalette: HPALETTE); -begin -end; - -procedure TTargaImage.SaveToStream(Stream: TStream); -var - io: FreeImageIO; -begin - with io do begin - read_proc := FI_ReadProc; - write_proc := FI_WriteProc; - seek_proc := FI_SeekProc; - tell_proc := FI_TellProc; - end; - FreeImage_SaveToHandle(FIF_TARGA, fImage, @io, Stream); -end; - -procedure TTargaImage.SetHeight(Value: Integer); -begin - if Assigned(fImage) then begin - fHeight := Value; - FreeImage_Rescale(fImage, fWidth, fHeight, FILTER_BICUBIC); - end; -end; - -procedure TTargaImage.SetWidth(Value: Integer); -begin - if Assigned(fImage) then begin - fWidth := Value; - FreeImage_Rescale(fImage, fWidth, fHeight, FILTER_BICUBIC); - end; -end; - -initialization - TPicture.RegisterFileFormat('tga', 'TARGA Files', TTargaImage); -end. diff --git a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/WinBitmap/MainDemo.dpr b/#ThirdParty/FreeImage/Wrapper/Delphi/demo/WinBitmap/MainDemo.dpr deleted file mode 100644 index b8ffadd..0000000 --- a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/WinBitmap/MainDemo.dpr +++ /dev/null @@ -1,13 +0,0 @@ -program MainDemo; - -uses - Forms, - MainForm in 'MainForm.pas' {fwbMainForm}; - -{$R *.res} - -begin - Application.Initialize; - Application.CreateForm(TfwbMainForm, fwbMainForm); - Application.Run; -end. diff --git a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/WinBitmap/MainDemo.res b/#ThirdParty/FreeImage/Wrapper/Delphi/demo/WinBitmap/MainDemo.res deleted file mode 100644 index 1228533..0000000 Binary files a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/WinBitmap/MainDemo.res and /dev/null differ diff --git a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/WinBitmap/MainForm.dfm b/#ThirdParty/FreeImage/Wrapper/Delphi/demo/WinBitmap/MainForm.dfm deleted file mode 100644 index 46d690b..0000000 --- a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/WinBitmap/MainForm.dfm +++ /dev/null @@ -1,607 +0,0 @@ -object fwbMainForm: TfwbMainForm - Left = 205 - Top = 206 - Width = 696 - Height = 480 - Caption = 'FreeWinBitmap - MainDemo' - Color = clCaptionText - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'Tahoma' - Font.Style = [] - Menu = MainMenu - OldCreateOrder = False - ShowHint = True - OnCreate = FormCreate - OnDestroy = FormDestroy - OnPaint = FormPaint - OnResize = FormResize - PixelsPerInch = 96 - TextHeight = 13 - object StatusBar: TStatusBar - Left = 0 - Top = 411 - Width = 688 - Height = 23 - Panels = < - item - Alignment = taCenter - Width = 120 - end - item - Alignment = taCenter - Width = 80 - end - item - Width = 50 - end> - end - object tbTools: TToolBar - Left = 0 - Top = 0 - Width = 688 - Height = 29 - Caption = 'ToolBar' - Color = clBtnFace - EdgeBorders = [ebTop, ebBottom] - Flat = True - Images = ImageList1 - ParentColor = False - TabOrder = 1 - object ToolButton1: TToolButton - Left = 0 - Top = 0 - Width = 8 - Caption = 'ToolButton1' - ImageIndex = 1 - Style = tbsSeparator - end - object btnOpen: TToolButton - Left = 8 - Top = 0 - Hint = 'Open image file...' - Caption = 'Open...' - ImageIndex = 0 - OnClick = mnuFileOpenClick - end - object ToolButton4: TToolButton - Left = 31 - Top = 0 - Width = 8 - Caption = 'ToolButton4' - ImageIndex = 4 - Style = tbsSeparator - end - object btnCopy: TToolButton - Left = 39 - Top = 0 - Hint = 'Copy to clipboard' - Caption = 'Copy' - ImageIndex = 1 - OnClick = btnCopyClick - end - object btnPaste: TToolButton - Left = 62 - Top = 0 - Hint = 'Paste from from clipboard' - Caption = 'Paste' - ImageIndex = 2 - OnClick = btnPasteClick - end - object ToolButton3: TToolButton - Left = 85 - Top = 0 - Width = 8 - Caption = 'ToolButton3' - ImageIndex = 4 - Style = tbsSeparator - end - object btnClear: TToolButton - Left = 93 - Top = 0 - Caption = 'Clear' - ImageIndex = 3 - OnClick = btnClearClick - end - end - object MainMenu: TMainMenu - Left = 120 - Top = 48 - object mnuFile: TMenuItem - Caption = '&File' - object mnuFileOpen: TMenuItem - Caption = '&Open' - OnClick = mnuFileOpenClick - end - object mnuExit: TMenuItem - Caption = 'E&xit' - OnClick = mnuExitClick - end - end - object mnuImage: TMenuItem - Caption = 'Image' - object mnuImageFlip: TMenuItem - Caption = 'Flip' - object mnuFlipHorz: TMenuItem - Caption = 'Horizontal' - OnClick = mnuFlipHorzClick - end - object mnuFlipVert: TMenuItem - Caption = 'Vertical' - OnClick = mnuFlipHorzClick - end - end - object mnuConvert: TMenuItem - Caption = 'Convert' - object mnuTo4Bits: TMenuItem - Caption = 'To 4 Bits' - OnClick = mnuFlipHorzClick - end - object mnuTo8Bits: TMenuItem - Caption = 'To 8 Bits' - OnClick = mnuFlipHorzClick - end - object mnuTo16Bits555: TMenuItem - Caption = 'To 16 Bits (555)' - OnClick = mnuFlipHorzClick - end - object mnuTo16Bits565: TMenuItem - Caption = 'To 16 Bits (565)' - OnClick = mnuFlipHorzClick - end - object mnuTo24Bits: TMenuItem - Caption = 'To 24 Bits' - OnClick = mnuFlipHorzClick - end - object mnuTo32Bits: TMenuItem - Caption = 'To 32 Bits' - OnClick = mnuFlipHorzClick - end - object mnuDither: TMenuItem - Caption = 'Dither' - OnClick = mnuFlipHorzClick - end - object mnuQuantize: TMenuItem - Caption = 'Quantize' - OnClick = mnuFlipHorzClick - end - object mnuGrayScale: TMenuItem - Caption = 'GrayScale' - OnClick = mnuFlipHorzClick - end - end - object mnuRotate: TMenuItem - Caption = 'Rotate' - object mnuClockwise: TMenuItem - Caption = 'Clockwise' - OnClick = mnuFlipHorzClick - end - object mnuAntiClockwise: TMenuItem - Caption = 'AntiClockwise' - OnClick = mnuFlipHorzClick - end - end - object mnuInvert: TMenuItem - Caption = 'Invert' - OnClick = mnuFlipHorzClick - end - object mnuClear: TMenuItem - Caption = 'Clear' - OnClick = mnuFlipHorzClick - end - end - end - object OD: TOpenDialog - Title = 'Open file ...' - Left = 152 - Top = 48 - end - object ImageList1: TImageList - Left = 184 - Top = 48 - Bitmap = { - 494C010104000900040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 - 0000000000003600000028000000400000003000000001002000000000000030 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000007088900060809000607880005070 - 8000506070004058600040485000303840002030300020203000101820001010 - 1000101020000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000080685000203040002030400020304000203040002030 - 4000203040002030400020304000203040000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000DFE2F700EFF0FB0000000000000000007088900090A0B00070B0D0000090 - D0000090D0000090D0000090C0001088C0001080B0001080B0002078A0002070 - 900020486000B9BEBE0000000000000000000000000000000000000000000000 - 00000000000000000000C0704000B0583000B0583000A0502000A05020009048 - 2000904820009040200080402000000000007086900060809000506070004050 - 6000304050002030400090706000F0E0D000B0A09000B0A09000B0A09000B0A0 - 9000B0A09000B0A09000B0A0900020304000000000000000000000000000EFF1 - FF001F3BF100EFF1FF000000000000000000000000000000000000000000CFD3 - F3001F2DB900CFD2F30000000000000000008088900080C0D00090A8B00080E0 - FF0060D0FF0050C8FF0050C8FF0040C0F00030B0F00030A8F00020A0E0001090 - D00020688000656A700000000000000000000000000000000000000000000000 - 00000000000000000000C0785000FFF8F000D0B0A000D0B0A000D0B0A000C0B0 - A000C0A8A000C0A8900090402000000000007080900020B8F0000090D0000090 - D0000090D0000090D00090786000F0E8E000F0D8D000E0D0C000E0C8C000D0C0 - B000D0B8B000D0B8B000B0A09000203040000000000000000000F0F2FF00576F - FF001030FF001E34FF00EFF1FF00000000000000000000000000DFE2F7003F51 - CF000018C0000F1EB400DFE2F700000000008090A00080D0F00090A8B00090C0 - D00070D8FF0060D0FF0060D0FF0050C8FF0050C0FF0040B8F00030B0F00030A8 - F0001088D00020486000E1E4E500000000000000000000000000000000000000 - 00000000000000000000D0886000FFFFFF00E0906000D0805000D0805000D080 - 5000D0805000C0A8A00090482000000000007088900070C8F00010B8F00010B0 - F00000A8E0000098D000A0807000F0F0F000C0B0A000C0B0A000C0A8A000B0A0 - 9000D0C0B000B0A09000B0A0900020304000000000000000000000000000F1F2 - FF002D52FF001030FF000028FF00CFD5FF0000000000CFD3F3001F34C7000018 - D0000F25C300BFC5EF0000000000000000008090A00080D8F00080C8E00090A8 - B00080E0FF0070D0FF0060D8FF0060D0FF0060D0FF0050C8FF0040C0F00040B8 - F00030B0F000206880007897A50000000000B0A0900060483000604830006048 - 30006048300060483000D0907000FFFFFF00FFFFFF00FFF0F000F0E0D000F0D0 - C000F0C0B000C0B0A00090482000000000008088900070D0F00030C0F00010B8 - F00000A8F00000A0E000A0888000FFF8FF00F0F0F000F0E8E000F0D8D000E0D0 - C000705850006050400050484000404040000000000000000000000000000000 - 0000F1F2FF002D52FF001030FF000F2DFF00CFD3F6001F34D5000020E0000F25 - D200DFE2F7000000000000000000000000008098A00090E0F00090E0FF0090A8 - B00090B8C00070D8FF0060D8FF0060D8FF0060D8FF0060D0FF0050D0FF0050C8 - FF0040B8F00030A0E0004B697800DEE1E400B0A09000FFF0F000F0E0D000E0D8 - D000E0D0C000E0C8C000E0A08000FFFFFF00F0A88000E0987000E0906000D080 - 5000D0805000D0B0A000A0482000000000008090A00080D8F00040C8F00030C0 - F00010B8F00000A0E000B0908000FFFFFF00C0B0A000C0B0A000C0A8A000F0E0 - D00080605000D0C8C00060504000000000000000000000000000000000000000 - 000000000000E3E6FF005669FF001038FF000020F0000F2DF0002F42D800DFE2 - F700000000000000000000000000000000008098A00090E0F000A0E8FF0080C8 - E00090A8B00080E0FF0080E0FF0080E0FF0080E0FF0080E0FF0080E0FF0080E0 - FF0070D8FF0070D8FF0050A8D000919BA500B0A09000FFF8F000E0B08000E0A0 - 7000E0A07000D0987000E0A89000FFFFFF00FFFFFF00FFFFFF00FFF8F000F0E8 - E000F0D0C000D0B0A000A0502000000000008098A00090E0F00060D8F00050C8 - F00030C0F00010B0F000B0989000FFFFFF00FFFFFF00FFF8FF00F0F0F000F0E8 - E000806850008060500000000000000000000000000000000000000000000000 - 00000000000000000000C3CAFF002048FF001030FF000F2DF000CFD3F6000000 - 00000000000000000000000000000000000090A0A000A0E8F000A0E8FF00A0E8 - FF0090B0C00090B0C00090A8B00090A8B00080A0B00080A0B0008098A0008098 - A0008090A0008090A0008088900070889000C0A89000FFFFFF00FFF8F000F0F0 - F000F0E8E000F0E0D000E0B8A000FFFFFF00FFB09000FFB09000F0D8D000E090 - 6000B0583000B0583000A0502000000000008098A000A0E8F00080E0F00070D8 - F00050D0F00010B0F000B0A09000B0989000B0908000A0888000A08070009078 - 6000907060000000000000000000000000000000000000000000000000000000 - 000000000000CFD7FF004060FF003050FF002D4BFF001038FF000020F000DFE3 - FD000000000000000000000000000000000090A0B000A0E8F000A0F0FF00A0E8 - FF00A0E8FF0080D8FF0060D8FF0060D8FF0060D8FF0060D8FF0060D8FF0060D8 - FF0070889000000000000000000000000000C0A8A000FFFFFF00FFC8A000F0B8 - 9000E0B08000E0A07000F0C0A000FFFFFF00FFFFFF00FFFFFF00FFFFFF00F098 - 7000F0C8B000B0583000EBD5CB000000000090A0A000B0F0FF00A0E8FF0090E0 - F00070D0F00010A0D00010A0D00010A0D0001098D0000090D0000090D0000090 - D000303840000000000000000000000000000000000000000000000000000000 - 0000DBE1FF004060FF004058FF004B70FF00CFD5FF004B69FF002040FF000020 - F000CFD5FC0000000000000000000000000090A0B000A0F0F000B0F0F000A0F0 - FF00A0E8FF00A0E8FF0070D8FF0090A0A0008098A0008098A0008090A0008090 - 900070889000000000000000000000000000C0B0A000FFFFFF00FFFFFF00FFF8 - FF00FFF0F000F0E8E000F0C8B000FFFFFF00FFFFFF00FFFFFF00FFFFFF00F0A8 - 8000C0683000EFD9CB00000000000000000090A0B000B0F0FF00A0F0FF006080 - 9000607080005070800050687000506870005060700040587000207090000090 - D00040486000000000000000000000000000000000000000000000000000E7EB - FF005070FF005078FF00708AFF00E7EBFF0000000000DBDFFF004B69FF003048 - FF000020F000CFD5FC00000000000000000090A8B000A0D0E000B0F0F000B0F0 - F000A0F0FF00A0E8FF0090A0B000B3C7CB000000000000000000000000000000 - 000000000000906850009068500090685000D0B8B000FFFFFF00FFD8C000FFD0 - B000F0E0D000B0A09000F0C8B000F0C0B000F0C0B000F0B8A000F0B09000F0B0 - 9000F7E3D70000000000000000000000000090A8B000B0F0FF00B0F0FF006088 - 900090C8D00090E8F00080D8E00060C8E0005098B000405860002080A0000090 - D000505870000000000000000000000000000000000000000000F3F5FF006078 - FF006078FF00697FFF00F3F5FF00000000000000000000000000E7EAFF004B69 - FF003050FF000028FF00DFE3FD0000000000DCE3E60090A8B00090A8B00090A8 - B00090A8B00090A8B000AAB3B400000000000000000000000000000000000000 - 000000000000E1D4D2009068500090685000D0C0B000FFFFFF00FFFFFF00FFFF - FF00FFFFFF00C0A89000D0C8C00090706000E1DCD80000000000000000000000 - 00000000000000000000000000000000000090A8B000B0F0F000B0F0FF00A0F0 - F0007098A000A0F0F00060757C0080C8D000507080003060800060C0F00020B8 - F00050607000000000000000000000000000000000000000000000000000E7EB - FF006987FF00F3F5FF000000000000000000000000000000000000000000E7EA - FF005773FF00E1E5FF0000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000090786000B7A498000000 - 0000F9F6F600A0908000E1D9D20090786000E0C0B000FFFFFF00FFFFFF00FFFF - FF00FFFFFF00C0B0A000A0806000E1DCD8000000000000000000000000000000 - 000000000000000000000000000000000000CED8DC0090A8B00090A8B00090A8 - B0006090A000A0E8F000A0E8F00090D8E0004068700070889000808890007088 - 9000D7DADC000000000000000000000000000000000000000000000000000000 - 0000F3F5FF000000000000000000000000000000000000000000000000000000 - 0000E7EAFF000000000000000000000000000000000000000000000000000000 - 00000000000000000000000000000000000000000000D1CFC900A0908000A088 - 8000B0988000CFC7BF000000000000000000E0C0B000E0C0B000D0C0B000D0C0 - B000D0B8B000D0B0A000E6DEDC00000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 00000000000080B0C00080B0C00080A0B000DEE1E40000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 000000000000000000000000000000000000424D3E000000000000003E000000 - 2800000040000000300000000100010000000000800100000000000000000000 - 000000000000000000000000FFFFFF0000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 00000000000000000000000000000000FFFFFFFFFFFFFFFF0007FFFFFC00FFF3 - 0003FC010000E3E30003FC010000C1C10001FC010000E083000100010000F007 - 000000010001F80F000000010003FC1F000000010007F80F000700010007F007 - 000700030007E08300F800070007C1C101F8007F0007E3E3FF9000FF0007F7F7 - FF8301FFF87FFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000 - 000000000000} - end -end diff --git a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/WinBitmap/MainForm.pas b/#ThirdParty/FreeImage/Wrapper/Delphi/demo/WinBitmap/MainForm.pas deleted file mode 100644 index 41b038b..0000000 --- a/#ThirdParty/FreeImage/Wrapper/Delphi/demo/WinBitmap/MainForm.pas +++ /dev/null @@ -1,227 +0,0 @@ -unit MainForm; - -interface - -uses - Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, - Dialogs, Menus, FreeBitmap, ComCtrls, ImgList, ToolWin; - -type - TfwbMainForm = class(TForm) - MainMenu: TMainMenu; - mnuFile: TMenuItem; - mnuFileOpen: TMenuItem; - mnuExit: TMenuItem; - OD: TOpenDialog; - StatusBar: TStatusBar; - mnuImage: TMenuItem; - mnuImageFlip: TMenuItem; - mnuFlipHorz: TMenuItem; - mnuFlipVert: TMenuItem; - mnuConvert: TMenuItem; - mnuTo8Bits: TMenuItem; - mnuTo16Bits555: TMenuItem; - mnuTo16Bits565: TMenuItem; - mnuTo24Bits: TMenuItem; - mnuTo32Bits: TMenuItem; - mnuDither: TMenuItem; - mnuQuantize: TMenuItem; - mnuGrayScale: TMenuItem; - mnuRotate: TMenuItem; - mnuClockwise: TMenuItem; - mnuAntiClockwise: TMenuItem; - mnuInvert: TMenuItem; - mnuClear: TMenuItem; - mnuTo4Bits: TMenuItem; - tbTools: TToolBar; - btnCopy: TToolButton; - ImageList1: TImageList; - ToolButton1: TToolButton; - btnPaste: TToolButton; - btnClear: TToolButton; - btnOpen: TToolButton; - ToolButton3: TToolButton; - ToolButton4: TToolButton; - procedure FormDestroy(Sender: TObject); - procedure FormPaint(Sender: TObject); - procedure FormCreate(Sender: TObject); - procedure mnuExitClick(Sender: TObject); - procedure mnuFileOpenClick(Sender: TObject); - procedure FormResize(Sender: TObject); - procedure mnuFlipHorzClick(Sender: TObject); - procedure btnCopyClick(Sender: TObject); - procedure btnClearClick(Sender: TObject); - procedure btnPasteClick(Sender: TObject); - private - FBitmap: TFreeWinBitmap; - procedure WMEraseBkgnd(var Message: TMessage); message WM_ERASEBKGND; - public - { Public declarations } - end; - -var - fwbMainForm: TfwbMainForm; - -implementation - -{$R *.dfm} - -uses - FreeUtils, FreeImage, Math; - -procedure TfwbMainForm.FormDestroy(Sender: TObject); -begin - if Assigned(FBitmap) then - FBitmap.Free; -end; - -procedure TfwbMainForm.FormPaint(Sender: TObject); -var - dx, dy, w, h: Integer; - r1, r2: Double; - R: TRect; -begin - if FBitmap.IsValid then // draw the bitmap - begin - // determine paint rect - r1 := FBitmap.GetWidth / FBitmap.GetHeight; - r2 := ClientWidth / ClientHeight; - if r1 > r2 then // fit by width - begin - w := ClientWidth; - h := Floor(w / r1); - dx := 0; - dy := (ClientHeight - h) div 2; - end - else // fit by height - begin - h := ClientHeight; - w := Floor(h * r1); - dy := 0; - dx := (ClientWidth - w) div 2; - end; - with ClientRect do - R := Bounds(Left + dx, Top + dy, w, h); - FBitmap.Draw(Canvas.Handle, R); - - // erase area around the image - Canvas.Brush.Color := Color; - if dx > 0 then - begin - with ClientRect do - R := Bounds(Left, Top, dx, ClientHeight); - Canvas.FillRect(R); - with ClientRect do - R := Bounds(Right - dx, Top, dx, ClientHeight); - Canvas.FillRect(R); - end else - if dy > 0 then - begin - with ClientRect do - R := Bounds(Left, Top, ClientWidth, dy); - Canvas.FillRect(R); - with ClientRect do - R := Bounds(Left, Bottom - dy, ClientWidth, dy); - Canvas.FillRect(R); - end - end - else // clear - begin - Canvas.Brush.Color := Color; - Canvas.FillRect(ClientRect); - end -end; - -procedure TfwbMainForm.FormCreate(Sender: TObject); -begin - FBitmap := TFreeWinBitmap.Create; - - mnuImage.Enabled := FBitmap.IsValid; - OD.Filter := FIU_GetAllFilters; -end; - -procedure TfwbMainForm.mnuExitClick(Sender: TObject); -begin - Close; -end; - -procedure TfwbMainForm.mnuFileOpenClick(Sender: TObject); -var - t: Cardinal; -begin - if OD.Execute then - begin - t := GetTickCount; - FBitmap.Load(OD.FileName); - t := GetTickCount - t; - mnuImage.Enabled := FBitmap.IsValid; - StatusBar.Panels[0].Text := 'Loaded in ' + IntToStr(t) + ' msec.'; - StatusBar.Panels[1].Text := Format('%dx%d', [FBitmap.GetWidth, FBitmap.GetHeight]); - Invalidate; - end; -end; - -procedure TfwbMainForm.FormResize(Sender: TObject); -begin - Invalidate -end; - -procedure TfwbMainForm.WMEraseBkgnd(var Message: TMessage); -begin - Message.Result := 1; -end; - -procedure TfwbMainForm.mnuFlipHorzClick(Sender: TObject); -begin - with FBitmap do - if Sender = mnuFlipHorz then - FLipHorizontal else - if Sender = mnuFlipVert then - FlipVertical else - if Sender = mnuTo4Bits then - ConvertTo4Bits else - if Sender = mnuTo8Bits then - ConvertTo8Bits else - if Sender = mnuTo16Bits555 then - ConvertTo16Bits555 else - if Sender = mnuTo16Bits565 then - ConvertTo16Bits565 else - if Sender = mnuTo24Bits then - ConvertTo24Bits else - if Sender = mnuTo32Bits then - ConvertTo32Bits else - if Sender = mnuDither then - Dither(FID_FS) else - if Sender = mnuQuantize then - ColorQuantize(FIQ_WUQUANT) else - if Sender = mnuGrayScale then - ConvertToGrayscale else - if Sender = mnuClockwise then - Rotate(-90) else - if Sender = mnuAntiClockwise then - Rotate(90) else - if Sender = mnuInvert then - Invert else - if Sender = mnuClear then - Clear; - Invalidate; -end; - -procedure TfwbMainForm.btnCopyClick(Sender: TObject); -begin - if FBitmap.IsValid then FBitmap.CopyToClipBoard(Handle); -end; - -procedure TfwbMainForm.btnClearClick(Sender: TObject); -begin - FBitmap.Clear; - Invalidate; -end; - -procedure TfwbMainForm.btnPasteClick(Sender: TObject); -begin - FBitmap.PasteFromClipBoard; - Invalidate; -end; - -end. diff --git a/#ThirdParty/FreeImage/Wrapper/Delphi/license.txt b/#ThirdParty/FreeImage/Wrapper/Delphi/license.txt deleted file mode 100644 index a930004..0000000 --- a/#ThirdParty/FreeImage/Wrapper/Delphi/license.txt +++ /dev/null @@ -1,3 +0,0 @@ -The contents of FreeImageDW package are subject to the FreeImage Public License Version 1.0 (the "License"); you may not use this package except in compliance with the License. You may obtain a copy of the License at http://home.wxs.nl/~flvdberg/freeimage-license.txt - -Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/Delphi/src/FreeBitmap.pas b/#ThirdParty/FreeImage/Wrapper/Delphi/src/FreeBitmap.pas deleted file mode 100644 index 582e2ae..0000000 --- a/#ThirdParty/FreeImage/Wrapper/Delphi/src/FreeBitmap.pas +++ /dev/null @@ -1,2187 +0,0 @@ -unit FreeBitmap; - -// ========================================================== -// -// Delphi wrapper for FreeImage 3 -// -// Design and implementation by -// - Anatoliy Pulyaevskiy (xvel84@rambler.ru) -// -// Contributors: -// - Enzo Costantini (enzocostantini@libero.it) -// - Lorenzo Monti (LM) lomo74@gmail.com -// - Maurício (MAU) mauricio_box@yahoo.com - see also http://sourceforge.net/projects/tcycomponents/ -// -// Revision history -// When Who What -// ----------- ----- ----------------------------------------------------------- -// 2010-07-14 LM made RAD2010 compliant (unicode) -// 2011-03-04 JMB modifications to run on 64 bits (Windows and linux) : -// - FreeImage_RotateClassic : deprecated function, call to DeprecationManager in 64 bits crashes freeimage.dll -// ==> FreeImage_RotateClassic : replaced by FreeImage_Rotate -// modifications to run on linux : -// - exclude windows specific functions by compilation directives -// some corrections in : -// - TFreeBitmap.DoChanging -// - TFreeBitmap.IsGrayScale -// - TFreeWinBitmap.CopyFromBitmap -// - TFreeMultiBitmap.Open -// 2013-11-25 MAU Added type FreeImageAnsiString for handling accents on MAC OSX filenames/path - -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// -// ========================================================== -// -// From begining all code of this file is based on C++ wrapper to -// FreeImage - FreeImagePlus. -// -// ========================================================== - -interface - -{$I 'Version.inc'} - -uses - SysUtils, Classes, -{$IFDEF MSWINDOWS} - Windows, -{$ENDIF} - FreeImage; - -type - { TFreeObject } - - TFreeObject = class(TObject) - public - function IsValid: Boolean; virtual; - end; - - { TFreeTag } - - TFreeTag = class(TFreeObject) - private - // fields - FTag: PFITAG; - - // getters & setters - function GetCount: Cardinal; - function GetDescription: AnsiString; - function GetID: Word; - function GetKey: AnsiString; - function GetLength: Cardinal; - function GetTagType: FREE_IMAGE_MDTYPE; - function GetValue: Pointer; - procedure SetCount(const Value: Cardinal); - procedure SetDescription(const Value: AnsiString); - procedure SetID(const Value: Word); - procedure SetKey(const Value: AnsiString); - procedure SetLength(const Value: Cardinal); - procedure SetTagType(const Value: FREE_IMAGE_MDTYPE); - procedure SetValue(const Value: Pointer); - public - // construction & destruction - constructor Create(ATag: PFITAG = nil); virtual; - destructor Destroy; override; - - // methods - function Clone: TFreeTag; - function IsValid: Boolean; override; - function ToString(Model: FREE_IMAGE_MDMODEL; Make: PAnsiChar = nil): AnsiString; reintroduce; - - // properties - property Key: AnsiString read GetKey write SetKey; - property Description: AnsiString read GetDescription write SetDescription; - property ID: Word read GetID write SetID; - property TagType: FREE_IMAGE_MDTYPE read GetTagType write SetTagType; - property Count: Cardinal read GetCount write SetCount; - property Length: Cardinal read GetLength write SetLength; - property Value: Pointer read GetValue write SetValue; - property Tag: PFITAG read FTag; - end; - - { forward declarations } - - TFreeBitmap = class; - TFreeMemoryIO = class; - - { TFreeBitmap } - - TFreeBitmapChangingEvent = procedure(Sender: TFreeBitmap; var OldDib, NewDib: PFIBITMAP; var Handled: Boolean) of object; - - TFreeBitmap = class(TFreeObject) - private - // fields - FDib: PFIBITMAP; - FOnChange: TNotifyEvent; - FOnChanging: TFreeBitmapChangingEvent; - - procedure SetDib(Value: PFIBITMAP); - protected - function DoChanging(var OldDib, NewDib: PFIBITMAP): Boolean; dynamic; - function Replace(NewDib: PFIBITMAP): Boolean; dynamic; - public - constructor Create(ImageType: FREE_IMAGE_TYPE = FIT_BITMAP; Width: Integer = 0; Height: Integer = 0; Bpp: Integer = 0); - destructor Destroy; override; - function SetSize(ImageType: FREE_IMAGE_TYPE; Width, Height, Bpp: Integer; RedMask: Cardinal = 0; GreenMask: Cardinal = 0; BlueMask: Cardinal = 0): Boolean; - procedure Change; dynamic; - procedure Assign(Source: TFreeBitmap); - function CopySubImage(Left, Top, Right, Bottom: Integer; Dest: TFreeBitmap): Boolean; - function PasteSubImage(Src: TFreeBitmap; Left, Top: Integer; Alpha: Integer = 256): Boolean; - procedure Clear; virtual; - function Load(const FileName: FreeImageAnsiString; Flag: Integer = 0): Boolean; - function LoadU(const FileName: {$IFDEF DELPHI2010}string{$ELSE}WideString{$ENDIF}; Flag: Integer = 0): Boolean; - function LoadFromHandle(IO: PFreeImageIO; Handle: fi_handle; Flag: Integer = 0): Boolean; - function LoadFromMemory(MemIO: TFreeMemoryIO; Flag: Integer = 0): Boolean; - function LoadFromStream(Stream: TStream; Flag: Integer = 0): Boolean; - // save functions - function CanSave(fif: FREE_IMAGE_FORMAT): Boolean; - function Save(const FileName: FreeImageAnsiString; Flag: Integer = 0): Boolean; - function SaveU(const FileName: {$IFDEF DELPHI2010}string{$ELSE}WideString{$ENDIF}; Flag: Integer = 0): Boolean; - function SaveToHandle(fif: FREE_IMAGE_FORMAT; IO: PFreeImageIO; Handle: fi_handle; Flag: Integer = 0): Boolean; - function SaveToMemory(fif: FREE_IMAGE_FORMAT; MemIO: TFreeMemoryIO; Flag: Integer = 0): Boolean; - function SaveToStream(fif: FREE_IMAGE_FORMAT; Stream: TStream; Flag: Integer = 0): Boolean; - // image information - function GetImageType: FREE_IMAGE_TYPE; - function GetWidth: Integer; - function GetHeight: Integer; - function GetScanWidth: Integer; - function IsValid: Boolean; override; - function GetInfo: PBitmapInfo; - function GetInfoHeader: PBitmapInfoHeader; - function GetImageSize: Cardinal; - function GetBitsPerPixel: Integer; - function GetLine: Integer; - function GetHorizontalResolution: Double; - function GetVerticalResolution: Double; - procedure SetHorizontalResolution(Value: Double); - procedure SetVerticalResolution(Value: Double); - // palette operations - function GetPalette: PRGBQUAD; - function GetPaletteSize: Integer; - function GetColorsUsed: Integer; - function GetColorType: FREE_IMAGE_COLOR_TYPE; - function IsGrayScale: Boolean; - // pixels access - function AccessPixels: PByte; - function GetScanLine(ScanLine: Integer): PByte; - function GetPixelIndex(X, Y: Cardinal; var Value: Byte): Boolean; - function GetPixelColor(X, Y: Cardinal; var Value: RGBQUAD): Boolean; - function SetPixelIndex(X, Y: Cardinal; var Value: Byte): Boolean; - function SetPixelColor(X, Y: Cardinal; var Value: RGBQUAD): Boolean; - // convertion - function ConvertToStandardType(ScaleLinear: Boolean): Boolean; - function ConvertToType(ImageType: FREE_IMAGE_TYPE; ScaleLinear: Boolean): Boolean; - function Threshold(T: Byte): Boolean; - function ConvertTo4Bits: Boolean; - function ConvertTo8Bits: Boolean; - function ConvertTo16Bits555: Boolean; - function ConvertTo16Bits565: Boolean; - function ConvertTo24Bits: Boolean; - function ConvertTo32Bits: Boolean; - function ConvertToGrayscale: Boolean; - function ColorQuantize(Algorithm: FREE_IMAGE_QUANTIZE): Boolean; - function Dither(Algorithm: FREE_IMAGE_DITHER): Boolean; - function ConvertToRGBF: Boolean; - function ToneMapping(TMO: FREE_IMAGE_TMO; FirstParam, SecondParam: Double): Boolean; - // transparency - function IsTransparent: Boolean; - function GetTransparencyCount: Cardinal; - function GetTransparencyTable: PByte; - procedure SetTransparencyTable(Table: PByte; Count: Integer); - function HasFileBkColor: Boolean; - function GetFileBkColor(var BkColor: RGBQUAD): Boolean; - function SetFileBkColor(BkColor: PRGBQuad): Boolean; - // channel processing routines - function GetChannel(Bitmap: TFreeBitmap; Channel: FREE_IMAGE_COLOR_CHANNEL): Boolean; - function SetChannel(Bitmap: TFreeBitmap; Channel: FREE_IMAGE_COLOR_CHANNEL): Boolean; - function SplitChannels(RedChannel, GreenChannel, BlueChannel: TFreeBitmap): Boolean; - function CombineChannels(Red, Green, Blue: TFreeBitmap): Boolean; - // rotation and flipping - function RotateEx(Angle, XShift, YShift, XOrigin, YOrigin: Double; UseMask: Boolean): Boolean; - function Rotate(Angle: Double): Boolean; - function FlipHorizontal: Boolean; - function FlipVertical: Boolean; - // color manipulation routines - function Invert: Boolean; - function AdjustCurve(Lut: PByte; Channel: FREE_IMAGE_COLOR_CHANNEL): Boolean; - function AdjustGamma(Gamma: Double): Boolean; - function AdjustBrightness(Percentage: Double): Boolean; - function AdjustContrast(Percentage: Double): Boolean; - function GetHistogram(Histo: PDWORD; Channel: FREE_IMAGE_COLOR_CHANNEL = FICC_BLACK): Boolean; - // upsampling / downsampling - procedure MakeThumbnail(const Width, Height: Integer; DestBitmap: TFreeBitmap); - function Rescale(NewWidth, NewHeight: Integer; Filter: FREE_IMAGE_FILTER; Dest: TFreeBitmap = nil): Boolean; - // metadata routines - function FindFirstMetadata(Model: FREE_IMAGE_MDMODEL; var Tag: TFreeTag): PFIMETADATA; - function FindNextMetadata(MDHandle: PFIMETADATA; var Tag: TFreeTag): Boolean; - procedure FindCloseMetadata(MDHandle: PFIMETADATA); - function SetMetadata(Model: FREE_IMAGE_MDMODEL; const Key: AnsiString; Tag: TFreeTag): Boolean; - function GetMetadata(Model: FREE_IMAGE_MDMODEL; const Key: AnsiString; var Tag: TFreeTag): Boolean; - function GetMetadataCount(Model: FREE_IMAGE_MDMODEL): Cardinal; - - // properties - property Dib: PFIBITMAP read FDib write SetDib; - property OnChange: TNotifyEvent read FOnChange write FOnChange; - property OnChanging: TFreeBitmapChangingEvent read FOnChanging write FOnChanging; - end; - - { TFreeWinBitmap } - - TFreeWinBitmap = class(TFreeBitmap) - private - FDeleteMe: Boolean; // True - need to delete FDisplayDib - FDisplayDib: PFIBITMAP; // Image that paints on DC - public - constructor Create(ImageType: FREE_IMAGE_TYPE = FIT_BITMAP; Width: Integer = 0; Height: Integer = 0; Bpp: Integer = 0); - destructor Destroy; override; - - procedure Clear; override; -{$IFDEF MSWINDOWS} - function CopyToHandle: THandle; - function CopyFromHandle(HMem: THandle): Boolean; - function CopyFromBitmap(HBmp: HBITMAP): Boolean; - function CopyToBitmapH: HBITMAP; - function CopyToClipBoard(NewOwner: HWND): Boolean; - function PasteFromClipBoard: Boolean; - function CaptureWindow(ApplicationWindow, SelectedWindow: HWND): Boolean; - - procedure Draw(DC: HDC; Rect: TRect); - procedure DrawEx(DC: HDC; Rect: TRect; UseFileBkg: Boolean = False; AppBkColor: PRGBQuad = nil; Bg: PFIBITMAP = nil); -{$ENDIF} - end; - - { TFreeMemoryIO } - - TFreeMemoryIO = class(TFreeObject) - private - FHMem: PFIMEMORY; - public - // construction and destruction - constructor Create(Data: PByte = nil; SizeInBytes: DWORD = 0); - destructor Destroy; override; - - function GetFileType: FREE_IMAGE_FORMAT; - function Read(fif: FREE_IMAGE_FORMAT; Flag: Integer = 0): PFIBITMAP; - function Write(fif: FREE_IMAGE_FORMAT; dib: PFIBITMAP; Flag: Integer = 0): Boolean; - function Tell: Longint; - function Seek(Offset: Longint; Origin: Word): Boolean; - function Acquire(var Data: PByte; var SizeInBytes: DWORD): Boolean; - // overriden methods - function IsValid: Boolean; override; - end; - - { TFreeMultiBitmap } - - TFreeMultiBitmap = class(TFreeObject) - private - FMPage: PFIMULTIBITMAP; - FMemoryCache: Boolean; - public - // constructor and destructor - constructor Create(KeepCacheInMemory: Boolean = False); - destructor Destroy; override; - - // methods - function Open(const FileName: FreeImageAnsiString; CreateNew, ReadOnly: Boolean; Flags: Integer = 0): Boolean; - function Close(Flags: Integer = 0): Boolean; - function GetPageCount: Integer; - procedure AppendPage(Bitmap: TFreeBitmap); - procedure InsertPage(Page: Integer; Bitmap: TFreeBitmap); - procedure DeletePage(Page: Integer); - function MovePage(Target, Source: Integer): Boolean; - procedure LockPage(Page: Integer; DestBitmap: TFreeBitmap); - procedure UnlockPage(Bitmap: TFreeBitmap; Changed: Boolean); - function GetLockedPageNumbers(var Pages: Integer; var Count: Integer): Boolean; - // overriden methods - function IsValid: Boolean; override; - - // properties - // change of this property influences only on the next opening of a file - property MemoryCache: Boolean read FMemoryCache write FMemoryCache; - end; - -implementation - -const - ThumbSize = 150; - -// marker used for clipboard copy / paste - -procedure SetFreeImageMarker(bmih: PBitmapInfoHeader; dib: PFIBITMAP); -begin - // Windows constants goes from 0L to 5L - // Add $FF to avoid conflicts - bmih.biCompression := $FF + FreeImage_GetImageType(dib); -end; - -function GetFreeImageMarker(bmih: PBitmapInfoHeader): FREE_IMAGE_TYPE; -begin - Result := FREE_IMAGE_TYPE(bmih.biCompression - $FF); -end; - -{ TFreePersistent } - -function TFreeObject.IsValid: Boolean; -begin - Result := False -end; - -{ TFreeBitmap } - -function TFreeBitmap.AccessPixels: PByte; -begin - Result := FreeImage_GetBits(FDib) -end; - -function TFreeBitmap.AdjustBrightness(Percentage: Double): Boolean; -begin - if FDib <> nil then - begin - Result := FreeImage_AdjustBrightness(FDib, Percentage); - Change; - end - else - Result := False -end; - -function TFreeBitmap.AdjustContrast(Percentage: Double): Boolean; -begin - if FDib <> nil then - begin - Result := FreeImage_AdjustContrast(FDib, Percentage); - Change; - end - else - Result := False -end; - -function TFreeBitmap.AdjustCurve(Lut: PByte; - Channel: FREE_IMAGE_COLOR_CHANNEL): Boolean; -begin - if FDib <> nil then - begin - Result := FreeImage_AdjustCurve(FDib, Lut, Channel); - Change; - end - else - Result := False -end; - -function TFreeBitmap.AdjustGamma(Gamma: Double): Boolean; -begin - if FDib <> nil then - begin - Result := FreeImage_AdjustGamma(FDib, Gamma); - Change; - end - else - Result := False -end; - -procedure TFreeBitmap.Assign(Source: TFreeBitmap); -var - SourceBmp: TFreeBitmap; - Clone: PFIBITMAP; -begin - if Source = nil then - begin - Clear; - Exit; - end; - - if Source is TFreeBitmap then - begin - SourceBmp := TFreeBitmap(Source); - if SourceBmp <> Self then - begin - if SourceBmp.IsValid then - begin - Clone := FreeImage_Clone(SourceBmp.FDib); - Replace(Clone); - end - else - Clear; - end; - end; -end; - -function TFreeBitmap.CanSave(fif: FREE_IMAGE_FORMAT): Boolean; -var - ImageType: FREE_IMAGE_TYPE; - Bpp: Word; -begin - Result := False; - if not IsValid then Exit; - - if fif <> FIF_UNKNOWN then - begin - // check that the dib can be saved in this format - ImageType := FreeImage_GetImageType(FDib); - if ImageType = FIT_BITMAP then - begin - // standard bitmap type - Bpp := FreeImage_GetBPP(FDib); - Result := FreeImage_FIFSupportsWriting(fif) - and FreeImage_FIFSupportsExportBPP(fif, Bpp); - end - else // special bitmap type - Result := FreeImage_FIFSupportsExportType(fif, ImageType); - end; -end; - -procedure TFreeBitmap.Change; -begin - if Assigned(FOnChange) then FOnChange(Self) -end; - -procedure TFreeBitmap.Clear; -begin - if FDib <> nil then - begin - FreeImage_Unload(FDib); - FDib := nil; - Change; - end; -end; - -function TFreeBitmap.ColorQuantize( - Algorithm: FREE_IMAGE_QUANTIZE): Boolean; -var - dib8: PFIBITMAP; -begin - if FDib <> nil then - begin - dib8 := FreeImage_ColorQuantize(FDib, Algorithm); - Result := Replace(dib8); - end - else - Result := False; -end; - -function TFreeBitmap.CombineChannels(Red, Green, - Blue: TFreeBitmap): Boolean; -var - Width, Height: Integer; -begin - if FDib = nil then - begin - Width := Red.GetWidth; - Height := Red.GetHeight; - FDib := FreeImage_Allocate(Width, Height, 24, FI_RGBA_RED_MASK, - FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK); - end; - - if FDib <> nil then - begin - Result := FreeImage_SetChannel(FDib, Red.FDib, FICC_RED) and - FreeImage_SetChannel(FDib, Green.FDib, FICC_GREEN) and - FreeImage_SetChannel(FDib, Blue.FDib, FICC_BLUE); - - Change - end - else - Result := False; -end; - -function TFreeBitmap.ConvertTo16Bits555: Boolean; -var - dib16_555: PFIBITMAP; -begin - if FDib <> nil then - begin - dib16_555 := FreeImage_ConvertTo16Bits555(FDib); - Result := Replace(dib16_555); - end - else - Result := False -end; - -function TFreeBitmap.ConvertTo16Bits565: Boolean; -var - dib16_565: PFIBITMAP; -begin - if FDib <> nil then - begin - dib16_565 := FreeImage_ConvertTo16Bits565(FDib); - Result := Replace(dib16_565); - end - else - Result := False -end; - -function TFreeBitmap.ConvertTo24Bits: Boolean; -var - dibRGB: PFIBITMAP; -begin - if FDib <> nil then - begin - dibRGB := FreeImage_ConvertTo24Bits(FDib); - Result := Replace(dibRGB); - end - else - Result := False -end; - -function TFreeBitmap.ConvertTo32Bits: Boolean; -var - dib32: PFIBITMAP; -begin - if FDib <> nil then - begin - dib32 := FreeImage_ConvertTo32Bits(FDib); - Result := Replace(dib32); - end - else - Result := False -end; - -function TFreeBitmap.ConvertTo4Bits: Boolean; -var - dib4: PFIBITMAP; -begin - Result := False; - if IsValid then - begin - dib4 := FreeImage_ConvertTo4Bits(FDib); - Result := Replace(dib4); - end; -end; - -function TFreeBitmap.ConvertTo8Bits: Boolean; -var - dib8: PFIBITMAP; -begin - if FDib <> nil then - begin - dib8 := FreeImage_ConvertTo8Bits(FDib); - Result := Replace(dib8); - end - else - Result := False -end; - -function TFreeBitmap.ConvertToGrayscale: Boolean; -var - dib8: PFIBITMAP; -begin - Result := False; - - if IsValid then - begin - dib8 := FreeImage_ConvertToGreyscale(FDib); - Result := Replace(dib8); - end -end; - -function TFreeBitmap.ConvertToRGBF: Boolean; -var - ImageType: FREE_IMAGE_TYPE; - NewDib: PFIBITMAP; -begin - Result := False; - if not IsValid then Exit; - - ImageType := GetImageType; - - if (ImageType = FIT_BITMAP) then - begin - if GetBitsPerPixel < 24 then - if not ConvertTo24Bits then - Exit - end; - NewDib := FreeImage_ConvertToRGBF(FDib); - Result := Replace(NewDib); -end; - -function TFreeBitmap.ConvertToStandardType(ScaleLinear: Boolean): Boolean; -var - dibStandard: PFIBITMAP; -begin - if IsValid then - begin - dibStandard := FreeImage_ConvertToStandardType(FDib, ScaleLinear); - Result := Replace(dibStandard); - end - else - Result := False; -end; - -function TFreeBitmap.ConvertToType(ImageType: FREE_IMAGE_TYPE; - ScaleLinear: Boolean): Boolean; -var - dib: PFIBITMAP; -begin - if FDib <> nil then - begin - dib := FreeImage_ConvertToType(FDib, ImageType, ScaleLinear); - Result := Replace(dib) - end - else - Result := False -end; - -function TFreeBitmap.CopySubImage(Left, Top, Right, Bottom: Integer; - Dest: TFreeBitmap): Boolean; -begin - if FDib <> nil then - begin - Dest.FDib := FreeImage_Copy(FDib, Left, Top, Right, Bottom); - Result := Dest.IsValid; - end else - Result := False; -end; - -constructor TFreeBitmap.Create(ImageType: FREE_IMAGE_TYPE; Width, Height, - Bpp: Integer); -begin - inherited Create; - - FDib := nil; - if (Width > 0) and (Height > 0) and (Bpp > 0) then - SetSize(ImageType, Width, Height, Bpp); -end; - -destructor TFreeBitmap.Destroy; -begin - if FDib <> nil then - FreeImage_Unload(FDib); - inherited; -end; - -function TFreeBitmap.Dither(Algorithm: FREE_IMAGE_DITHER): Boolean; -var - dib: PFIBITMAP; -begin - if FDib <> nil then - begin - dib := FreeImage_Dither(FDib, Algorithm); - Result := Replace(dib); - end - else - Result := False; -end; - -function TFreeBitmap.DoChanging(var OldDib, NewDib: PFIBITMAP): Boolean; -begin - Result := False; - if (OldDib <> NewDib) and Assigned(FOnChanging) then - FOnChanging(Self, OldDib, NewDib, Result); -end; - -procedure TFreeBitmap.FindCloseMetadata(MDHandle: PFIMETADATA); -begin - FreeImage_FindCloseMetadata(MDHandle); -end; - -function TFreeBitmap.FindFirstMetadata(Model: FREE_IMAGE_MDMODEL; - var Tag: TFreeTag): PFIMETADATA; -begin - Result := FreeImage_FindFirstMetadata(Model, FDib, Tag.FTag); -end; - -function TFreeBitmap.FindNextMetadata(MDHandle: PFIMETADATA; - var Tag: TFreeTag): Boolean; -begin - Result := FreeImage_FindNextMetadata(MDHandle, Tag.FTag); -end; - -function TFreeBitmap.FlipHorizontal: Boolean; -begin - if FDib <> nil then - begin - Result := FreeImage_FlipHorizontal(FDib); - Change; - end - else - Result := False -end; - -function TFreeBitmap.FlipVertical: Boolean; -begin - if FDib <> nil then - begin - Result := FreeImage_FlipVertical(FDib); - Change; - end - else - Result := False -end; - -function TFreeBitmap.GetBitsPerPixel: Integer; -begin - Result := FreeImage_GetBPP(FDib) -end; - -function TFreeBitmap.GetChannel(Bitmap: TFreeBitmap; - Channel: FREE_IMAGE_COLOR_CHANNEL): Boolean; -begin - if FDib <> nil then - begin - Bitmap.Dib := FreeImage_GetChannel(FDib, Channel); - Result := Bitmap.IsValid; - end - else - Result := False -end; - -function TFreeBitmap.GetColorsUsed: Integer; -begin - Result := FreeImage_GetColorsUsed(FDib) -end; - -function TFreeBitmap.GetColorType: FREE_IMAGE_COLOR_TYPE; -begin - Result := FreeImage_GetColorType(FDib); -end; - -function TFreeBitmap.GetFileBkColor(var BkColor: RGBQUAD): Boolean; -begin - Result := FreeImage_GetBackgroundColor(FDib, BkColor); -end; - -function TFreeBitmap.GetHeight: Integer; -begin - Result := FreeImage_GetHeight(FDib) -end; - -function TFreeBitmap.GetHistogram(Histo: PDWORD; - Channel: FREE_IMAGE_COLOR_CHANNEL): Boolean; -begin - if FDib <> nil then - Result := FreeImage_GetHistogram(FDib, Histo, Channel) - else - Result := False -end; - -function TFreeBitmap.GetHorizontalResolution: Double; -begin - Result := FreeImage_GetDotsPerMeterX(FDib) / 100 -end; - -function TFreeBitmap.GetImageSize: Cardinal; -begin - Result := FreeImage_GetDIBSize(FDib); -end; - -function TFreeBitmap.GetImageType: FREE_IMAGE_TYPE; -begin - Result := FreeImage_GetImageType(FDib); -end; - -function TFreeBitmap.GetInfo: PBitmapInfo; -begin - Result := FreeImage_GetInfo(FDib); -end; - -function TFreeBitmap.GetInfoHeader: PBITMAPINFOHEADER; -begin - Result := FreeImage_GetInfoHeader(FDib) -end; - -function TFreeBitmap.GetLine: Integer; -begin - Result := FreeImage_GetLine(FDib) -end; - -function TFreeBitmap.GetMetadata(Model: FREE_IMAGE_MDMODEL; - const Key: AnsiString; var Tag: TFreeTag): Boolean; -begin - Result := FreeImage_GetMetadata(Model, FDib, PAnsiChar(Key), Tag.FTag); -end; - -function TFreeBitmap.GetMetadataCount(Model: FREE_IMAGE_MDMODEL): Cardinal; -begin - Result := FreeImage_GetMetadataCount(Model, FDib); -end; - -function TFreeBitmap.GetPalette: PRGBQUAD; -begin - Result := FreeImage_GetPalette(FDib) -end; - -function TFreeBitmap.GetPaletteSize: Integer; -begin - Result := FreeImage_GetColorsUsed(FDib) * SizeOf(RGBQUAD) -end; - -function TFreeBitmap.GetPixelColor(X, Y: Cardinal; - var Value: RGBQUAD): Boolean; -begin - Result := FreeImage_GetPixelColor(FDib, X, Y, Value); -end; - -function TFreeBitmap.GetPixelIndex(X, Y: Cardinal; - var Value: Byte): Boolean; -begin - Result := FreeImage_GetPixelIndex(FDib, X, Y, Value); -end; - -function TFreeBitmap.GetScanLine(ScanLine: Integer): PByte; -var - H: Integer; -begin - H := FreeImage_GetHeight(FDib); - if ScanLine < H then - Result := FreeImage_GetScanLine(FDib, ScanLine) - else - Result := nil; -end; - -function TFreeBitmap.GetScanWidth: Integer; -begin - Result := FreeImage_GetPitch(FDib) -end; - -function TFreeBitmap.GetTransparencyCount: Cardinal; -begin - Result := FreeImage_GetTransparencyCount(FDib) -end; - -function TFreeBitmap.GetTransparencyTable: PByte; -begin - Result := FreeImage_GetTransparencyTable(FDib) -end; - -function TFreeBitmap.GetVerticalResolution: Double; -begin - Result := FreeImage_GetDotsPerMeterY(Fdib) / 100 -end; - -function TFreeBitmap.GetWidth: Integer; -begin - Result := FreeImage_GetWidth(FDib) -end; - -function TFreeBitmap.HasFileBkColor: Boolean; -begin - Result := FreeImage_HasBackgroundColor(FDib) -end; - -function TFreeBitmap.Invert: Boolean; -begin - if FDib <> nil then - begin - Result := FreeImage_Invert(FDib); - Change; - end - else - Result := False -end; - -function TFreeBitmap.IsGrayScale: Boolean; -begin - Result := (FreeImage_GetBPP(FDib) = 8) -// modif JMB NOVAXEL -// FIC_PALETTE isn't enough to tell the bitmap is grayscale -// and (FreeImage_GetColorType(FDib) = FIC_PALETTE); - and ((FreeImage_GetColorType(FDib) = FIC_MINISBLACK) or - (FreeImage_GetColorType(FDib) = FIC_MINISWHITE)); -// end of modif JMB NOVAXEL -end; - -function TFreeBitmap.IsTransparent: Boolean; -begin - Result := FreeImage_IsTransparent(FDib); -end; - -function TFreeBitmap.IsValid: Boolean; -begin - Result := FDib <> nil -end; - -function TFreeBitmap.Load(const FileName: FreeImageAnsiString; Flag: Integer): Boolean; -var - fif: FREE_IMAGE_FORMAT; -begin - - // check the file signature and get its format - fif := FreeImage_GetFileType(PAnsiChar(FileName), 0); - if fif = FIF_UNKNOWN then - // no signature? - // try to guess the file format from the file extention - fif := FreeImage_GetFIFFromFilename(PAnsiChar(FileName)); - - // check that the plugin has reading capabilities ... - if (fif <> FIF_UNKNOWN) and FreeImage_FIFSupportsReading(FIF) then - begin - // free the previous dib - if FDib <> nil then - FreeImage_Unload(dib); - - // load the file - FDib := FreeImage_Load(fif, PAnsiChar(FileName), Flag); - - Change; - Result := IsValid; - end else - Result := False; -end; - -function TFreeBitmap.LoadFromHandle(IO: PFreeImageIO; Handle: fi_handle; - Flag: Integer): Boolean; -var - fif: FREE_IMAGE_FORMAT; -begin - // check the file signature and get its format - fif := FreeImage_GetFileTypeFromHandle(IO, Handle, 16); - if (fif <> FIF_UNKNOWN) and FreeImage_FIFSupportsReading(fif) then - begin - // free the previous dib - if FDib <> nil then - FreeImage_Unload(FDib); - - // load the file - FDib := FreeImage_LoadFromHandle(fif, IO, Handle, Flag); - - Change; - Result := IsValid; - end else - Result := False; -end; - -function TFreeBitmap.LoadFromMemory(MemIO: TFreeMemoryIO; - Flag: Integer): Boolean; -var - fif: FREE_IMAGE_FORMAT; -begin - - // check the file signature and get its format - fif := MemIO.GetFileType; - if (fif <> FIF_UNKNOWN) and FreeImage_FIFSupportsReading(fif) then - begin - // free the previous dib - if FDib <> nil then - FreeImage_Unload(FDib); - - // load the file - FDib := MemIO.Read(fif, Flag); - - Result := IsValid; - Change; - end else - Result := False; -end; - -function TFreeBitmap.LoadFromStream(Stream: TStream; - Flag: Integer): Boolean; -var - MemIO: TFreeMemoryIO; - Data: PByte; - MemStream: TMemoryStream; - Size: Cardinal; -begin - Size := Stream.Size; - - MemStream := TMemoryStream.Create; - try - MemStream.CopyFrom(Stream, Size); - Data := MemStream.Memory; - - MemIO := TFreeMemoryIO.Create(Data, Size); - try - Result := LoadFromMemory(MemIO); - finally - MemIO.Free; - end; - finally - MemStream.Free; - end; -end; - -function TFreeBitmap.LoadU(const FileName: {$IFDEF DELPHI2010}string{$ELSE}WideString{$ENDIF}; - Flag: Integer): Boolean; -var - fif: FREE_IMAGE_FORMAT; -begin - - // check the file signature and get its format - fif := FreeImage_GetFileTypeU(PWideChar(Filename), 0); - if fif = FIF_UNKNOWN then - // no signature? - // try to guess the file format from the file extention - fif := FreeImage_GetFIFFromFilenameU(PWideChar(FileName)); - - // check that the plugin has reading capabilities ... - if (fif <> FIF_UNKNOWN) and FreeImage_FIFSupportsReading(FIF) then - begin - // free the previous dib - if FDib <> nil then - FreeImage_Unload(dib); - - // load the file - FDib := FreeImage_LoadU(fif, PWideChar(FileName), Flag); - - Change; - Result := IsValid; - end else - Result := False; -end; - -procedure TFreeBitmap.MakeThumbnail(const Width, Height: Integer; - DestBitmap: TFreeBitmap); -type - PRGB24 = ^TRGB24; - TRGB24 = packed record - B: Byte; - G: Byte; - R: Byte; - end; -var - x, y, ix, iy: integer; - x1, x2, x3: integer; - - xscale, yscale: single; - iRed, iGrn, iBlu, iRatio: Longword; - p, c1, c2, c3, c4, c5: TRGB24; - pt, pt1: PRGB24; - iSrc, iDst, s1: integer; - i, j, r, g, b, tmpY: integer; - - RowDest, RowSource, RowSourceStart: integer; - w, h: Integer; - dxmin, dymin: integer; - ny1, ny2, ny3: integer; - dx, dy: integer; - lutX, lutY: array of integer; - - SrcBmp, DestBmp: PFIBITMAP; -begin - if not IsValid then Exit; - - if (GetWidth <= ThumbSize) and (GetHeight <= ThumbSize) then - begin - DestBitmap.Assign(Self); - Exit; - end; - - w := Width; - h := Height; - - // prepare bitmaps - if GetBitsPerPixel <> 24 then - SrcBmp := FreeImage_ConvertTo24Bits(FDib) - else - SrcBmp := FDib; - DestBmp := FreeImage_Allocate(w, h, 24); - Assert(DestBmp <> nil, 'TFreeBitmap.MakeThumbnail error'); - -{ iDst := (w * 24 + 31) and not 31; - iDst := iDst div 8; //BytesPerScanline - iSrc := (GetWidth * 24 + 31) and not 31; - iSrc := iSrc div 8; -} - // BytesPerScanline - iDst := FreeImage_GetPitch(DestBmp); - iSrc := FreeImage_GetPitch(SrcBmp); - - xscale := 1 / (w / FreeImage_GetWidth(SrcBmp)); - yscale := 1 / (h / FreeImage_GetHeight(SrcBmp)); - - // X lookup table - SetLength(lutX, w); - x1 := 0; - x2 := trunc(xscale); - for x := 0 to w - 1 do - begin - lutX[x] := x2 - x1; - x1 := x2; - x2 := trunc((x + 2) * xscale); - end; - - // Y lookup table - SetLength(lutY, h); - x1 := 0; - x2 := trunc(yscale); - for x := 0 to h - 1 do - begin - lutY[x] := x2 - x1; - x1 := x2; - x2 := trunc((x + 2) * yscale); - end; - - Dec(w); - Dec(h); - RowDest := integer(FreeImage_GetScanLine(DestBmp, 0)); - RowSourceStart := integer(FreeImage_GetScanLine(SrcBmp, 0)); - RowSource := RowSourceStart; - - for y := 0 to h do - // resampling - begin - dy := lutY[y]; - x1 := 0; - x3 := 0; - for x := 0 to w do // loop through row - begin - dx:= lutX[x]; - iRed:= 0; - iGrn:= 0; - iBlu:= 0; - RowSource := RowSourceStart; - for iy := 1 to dy do - begin - pt := PRGB24(RowSource + x1); - for ix := 1 to dx do - begin - iRed := iRed + pt.R; - iGrn := iGrn + pt.G; - iBlu := iBlu + pt.B; - inc(pt); - end; - RowSource := RowSource + iSrc; - end; - iRatio := 65535 div (dx * dy); - pt1 := PRGB24(RowDest + x3); - pt1.R := (iRed * iRatio) shr 16; - pt1.G := (iGrn * iRatio) shr 16; - pt1.B := (iBlu * iRatio) shr 16; - x1 := x1 + 3 * dx; - inc(x3,3); - end; - RowDest := RowDest + iDst; - RowSourceStart := RowSource; - end; // resampling - - if FreeImage_GetHeight(DestBmp) >= 3 then - // Sharpening... - begin - s1 := integer(FreeImage_GetScanLine(DestBmp, 0)); - iDst := integer(FreeImage_GetScanLine(DestBmp, 1)) - s1; - ny1 := Integer(s1); - ny2 := ny1 + iDst; - ny3 := ny2 + iDst; - for y := 1 to FreeImage_GetHeight(DestBmp) - 2 do - begin - for x := 0 to FreeImage_GetWidth(DestBmp) - 3 do - begin - x1 := x * 3; - x2 := x1 + 3; - x3 := x1 + 6; - - c1 := pRGB24(ny1 + x1)^; - c2 := pRGB24(ny1 + x3)^; - c3 := pRGB24(ny2 + x2)^; - c4 := pRGB24(ny3 + x1)^; - c5 := pRGB24(ny3 + x3)^; - - r := (c1.R + c2.R + (c3.R * -12) + c4.R + c5.R) div -8; - g := (c1.G + c2.G + (c3.G * -12) + c4.G + c5.G) div -8; - b := (c1.B + c2.B + (c3.B * -12) + c4.B + c5.B) div -8; - - if r < 0 then r := 0 else if r > 255 then r := 255; - if g < 0 then g := 0 else if g > 255 then g := 255; - if b < 0 then b := 0 else if b > 255 then b := 255; - - pt1 := pRGB24(ny2 + x2); - pt1.R := r; - pt1.G := g; - pt1.B := b; - end; - inc(ny1, iDst); - inc(ny2, iDst); - inc(ny3, iDst); - end; - end; // sharpening - - if SrcBmp <> FDib then - FreeImage_Unload(SrcBmp); - DestBitmap.Replace(DestBmp); -end; - -function TFreeBitmap.PasteSubImage(Src: TFreeBitmap; Left, Top, - Alpha: Integer): Boolean; -begin - if FDib <> nil then - begin - Result := FreeImage_Paste(FDib, Src.Dib, Left, Top, Alpha); - Change; - end else - Result := False; -end; - -function TFreeBitmap.Replace(NewDib: PFIBITMAP): Boolean; -begin - Result := False; - if NewDib = nil then Exit; - - if not DoChanging(FDib, NewDib) and IsValid then - FreeImage_Unload(FDib); - - FDib := NewDib; - Result := True; - Change; -end; - -function TFreeBitmap.Rescale(NewWidth, NewHeight: Integer; - Filter: FREE_IMAGE_FILTER; Dest: TFreeBitmap): Boolean; -var - Bpp: Integer; - DstDib: PFIBITMAP; -begin - Result := False; - - if FDib <> nil then - begin - Bpp := FreeImage_GetBPP(FDib); - - if Bpp < 8 then - if not ConvertToGrayscale then Exit - else - if Bpp = 16 then - // convert to 24-bit - if not ConvertTo24Bits then Exit; - - // perform upsampling / downsampling - DstDib := FreeImage_Rescale(FDib, NewWidth, NewHeight, Filter); - if Dest = nil then - Result := Replace(DstDib) - else - Result := Dest.Replace(DstDib) - end -end; - -function TFreeBitmap.Rotate(Angle: Double): Boolean; -var - Bpp: Integer; - Rotated: PFIBITMAP; -begin - Result := False; - if IsValid then - begin - Bpp := FreeImage_GetBPP(FDib); - if Bpp in [1, 8, 24, 32] then - begin -// modif JMB : FreeImage_RotateClassic : deprecated function, call to DeprecationManager in 64 bits crash freeimage.dll - //Rotated := FreeImage_RotateClassic(FDib, Angle); - Rotated := FreeImage_Rotate(FDib, Angle, nil); -// end of modif JMB - //Rotated := FreeImage_Rotate(FDib, Angle); - Result := Replace(Rotated); - end - end; -end; - -function TFreeBitmap.RotateEx(Angle, XShift, YShift, XOrigin, - YOrigin: Double; UseMask: Boolean): Boolean; -var - Rotated: PFIBITMAP; -begin - Result := False; - if FDib <> nil then - begin - if FreeImage_GetBPP(FDib) >= 8 then - begin - Rotated := FreeImage_RotateEx(FDib, Angle, XShift, YShift, XOrigin, YOrigin, UseMask); - Result := Replace(Rotated); - end - end; -end; - -function TFreeBitmap.Save(const FileName: FreeImageAnsiString; Flag: Integer): Boolean; -var - fif: FREE_IMAGE_FORMAT; -begin - Result := False; - - // try to guess the file format from the file extension - fif := FreeImage_GetFIFFromFilename(PAnsiChar(FileName)); - if CanSave(fif) then - Result := FreeImage_Save(fif, FDib, PAnsiChar(FileName), Flag); -end; - -function TFreeBitmap.SaveToHandle(fif: FREE_IMAGE_FORMAT; IO: PFreeImageIO; - Handle: fi_handle; Flag: Integer): Boolean; -begin - Result := False; - if CanSave(fif) then - Result := FreeImage_SaveToHandle(fif, FDib, IO, Handle, Flag) -end; - -function TFreeBitmap.SaveToMemory(fif: FREE_IMAGE_FORMAT; - MemIO: TFreeMemoryIO; Flag: Integer): Boolean; -begin - Result := False; - - if CanSave(fif) then - Result := MemIO.Write(fif, FDib, Flag) -end; - -function TFreeBitmap.SaveToStream(fif: FREE_IMAGE_FORMAT; Stream: TStream; - Flag: Integer): Boolean; -var - MemIO: TFreeMemoryIO; - Data: PByte; - Size: Cardinal; -begin - MemIO := TFreeMemoryIO.Create; - try - Result := SaveToMemory(fif, MemIO, Flag); - if Result then - begin - MemIO.Acquire(Data, Size); - Stream.WriteBuffer(Data^, Size); - end; - finally - MemIO.Free; - end; -end; - -function TFreeBitmap.SaveU(const FileName: {$IFDEF DELPHI2010}string{$ELSE}WideString{$ENDIF}; - Flag: Integer): Boolean; -var - fif: FREE_IMAGE_FORMAT; -begin - Result := False; - - // try to guess the file format from the file extension - fif := FreeImage_GetFIFFromFilenameU(PWideChar(Filename)); - if CanSave(fif) then - Result := FreeImage_SaveU(fif, FDib, PWideChar(FileName), Flag); -end; - -function TFreeBitmap.SetChannel(Bitmap: TFreeBitmap; - Channel: FREE_IMAGE_COLOR_CHANNEL): Boolean; -begin - if FDib <> nil then - begin - Result := FreeImage_SetChannel(FDib, Bitmap.FDib, Channel); - Change; - end - else - Result := False -end; - -procedure TFreeBitmap.SetDib(Value: PFIBITMAP); -begin - Replace(Value); -end; - -function TFreeBitmap.SetFileBkColor(BkColor: PRGBQuad): Boolean; -begin - Result := FreeImage_SetBackgroundColor(FDib, BkColor); - Change; -end; - -procedure TFreeBitmap.SetHorizontalResolution(Value: Double); -begin - if IsValid then - begin - FreeImage_SetDotsPerMeterX(FDib, Trunc(Value * 100 + 0.5)); - Change; - end; -end; - -function TFreeBitmap.SetMetadata(Model: FREE_IMAGE_MDMODEL; - const Key: AnsiString; Tag: TFreeTag): Boolean; -begin - Result := FreeImage_SetMetadata(Model, FDib, PAnsiChar(Key), Tag.Tag); -end; - -function TFreeBitmap.SetPixelColor(X, Y: Cardinal; - var Value: RGBQUAD): Boolean; -begin - Result := FreeImage_SetPixelColor(FDib, X, Y, Value); - Change; -end; - -function TFreeBitmap.SetPixelIndex(X, Y: Cardinal; var Value: Byte): Boolean; -begin - Result := FreeImage_SetPixelIndex(FDib, X, Y, Value); - Change; -end; - -function TFreeBitmap.SetSize(ImageType: FREE_IMAGE_TYPE; Width, Height, - Bpp: Integer; RedMask, GreenMask, BlueMask: Cardinal): Boolean; -var - Pal: PRGBQuad; - I: Cardinal; -begin - Result := False; - - if FDib <> nil then - FreeImage_Unload(FDib); - - FDib := FreeImage_Allocate(Width, Height, Bpp, RedMask, GreenMask, BlueMask); - if FDib = nil then Exit; - - if ImageType = FIT_BITMAP then - case Bpp of - 1, 4, 8: - begin - Pal := FreeImage_GetPalette(FDib); - for I := 0 to FreeImage_GetColorsUsed(FDib) - 1 do - begin - Pal.rgbBlue := I; - Pal.rgbGreen := I; - Pal.rgbRed := I; - Inc(Pal);//, SizeOf(RGBQUAD)); - end; - end; - end; - - Result := True; - Change; -end; - -procedure TFreeBitmap.SetTransparencyTable(Table: PByte; Count: Integer); -begin - FreeImage_SetTransparencyTable(FDib, Table, Count); - Change; -end; - -procedure TFreeBitmap.SetVerticalResolution(Value: Double); -begin - if IsValid then - begin - FreeImage_SetDotsPerMeterY(FDib, Trunc(Value * 100 + 0.5)); - Change; - end; -end; - -function TFreeBitmap.SplitChannels(RedChannel, GreenChannel, - BlueChannel: TFreeBitmap): Boolean; -begin - if FDib <> nil then - begin - RedChannel.FDib := FreeImage_GetChannel(FDib, FICC_RED); - GreenChannel.FDib := FreeImage_GetChannel(FDib, FICC_GREEN); - BlueChannel.FDib := FreeImage_GetChannel(FDib, FICC_BLUE); - Result := RedChannel.IsValid and GreenChannel.IsValid and BlueChannel.IsValid; - end - else - Result := False -end; - -function TFreeBitmap.Threshold(T: Byte): Boolean; -var - dib1: PFIBITMAP; -begin - if FDib <> nil then - begin - dib1 := FreeImage_Threshold(FDib, T); - Result := Replace(dib1); - end - else - Result := False -end; - -function TFreeBitmap.ToneMapping(TMO: FREE_IMAGE_TMO; FirstParam, - SecondParam: Double): Boolean; -var - NewDib: PFIBITMAP; -begin - Result := False; - if not IsValid then Exit; - - NewDib := FreeImage_ToneMapping(Fdib, TMO, FirstParam, SecondParam); - Result := Replace(NewDib); -end; - -{ TFreeWinBitmap } -{$IFDEF MSWINDOWS} -function TFreeWinBitmap.CaptureWindow(ApplicationWindow, - SelectedWindow: HWND): Boolean; -var - XScreen, YScreen, XShift, YShift, Width, Height: Integer; - R: TRect; - dstDC, srcDC, memDC: HDC; - BM, oldBM: HBITMAP; -begin - Result := False; - - // get window size - GetWindowRect(SelectedWindow, R); - - // check if the window is out of screen or maximized - XShift := 0; - YShift := 0; - XScreen := GetSystemMetrics(SM_CXSCREEN); - YScreen := GetSystemMetrics(SM_CYSCREEN); - if R.Right > XScreen then - R.Right := XScreen; - if R.Bottom > YScreen then - R.Bottom := YScreen; - if R.Left < 0 then - begin - XShift := -R.Left; - R.Left := 0; - end; - if R.Top < 0 then - begin - YShift := -R.Top; - R.Top := 0; - end; - - Width := R.Right - R.Left; - Height := R.Bottom - R.Top; - - if (Width <= 0) or (Height <= 0) then Exit; - - // hide the application window - ShowWindow(ApplicationWindow, SW_HIDE); - - // bring the window at the top most level - SetWindowPos(SelectedWindow, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE); - - // give enough time to refresh the window - Sleep(500); - - // prepare the DCs - dstDc := GetDC(0); - srcDC := GetWindowDC(SelectedWindow); //full window (GetDC(SelectedWindow) = clientarea) - memDC := CreateCompatibleDC(dstDC); - - // copy the screen to the bitmap - BM := CreateCompatibleBitmap(dstDC, Width, Height); - oldBM := HBITMAP(SelectObject(memDC, BM)); - BitBlt(memDC, 0, 0, Width, Height, srcDC, XShift, YShift, SRCCOPY); - - // redraw the application window - ShowWindow(ApplicationWindow, SW_SHOW); - - // restore the position - SetWindowPos(SelectedWindow, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE); - SetWindowPos(ApplicationWindow, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE); - - // convert the HBITMAP to FIBITMAP - CopyFromBitmap(BM); - - // free objects - DeleteObject(SelectObject(memDC, oldBM)); - DeleteObject(memDC); - - if GetBitsPerPixel = 32 then ConvertTo24Bits; - - Result := True; -end; -{$ENDIF} - -procedure TFreeWinBitmap.Clear; -begin - if FDeleteMe then FreeImage_Unload(FDisplayDib); - inherited; -end; - -{$IFDEF MSWINDOWS} -function TFreeWinBitmap.CopyFromBitmap(HBmp: HBITMAP): Boolean; -var - bm: BITMAP; - DC: HDC; - Success: Integer; -// modif NOVAXEL - nColors : integer; - bmih: PBitmapInfoHeader; -// end of modif NOVAXEL -begin - Result := False; - - if HBmp <> 0 then - begin - // get information about the bitmap - GetObject(HBmp, SizeOf(BITMAP), @bm); - - // create the image - SetSize(FIT_BITMAP, bm.bmWidth, bm.bmHeight, bm.bmBitsPixel); - -// modif NOVAXEL - // GetDIBits clears the biClrUsed and biClrImportant BITMAPINFO properties. - // So for the Palettized bitmaps, we need to save the count of colors and - // to restore it after the call to GetDIBits - nColors := GetColorsUsed; -// end of modif NOVAXEL - // create the device context for the bitmap - DC := GetDC(0); - - // copy the pixels - Success := GetDIBits(DC, // handle to DC - HBmp, // handle to Bitmap - 0, // first scan line - FreeImage_GetHeight(Dib), // number of scan lines to copy - FreeImage_GetBits(Dib), // array for bitmap bits - FreeImage_GetInfo(Dib)^, // bitmap data buffer - DIB_RGB_COLORS // RGB - ); - - ReleaseDC(0, DC); -// modif NOVAXEL - // as seen above, wr restore the properties which have been cleared by GetDIBits - bmih := GetInfoHeader; - bmih.biClrUsed := nColors; - bmih.biClrImportant := nColors; -// end of modif NOVAXEL - - if Success = 0 then - raise Exception.Create('Error: GetDIBits failed') - else - Result := True; - end; -end; - -function TFreeWinBitmap.CopyFromHandle(HMem: THandle): Boolean; -var - Data: PByte; - bmih: PBitmapInfoHeader; - Palette: PRGBQuad; - Bits: PByte; - BitFields: array [0..2] of DWORD; - MaskSize: Longint; - image_type: FREE_IMAGE_TYPE; -begin - Result := False; - Palette := nil; - BitFields[0] := 0; BitFields[1] := 0; BitFields[2] := 0; - - // get a pointer to the bitmap - Data := GlobalLock(HMem); - - // get a pointer to the bitmap header - bmih := PBitmapInfoHeader(Data); - - // get a pointer to the palette - if bmih.biBitCount < 16 then - begin - Palette := PRGBQUAD(bmih); - Inc(PByte(Palette), SizeOf(BITMAPINFOHEADER)); - end; - - // get a pointer to the pixels - Bits := PByte(bmih); - Inc(Bits, SizeOf(BITMAPINFOHEADER) + SizeOF(RGBQUAD) * bmih.biClrUsed); - - if bmih.biCompression = BI_BITFIELDS then - begin - // take into account the color masks that specify the red, green and blue - // components (16- and 32-bit) - MaskSize := 3 * SizeOf(DWORD); - CopyMemory(@BitFields[0], Bits, MaskSize); - Inc(Bits, MaskSize); - end; - - if Data <> nil then - begin - image_type := FIT_BITMAP; - - case GetFreeImageMarker(bmih) of - FIT_UINT16..FIT_RGBAF: image_type := GetFreeImageMarker(bmih); - end; - - // allocate a new FIBITMAP - if not SetSize(image_type, bmih.biWidth, bmih.biHeight, bmih.biBitCount, - BitFields[2], BitFields[1], BitFields[0]) then - begin - GlobalUnlock(HMem); - Exit; - end; - - // copy the bitmap header - CopyMemory(FreeImage_GetInfoHeader(Dib), bmih, SizeOf(BITMAPINFOHEADER)); - - // copy the palette - CopyMemory(FreeImage_GetPalette(Dib), Palette, bmih.biClrUsed * SizeOf(RGBQUAD)); - - // copy the bitmap - CopyMemory(FreeImage_GetBits(Dib), Bits, FreeImage_GetPitch(Dib) * FreeImage_GetHeight(Dib)); - - GlobalUnlock(HMem); - end; -end; - -function TFreeWinBitmap.CopyToBitmapH: HBITMAP; -var DC : HDC; -begin - Result:=0; - if IsValid then - begin - DC:=GetDC(0); - Result:=CreateDIBitmap(DC, - FreeImage_GetInfoHeader(Dib)^, - CBM_INIT, - PAnsiChar(FreeImage_GetBits(Dib)), - FreeImage_GetInfo(Dib)^, - DIB_RGB_COLORS); - ReleaseDC(0,DC); - end; -end; - -function TFreeWinBitmap.CopyToClipBoard(NewOwner: HWND): Boolean; -var - HDib: THandle; -begin - Result := False; - HDib := CopyToHandle; - - if OpenClipboard(NewOwner) and EmptyClipboard then - begin - if SetClipboardData(CF_DIB, HDib) = 0 then - begin - MessageBox(NewOwner, 'Unable to set clipboard data', 'FreeImage', MB_ICONERROR); - CloseClipboard; - Exit; - end; - end; - CloseClipboard; - Result := True; -end; - -function TFreeWinBitmap.CopyToHandle: THandle; -var - DibSize: Longint; - ADib, pdib: PByte; - bmih: PBITMAPINFOHEADER; - Pal: PRGBQuad; - Bits: PByte; -begin - Result := 0; - if IsValid then - begin - // get equivalent DIB size - DibSize := SizeOf(BITMAPINFOHEADER); - Inc(DibSize, FreeImage_GetColorsUsed(Dib) * SizeOf(RGBQUAD)); - Inc(DibSize, FreeImage_GetPitch(Dib) * FreeImage_GetHeight(Dib)); - - // allocate a DIB - Result := GlobalAlloc(GHND, DibSize); - ADib := GlobalLock(Result); - - pdib := ADib; - - // copy the BITMAPINFOHEADER - bmih := FreeImage_GetInfoHeader(Dib); - CopyMemory(pdib, bmih, SizeOf(BITMAPINFOHEADER)); - Inc(pdib, SizeOf(BITMAPINFOHEADER)); - if FreeImage_GetImageType(Dib) <> FIT_BITMAP then - SetFreeImageMarker(bmih, FDib); - - // copy the palette - Pal := FreeImage_GetPalette(Dib); - CopyMemory(pdib, Pal, FreeImage_GetColorsUsed(Dib) * SizeOf(RGBQUAD)); - Inc(pdib, FreeImage_GetColorsUsed(Dib) * SizeOf(RGBQUAD)); - - // copy the bitmap - Bits := FreeImage_GetBits(Dib); - CopyMemory(pdib, Bits, FreeImage_GetPitch(Dib) * FreeImage_GetHeight(Dib)); - - GlobalUnlock(Result); - end; -end; -{$ENDIF} - -constructor TFreeWinBitmap.Create(ImageType: FREE_IMAGE_TYPE; Width, - Height, Bpp: Integer); -begin - inherited Create(ImageType, Width, Height, Bpp); - - FDisplayDib := nil; - FDeleteMe := False; -end; - -destructor TFreeWinBitmap.Destroy; -begin - if FDeleteMe then - FreeImage_Unload(FDisplayDib); - inherited; -end; - -{$IFDEF MSWINDOWS} -procedure TFreeWinBitmap.Draw(DC: HDC; Rect: TRect); -begin - DrawEx(DC, Rect); -end; - -procedure TFreeWinBitmap.DrawEx(DC: HDC; Rect: TRect; UseFileBkg: Boolean; - AppBkColor: PRGBQuad; Bg: PFIBITMAP); -var - ImageType: FREE_IMAGE_TYPE; - HasBackground, Transparent: Boolean; - DibDouble: PFIBITMAP; -begin - if not IsValid then Exit; - - // convert to standard bitmap if needed - if FDeleteMe then - begin - FreeImage_Unload(FDisplayDib); - FDisplayDib := nil; - FDeleteMe := False; - end; - - ImageType := FreeImage_GetImageType(FDib); - if ImageType = FIT_BITMAP then - begin - HasBackground := FreeImage_HasBackgroundColor(Dib); - Transparent := FreeImage_IsTransparent(Dib); - - if not Transparent and not HasBackground then - // copy pointer - FDisplayDib := Dib - else - begin - // create the transparent / alpha blended image - FDisplayDib := FreeImage_Composite(Dib, UseFileBkg, AppBkColor, Bg); - // remember to delete FDisplayDib - FDeleteMe := True; - end - end - else - begin - // convert to standard dib for display - if ImageType <> FIT_COMPLEX then - FDisplayDib := FreeImage_ConvertToStandardType(Dib, True) - else - begin - // convert to type FIT_DOUBLE - DibDouble := FreeImage_GetComplexChannel(Dib, FICC_MAG); - FDisplayDib := FreeImage_ConvertToStandardType(DibDouble, True); - // free image of type FIT_DOUBLE - FreeImage_Unload(DibDouble); - end; - // remember to delete FDisplayDib - FDeleteMe := True; - end; - - // Draw the DIB - SetStretchBltMode(DC, COLORONCOLOR); - StretchDIBits(DC, Rect.Left, Rect.Top, - Rect.Right - Rect.Left, Rect.Bottom - Rect.Top, - 0, 0, FreeImage_GetWidth(FDisplayDib), FreeImage_GetHeight(FDisplayDib), - FreeImage_GetBits(FDisplayDib), FreeImage_GetInfo(FDisplayDib)^, DIB_RGB_COLORS, SRCCOPY); -end; - -function TFreeWinBitmap.PasteFromClipBoard: Boolean; -var - HDib: THandle; -begin - Result := False; - if not IsClipboardFormatAvailable(CF_DIB) then Exit; - - if OpenClipboard(0) then - begin - HDib := GetClipboardData(CF_DIB); - CopyFromHandle(HDib); - Result := True; - end; - CloseClipboard; -end; -{$ENDIF} - -{ TFreeMultiBitmap } - -procedure TFreeMultiBitmap.AppendPage(Bitmap: TFreeBitmap); -begin - if IsValid then - FreeImage_AppendPage(FMPage, Bitmap.FDib); -end; - -function TFreeMultiBitmap.Close(Flags: Integer): Boolean; -begin - Result := FreeImage_CloseMultiBitmap(FMPage, Flags); - FMPage := nil; -end; - -constructor TFreeMultiBitmap.Create(KeepCacheInMemory: Boolean); -begin - inherited Create; - FMemoryCache := KeepCacheInMemory; -end; - -procedure TFreeMultiBitmap.DeletePage(Page: Integer); -begin - if IsValid then - FreeImage_DeletePage(FMPage, Page); -end; - -destructor TFreeMultiBitmap.Destroy; -begin - if FMPage <> nil then Close; - inherited; -end; - -function TFreeMultiBitmap.GetLockedPageNumbers(var Pages, - Count: Integer): Boolean; -begin - Result := False; - if not IsValid then Exit; - Result := FreeImage_GetLockedPageNumbers(FMPage, Pages, Count) -end; - -function TFreeMultiBitmap.GetPageCount: Integer; -begin - Result := 0; - if IsValid then - Result := FreeImage_GetPageCount(FMPage) -end; - -procedure TFreeMultiBitmap.InsertPage(Page: Integer; Bitmap: TFreeBitmap); -begin - if IsValid then - FreeImage_InsertPage(FMPage, Page, Bitmap.FDib); -end; - -function TFreeMultiBitmap.IsValid: Boolean; -begin - Result := FMPage <> nil -end; - -procedure TFreeMultiBitmap.LockPage(Page: Integer; DestBitmap: TFreeBitmap); -begin - if not IsValid then Exit; - - if Assigned(DestBitmap) then - begin - DestBitmap.Replace(FreeImage_LockPage(FMPage, Page)); - end; -end; - -function TFreeMultiBitmap.MovePage(Target, Source: Integer): Boolean; -begin - Result := False; - if not IsValid then Exit; - Result := FreeImage_MovePage(FMPage, Target, Source); -end; - -function TFreeMultiBitmap.Open(const FileName: FreeImageAnsiString; CreateNew, - ReadOnly: Boolean; Flags: Integer): Boolean; -var - fif: FREE_IMAGE_FORMAT; -begin - Result := False; - -// modif NOVAXEL -// In order to try to get the file format even if the extension is not standard, -// we check first the file signature - fif := FreeImage_GetFileType(PAnsiChar(FileName), 0); - - if fif = FIF_UNKNOWN then - // no signature? -// end of modif NOVAXEL - // try to guess the file format from the filename - fif := FreeImage_GetFIFFromFilename(PAnsiChar(FileName)); - - // check for supported file types - if (fif <> FIF_UNKNOWN) and (not fif in [FIF_TIFF, FIF_ICO, FIF_GIF]) then - Exit; - - // open the stream - FMPage := FreeImage_OpenMultiBitmap(fif, PAnsiChar(FileName), CreateNew, ReadOnly, FMemoryCache, Flags); - - Result := FMPage <> nil; -end; - -procedure TFreeMultiBitmap.UnlockPage(Bitmap: TFreeBitmap; - Changed: Boolean); -begin - if IsValid then - begin - FreeImage_UnlockPage(FMPage, Bitmap.FDib, Changed); - // clear the image so that it becomes invalid. - // don't use Bitmap.Clear method because it calls FreeImage_Unload - // just clear the pointer - Bitmap.FDib := nil; - Bitmap.Change; - end; -end; - -{ TFreeMemoryIO } - -function TFreeMemoryIO.Acquire(var Data: PByte; - var SizeInBytes: DWORD): Boolean; -begin - Result := FreeImage_AcquireMemory(FHMem, Data, SizeInBytes); -end; - -constructor TFreeMemoryIO.Create(Data: PByte; SizeInBytes: DWORD); -begin - inherited Create; - FHMem := FreeImage_OpenMemory(Data, SizeInBytes); -end; - -destructor TFreeMemoryIO.Destroy; -begin - FreeImage_CloseMemory(FHMem); - inherited; -end; - -function TFreeMemoryIO.GetFileType: FREE_IMAGE_FORMAT; -begin - Result := FreeImage_GetFileTypeFromMemory(FHMem); -end; - -function TFreeMemoryIO.IsValid: Boolean; -begin - Result := FHMem <> nil -end; - -function TFreeMemoryIO.Read(fif: FREE_IMAGE_FORMAT; - Flag: Integer): PFIBITMAP; -begin - Result := FreeImage_LoadFromMemory(fif, FHMem, Flag) -end; - -function TFreeMemoryIO.Seek(Offset: Longint; Origin: Word): Boolean; -begin - Result := FreeImage_SeekMemory(FHMem, Offset, Origin) -end; - -function TFreeMemoryIO.Tell: Longint; -begin - Result := FreeImage_TellMemory(FHMem) -end; - -function TFreeMemoryIO.Write(fif: FREE_IMAGE_FORMAT; dib: PFIBITMAP; - Flag: Integer): Boolean; -begin - Result := FreeImage_SaveToMemory(fif, dib, FHMem, Flag) -end; - -{ TFreeTag } - -function TFreeTag.Clone: TFreeTag; -var - CloneTag: PFITAG; -begin - Result := nil; - if not IsValid then Exit; - - CloneTag := FreeImage_CloneTag(FTag); - Result := TFreeTag.Create(CloneTag); -end; - -constructor TFreeTag.Create(ATag: PFITAG); -begin - inherited Create; - - if ATag <> nil then - FTag := ATag - else - FTag := FreeImage_CreateTag; -end; - -destructor TFreeTag.Destroy; -begin - if IsValid then - FreeImage_DeleteTag(FTag); - - inherited; -end; - -function TFreeTag.GetCount: Cardinal; -begin - Result := 0; - if not IsValid then Exit; - - Result := FreeImage_GetTagCount(FTag); -end; - -function TFreeTag.GetDescription: AnsiString; -begin - Result := ''; - if not IsValid then Exit; - - Result := FreeImage_GetTagDescription(FTag); -end; - -function TFreeTag.GetID: Word; -begin - Result := 0; - if not IsValid then Exit; - - Result := FreeImage_GetTagID(FTag); -end; - -function TFreeTag.GetKey: AnsiString; -begin - Result := ''; - if not IsValid then Exit; - - Result := FreeImage_GetTagKey(FTag); -end; - -function TFreeTag.GetLength: Cardinal; -begin - Result := 0; - if not IsValid then Exit; - - Result := FreeImage_GetTagLength(FTag); -end; - -function TFreeTag.GetTagType: FREE_IMAGE_MDTYPE; -begin - Result := FIDT_NOTYPE; - if not IsValid then Exit; - - Result := FreeImage_GetTagType(FTag); -end; - -function TFreeTag.GetValue: Pointer; -begin - Result := nil; - if not IsValid then Exit; - - Result := FreeImage_GetTagValue(FTag); -end; - -function TFreeTag.IsValid: Boolean; -begin - Result := FTag <> nil; -end; - -procedure TFreeTag.SetCount(const Value: Cardinal); -begin - if IsValid then - FreeImage_SetTagCount(FTag, Value); -end; - -procedure TFreeTag.SetDescription(const Value: AnsiString); -begin - if IsValid then - FreeImage_SetTagDescription(FTag, PAnsiChar(Value)); -end; - -procedure TFreeTag.SetID(const Value: Word); -begin - if IsValid then - FreeImage_SetTagID(FTag, Value); -end; - -procedure TFreeTag.SetKey(const Value: AnsiString); -begin - if IsValid then - FreeImage_SetTagKey(FTag, PAnsiChar(Value)); -end; - -procedure TFreeTag.SetLength(const Value: Cardinal); -begin - if IsValid then - FreeImage_SetTagLength(FTag, Value); -end; - -procedure TFreeTag.SetTagType(const Value: FREE_IMAGE_MDTYPE); -begin - if IsValid then - FreeImage_SetTagType(FTag, Value); -end; - -procedure TFreeTag.SetValue(const Value: Pointer); -begin - if IsValid then - FreeImage_SetTagValue(FTag, Value); -end; - -function TFreeTag.ToString(Model: FREE_IMAGE_MDMODEL; Make: PAnsiChar): AnsiString; -begin - Result := FreeImage_TagToString(Model, FTag, Make); -end; - -end. diff --git a/#ThirdParty/FreeImage/Wrapper/Delphi/src/FreeImage.pas b/#ThirdParty/FreeImage/Wrapper/Delphi/src/FreeImage.pas deleted file mode 100644 index 66f0408..0000000 --- a/#ThirdParty/FreeImage/Wrapper/Delphi/src/FreeImage.pas +++ /dev/null @@ -1,1746 +0,0 @@ -unit FreeImage; - -// ========================================================== -// Delphi wrapper for FreeImage 3 -// -// Design and implementation by -// - Simon Beavis -// - Peter Byström -// - Anatoliy Pulyaevskiy (xvel84@rambler.ru) -// -// Contributors: -// - Lorenzo Monti (LM) lomo74@gmail.com -// - Maurício (MAU) mauricio_box@yahoo.com - see also http://sourceforge.net/projects/tcycomponents/ -// -// Revision history -// When Who What -// ----------- ----- ----------------------------------------------------------- -// 2010-07-14 LM Fixed some C->Delphi translation errors, -// updated to 3.13.1, made RAD2010 compliant (unicode) -// 2010-07-29 LM Added Free Pascal / Lazarus 32 bit support -// 2010-11-12 LM Updated to 3.14.1 -// 2011-02-15 LM Updated to 3.15.0 -// 2011-03-04 JMB Modifications to compile on Free Pascal / Lazarus 64 bits (tested on Windows 7 and linux OpenSuse) : -// - in 64 bits, the names of the exported function are different : -// e.g. : _FreeImage_AcquireMemory@12 in 32 bits and FreeImage_AcquireMemory in 64 bits -// so the define WIN32 will allow to distinguish 32 and 64 bits in the calls to the freeimage library -// - in 64 bits, the Boolean type is not correctly converted to freeimage BOOL type (integer 32 bits) -// ==> replace Boolean with LongBool in the calls to the freeimage library -// - as linux sees the difference between uppercase and lowercase : -// ==> replace FreeImage_GetMetaData with FreeImage_GetMetadata in the call to the freeimage library -// 2012-06-04 LM Updated to 3.15.3 -// 2012-12-08 LM Updated to 3.15.4 -// 2013-05-06 MAU Corrected calls definition to MAC OSX library -// 2013-11-25 MAU Added type FreeImageAnsiString for handling accents on MAC OSX filenames/path -// 2014-05-05 LM Updated to 3.16.1 -// - -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -interface - -{$MINENUMSIZE 4} // Make sure enums are stored as an integer to be compatible with C/C++ - -{$I 'Version.inc'} - -{$IFDEF MSWINDOWS} -uses Windows; - -type - FreeImageAnsiString = AnsiString; - -{$ELSE} -type - FreeImageAnsiString = UTF8String; - - LONG = LongInt; - DWORD = Cardinal; - - PDWORD = ^DWORD; - - BITMAPINFOHEADER = record - biSize : DWORD; - biWidth : LONG; - biHeight : LONG; - biPlanes : WORD; - biBitCount : WORD; - biCompression : DWORD; - biSizeImage : DWORD; - biXPelsPerMeter : LONG; - biYPelsPerMeter : LONG; - biClrUsed : DWORD; - biClrImportant : DWORD; - end; - LPBITMAPINFOHEADER = ^BITMAPINFOHEADER; - TBITMAPINFOHEADER = BITMAPINFOHEADER; - PBITMAPINFOHEADER = ^BITMAPINFOHEADER; - - RGBQUAD = record - rgbBlue : BYTE; - rgbGreen : BYTE; - rgbRed : BYTE; - rgbReserved : BYTE; - end; - tagRGBQUAD = RGBQUAD; - TRGBQUAD = RGBQUAD; - PRGBQUAD = ^RGBQUAD; - - BITMAPINFO = record - bmiHeader : BITMAPINFOHEADER; - bmiColors : array[0..0] of RGBQUAD; - end; - LPBITMAPINFO = ^BITMAPINFO; - PBITMAPINFO = ^BITMAPINFO; - TBITMAPINFO = BITMAPINFO; -// modif JMB NOVAXEL - HBITMAP = type LongWord; - HWND = type LongWord; - HDC = type LongWord; -// end of modif JMB NOVAXEL -{$ENDIF} - -const - FIDLL = {$IFDEF MSWINDOWS}'FreeImage.dll';{$ENDIF} - {$IFDEF LINUX}'libfreeimage.so';{$ENDIF} - {$IFDEF MACOS}'libfreeimage.dylib';{$ENDIF} - -const - // Version information - FREEIMAGE_MAJOR_VERSION = 3; - FREEIMAGE_MINOR_VERSION = 16; - FREEIMAGE_RELEASE_SERIAL = 1; - // This really only affects 24 and 32 bit formats, the rest are always RGB order. - FREEIMAGE_COLORORDER_BGR = 0; - FREEIMAGE_COLORORDER_RGB = 1; - FREEIMAGE_COLORORDER = FREEIMAGE_COLORORDER_BGR; - -// -------------------------------------------------------------------------- -// Bitmap types ------------------------------------------------------------- -// -------------------------------------------------------------------------- - -type - FIBITMAP = record - data: Pointer; - end; - PFIBITMAP = ^FIBITMAP; - - FIMULTIBITMAP = record - data: Pointer; - end; - PFIMULTIBITMAP = ^FIMULTIBITMAP; - -// -------------------------------------------------------------------------- -// Types used in the library (specific to FreeImage) ------------------------ -// -------------------------------------------------------------------------- - -type - {* 48-bit RGB } - tagFIRGB16 = packed record - red: WORD; - green: WORD; - blue: WORD; - end; - FIRGB16 = tagFIRGB16; - - {* 64-bit RGBA } - tagFIRGBA16 = packed record - red: WORD; - green: WORD; - blue: WORD; - alpha: WORD; - end; - FIRGBA16 = tagFIRGBA16; - - {* 96-bit RGB Float } - tagFIRGBF = packed record - red: Single; - green: Single; - blue: Single; - end; - FIRGBF = tagFIRGBF; - - {* 128-bit RGBA Float } - tagFIRGBAF = packed record - red: Single; - green: Single; - blue: Single; - alpha: Single; - end; - FIRGBAF = tagFIRGBAF; - - {* Data structure for COMPLEX type (complex number) } - tagFICOMPLEX = packed record - /// real part - r: Double; - /// imaginary part - i: Double; - end; - FICOMPLEX = tagFICOMPLEX; - -// -------------------------------------------------------------------------- -// Indexes for byte arrays, masks and shifts for treating pixels as words --- -// These coincide with the order of RGBQUAD and RGBTRIPLE ------------------- -// Little Endian (x86 / MS Windows, Linux) : BGR(A) order ------------------- -// -------------------------------------------------------------------------- - -const - FI_RGBA_RED = 2; - FI_RGBA_GREEN = 1; - FI_RGBA_BLUE = 0; - FI_RGBA_ALPHA = 3; - FI_RGBA_RED_MASK = $00FF0000; - FI_RGBA_GREEN_MASK = $0000FF00; - FI_RGBA_BLUE_MASK = $000000FF; - FI_RGBA_ALPHA_MASK = $FF000000; - FI_RGBA_RED_SHIFT = 16; - FI_RGBA_GREEN_SHIFT = 8; - FI_RGBA_BLUE_SHIFT = 0; - FI_RGBA_ALPHA_SHIFT = 24; - - FI_RGBA_RGB_MASK = FI_RGBA_RED_MASK or FI_RGBA_GREEN_MASK or FI_RGBA_BLUE_MASK; - -// -------------------------------------------------------------------------- -// The 16bit macros only include masks and shifts, -------------------------- -// since each color element is not byte aligned ----------------------------- -// -------------------------------------------------------------------------- - -const - FI16_555_RED_MASK = $7C00; - FI16_555_GREEN_MASK = $03E0; - FI16_555_BLUE_MASK = $001F; - FI16_555_RED_SHIFT = 10; - FI16_555_GREEN_SHIFT = 5; - FI16_555_BLUE_SHIFT = 0; - FI16_565_RED_MASK = $F800; - FI16_565_GREEN_MASK = $07E0; - FI16_565_BLUE_MASK = $001F; - FI16_565_RED_SHIFT = 11; - FI16_565_GREEN_SHIFT = 5; - FI16_565_BLUE_SHIFT = 0; - -// -------------------------------------------------------------------------- -// ICC profile support ------------------------------------------------------ -// -------------------------------------------------------------------------- - -const - FIICC_DEFAULT = $0; - FIICC_COLOR_IS_CMYK = $1; - -type - FIICCPROFILE = record - flags: WORD; // info flag - size: DWORD; // profile's size measured in bytes - data: Pointer; // points to a block of contiguous memory containing the profile - end; - PFIICCPROFILE = ^FIICCPROFILE; - -// -------------------------------------------------------------------------- -// Important enums ---------------------------------------------------------- -// -------------------------------------------------------------------------- - -type - FREE_IMAGE_FORMAT = type Integer; - FREE_IMAGE_TYPE = type Integer; - FREE_IMAGE_COLOR_TYPE = type Integer; - FREE_IMAGE_QUANTIZE = type Integer; - FREE_IMAGE_DITHER = type Integer; - FREE_IMAGE_FILTER = type Integer; - FREE_IMAGE_COLOR_CHANNEL = type Integer; - FREE_IMAGE_MDTYPE = type Integer; - FREE_IMAGE_MDMODEL = type Integer; - FREE_IMAGE_JPEG_OPERATION = type Integer; - FREE_IMAGE_TMO = type Integer; - -const - // I/O image format identifiers. - FIF_UNKNOWN = FREE_IMAGE_FORMAT(-1); - FIF_BMP = FREE_IMAGE_FORMAT(0); - FIF_ICO = FREE_IMAGE_FORMAT(1); - FIF_JPEG = FREE_IMAGE_FORMAT(2); - FIF_JNG = FREE_IMAGE_FORMAT(3); - FIF_KOALA = FREE_IMAGE_FORMAT(4); - FIF_LBM = FREE_IMAGE_FORMAT(5); - FIF_IFF = FIF_LBM; - FIF_MNG = FREE_IMAGE_FORMAT(6); - FIF_PBM = FREE_IMAGE_FORMAT(7); - FIF_PBMRAW = FREE_IMAGE_FORMAT(8); - FIF_PCD = FREE_IMAGE_FORMAT(9); - FIF_PCX = FREE_IMAGE_FORMAT(10); - FIF_PGM = FREE_IMAGE_FORMAT(11); - FIF_PGMRAW = FREE_IMAGE_FORMAT(12); - FIF_PNG = FREE_IMAGE_FORMAT(13); - FIF_PPM = FREE_IMAGE_FORMAT(14); - FIF_PPMRAW = FREE_IMAGE_FORMAT(15); - FIF_RAS = FREE_IMAGE_FORMAT(16); - FIF_TARGA = FREE_IMAGE_FORMAT(17); - FIF_TIFF = FREE_IMAGE_FORMAT(18); - FIF_WBMP = FREE_IMAGE_FORMAT(19); - FIF_PSD = FREE_IMAGE_FORMAT(20); - FIF_CUT = FREE_IMAGE_FORMAT(21); - FIF_XBM = FREE_IMAGE_FORMAT(22); - FIF_XPM = FREE_IMAGE_FORMAT(23); - FIF_DDS = FREE_IMAGE_FORMAT(24); - FIF_GIF = FREE_IMAGE_FORMAT(25); - FIF_HDR = FREE_IMAGE_FORMAT(26); - FIF_FAXG3 = FREE_IMAGE_FORMAT(27); - FIF_SGI = FREE_IMAGE_FORMAT(28); - FIF_EXR = FREE_IMAGE_FORMAT(29); - FIF_J2K = FREE_IMAGE_FORMAT(30); - FIF_JP2 = FREE_IMAGE_FORMAT(31); - FIF_PFM = FREE_IMAGE_FORMAT(32); - FIF_PICT = FREE_IMAGE_FORMAT(33); - FIF_RAW = FREE_IMAGE_FORMAT(34); - FIF_WEBP = FREE_IMAGE_FORMAT(35); - FIF_JXR = FREE_IMAGE_FORMAT(36); - - // Image type used in FreeImage. - FIT_UNKNOWN = FREE_IMAGE_TYPE(0); // unknown type - FIT_BITMAP = FREE_IMAGE_TYPE(1); // standard image: 1-, 4-, 8-, 16-, 24-, 32-bit - FIT_UINT16 = FREE_IMAGE_TYPE(2); // array of unsigned short: unsigned 16-bit - FIT_INT16 = FREE_IMAGE_TYPE(3); // array of short: signed 16-bit - FIT_UINT32 = FREE_IMAGE_TYPE(4); // array of unsigned long: unsigned 32-bit - FIT_INT32 = FREE_IMAGE_TYPE(5); // array of long: signed 32-bit - FIT_FLOAT = FREE_IMAGE_TYPE(6); // array of float: 32-bit IEEE floating point - FIT_DOUBLE = FREE_IMAGE_TYPE(7); // array of double: 64-bit IEEE floating point - FIT_COMPLEX = FREE_IMAGE_TYPE(8); // array of FICOMPLEX: 2 x 64-bit IEEE floating point - FIT_RGB16 = FREE_IMAGE_TYPE(9); // 48-bit RGB image: 3 x 16-bit - FIT_RGBA16 = FREE_IMAGE_TYPE(10); // 64-bit RGBA image: 4 x 16-bit - FIT_RGBF = FREE_IMAGE_TYPE(11); // 96-bit RGB float image: 3 x 32-bit IEEE floating point - FIT_RGBAF = FREE_IMAGE_TYPE(12); // 128-bit RGBA float image: 4 x 32-bit IEEE floating point - - // Image color type used in FreeImage. - FIC_MINISWHITE = FREE_IMAGE_COLOR_TYPE(0); // min value is white - FIC_MINISBLACK = FREE_IMAGE_COLOR_TYPE(1); // min value is black - FIC_RGB = FREE_IMAGE_COLOR_TYPE(2); // RGB color model - FIC_PALETTE = FREE_IMAGE_COLOR_TYPE(3); // color map indexed - FIC_RGBALPHA = FREE_IMAGE_COLOR_TYPE(4); // RGB color model with alpha channel - FIC_CMYK = FREE_IMAGE_COLOR_TYPE(5); // CMYK color model - - // Color quantization algorithms. Constants used in FreeImage_ColorQuantize. - FIQ_WUQUANT = FREE_IMAGE_QUANTIZE(0); // Xiaolin Wu color quantization algorithm - FIQ_NNQUANT = FREE_IMAGE_QUANTIZE(1); // NeuQuant neural-net quantization algorithm by Anthony Dekker - - // Dithering algorithms. Constants used FreeImage_Dither. - FID_FS = FREE_IMAGE_DITHER(0); // Floyd & Steinberg error diffusion - FID_BAYER4x4 = FREE_IMAGE_DITHER(1); // Bayer ordered dispersed dot dithering (order 2 dithering matrix) - FID_BAYER8x8 = FREE_IMAGE_DITHER(2); // Bayer ordered dispersed dot dithering (order 3 dithering matrix) - FID_CLUSTER6x6 = FREE_IMAGE_DITHER(3); // Ordered clustered dot dithering (order 3 - 6x6 matrix) - FID_CLUSTER8x8 = FREE_IMAGE_DITHER(4); // Ordered clustered dot dithering (order 4 - 8x8 matrix) - FID_CLUSTER16x16 = FREE_IMAGE_DITHER(5); // Ordered clustered dot dithering (order 8 - 16x16 matrix) - FID_BAYER16x16 = FREE_IMAGE_DITHER(6); // Bayer ordered dispersed dot dithering (order 4 dithering matrix) - - // Lossless JPEG transformations Constants used in FreeImage_JPEGTransform - FIJPEG_OP_NONE = FREE_IMAGE_JPEG_OPERATION(0); // no transformation - FIJPEG_OP_FLIP_H = FREE_IMAGE_JPEG_OPERATION(1); // horizontal flip - FIJPEG_OP_FLIP_V = FREE_IMAGE_JPEG_OPERATION(2); // vertical flip - FIJPEG_OP_TRANSPOSE = FREE_IMAGE_JPEG_OPERATION(3); // transpose across UL-to-LR axis - FIJPEG_OP_TRANSVERSE = FREE_IMAGE_JPEG_OPERATION(4); // transpose across UR-to-LL axis - FIJPEG_OP_ROTATE_90 = FREE_IMAGE_JPEG_OPERATION(5); // 90-degree clockwise rotation - FIJPEG_OP_ROTATE_180 = FREE_IMAGE_JPEG_OPERATION(6); // 180-degree rotation - FIJPEG_OP_ROTATE_270 = FREE_IMAGE_JPEG_OPERATION(7); // 270-degree clockwise (or 90 ccw) - - // Tone mapping operators. Constants used in FreeImage_ToneMapping. - FITMO_DRAGO03 = FREE_IMAGE_TMO(0); // Adaptive logarithmic mapping (F. Drago, 2003) - FITMO_REINHARD05 = FREE_IMAGE_TMO(1); // Dynamic range reduction inspired by photoreceptor physiology (E. Reinhard, 2005) - FITMO_FATTAL02 = FREE_IMAGE_TMO(2); // Gradient domain high dynamic range compression (R. Fattal, 2002) - - // Upsampling / downsampling filters. Constants used in FreeImage_Rescale. - FILTER_BOX = FREE_IMAGE_FILTER(0); // Box, pulse, Fourier window, 1st order (constant) b-spline - FILTER_BICUBIC = FREE_IMAGE_FILTER(1); // Mitchell & Netravali's two-param cubic filter - FILTER_BILINEAR = FREE_IMAGE_FILTER(2); // Bilinear filter - FILTER_BSPLINE = FREE_IMAGE_FILTER(3); // 4th order (cubic) b-spline - FILTER_CATMULLROM = FREE_IMAGE_FILTER(4); // Catmull-Rom spline, Overhauser spline - FILTER_LANCZOS3 = FREE_IMAGE_FILTER(5); // Lanczos3 filter - - // Color channels. Constants used in color manipulation routines. - FICC_RGB = FREE_IMAGE_COLOR_CHANNEL(0); // Use red, green and blue channels - FICC_RED = FREE_IMAGE_COLOR_CHANNEL(1); // Use red channel - FICC_GREEN = FREE_IMAGE_COLOR_CHANNEL(2); // Use green channel - FICC_BLUE = FREE_IMAGE_COLOR_CHANNEL(3); // Use blue channel - FICC_ALPHA = FREE_IMAGE_COLOR_CHANNEL(4); // Use alpha channel - FICC_BLACK = FREE_IMAGE_COLOR_CHANNEL(5); // Use black channel - FICC_REAL = FREE_IMAGE_COLOR_CHANNEL(6); // Complex images: use real part - FICC_IMAG = FREE_IMAGE_COLOR_CHANNEL(7); // Complex images: use imaginary part - FICC_MAG = FREE_IMAGE_COLOR_CHANNEL(8); // Complex images: use magnitude - FICC_PHASE = FREE_IMAGE_COLOR_CHANNEL(9); // Complex images: use phase - - // Tag data type information (based on TIFF specifications) - FIDT_NOTYPE = FREE_IMAGE_MDTYPE(0); // placeholder - FIDT_BYTE = FREE_IMAGE_MDTYPE(1); // 8-bit unsigned integer - FIDT_ASCII = FREE_IMAGE_MDTYPE(2); // 8-bit bytes w/ last byte null - FIDT_SHORT = FREE_IMAGE_MDTYPE(3); // 16-bit unsigned integer - FIDT_LONG = FREE_IMAGE_MDTYPE(4); // 32-bit unsigned integer - FIDT_RATIONAL = FREE_IMAGE_MDTYPE(5); // 64-bit unsigned fraction - FIDT_SBYTE = FREE_IMAGE_MDTYPE(6); // 8-bit signed integer - FIDT_UNDEFINED = FREE_IMAGE_MDTYPE(7); // 8-bit untyped data - FIDT_SSHORT = FREE_IMAGE_MDTYPE(8); // 16-bit signed integer - FIDT_SLONG = FREE_IMAGE_MDTYPE(9); // 32-bit signed integer - FIDT_SRATIONAL = FREE_IMAGE_MDTYPE(10); // 64-bit signed fraction - FIDT_FLOAT = FREE_IMAGE_MDTYPE(11); // 32-bit IEEE floating point - FIDT_DOUBLE = FREE_IMAGE_MDTYPE(12); // 64-bit IEEE floating point - FIDT_IFD = FREE_IMAGE_MDTYPE(13); // 32-bit unsigned integer (offset) - FIDT_PALETTE = FREE_IMAGE_MDTYPE(14); // 32-bit RGBQUAD - FIDT_LONG8 = FREE_IMAGE_MDTYPE(16); // 64-bit unsigned integer - FIDT_SLONG8 = FREE_IMAGE_MDTYPE(17); // 64-bit signed integer - FIDT_IFD8 = FREE_IMAGE_MDTYPE(18); // 64-bit unsigned integer (offset) - - // Metadata models supported by FreeImage - FIMD_NODATA = FREE_IMAGE_MDMODEL(-1); - FIMD_COMMENTS = FREE_IMAGE_MDMODEL(0); // single comment or keywords - FIMD_EXIF_MAIN = FREE_IMAGE_MDMODEL(1); // Exif-TIFF metadata - FIMD_EXIF_EXIF = FREE_IMAGE_MDMODEL(2); // Exif-specific metadata - FIMD_EXIF_GPS = FREE_IMAGE_MDMODEL(3); // Exif GPS metadata - FIMD_EXIF_MAKERNOTE = FREE_IMAGE_MDMODEL(4); // Exif maker note metadata - FIMD_EXIF_INTEROP = FREE_IMAGE_MDMODEL(5); // Exif interoperability metadata - FIMD_IPTC = FREE_IMAGE_MDMODEL(6); // IPTC/NAA metadata - FIMD_XMP = FREE_IMAGE_MDMODEL(7); // Abobe XMP metadata - FIMD_GEOTIFF = FREE_IMAGE_MDMODEL(8); // GeoTIFF metadata (to be implemented) - FIMD_ANIMATION = FREE_IMAGE_MDMODEL(9); // Animation metadata - FIMD_CUSTOM = FREE_IMAGE_MDMODEL(10); // Used to attach other metadata types to a dib - FIMD_EXIF_RAW = FREE_IMAGE_MDMODEL(11); // Exif metadata as a raw buffer - -type - // Handle to a metadata model - FIMETADATA = record - data: Pointer; - end; - PFIMETADATA = ^FIMETADATA; - - // Handle to a metadata tag - FITAG = record - data: Pointer; - end; - PFITAG = ^FITAG; - -// -------------------------------------------------------------------------- -// File IO routines --------------------------------------------------------- -// -------------------------------------------------------------------------- - -type - fi_handle = Pointer; - - FI_ReadProc = function(buffer: Pointer; size, count: Cardinal; - handle: fi_handle): Cardinal; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - FI_WriteProc = function(buffer: Pointer; size, count: Cardinal; - handle: fi_handle): Cardinal; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - FI_SeekProc = function(handle: fi_handle; offset: LongInt; - origin: Integer): Integer; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - FI_TellProc = function(handle: fi_handle): LongInt; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - - FreeImageIO = packed record - read_proc : FI_ReadProc; // pointer to the function used to read data - write_proc: FI_WriteProc; // pointer to the function used to write data - seek_proc : FI_SeekProc; // pointer to the function used to seek - tell_proc : FI_TellProc; // pointer to the function used to aquire the current position - end; - PFreeImageIO = ^FreeImageIO; - - // Handle to a memory I/O stream - FIMEMORY = record - data: Pointer; - end; - PFIMEMORY = ^FIMEMORY; - -const - // constants used in FreeImage_Seek for Origin parameter - SEEK_SET = 0; - SEEK_CUR = 1; - SEEK_END = 2; - -//type - // define portable types for 32-bit / 64-bit OS - //FIINT64 = Int64; - //FIUINT64 = UInt64; - -// -------------------------------------------------------------------------- -// Plugin routines ---------------------------------------------------------- -// -------------------------------------------------------------------------- - -type - PPlugin = ^Plugin; - - FI_FormatProc = function: PAnsiChar; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - FI_DescriptionProc = function: PAnsiChar; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - FI_ExtensionListProc = function: PAnsiChar; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - FI_RegExprProc = function: PAnsiChar; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - FI_OpenProc = function(io: PFreeImageIO; handle: fi_handle; - read: LongBool): Pointer; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - FI_CloseProc = procedure(io: PFreeImageIO; handle: fi_handle; - data: Pointer); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - FI_PageCountProc = function(io: PFreeImageIO; handle: fi_handle; - data: Pointer): Integer; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - FI_PageCapabilityProc = function(io: PFreeImageIO; handle: fi_handle; - data: Pointer): Integer; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - FI_LoadProc = function(io: PFreeImageIO; handle: fi_handle; page, flags: Integer; - data: Pointer): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - FI_SaveProc = function(io: PFreeImageIO; dib: PFIBITMAP; handle: fi_handle; - page, flags: Integer; data: Pointer): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - FI_ValidateProc = function(io: PFreeImageIO; handle: fi_handle): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - FI_MimeProc = function: PAnsiChar; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - FI_SupportsExportBPPProc = function(bpp: integer): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - FI_SupportsExportTypeProc = function(_type: FREE_IMAGE_TYPE): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - FI_SupportsICCProfilesProc = function: LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - FI_SupportsNoPixelsProc = function: LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - - Plugin = record - format_proc: FI_FormatProc; - description_proc: FI_DescriptionProc; - extension_proc: FI_ExtensionListProc; - regexpr_proc: FI_RegExprProc; - open_proc: FI_OpenProc; - close_proc: FI_CloseProc; - pagecount_proc: FI_PageCountProc; - pagecapability_proc: FI_PageCapabilityProc; - load_proc: FI_LoadProc; - save_proc: FI_SaveProc; - validate_proc: FI_ValidateProc; - mime_proc: FI_MimeProc; - supports_export_bpp_proc: FI_SupportsExportBPPProc; - supports_export_type_proc: FI_SupportsExportTypeProc; - supports_icc_profiles_proc: FI_SupportsICCProfilesProc; - supports_no_pixels_proc: FI_SupportsNoPixelsProc; - end; - - FI_InitProc = procedure(aplugin: PPlugin; format_id: Integer); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - -// -------------------------------------------------------------------------- -// Load/Save flag constants ------------------------------------------------- -// -------------------------------------------------------------------------- - -const - FIF_LOAD_NOPIXELS = $8000; //! loading: load the image header only (not supported by all plugins, default to full loading) - BMP_DEFAULT = 0; - BMP_SAVE_RLE = 1; - CUT_DEFAULT = 0; - DDS_DEFAULT = 0; - EXR_DEFAULT = 0; //! save data as half with piz-based wavelet compression - EXR_FLOAT = $0001; //! save data as float instead of as half (not recommended) - EXR_NONE = $0002; //! save with no compression - EXR_ZIP = $0004; //! save with zlib compression, in blocks of 16 scan lines - EXR_PIZ = $0008; //! save with piz-based wavelet compression - EXR_PXR24 = $0010; //! save with lossy 24-bit float compression - EXR_B44 = $0020; //! save with lossy 44% float compression - goes to 22% when combined with EXR_LC - EXR_LC = $0040; //! save images with one luminance and two chroma channels, rather than as RGB (lossy compression) - FAXG3_DEFAULT = 0; - GIF_DEFAULT = 0; - GIF_LOAD256 = 1; //! Load the image as a 256 color image with ununsed palette entries, if it's 16 or 2 color - GIF_PLAYBACK = 2; //! 'Play' the GIF to generate each frame (as 32bpp) instead of returning raw frame data when loading - HDR_DEFAULT = 0; - ICO_DEFAULT = 0; - ICO_MAKEALPHA = 1; //! convert to 32bpp and create an alpha channel from the AND-mask when loading - IFF_DEFAULT = 0; - J2K_DEFAULT = 0; //! save with a 16:1 rate - JP2_DEFAULT = 0; //! save with a 16:1 rate - JPEG_DEFAULT = 0; //! loading (see JPEG_FAST); saving (see JPEG_QUALITYGOOD|JPEG_SUBSAMPLING_420) - JPEG_FAST = 1; //! load the file as fast as possible, sacrificing some quality - JPEG_ACCURATE = 2; //! load the file with the best quality, sacrificing some speed - JPEG_CMYK = $0004; //! load separated CMYK "as is" (use | to combine with other flags) - JPEG_EXIFROTATE = $0008; //! load and rotate according to Exif 'Orientation' tag if available - JPEG_GREYSCALE = $0010; //! load and convert to a 8-bit greyscale image - JPEG_QUALITYSUPERB = $0080; //! save with superb quality (100:1) - JPEG_QUALITYGOOD = $0100; //! save with good quality (75:1) - JPEG_QUALITYNORMAL = $0200; //! save with normal quality (50:1) - JPEG_QUALITYAVERAGE = $0400; //! save with average quality (25:1) - JPEG_QUALITYBAD = $0800; //! save with bad quality (10:1) - JPEG_PROGRESSIVE = $2000; //! save as a progressive-JPEG (use | to combine with other save flags) - JPEG_SUBSAMPLING_411 = $1000; //! save with high 4x1 chroma subsampling (4:1:1) - JPEG_SUBSAMPLING_420 = $4000; //! save with medium 2x2 medium chroma subsampling (4:2:0) - default value - JPEG_SUBSAMPLING_422 = $8000; //! save with low 2x1 chroma subsampling (4:2:2) - JPEG_SUBSAMPLING_444 = $10000; //! save with no chroma subsampling (4:4:4) - JPEG_OPTIMIZE = $20000; //! on saving, compute optimal Huffman coding tables (can reduce a few percent of file size) - JPEG_BASELINE = $40000; //! save basic JPEG, without metadata or any markers - KOALA_DEFAULT = 0; - LBM_DEFAULT = 0; - MNG_DEFAULT = 0; - PCD_DEFAULT = 0; - PCD_BASE = 1; //! load the bitmap sized 768 x 512 - PCD_BASEDIV4 = 2; //! load the bitmap sized 384 x 256 - PCD_BASEDIV16 = 3; //! load the bitmap sized 192 x 128 - PCX_DEFAULT = 0; - PFM_DEFAULT = 0; - PICT_DEFAULT = 0; - PNG_DEFAULT = 0; - PNG_IGNOREGAMMA = 1; //! loading: avoid gamma correction - PNG_Z_BEST_SPEED = $0001; //! save using ZLib level 1 compression flag (default value is 6) - PNG_Z_DEFAULT_COMPRESSION = $0006; //! save using ZLib level 6 compression flag (default recommended value) - PNG_Z_BEST_COMPRESSION = $0009; //! save using ZLib level 9 compression flag (default value is 6) - PNG_Z_NO_COMPRESSION = $0100; //! save without ZLib compression - PNG_INTERLACED = $0200; //! save using Adam7 interlacing (use | to combine with other save flags) - PNM_DEFAULT = 0; - PNM_SAVE_RAW = 0; //! if set the writer saves in RAW format (i.e. P4, P5 or P6) - PNM_SAVE_ASCII = 1; //! if set the writer saves in ASCII format (i.e. P1, P2 or P3) - PSD_DEFAULT = 0; - PSD_CMYK = 1; //! reads tags for separated CMYK (default is conversion to RGB) - PSD_LAB = 2; //! reads tags for CIELab (default is conversion to RGB) - RAS_DEFAULT = 0; - RAW_DEFAULT = 0; //! load the file as linear RGB 48-bit - RAW_PREVIEW = 1; //! try to load the embedded JPEG preview with included Exif Data or default to RGB 24-bit - RAW_DISPLAY = 2; //! load the file as RGB 24-bit - RAW_HALFSIZE = 4; //! output a half-size color image - SGI_DEFAULT = 0; - TARGA_DEFAULT = 0; - TARGA_LOAD_RGB888 = 1; //! if set the loader converts RGB555 and ARGB8888 -> RGB888. - TARGA_SAVE_RLE = 2; //! if set, the writer saves with RLE compression - TIFF_DEFAULT = 0; - TIFF_CMYK = $0001; //! reads/stores tags for separated CMYK (use | to combine with compression flags) - TIFF_PACKBITS = $0100; //! save using PACKBITS compression - TIFF_DEFLATE = $0200; //! save using DEFLATE compression - TIFF_ADOBE_DEFLATE = $0400; //! save using ADOBE DEFLATE compression - TIFF_NONE = $0800; //! save without any compression - TIFF_CCITTFAX3 = $1000; //! save using CCITT Group 3 fax encoding - TIFF_CCITTFAX4 = $2000; //! save using CCITT Group 4 fax encoding - TIFF_LZW = $4000; //! save using LZW compression - TIFF_JPEG = $8000; //! save using JPEG compression - TIFF_LOGLUV = $10000; //! save using LogLuv compression - WBMP_DEFAULT = 0; - XBM_DEFAULT = 0; - XPM_DEFAULT = 0; - WEBP_DEFAULT = 0; //! save with good quality (75:1) - WEBP_LOSSLESS = $100; //! save in lossless mode - JXR_DEFAULT = 0; //! save with quality 80 and no chroma subsampling (4:4:4) - JXR_LOSSLESS = $0064; //! save lossless - JXR_PROGRESSIVE = $2000; //! save as a progressive-JXR (use | to combine with other save flags) - -// -------------------------------------------------------------------------- -// Background filling options ----------------------------------------------- -// Constants used in FreeImage_FillBackground and FreeImage_EnlargeCanvas -// -------------------------------------------------------------------------- - -const - FI_COLOR_IS_RGB_COLOR = $00; // RGBQUAD color is a RGB color (contains no valid alpha channel) - FI_COLOR_IS_RGBA_COLOR = $01; // RGBQUAD color is a RGBA color (contains a valid alpha channel) - FI_COLOR_FIND_EQUAL_COLOR = $02; // For palettized images: lookup equal RGB color from palette - FI_COLOR_ALPHA_IS_INDEX = $04; // The color's rgbReserved member (alpha) contains the palette index to be used - FI_COLOR_PALETTE_SEARCH_MASK = FI_COLOR_FIND_EQUAL_COLOR or FI_COLOR_ALPHA_IS_INDEX; // No color lookup is performed - -// -------------------------------------------------------------------------- -// Init/Error routines ------------------------------------------------------ -// -------------------------------------------------------------------------- - -procedure FreeImage_Initialise(load_local_plugins_only: LongBool = False); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_Initialise@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_Initialise'{$ENDIF}; -procedure FreeImage_DeInitialise; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_DeInitialise@0'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_DeInitialise'{$ENDIF}; - -// -------------------------------------------------------------------------- -// Version routines --------------------------------------------------------- -// -------------------------------------------------------------------------- - -function FreeImage_GetVersion: PAnsiChar; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetVersion@0'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetVersion'{$ENDIF}; -function FreeImage_GetCopyrightMessage: PAnsiChar; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetCopyrightMessage@0'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetCopyrightMessage'{$ENDIF}; - -// -------------------------------------------------------------------------- -// Message output functions ------------------------------------------------- -// -------------------------------------------------------------------------- - -type - FreeImage_OutputMessageFunction = procedure(fif: FREE_IMAGE_FORMAT; - msg: PAnsiChar); cdecl; - FreeImage_OutputMessageFunctionStdCall = procedure(fif: FREE_IMAGE_FORMAT; - msg: PAnsiChar); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - -procedure FreeImage_SetOutputMessageStdCall(omf: FreeImage_OutputMessageFunctionStdCall); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_SetOutputMessageStdCall@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_SetOutputMessageStdCall'{$ENDIF}; -procedure FreeImage_SetOutputMessage(omf: FreeImage_OutputMessageFunction); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_SetOutputMessage@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_SetOutputMessage'{$ENDIF}; - -{$IFDEF DELPHI6} -//this is declared stdcall in the C header but it is actually cdecl. -//with varargs functions, clearing the stack is caller's responsibility -//(since the callee doesn't know how many parameters were passed). -//cdecl is the right convention here, not stdcall -procedure FreeImage_OutputMessageProc(fif: Integer; fmt: PAnsiChar); cdecl; varargs; - external FIDLL; -{$ELSE} -//older Delphi versions (<6) do not support varargs. -//we provide a wrapper that uses open arrays instead -procedure FreeImage_OutputMessageProc(fif: Integer; fmt: PAnsiChar; args: array of const); -{$ENDIF} - -// -------------------------------------------------------------------------- -// Allocate / Clone / Unload routines --------------------------------------- -// -------------------------------------------------------------------------- - -function FreeImage_Allocate(width, height, bpp: Integer; red_mask: Cardinal = 0; - green_mask: Cardinal = 0; blue_mask: Cardinal = 0): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_Allocate@24'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_Allocate'{$ENDIF}; -function FreeImage_AllocateT(_type: FREE_IMAGE_TYPE; width, height: Integer; - bpp: Integer = 8; red_mask: Cardinal = 0; green_mask: Cardinal = 0; - blue_mask: Cardinal = 0): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_AllocateT@28'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_AllocateT'{$ENDIF}; -function FreeImage_Clone(dib: PFIBITMAP): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_Clone@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_Clone'{$ENDIF}; -procedure FreeImage_Unload(dib: PFIBITMAP); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_Unload@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_Unload'{$ENDIF}; - -// -------------------------------------------------------------------------- -// Header loading routines -// -------------------------------------------------------------------------- -function FreeImage_HasPixels(dib: PFIBITMAP): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_HasPixels@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_HasPixels'{$ENDIF}; - -// -------------------------------------------------------------------------- -// Load / Save routines ----------------------------------------------------- -// -------------------------------------------------------------------------- - -function FreeImage_Load(fif: FREE_IMAGE_FORMAT; filename: PAnsiChar; - flags: Integer = 0): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_Load@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_Load'{$ENDIF}; -function FreeImage_LoadU(fif: FREE_IMAGE_FORMAT; filename: PWideChar; - flags: Integer = 0): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_LoadU@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_LoadU'{$ENDIF}; -function FreeImage_LoadFromHandle(fif: FREE_IMAGE_FORMAT; io: PFreeImageIO; - handle: fi_handle; flags: Integer = 0): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_LoadFromHandle@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_LoadFromHandle'{$ENDIF}; -function FreeImage_Save(fif: FREE_IMAGE_FORMAT; dib: PFIBITMAP; filename: PAnsiChar; - flags: Integer = 0): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_Save@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_Save'{$ENDIF}; -function FreeImage_SaveU(fif: FREE_IMAGE_FORMAT; dib: PFIBITMAP; filename: PWideChar; - flags: Integer = 0): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_SaveU@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_SaveU'{$ENDIF}; -function FreeImage_SaveToHandle(fif: FREE_IMAGE_FORMAT; dib: PFIBITMAP; - io: PFreeImageIO; handle: fi_handle; flags: Integer = 0): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_SaveToHandle@20'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_SaveToHandle'{$ENDIF}; - -// -------------------------------------------------------------------------- -// Memory I/O stream routines ----------------------------------------------- -// -------------------------------------------------------------------------- - -function FreeImage_OpenMemory(data: PByte = nil; size_in_bytes: DWORD = 0): PFIMEMORY; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_OpenMemory@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_OpenMemory'{$ENDIF}; -procedure FreeImage_CloseMemory(stream: PFIMEMORY); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_CloseMemory@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_CloseMemory'{$ENDIF}; -function FreeImage_LoadFromMemory(fif: FREE_IMAGE_FORMAT; stream: PFIMEMORY; - flags: Integer = 0): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_LoadFromMemory@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_LoadFromMemory'{$ENDIF}; -function FreeImage_SaveToMemory(fif: FREE_IMAGE_FORMAT; dib: PFIBITMAP; - stream: PFIMEMORY; flags: Integer = 0): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_SaveToMemory@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_SaveToMemory'{$ENDIF}; -function FreeImage_TellMemory(stream: PFIMEMORY): LongInt; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_TellMemory@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_TellMemory'{$ENDIF}; -function FreeImage_SeekMemory(stream: PFIMEMORY; offset: LongInt; - origin: Integer): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_SeekMemory@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_SeekMemory'{$ENDIF}; -function FreeImage_AcquireMemory(stream: PFIMEMORY; var data: PByte; - var size_in_bytes: DWORD): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_AcquireMemory@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_AcquireMemory'{$ENDIF}; -function FreeImage_ReadMemory(buffer: Pointer; size, count: Cardinal; - stream: PFIMEMORY): Cardinal; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ReadMemory@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ReadMemory'{$ENDIF}; -function FreeImage_WriteMemory(buffer: Pointer; size, count: Cardinal; - stream: PFIMEMORY): Cardinal; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_WriteMemory@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_WriteMemory'{$ENDIF}; -function FreeImage_LoadMultiBitmapFromMemory(fif: FREE_IMAGE_FORMAT; stream: PFIMEMORY; - flags: Integer = 0): PFIMULTIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_LoadMultiBitmapFromMemory@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_LoadMultiBitmapFromMemory'{$ENDIF}; -function FreeImage_SaveMultiBitmapToMemory(fif: FREE_IMAGE_FORMAT; bitmap: PFIMULTIBITMAP; - stream: PFIMEMORY; flags: Integer): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_SaveMultiBitmapToMemory@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_SaveMultiBitmapToMemory'{$ENDIF}; - -// -------------------------------------------------------------------------- -// Plugin Interface --------------------------------------------------------- -// -------------------------------------------------------------------------- - -function FreeImage_RegisterLocalPlugin(proc_address: FI_InitProc; format: PAnsiChar = nil; - description: PAnsiChar = nil; extension: PAnsiChar = nil; - regexpr: PAnsiChar = nil): FREE_IMAGE_FORMAT; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_RegisterLocalPlugin@20'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_RegisterLocalPlugin'{$ENDIF}; -function FreeImage_RegisterExternalPlugin(path: PAnsiChar; format: PAnsiChar = nil; - description: PAnsiChar = nil; extension: PAnsiChar = nil; - regexpr: PAnsiChar = nil): FREE_IMAGE_FORMAT; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_RegisterExternalPlugin@20'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_RegisterExternalPlugin'{$ENDIF}; -function FreeImage_GetFIFCount: Integer; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetFIFCount@0'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetFIFCount'{$ENDIF}; -procedure FreeImage_SetPluginEnabled(fif: FREE_IMAGE_FORMAT; enable: LongBool); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_SetPluginEnabled@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_SetPluginEnabled'{$ENDIF}; -function FreeImage_IsPluginEnabled(fif: FREE_IMAGE_FORMAT): Integer; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_IsPluginEnabled@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_IsPluginEnabled'{$ENDIF}; -function FreeImage_GetFIFFromFormat(format: PAnsiChar): FREE_IMAGE_FORMAT; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetFIFFromFormat@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetFIFFromFormat'{$ENDIF}; -function FreeImage_GetFIFFromMime(mime: PAnsiChar): FREE_IMAGE_FORMAT; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetFIFFromMime@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetFIFFromMime'{$ENDIF}; -function FreeImage_GetFormatFromFIF(fif: FREE_IMAGE_FORMAT): PAnsiChar; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetFormatFromFIF@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetFormatFromFIF'{$ENDIF}; -function FreeImage_GetFIFExtensionList(fif: FREE_IMAGE_FORMAT): PAnsiChar; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetFIFExtensionList@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetFIFExtensionList'{$ENDIF}; -function FreeImage_GetFIFDescription(fif: FREE_IMAGE_FORMAT): PAnsiChar; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetFIFDescription@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetFIFDescription'{$ENDIF}; -function FreeImage_GetFIFRegExpr(fif: FREE_IMAGE_FORMAT): PAnsiChar; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetFIFRegExpr@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetFIFRegExpr'{$ENDIF}; -function FreeImage_GetFIFMimeType(fif: FREE_IMAGE_FORMAT): PAnsiChar; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetFIFMimeType@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetFIFMimeType'{$ENDIF}; -function FreeImage_GetFIFFromFilename(filename: PAnsiChar): FREE_IMAGE_FORMAT; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetFIFFromFilename@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetFIFFromFilename'{$ENDIF}; -function FreeImage_GetFIFFromFilenameU(filename: PWideChar): FREE_IMAGE_FORMAT; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetFIFFromFilenameU@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetFIFFromFilenameU'{$ENDIF}; -function FreeImage_FIFSupportsReading(fif: FREE_IMAGE_FORMAT): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_FIFSupportsReading@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_FIFSupportsReading'{$ENDIF}; -function FreeImage_FIFSupportsWriting(fif: FREE_IMAGE_FORMAT): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_FIFSupportsWriting@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_FIFSupportsWriting'{$ENDIF}; -function FreeImage_FIFSupportsExportBPP(fif: FREE_IMAGE_FORMAT; - bpp: Integer): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_FIFSupportsExportBPP@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_FIFSupportsExportBPP'{$ENDIF}; -function FreeImage_FIFSupportsExportType(fif: FREE_IMAGE_FORMAT; - _type: FREE_IMAGE_TYPE): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_FIFSupportsExportType@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_FIFSupportsExportType'{$ENDIF}; -function FreeImage_FIFSupportsICCProfiles(fif: FREE_IMAGE_FORMAT): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_FIFSupportsICCProfiles@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_FIFSupportsICCProfiles'{$ENDIF}; -function FreeImage_FIFSupportsNoPixels(fif: FREE_IMAGE_FORMAT): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_FIFSupportsNoPixels@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_FIFSupportsNoPixels'{$ENDIF}; - -// -------------------------------------------------------------------------- -// Multipaging interface ---------------------------------------------------- -// -------------------------------------------------------------------------- - -function FreeImage_OpenMultiBitmap(fif: FREE_IMAGE_FORMAT; filename: PAnsiChar; - create_new, read_only: LongBool; keep_cache_in_memory: LongBool = False; - flags: Integer = 0): PFIMULTIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_OpenMultiBitmap@24'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_OpenMultiBitmap'{$ENDIF}; -function FreeImage_OpenMultiBitmapFromHandle(fif: FREE_IMAGE_FORMAT; io: PFreeImageIO; - handle: fi_handle; flags: Integer = 0): PFIMULTIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_OpenMultiBitmapFromHandle@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_OpenMultiBitmapFromHandle'{$ENDIF}; -function FreeImage_SaveMultiBitmapToHandle(fif: FREE_IMAGE_FORMAT; bitmap: PFIMULTIBITMAP; - io: PFreeImageIO; handle: fi_handle; flags: Integer = 0): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_SaveMultiBitmapToHandle@20'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_SaveMultiBitmapToHandle'{$ENDIF}; -function FreeImage_CloseMultiBitmap(bitmap: PFIMULTIBITMAP; - flags: Integer = 0): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_CloseMultiBitmap@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_CloseMultiBitmap'{$ENDIF}; -function FreeImage_GetPageCount(bitmap: PFIMULTIBITMAP): Integer; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetPageCount@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetPageCount'{$ENDIF}; -procedure FreeImage_AppendPage(bitmap: PFIMULTIBITMAP; data: PFIBITMAP); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_AppendPage@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_AppendPage'{$ENDIF}; -procedure FreeImage_InsertPage(bitmap: PFIMULTIBITMAP; page: Integer; - data: PFIBITMAP); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_InsertPage@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_InsertPage'{$ENDIF}; -procedure FreeImage_DeletePage(bitmap: PFIMULTIBITMAP; page: Integer); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_DeletePage@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_DeletePage'{$ENDIF}; -function FreeImage_LockPage(bitmap: PFIMULTIBITMAP; page: Integer): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_LockPage@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_LockPage'{$ENDIF}; -procedure FreeImage_UnlockPage(bitmap: PFIMULTIBITMAP; data: PFIBITMAP; - changed: LongBool); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_UnlockPage@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_UnlockPage'{$ENDIF}; -function FreeImage_MovePage(bitmap: PFIMULTIBITMAP; target, source: Integer): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_MovePage@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_MovePage'{$ENDIF}; -function FreeImage_GetLockedPageNumbers(bitmap: PFIMULTIBITMAP; var pages: Integer; - var count: Integer): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetLockedPageNumbers@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetLockedPageNumbers'{$ENDIF}; - -// -------------------------------------------------------------------------- -// Filetype request routines ------------------------------------------------ -// -------------------------------------------------------------------------- - -function FreeImage_GetFileType(filename: PAnsiChar; - size: Integer = 0): FREE_IMAGE_FORMAT; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetFileType@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetFileType'{$ENDIF}; -function FreeImage_GetFileTypeU(filename: PWideChar; - size: Integer = 0): FREE_IMAGE_FORMAT; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetFileTypeU@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetFileTypeU'{$ENDIF}; -function FreeImage_GetFileTypeFromHandle(io: PFreeImageIO; handle: FI_Handle; - size: Integer = 0): FREE_IMAGE_FORMAT; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetFileTypeFromHandle@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetFileTypeFromHandle'{$ENDIF}; -function FreeImage_GetFileTypeFromMemory(stream: PFIMEMORY; - size: Integer = 0): FREE_IMAGE_FORMAT; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetFileTypeFromMemory@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetFileTypeFromMemory'{$ENDIF}; - -// -------------------------------------------------------------------------- -// ImageType request routine ------------------------------------------------ -// -------------------------------------------------------------------------- - -function FreeImage_GetImageType(dib: PFIBITMAP): FREE_IMAGE_TYPE; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetImageType@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetImageType'{$ENDIF}; - -// -------------------------------------------------------------------------- -// FreeImage helper routines ------------------------------------------------ -// -------------------------------------------------------------------------- - -function FreeImage_IsLittleEndian: LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_IsLittleEndian@0'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_IsLittleEndian'{$ENDIF}; -function FreeImage_LookupX11Color(szColor: PAnsiChar; var nRed, nGreen, nBlue: Byte): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_LookupX11Color@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_LookupX11Color'{$ENDIF}; -function FreeImage_LookupSVGColor(szColor: PAnsiChar; var nRed, nGreen, nBlue: Byte): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_LookupSVGColor@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_LookupSVGColor'{$ENDIF}; - -// -------------------------------------------------------------------------- -// Pixels access routines --------------------------------------------------- -// -------------------------------------------------------------------------- - -function FreeImage_GetBits(dib: PFIBITMAP): PByte; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetBits@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetBits'{$ENDIF}; -function FreeImage_GetScanLine(dib: PFIBITMAP; scanline: Integer): PByte; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetScanLine@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetScanLine'{$ENDIF}; - -function FreeImage_GetPixelIndex(dib: PFIBITMAP; x, y: Cardinal; var value: Byte): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetPixelIndex@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetPixelIndex'{$ENDIF}; -function FreeImage_GetPixelColor(dib: PFIBITMAP; x, y: Cardinal; var value: RGBQUAD): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetPixelColor@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetPixelColor'{$ENDIF}; -function FreeImage_SetPixelIndex(dib: PFIBITMAP; x, y: Cardinal; var value: Byte): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_SetPixelIndex@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_SetPixelIndex'{$ENDIF}; -function FreeImage_SetPixelColor(dib: PFIBITMAP; x, y: Cardinal; var value: RGBQUAD): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_SetPixelColor@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_SetPixelColor'{$ENDIF}; - -// -------------------------------------------------------------------------- -// DIB info routines -------------------------------------------------------- -// -------------------------------------------------------------------------- - -function FreeImage_GetColorsUsed(dib: PFIBITMAP): Cardinal; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetColorsUsed@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetColorsUsed'{$ENDIF}; -function FreeImage_GetBPP(dib: PFIBITMAP): Cardinal; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetBPP@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetBPP'{$ENDIF}; -function FreeImage_GetWidth(dib: PFIBITMAP): Cardinal; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetWidth@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetWidth'{$ENDIF}; -function FreeImage_GetHeight(dib: PFIBITMAP): Cardinal; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetHeight@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetHeight'{$ENDIF}; -function FreeImage_GetLine(dib: PFIBITMAP): Cardinal; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetLine@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetLine'{$ENDIF}; -function FreeImage_GetPitch(dib: PFIBITMAP): Cardinal; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetPitch@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetPitch'{$ENDIF}; -function FreeImage_GetDIBSize(dib: PFIBITMAP): Cardinal; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetDIBSize@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetDIBSize'{$ENDIF}; -function FreeImage_GetPalette(dib: PFIBITMAP): PRGBQuad; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetPalette@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetPalette'{$ENDIF}; - -function FreeImage_GetDotsPerMeterX(dib: PFIBITMAP): Cardinal; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetDotsPerMeterX@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetDotsPerMeterX'{$ENDIF}; -function FreeImage_GetDotsPerMeterY(dib: PFIBITMAP): Cardinal; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetDotsPerMeterY@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetDotsPerMeterY'{$ENDIF}; -procedure FreeImage_SetDotsPerMeterX(dib: PFIBITMAP; res: Cardinal); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_SetDotsPerMeterX@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_SetDotsPerMeterX'{$ENDIF}; -procedure FreeImage_SetDotsPerMeterY(dib: PFIBITMAP; res: Cardinal); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_SetDotsPerMeterY@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_SetDotsPerMeterY'{$ENDIF}; - -function FreeImage_GetInfoHeader(dib: PFIBITMAP): PBITMAPINFOHEADER; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetInfoHeader@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetInfoHeader'{$ENDIF}; -function FreeImage_GetInfo(dib: PFIBITMAP): PBITMAPINFO; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetInfo@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetInfo'{$ENDIF}; -function FreeImage_GetColorType(dib: PFIBITMAP): FREE_IMAGE_COLOR_TYPE; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetColorType@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetColorType'{$ENDIF}; - -function FreeImage_GetRedMask(dib: PFIBITMAP): Cardinal; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetRedMask@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetRedMask'{$ENDIF}; -function FreeImage_GetGreenMask(dib: PFIBITMAP): Cardinal; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetGreenMask@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetGreenMask'{$ENDIF}; -function FreeImage_GetBlueMask(dib: PFIBITMAP): Cardinal; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetBlueMask@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetBlueMask'{$ENDIF}; - -function FreeImage_GetTransparencyCount(dib: PFIBITMAP): Cardinal; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetTransparencyCount@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetTransparencyCount'{$ENDIF}; -function FreeImage_GetTransparencyTable(dib: PFIBITMAP): PByte; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetTransparencyTable@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetTransparencyTable'{$ENDIF}; -procedure FreeImage_SetTransparent(dib: PFIBITMAP; enabled: LongBool); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_SetTransparent@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_SetTransparent'{$ENDIF}; -procedure FreeImage_SetTransparencyTable(dib: PFIBITMAP; table: PByte; - count: Integer); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_SetTransparencyTable@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_SetTransparencyTable'{$ENDIF}; -function FreeImage_IsTransparent(dib: PFIBITMAP): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_IsTransparent@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_IsTransparent'{$ENDIF}; -procedure FreeImage_SetTransparentIndex(dib: PFIBITMAP; index: Integer); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_SetTransparentIndex@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_SetTransparentIndex'{$ENDIF}; -function FreeImage_GetTransparentIndex(dib: PFIBITMAP): Integer; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetTransparentIndex@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetTransparentIndex'{$ENDIF}; - -function FreeImage_HasBackgroundColor(dib: PFIBITMAP): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_HasBackgroundColor@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_HasBackgroundColor'{$ENDIF}; -function FreeImage_GetBackgroundColor(dib: PFIBITMAP; var bkcolor: RGBQUAD): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetBackgroundColor@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetBackgroundColor'{$ENDIF}; -function FreeImage_SetBackgroundColor(dib: PFIBITMAP; bkcolor: PRGBQuad): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_SetBackgroundColor@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_SetBackgroundColor'{$ENDIF}; - -function FreeImage_GetThumbnail(dib: PFIBITMAP): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetThumbnail@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetThumbnail'{$ENDIF}; -function FreeImage_SetThumbnail(dib, thumbnail: PFIBITMAP): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_SetThumbnail@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_SetThumbnail'{$ENDIF}; - -// -------------------------------------------------------------------------- -// ICC profile routines ----------------------------------------------------- -// -------------------------------------------------------------------------- - -function FreeImage_GetICCProfile(dib: PFIBITMAP): PFIICCPROFILE; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetICCProfile@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetICCProfile'{$ENDIF}; -function FreeImage_CreateICCProfile(dib: PFIBITMAP; data: Pointer; - size: LongInt): PFIICCPROFILE; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name 'FreeImage_CreateICCProfile@12'{$ENDIF} - {$IFDEF MACOS}name 'FreeImage_CreateICCProfile'{$ENDIF}; -procedure FreeImage_DestroyICCProfile(dib: PFIBITMAP); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name 'FreeImage_DestroyICCProfile@4'{$ENDIF} - {$IFDEF MACOS}name 'FreeImage_DestroyICCProfile'{$ENDIF}; - -// -------------------------------------------------------------------------- -// Line conversion routines ------------------------------------------------- -// -------------------------------------------------------------------------- - -procedure FreeImage_ConvertLine1To4(target, source: PByte; width_in_pixels: Integer); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine1To4@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine1To4'{$ENDIF}; -procedure FreeImage_ConvertLine8To4(target, source: PByte; width_in_pixels: Integer; - palette: PRGBQuad); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine8To4@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine8To4'{$ENDIF}; -procedure FreeImage_ConvertLine16To4_555(target, source: PByte; width_in_pixels: Integer); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine16To4_555@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine16To4_555'{$ENDIF}; -procedure FreeImage_ConvertLine16To4_565(target, source: PByte; width_in_pixels: Integer); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine16To4_565@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine16To4_565'{$ENDIF}; -procedure FreeImage_ConvertLine24To4(target, source: PByte; width_in_pixels: Integer); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine24To4@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine24To4'{$ENDIF}; -procedure FreeImage_ConvertLine32To4(target, source: PByte; width_in_pixels: Integer); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine32To4@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine32To4'{$ENDIF}; - -procedure FreeImage_ConvertLine1To8(target, source: PByte; width_in_pixels: Integer); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine1To8@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine1To8'{$ENDIF}; -procedure FreeImage_ConvertLine4To8(target, source: PByte; width_in_pixels: Integer); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine4To8@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine4To8'{$ENDIF}; -procedure FreeImage_ConvertLine16To8_555(target, source: PByte; width_in_pixels: Integer); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine16To8_555@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine16To8_555'{$ENDIF}; -procedure FreeImage_ConvertLine16To8_565(target, source: PByte; width_in_pixels: Integer); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine16To8_565@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine16To8_565'{$ENDIF}; -procedure FreeImage_ConvertLine24To8(target, source: PByte; width_in_pixels: Integer); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine24To8@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine24To8'{$ENDIF}; -procedure FreeImage_ConvertLine32To8(target, source: PByte; width_in_pixels: Integer); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine32To8@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine32To8'{$ENDIF}; - -procedure FreeImage_ConvertLine1To16_555(target, source: PByte; width_in_pixels: Integer; - palette: PRGBQuad); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine1To16_555@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine1To16_555'{$ENDIF}; -procedure FreeImage_ConvertLine4To16_555(target, source: PByte; width_in_pixels: Integer; - palette: PRGBQuad); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine4To16_555@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine4To16_555'{$ENDIF}; -procedure FreeImage_ConvertLine8To16_555(target, source: PByte; width_in_pixels: Integer; - palette: PRGBQuad); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine8To16_555@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine8To16_555'{$ENDIF}; -procedure FreeImage_ConvertLine16_565_To16_555(target, source: PByte; width_in_pixels: Integer); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine16_565_To16_555@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine16_565_To16_555'{$ENDIF}; -procedure FreeImage_ConvertLine24To16_555(target, source: PByte; width_in_pixels: Integer); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine24To16_555@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine24To16_555'{$ENDIF}; -procedure FreeImage_ConvertLine32To16_555(target, source: PByte; width_in_pixels: Integer); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine32To16_555@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine32To16_555'{$ENDIF}; - -procedure FreeImage_ConvertLine1To16_565(target, source: PByte; width_in_pixels: Integer; - palette: PRGBQuad); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine1To16_565@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine1To16_565'{$ENDIF}; -procedure FreeImage_ConvertLine4To16_565(target, source: PByte; width_in_pixels: Integer; - palette: PRGBQuad); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine4To16_565@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine4To16_565'{$ENDIF}; -procedure FreeImage_ConvertLine8To16_565(target, source: PByte; width_in_pixels: Integer; - palette: PRGBQuad); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine8To16_565@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine8To16_565'{$ENDIF}; -procedure FreeImage_ConvertLine16_555_To16_565(target, source: PByte; width_in_pixels: Integer); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine16_555_To16_565@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine16_555_To16_565'{$ENDIF}; -procedure FreeImage_ConvertLine24To16_565(target, source: PByte; width_in_pixels: Integer); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine24To16_565@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine24To16_565'{$ENDIF}; -procedure FreeImage_ConvertLine32To16_565(target, source: PByte; width_in_pixels: Integer); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine32To16_565@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine32To16_565'{$ENDIF}; - -procedure FreeImage_ConvertLine1To24(target, source: PByte; width_in_pixels: Integer; - palette: PRGBQuad); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine1To24@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine1To24'{$ENDIF}; -procedure FreeImage_ConvertLine4To24(target, source: PByte; width_in_pixels: Integer; - palette: PRGBQuad); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine4To24@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine4To24'{$ENDIF}; -procedure FreeImage_ConvertLine8To24(target, source: PByte; width_in_pixels: Integer; - palette: PRGBQuad); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine8To24@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine8To24'{$ENDIF}; -procedure FreeImage_ConvertLine16To24_555(target, source: PByte; width_in_pixels: Integer); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine16To24_555@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine16To24_555'{$ENDIF}; -procedure FreeImage_ConvertLine16To24_565(target, source: PByte; width_in_pixels: Integer); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine16To24_565@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine16To24_565'{$ENDIF}; -procedure FreeImage_ConvertLine32To24(target, source: PByte; width_in_pixels: Integer); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine32To24@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine32To24'{$ENDIF}; - -procedure FreeImage_ConvertLine1To32(target, source: PByte; width_in_pixels: Integer; - palette: PRGBQuad); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine1To32@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine1To32'{$ENDIF}; -procedure FreeImage_ConvertLine4To32(target, source: PByte; width_in_pixels: Integer; - palette: PRGBQuad); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine4To32@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine4To32'{$ENDIF}; -procedure FreeImage_ConvertLine8To32(target, source: PByte; width_in_pixels: Integer; - palette: PRGBQuad); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine8To32@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine8To32'{$ENDIF}; -procedure FreeImage_ConvertLine16To32_555(target, source: PByte; width_in_pixels: Integer); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine16To32_555@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine16To32_555'{$ENDIF}; -procedure FreeImage_ConvertLine16To32_565(target, source: PByte; width_in_pixels: Integer); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine16To32_565@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine16To32_565'{$ENDIF}; -procedure FreeImage_ConvertLine24To32(target, source: PByte; width_in_pixels: Integer); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertLine24To32@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertLine24To32'{$ENDIF}; - -// -------------------------------------------------------------------------- -// Smart conversion routines ------------------------------------------------ -// -------------------------------------------------------------------------- - -function FreeImage_ConvertTo4Bits(dib: PFIBITMAP): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertTo4Bits@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertTo4Bits'{$ENDIF}; -function FreeImage_ConvertTo8Bits(dib: PFIBITMAP): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertTo8Bits@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertTo8Bits'{$ENDIF}; -function FreeImage_ConvertToGreyscale(dib: PFIBITMAP): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertToGreyscale@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertToGreyscale'{$ENDIF}; -function FreeImage_ConvertTo16Bits555(dib: PFIBITMAP): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertTo16Bits555@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertTo16Bits555'{$ENDIF}; -function FreeImage_ConvertTo16Bits565(dib: PFIBITMAP): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertTo16Bits565@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertTo16Bits565'{$ENDIF}; -function FreeImage_ConvertTo24Bits(dib: PFIBITMAP): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertTo24Bits@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertTo24Bits'{$ENDIF}; -function FreeImage_ConvertTo32Bits(dib: PFIBITMAP): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertTo32Bits@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertTo32Bits'{$ENDIF}; -function FreeImage_ColorQuantize(dib: PFIBITMAP; quantize: FREE_IMAGE_QUANTIZE): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ColorQuantize@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ColorQuantize'{$ENDIF}; -function FreeImage_ColorQuantizeEx(dib: PFIBITMAP; quantize: FREE_IMAGE_QUANTIZE = FIQ_WUQUANT; - PaletteSize: Integer = 256; ReserveSize: Integer = 0; - ReservePalette: PRGBQuad = nil): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ColorQuantizeEx@20'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ColorQuantizeEx'{$ENDIF}; -function FreeImage_Threshold(dib: PFIBITMAP; T: Byte): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_Threshold@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_Threshold'{$ENDIF}; -function FreeImage_Dither(dib: PFIBITMAP; algorithm: FREE_IMAGE_DITHER): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_Dither@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_Dither'{$ENDIF}; - -function FreeImage_ConvertFromRawBits(bits: PByte; width, height, pitch: Integer; - bpp, red_mask, green_mask, blue_mask: Cardinal; topdown: LongBool = False): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertFromRawBits@36'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertFromRawBits'{$ENDIF}; -function FreeImage_ConvertFromRawBitsEx(copySource: LongBool; bits: PByte; _type: FREE_IMAGE_TYPE; - width, height, pitch: Integer; bpp, red_mask, green_mask, blue_mask: Cardinal; - topdown: LongBool = False): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertFromRawBitsEx@44'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertFromRawBitsEx'{$ENDIF}; -procedure FreeImage_ConvertToRawBits(bits: PByte; dib: PFIBITMAP; pitch: Integer; - bpp, red_mask, green_mask, blue_mask: Cardinal; topdown: LongBool = False); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertToRawBits@32'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertToRawBits'{$ENDIF}; - -function FreeImage_ConvertToFloat(dib: PFIBITMAP): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertToFloat@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertToFloat'{$ENDIF}; -function FreeImage_ConvertToRGBF(dib: PFIBITMAP): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertToRGBF@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertToRGBF'{$ENDIF}; -function FreeImage_ConvertToUINT16(dib: PFIBITMAP): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertToUINT16@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertToUINT16'{$ENDIF}; -function FreeImage_ConvertToRGB16(dib: PFIBITMAP): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertToRGB16@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertToRGB16'{$ENDIF}; - -function FreeImage_ConvertToStandardType(src: PFIBITMAP; - scale_linear: LongBool = True): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertToStandardType@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertToStandardType'{$ENDIF}; -function FreeImage_ConvertToType(src: PFIBITMAP; dst_type: FREE_IMAGE_TYPE; - scale_linear: LongBool = True): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ConvertToType@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ConvertToType'{$ENDIF}; - -// Tone mapping operators --------------------------------------------------- -function FreeImage_ToneMapping(dib: PFIBITMAP; tmo: FREE_IMAGE_TMO; - first_param: Double = 0; second_param: Double = 0): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ToneMapping@24'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ToneMapping'{$ENDIF}; -function FreeImage_TmoDrago03(src: PFIBITMAP; gamma: Double = 2.2; - exposure: Double = 0): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_TmoDrago03@20'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_TmoDrago03'{$ENDIF}; -function FreeImage_TmoReinhard05(src: PFIBITMAP; intensity: Double = 0; - contrast: Double = 0): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_TmoReinhard05@20'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_TmoReinhard05'{$ENDIF}; -function FreeImage_TmoReinhard05Ex(src: PFIBITMAP; intensity: Double = 0; - contrast: Double = 0; adaptation: Double = 1; color_correction: Double = 0): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_TmoReinhard05Ex@36'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_TmoReinhard05Ex'{$ENDIF}; - -function FreeImage_TmoFattal02(src: PFIBITMAP; color_saturation: Double = 0.5; - attenuation: Double = 0.85): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_TmoFattal02@20'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_TmoFattal02'{$ENDIF}; - -// -------------------------------------------------------------------------- -// ZLib interface ----------------------------------------------------------- -// -------------------------------------------------------------------------- - -function FreeImage_ZLibCompress(target: PByte; target_size: DWORD; source: PByte; source_size: DWORD): DWORD; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ZLibCompress@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ZLibCompress'{$ENDIF}; -function FreeImage_ZLibUncompress(target: PByte; target_size: DWORD; source: PByte; source_size: DWORD): DWORD; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ZLibUncompress@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ZLibUncompress'{$ENDIF}; -function FreeImage_ZLibGZip(target: PByte; target_size: DWORD; source: PByte; source_size: DWORD): DWORD; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ZLibGZip@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ZLibGZip'{$ENDIF}; -function FreeImage_ZLibGUnzip(target: PByte; target_size: DWORD; source: PByte; source_size: DWORD): DWORD; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ZLibGUnzip@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ZLibGUnzip'{$ENDIF}; -function FreeImage_ZLibCRC32(crc: DWORD; source: PByte; source_size: DWORD): DWORD; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ZLibCRC32@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ZLibCRC32'{$ENDIF}; - -// -------------------------------------------------------------------------- -// Metadata routines -// -------------------------------------------------------------------------- - -// tag creation / destruction -function FreeImage_CreateTag: PFITAG; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_CreateTag@0'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_CreateTag'{$ENDIF}; -procedure FreeImage_DeleteTag(tag: PFITAG); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_DeleteTag@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_DeleteTag'{$ENDIF}; -function FreeImage_CloneTag(tag: PFITAG): PFITAG; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_CloneTag@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_CloneTag'{$ENDIF}; - -// tag getters and setters -function FreeImage_GetTagKey(tag: PFITAG): PAnsiChar; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetTagKey@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetTagKey'{$ENDIF}; -function FreeImage_GetTagDescription(tag: PFITAG): PAnsiChar; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetTagDescription@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetTagDescription'{$ENDIF}; -function FreeImage_GetTagID(tag: PFITAG): Word; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetTagID@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetTagID'{$ENDIF}; -function FreeImage_GetTagType(tag: PFITAG): FREE_IMAGE_MDTYPE; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetTagType@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetTagType'{$ENDIF}; -function FreeImage_GetTagCount(tag: PFITAG): DWORD; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetTagCount@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetTagCount'{$ENDIF}; -function FreeImage_GetTagLength(tag: PFITAG): DWORD; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetTagLength@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetTagLength'{$ENDIF}; -function FreeImage_GetTagValue(tag: PFITAG): Pointer; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetTagValue@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetTagValue'{$ENDIF}; - -function FreeImage_SetTagKey(tag: PFITAG; key: PAnsiChar): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_SetTagKey@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_SetTagKey'{$ENDIF}; -function FreeImage_SetTagDescription(tag: PFITAG; description: PAnsiChar): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_SetTagDescription@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_SetTagDescription'{$ENDIF}; -function FreeImage_SetTagID(tag: PFITAG; id: Word): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_SetTagID@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_SetTagID'{$ENDIF}; -function FreeImage_SetTagType(tag: PFITAG; _type: FREE_IMAGE_MDTYPE): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_SetTagType@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_SetTagType'{$ENDIF}; -function FreeImage_SetTagCount(tag: PFITAG; count: DWORD): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_SetTagCount@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_SetTagCount'{$ENDIF}; -function FreeImage_SetTagLength(tag: PFITAG; length: DWORD): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_SetTagLength@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_SetTagLength'{$ENDIF}; -function FreeImage_SetTagValue(tag: PFITAG; value: Pointer): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_SetTagValue@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_SetTagValue'{$ENDIF}; - -// iterator -function FreeImage_FindFirstMetadata(model: FREE_IMAGE_MDMODEL; dib: PFIBITMAP; - var tag: PFITAG): PFIMETADATA; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_FindFirstMetadata@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_FindFirstMetadata'{$ENDIF}; -function FreeImage_FindNextMetadata(mdhandle: PFIMETADATA; var tag: PFITAG): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_FindNextMetadata@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_FindNextMetadata'{$ENDIF}; -procedure FreeImage_FindCloseMetadata(mdhandle: PFIMETADATA); {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_FindCloseMetadata@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_FindCloseMetadata'{$ENDIF}; - -// metadata setter and getter -function FreeImage_SetMetadata(model: FREE_IMAGE_MDMODEL; dib: PFIBITMAP; - key: PAnsiChar; tag: PFITAG): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_SetMetadata@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_SetMetadata'{$ENDIF}; -function FreeImage_GetMetadata(model: FREE_IMAGE_MDMODEL; dib: PFIBITMAP; - key: PAnsiChar; var tag: PFITAG): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetMetadata@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetMetadata'{$ENDIF}; - -// helpers -function FreeImage_GetMetadataCount(model: FREE_IMAGE_MDMODEL; dib: PFIBITMAP): Cardinal; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetMetadataCount@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetMetadataCount'{$ENDIF}; -function FreeImage_CloneMetadata(dst, src: PFIBITMAP): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_CloneMetadata@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_CloneMetadata'{$ENDIF}; - -// tag to C string conversion -function FreeImage_TagToString(model: FREE_IMAGE_MDMODEL; tag: PFITAG; - Make: PAnsiChar = nil): PAnsiChar; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_TagToString@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_TagToString'{$ENDIF}; - -// -------------------------------------------------------------------------- -// JPEG lossless transformation routines -// -------------------------------------------------------------------------- - -function FreeImage_JPEGTransform(src_file, dst_file: PAnsiChar; operation: FREE_IMAGE_JPEG_OPERATION; - perfect: LongBool = False): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_JPEGTransform@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_JPEGTransform'{$ENDIF}; -function FreeImage_JPEGTransformU(src_file, dst_file: PWideChar; operation: FREE_IMAGE_JPEG_OPERATION; - perfect: LongBool = False): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_JPEGTransformU@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_JPEGTransformU'{$ENDIF}; -function FreeImage_JPEGCrop(src_file, dst_file: PAnsiChar; - left, top, right, bottom: Integer): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_JPEGCrop@24'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_JPEGCrop'{$ENDIF}; -function FreeImage_JPEGCropU(src_file, dst_file: PWideChar; - left, top, right, bottom: Integer): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_JPEGCropU@24'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_JPEGCropU'{$ENDIF}; -function FreeImage_JPEGTransformFromHandle(src_io: PFreeImageIO; src_handle: fi_handle; dst_io: PFreeImageIO; - dst_handle: fi_handle; operation: FREE_IMAGE_JPEG_OPERATION; var left, top, right, bottom: Integer; - perfect: LongBool = True): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_JPEGTransformFromHandle@40'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_JPEGTransformFromHandle'{$ENDIF}; -function FreeImage_JPEGTransformCombined(src_file, dst_file: PAnsiChar; operation: FREE_IMAGE_JPEG_OPERATION; - var left, top, right, bottom: Integer; perfect: LongBool = True): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_JPEGTransformCombined@32'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_JPEGTransformCombined'{$ENDIF}; -function FreeImage_JPEGTransformCombinedU(src_file, dst_file: PWideChar; operation: FREE_IMAGE_JPEG_OPERATION; - var left, top, right, bottom: Integer; perfect: LongBool = True): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_JPEGTransformCombinedU@32'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_JPEGTransformCombinedU'{$ENDIF}; -function FreeImage_JPEGTransformCombinedFromMemory(src_stream, dst_stream: PFIMEMORY; operation: FREE_IMAGE_JPEG_OPERATION; - var left, top, right, bottom: Integer; perfect: LongBool = True): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_JPEGTransformCombinedFromMemory@32'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_JPEGTransformCombinedFromMemory'{$ENDIF}; - -// -------------------------------------------------------------------------- -// Image manipulation toolkit -// -------------------------------------------------------------------------- - -// rotation and flipping -// modif JMB : FreeImage_RotateClassic : deprecated function, call to DeprecationManager in 64 bits crashes freeimage.dll -//function FreeImage_RotateClassic(dib: PFIBITMAP; angle: Double): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} -// external FIDLL {$IFDEF WIN32}name '_FreeImage_RotateClassic@12'{$ENDIF} -// {$IFDEF MACOS}name '_FreeImage_RotateClassic'{$ENDIF}; -function FreeImage_Rotate(dib: PFIBITMAP; angle: Double; bkcolor: Pointer = nil): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_Rotate@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_Rotate'{$ENDIF}; -function FreeImage_RotateEx(dib: PFIBITMAP; angle, x_shift, y_shift, x_origin, y_origin: Double; - use_mask: LongBool): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_RotateEx@48'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_RotateEx'{$ENDIF}; -function FreeImage_FlipHorizontal(dib: PFIBITMAP): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_FlipHorizontal@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_FlipHorizontal'{$ENDIF}; -function FreeImage_FlipVertical(dib: PFIBITMAP): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_FlipVertical@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_FlipVertical'{$ENDIF}; - -// upsampling / downsampling -function FreeImage_Rescale(dib: PFIBITMAP; dst_width, dst_height: Integer; - filter: FREE_IMAGE_FILTER = FILTER_CATMULLROM): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_Rescale@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_Rescale'{$ENDIF}; -function FreeImage_MakeThumbnail(dib: PFIBITMAP; max_pixel_size: Integer; convert: LongBool = True): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_MakeThumbnail@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_MakeThumbnail'{$ENDIF}; - -// color manipulation routines (point operations) -function FreeImage_AdjustCurve(dib: PFIBITMAP; LUT: PByte; - channel: FREE_IMAGE_COLOR_CHANNEL): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_AdjustCurve@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_AdjustCurve'{$ENDIF}; -function FreeImage_AdjustGamma(dib: PFIBITMAP; gamma: Double): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_AdjustGamma@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_AdjustGamma'{$ENDIF}; -function FreeImage_AdjustBrightness(dib: PFIBITMAP; percentage: Double): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_AdjustBrightness@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_AdjustBrightness'{$ENDIF}; -function FreeImage_AdjustContrast(dib: PFIBITMAP; percentage: Double): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_AdjustContrast@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_AdjustContrast'{$ENDIF}; -function FreeImage_Invert(dib: PFIBITMAP): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_Invert@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_Invert'{$ENDIF}; -function FreeImage_GetHistogram(dib: PFIBITMAP; histo: PDWORD; - channel: FREE_IMAGE_COLOR_CHANNEL = FICC_BLACK): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetHistogram@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetHistogram'{$ENDIF}; -function FreeImage_GetAdjustColorsLookupTable(LUT: PByte; brightness, contrast, gamma: Double; - invert: LongBool): Integer; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetAdjustColorsLookupTable@32'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetAdjustColorsLookupTable'{$ENDIF}; -function FreeImage_AdjustColors(dib: PFIBITMAP; brightness, contrast, gamma: Double; - invert: LongBool = False): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_AdjustColors@32'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_AdjustColors'{$ENDIF}; -function FreeImage_ApplyColorMapping(dib: PFIBITMAP; srccolors, dstcolors: PRGBQuad; - count: Cardinal; ignore_alpha, swap: LongBool): Cardinal; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ApplyColorMapping@24'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ApplyColorMapping'{$ENDIF}; -function FreeImage_SwapColors(dib: PFIBITMAP; color_a, color_b: PRGBQuad; - ignore_alpha: LongBool): Cardinal; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_SwapColors@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_SwapColors'{$ENDIF}; -function FreeImage_ApplyPaletteIndexMapping(dib: PFIBITMAP; srcindices, dstindices: PByte; - count: Cardinal; swap: LongBool): Cardinal; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_ApplyPaletteIndexMapping@20'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_ApplyPaletteIndexMapping'{$ENDIF}; -function FreeImage_SwapPaletteIndices(dib: PFIBITMAP; index_a, index_b: PByte): Cardinal; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_SwapPaletteIndices@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_SwapPaletteIndices'{$ENDIF}; - -// channel processing routines -function FreeImage_GetChannel(dib: PFIBITMAP; channel: FREE_IMAGE_COLOR_CHANNEL): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetChannel@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetChannel'{$ENDIF}; -function FreeImage_SetChannel(dst, src: PFIBITMAP; channel: FREE_IMAGE_COLOR_CHANNEL): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_SetChannel@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_SetChannel'{$ENDIF}; -function FreeImage_GetComplexChannel(src: PFIBITMAP; channel: FREE_IMAGE_COLOR_CHANNEL): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_GetComplexChannel@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_GetComplexChannel'{$ENDIF}; -function FreeImage_SetComplexChannel(dst, src: PFIBITMAP; channel: FREE_IMAGE_COLOR_CHANNEL): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_SetComplexChannel@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_SetComplexChannel'{$ENDIF}; - -// copy / paste / composite routines - -function FreeImage_Copy(dib: PFIBITMAP; left, top, right, bottom: Integer): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_Copy@20'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_Copy'{$ENDIF}; -function FreeImage_Paste(dst, src: PFIBITMAP; left, top, alpha: Integer): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_Paste@20'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_Paste'{$ENDIF}; -function FreeImage_Composite(fg: PFIBITMAP; useFileBkg: LongBool = False; - appBkColor: PRGBQuad = nil; bg: PFIBITMAP = nil): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_Composite@16'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_Composite'{$ENDIF}; -function FreeImage_PreMultiplyWithAlpha(dib: PFIBITMAP): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_PreMultiplyWithAlpha@4'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_PreMultiplyWithAlpha'{$ENDIF}; - -// background filling routines -function FreeImage_FillBackground(dib: PFIBITMAP; color: Pointer; - options: Integer = 0): LongBool; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_FillBackground@12'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_FillBackground'{$ENDIF}; -function FreeImage_EnlargeCanvas(src: PFIBITMAP; left, top, right, bottom: Integer; - color: Pointer; options: Integer = 0): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_EnlargeCanvas@28'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_EnlargeCanvas'{$ENDIF}; -function FreeImage_AllocateEx(width, height, bpp: Integer; color: PRGBQuad; - options: Integer = 0; palette: PRGBQuad = nil; red_mask: Cardinal = 0; - green_mask: Cardinal = 0; blue_mask: Cardinal = 0): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_AllocateEx@36'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_AllocateEx'{$ENDIF}; -function FreeImage_AllocateExT(_type: FREE_IMAGE_TYPE; width, height, bpp: Integer; - color: Pointer; options: Integer = 0; palette: PRGBQuad = nil; red_mask: Cardinal = 0; - green_mask: Cardinal = 0; blue_mask: Cardinal = 0): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_AllocateExT@40'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_AllocateExT'{$ENDIF}; - -// miscellaneous algorithms -function FreeImage_MultigridPoissonSolver(Laplacian: PFIBITMAP; - ncycle: Integer = 3): PFIBITMAP; {$IFDEF MSWINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} - external FIDLL {$IFDEF WIN32}name '_FreeImage_MultigridPoissonSolver@8'{$ENDIF} - {$IFDEF MACOS}name '_FreeImage_MultigridPoissonSolver'{$ENDIF}; - - -implementation - -{$IFNDEF DELPHI6} -uses SysUtils; - -//we provide a wrapper since we haven't varargs in older versions of Delphi -procedure __FreeImage_OutputMessageProc; cdecl; - external FIDLL name 'FreeImage_OutputMessageProc'; - -procedure FreeImage_OutputMessageProc(fif: Integer; fmt: PAnsiChar; args: array of const); - function ArrayToBuffer(Args: array of const; - var Argv: Pointer; Buffer: Pointer; Size: Cardinal): Integer; - var - i: Integer; - temp: AnsiString; - parg: Pointer; - psrc, pbuf: PAnsiChar; - len: Cardinal; - begin - Result := High(Args) + 1; - if Result = 0 then - Exit; - //array of pointers to push on stack - GetMem(Argv, Result * SizeOf(Pointer)); - //pointer to current string in buffer - pbuf := Buffer; - //pointer to current arg - parg := Argv; - //for each const... - for i := 0 to Result - 1 do begin - case Args[i].VType of - vtInteger: begin - //integer - psrc := nil; - len := 0; - Integer(parg^) := Args[i].VInteger; - end; - vtString: begin - //short string - psrc := PAnsiChar(Cardinal(Args[i].VString) + SizeOf(Byte)); - len := PByte(Args[i].VString)^; - PAnsiChar(parg^) := pbuf; - end; - vtPChar: begin - //NULL terminated MBCS string - psrc := nil; - len := 0; - PAnsiChar(parg^) := Args[i].VPChar; - end; - vtPWideChar: begin - //NULL terminated Unicode string - temp := AnsiString(Args[i].VPWideChar); - psrc := PAnsiChar(temp); - len := Length(temp); - PAnsiChar(parg^) := pbuf; - end; - vtAnsiString: begin - //ANSI string - psrc := PAnsiChar(Args[i].VAnsiString); - len := StrLen(psrc); - PAnsiChar(parg^) := pbuf; - end; - vtWideString: begin - //Wide string (OLE) - temp := AnsiString(PWideChar(Args[i].VWideString)); - psrc := PAnsiChar(temp); - len := Length(temp); - PAnsiChar(parg^) := pbuf; - end; - else raise Exception.Create('Unsupported argument type'); - end; - if (psrc <> nil) and (len <> 0) then begin - //enough space to hold string? - if Size < (len + 1) then - raise Exception.Create('Buffer overflow'); - //copy string - Move(psrc^, pbuf^, len); - //NULL terminator - PAnsiChar(Cardinal(pbuf) + len)^ := #0; - //shift pointer... - Inc(pbuf, len + 1); - //...and decrease space left - Dec(Size, len + 1); - end; - Cardinal(parg) := Cardinal(parg) + SizeOf(Pointer); - end; - end; - - procedure DoVarargsCall(fif: Integer; fmt: PAnsiChar; Argv: Pointer; Argc: Integer); - { - fif -> EAX - fmt -> EDX - Argv -> ECX - Argc -> [EBP+$08] - } - asm - PUSH EAX //remember fif - PUSH ECX //make room for ESP backup - - MOV DWORD PTR [EBP-$08], ESP //backup stack pointer - - MOV EAX, DWORD PTR [EBP+$08] //store Argc - - TEST EAX, EAX //Argc <= 0? - JLE @Call - - @Loop: - PUSH DWORD PTR [ECX+EAX*$04-$04] //push Argv in right to left order - DEC EAX - JNZ @Loop - - @Call: - PUSH EDX //push fmt - PUSH DWORD PTR [EBP-$04] //push fif - CALL __FreeImage_OutputMessageProc - - MOV ESP, DWORD PTR [EBP-$08] //restore stack pointer - - POP ECX //clean stack - POP EAX - end; -var - Argc: Integer; - Argv: Pointer; - //buffer to hold strings - FreeImage allocates 512 bytes, we needn't more... - Buffer: array[1..512] of Byte; -begin - Argv := nil; - //build array of pointers from array of const - Argc := ArrayToBuffer(args, Argv, @Buffer, SizeOf(Buffer)); - try - //mimic cdecl call with varargs - DoVarargsCall(fif, fmt, Argv, Argc); - finally - //cleanup - FreeMem(Argv); - end; -end; -{$ENDIF} - -end. diff --git a/#ThirdParty/FreeImage/Wrapper/Delphi/src/FreeUtils.pas b/#ThirdParty/FreeImage/Wrapper/Delphi/src/FreeUtils.pas deleted file mode 100644 index 9665dca..0000000 --- a/#ThirdParty/FreeImage/Wrapper/Delphi/src/FreeUtils.pas +++ /dev/null @@ -1,186 +0,0 @@ -unit FreeUtils; - -// ========================================================== -// -// Delphi wrapper for FreeImage 3 -// -// Design and implementation by -// - Anatoliy Pulyaevskiy (xvel84@rambler.ru) -// -// Contributors: -// - Enzo Costantini (enzocostantini@libero.it) -// - Armindo (tech1.yxendis@wanadoo.fr) -// - Lorenzo Monti (LM) lomo74@gmail.com -// -// Revision history -// When Who What -// ----------- ----- ----------------------------------------------------------- -// 2010-07-14 LM made RAD2010 compliant (unicode) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// -// ========================================================== - -interface - -{$I 'Version.inc'} - -uses - {$IFDEF DELPHI2010}AnsiStrings,{$ENDIF} SysUtils, Classes, FreeImage; - -function FIU_GetFIFType(filename: AnsiString): FREE_IMAGE_FORMAT; - -// returns FIF (plugin) description string -function FIU_GetFIFDescription(fif: FREE_IMAGE_FORMAT): AnsiString; - -procedure FIU_GetAllDescriptions(var Descriptions: TStringList); - -// returns file extentions for FIF (e.g. '*.tif;*.tiff) -function FIU_GetFIFExtList(fif: FREE_IMAGE_FORMAT): AnsiString; - -// returns file extentions for all plugins -function FIU_GetFullExtList: AnsiString; - -// returns "Description + | + ExtList" for specified FIF -function FIU_GetFIFFilter(fif: FREE_IMAGE_FORMAT): AnsiString; - -// All supported formats + Full filter list for FIFs -function FIU_GetAllFilters: AnsiString; - -//Filter for OpenDialogs -function FIU_GetAllOpenFilters: AnsiString; - -//Filter for SaveDialogs -function FIU_GetAllSaveFilters: AnsiString; - -implementation - -const - FIF_START = FIF_UNKNOWN; - FIF_END = FIF_XPM; - -function FIU_GetFIFType(filename: AnsiString): FREE_IMAGE_FORMAT; -begin - Result := FreeImage_GetFileType(PAnsiChar(filename), 0); -end; - -function FIU_GetFIFDescription(fif: FREE_IMAGE_FORMAT): AnsiString; -begin - Result := FreeImage_GetFIFDescription(fif) -end; - -procedure FIU_GetAllDescriptions(var Descriptions: TStringList); -var - fif: FREE_IMAGE_FORMAT; -begin - Descriptions.Clear; - for fif := FIF_START to FIF_END do - Descriptions.Add(string(FreeImage_GetFIFDescription(fif)) + ' (' + - string(FIu_GetFIFExtList(fif)) + ')'); -end; - -function FIU_GetFIFExtList(fif: FREE_IMAGE_FORMAT): AnsiString; -var - ExtList: AnsiString; - I: Smallint; - C: AnsiChar; -begin - Result := '*.'; - ExtList := FreeImage_GetFIFExtensionList(fif); - for I := 1 to Length(ExtList) do - begin - C := ExtList[i]; - if C <> ',' then - Result := Result + C - else - Result := Result + ';*.'; - end -end; - -function FIU_GetFullExtList: AnsiString; -var - fif: FREE_IMAGE_FORMAT; -begin - Result := FIU_GetFIFExtList(FIF_START); - for fif := FIF_START to FIF_END do - Result := Result + ';' + FIU_GetFIFExtList(fif) -end; - -function FIU_GetFIFFilter(fif: FREE_IMAGE_FORMAT): AnsiString; -var - Text, ExtList: AnsiString; -begin - Result := ''; - if fif <> FIF_UNKNOWN then - begin - Text := {$IFDEF DELPHI2010}AnsiStrings.{$ENDIF}Trim(FreeImage_GetFIFDescription(fif)); - ExtList := FIU_GetFIFExtList(fif); - Result := Text + '(' + ExtList + ')' + '|' + ExtList - end -end; - -function FIU_GetAllFilters: AnsiString; -var - fif: FREE_IMAGE_FORMAT; -begin - Result := 'All supported formats|' + FIU_GetFullExtList; - for fif := FIF_START to FIF_END do - begin - Result := Result + '|' + FIU_GetFIFFilter(fif) - end; -end; - -function FIU_GetAllOpenFilters: AnsiString; -var - fif: FREE_IMAGE_FORMAT; -begin - Result := 'All supported formats|' + FIU_GetFullExtList; - for fif := FIF_START to FIF_END do - if FreeImage_FIFSupportsReading(fif) then - begin - Result := Result + '|' + FIU_GetFIFFilter(fif) - end; -end; - -function FIU_GetAllSaveFilters: AnsiString; -var - ExtList: AnsiString; - I: Smallint; - C: AnsiChar; - fif: FREE_IMAGE_FORMAT; - s: AnsiString; -begin - result := ''; - for fif := FIF_START to FIF_END do - if FreeImage_FIFSupportsWriting(fif) then - begin - ExtList := FreeImage_GetFIFExtensionList(fif); - s := ''; - for I := 1 to Length(ExtList) do - begin - C := ExtList[i]; - if C <> ',' then - S := S + C - else - begin - result := Result + FreeImage_GetFIFDescription(fif) + ' (' + UpperCase(s) + ')|*.' + s + '|'; - s := ''; - end; - end; - result := Result + FreeImage_GetFIFDescription(fif) + ' (' + UpperCase(s) + ')|*.' + s + '|'; - end; -end; - -end. diff --git a/#ThirdParty/FreeImage/Wrapper/Delphi/src/Version.inc b/#ThirdParty/FreeImage/Wrapper/Delphi/src/Version.inc deleted file mode 100644 index f72863d..0000000 --- a/#ThirdParty/FreeImage/Wrapper/Delphi/src/Version.inc +++ /dev/null @@ -1,305 +0,0 @@ -// ========================================================== -// Delphi wrapper for FreeImage 3 -// -// Design and implementation by -// - Simon Beavis -// - Peter Byström -// - Anatoliy Pulyaevskiy (xvel84@rambler.ru) -// -// Contributors: -// - Lorenzo Monti (LM) lomo74@gmail.com -// -// Revision history -// When Who What -// ----------- ----- ----------------------------------------------------------- -// 2010-07-29 LM Added Free Pascal / Lazarus 32 bit support -// 2010-11-12 LM Added Delphi XE support -// 2011-03-04 JMB Added 64 bit compiler support -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -//some older Delphi version will define WIN32 but not MSWINDOWS -{$IFNDEF MSWINDOWS} - {$IFDEF WIN32} - {$DEFINE MSWINDOWS} - {$ENDIF} -{$ENDIF} - -//test for compiler -{$IFDEF FPC} - //Free pascal - {$IFNDEF CPU32} - //{$ERROR "64 bit platforms not tested yet. Remove this line if you feel brave."} - {$ENDIF} - {$IFNDEF ENDIAN_LITTLE} - {$ERROR "Big endian CPUs not tested yet. Remove this line if you feel brave."} - {$ENDIF} - {$DEFINE DELPHI1} - {$DEFINE DELPHI2} - {$DEFINE DELPHI3} - {$DEFINE DELPHI4} - {$DEFINE DELPHI5} - {$DEFINE DELPHI6} - {$DEFINE DELPHI7} -{$ELSE} - //Delphi - {$IFDEF VER80} - {$DEFINE DELPHI1} - {$ENDIF} - - {$IFDEF VER90} - {$DEFINE DELPHI1} - {$DEFINE DELPHI2} - {$ENDIF} - - {$IFDEF VER100} - {$DEFINE DELPHI1} - {$DEFINE DELPHI2} - {$DEFINE DELPHI3} - {$ENDIF} - - {$IFDEF VER120} - {$DEFINE DELPHI1} - {$DEFINE DELPHI2} - {$DEFINE DELPHI3} - {$DEFINE DELPHI4} - {$ENDIF} - - {$IFDEF VER130} - {$DEFINE DELPHI1} - {$DEFINE DELPHI2} - {$DEFINE DELPHI3} - {$DEFINE DELPHI4} - {$DEFINE DELPHI5} - {$ENDIF} - - {$IFDEF VER140} - {$DEFINE DELPHI1} - {$DEFINE DELPHI2} - {$DEFINE DELPHI3} - {$DEFINE DELPHI4} - {$DEFINE DELPHI5} - {$DEFINE DELPHI6} - {$ENDIF} - - {$IFDEF VER150} - {$DEFINE DELPHI1} - {$DEFINE DELPHI2} - {$DEFINE DELPHI3} - {$DEFINE DELPHI4} - {$DEFINE DELPHI5} - {$DEFINE DELPHI6} - {$DEFINE DELPHI7} - {$ENDIF} - - {$IFDEF VER160} - {$DEFINE DELPHI1} - {$DEFINE DELPHI2} - {$DEFINE DELPHI3} - {$DEFINE DELPHI4} - {$DEFINE DELPHI5} - {$DEFINE DELPHI6} - {$DEFINE DELPHI7} - {$DEFINE DELPHI8} - {$ENDIF} - - {$IFDEF VER170} - {$DEFINE DELPHI1} - {$DEFINE DELPHI2} - {$DEFINE DELPHI3} - {$DEFINE DELPHI4} - {$DEFINE DELPHI5} - {$DEFINE DELPHI6} - {$DEFINE DELPHI7} - {$DEFINE DELPHI8} - {$DEFINE DELPHI2005} - {$ENDIF} - - {$IFDEF VER180} - {$DEFINE DELPHI1} - {$DEFINE DELPHI2} - {$DEFINE DELPHI3} - {$DEFINE DELPHI4} - {$DEFINE DELPHI5} - {$DEFINE DELPHI6} - {$DEFINE DELPHI7} - {$DEFINE DELPHI8} - {$DEFINE DELPHI2005} - {$DEFINE DELPHI2006} - {$ENDIF} - - {$IFDEF VER185} - {$DEFINE DELPHI1} - {$DEFINE DELPHI2} - {$DEFINE DELPHI3} - {$DEFINE DELPHI4} - {$DEFINE DELPHI5} - {$DEFINE DELPHI6} - {$DEFINE DELPHI7} - {$DEFINE DELPHI8} - {$DEFINE DELPHI2005} - {$DEFINE DELPHI2006} - {$DEFINE DELPHI2007} - {$ENDIF} - - {$IFDEF VER200} - {$DEFINE DELPHI1} - {$DEFINE DELPHI2} - {$DEFINE DELPHI3} - {$DEFINE DELPHI4} - {$DEFINE DELPHI5} - {$DEFINE DELPHI6} - {$DEFINE DELPHI7} - {$DEFINE DELPHI8} - {$DEFINE DELPHI2005} - {$DEFINE DELPHI2006} - {$DEFINE DELPHI2007} - {$DEFINE DELPHI2009} - {$ENDIF} - - {$IFDEF VER210} - {$DEFINE DELPHI1} - {$DEFINE DELPHI2} - {$DEFINE DELPHI3} - {$DEFINE DELPHI4} - {$DEFINE DELPHI5} - {$DEFINE DELPHI6} - {$DEFINE DELPHI7} - {$DEFINE DELPHI8} - {$DEFINE DELPHI2005} - {$DEFINE DELPHI2006} - {$DEFINE DELPHI2007} - {$DEFINE DELPHI2009} - {$DEFINE DELPHI2010} - {$ENDIF} - - {$IFDEF VER220} - {$DEFINE DELPHI1} - {$DEFINE DELPHI2} - {$DEFINE DELPHI3} - {$DEFINE DELPHI4} - {$DEFINE DELPHI5} - {$DEFINE DELPHI6} - {$DEFINE DELPHI7} - {$DEFINE DELPHI8} - {$DEFINE DELPHI2005} - {$DEFINE DELPHI2006} - {$DEFINE DELPHI2007} - {$DEFINE DELPHI2009} - {$DEFINE DELPHI2010} - {$DEFINE DELPHIXE} - {$ENDIF} - - {$IFDEF VER230} - {$DEFINE DELPHI1} - {$DEFINE DELPHI2} - {$DEFINE DELPHI3} - {$DEFINE DELPHI4} - {$DEFINE DELPHI5} - {$DEFINE DELPHI6} - {$DEFINE DELPHI7} - {$DEFINE DELPHI8} - {$DEFINE DELPHI2005} - {$DEFINE DELPHI2006} - {$DEFINE DELPHI2007} - {$DEFINE DELPHI2009} - {$DEFINE DELPHI2010} - {$DEFINE DELPHIXE} - {$DEFINE DELPHIXE2} - {$ENDIF} - - {$IFDEF VER240} - {$DEFINE DELPHI1} - {$DEFINE DELPHI2} - {$DEFINE DELPHI3} - {$DEFINE DELPHI4} - {$DEFINE DELPHI5} - {$DEFINE DELPHI6} - {$DEFINE DELPHI7} - {$DEFINE DELPHI8} - {$DEFINE DELPHI2005} - {$DEFINE DELPHI2006} - {$DEFINE DELPHI2007} - {$DEFINE DELPHI2009} - {$DEFINE DELPHI2010} - {$DEFINE DELPHIXE} - {$DEFINE DELPHIXE2} - {$DEFINE DELPHIXE3} - {$ENDIF} - - {$IFDEF VER250} - {$DEFINE DELPHI1} - {$DEFINE DELPHI2} - {$DEFINE DELPHI3} - {$DEFINE DELPHI4} - {$DEFINE DELPHI5} - {$DEFINE DELPHI6} - {$DEFINE DELPHI7} - {$DEFINE DELPHI8} - {$DEFINE DELPHI2005} - {$DEFINE DELPHI2006} - {$DEFINE DELPHI2007} - {$DEFINE DELPHI2009} - {$DEFINE DELPHI2010} - {$DEFINE DELPHIXE} - {$DEFINE DELPHIXE2} - {$DEFINE DELPHIXE3} - {$DEFINE DELPHIXE4} - {$ENDIF} - - {$IFDEF VER260} - {$DEFINE DELPHI1} - {$DEFINE DELPHI2} - {$DEFINE DELPHI3} - {$DEFINE DELPHI4} - {$DEFINE DELPHI5} - {$DEFINE DELPHI6} - {$DEFINE DELPHI7} - {$DEFINE DELPHI8} - {$DEFINE DELPHI2005} - {$DEFINE DELPHI2006} - {$DEFINE DELPHI2007} - {$DEFINE DELPHI2009} - {$DEFINE DELPHI2010} - {$DEFINE DELPHIXE} - {$DEFINE DELPHIXE2} - {$DEFINE DELPHIXE3} - {$DEFINE DELPHIXE4} - {$DEFINE DELPHIXE5} - {$ENDIF} - - {$IFDEF VER270} - {$DEFINE DELPHI1} - {$DEFINE DELPHI2} - {$DEFINE DELPHI3} - {$DEFINE DELPHI4} - {$DEFINE DELPHI5} - {$DEFINE DELPHI6} - {$DEFINE DELPHI7} - {$DEFINE DELPHI8} - {$DEFINE DELPHI2005} - {$DEFINE DELPHI2006} - {$DEFINE DELPHI2007} - {$DEFINE DELPHI2009} - {$DEFINE DELPHI2010} - {$DEFINE DELPHIXE} - {$DEFINE DELPHIXE2} - {$DEFINE DELPHIXE3} - {$DEFINE DELPHIXE4} - {$DEFINE DELPHIXE5} - {$DEFINE DELPHIXE6} - {$ENDIF} -{$ENDIF} diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/AssemblyInfo.cpp b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/AssemblyInfo.cpp deleted file mode 100644 index 2c401db..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/AssemblyInfo.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include "stdafx.h" - -using namespace System::Reflection; -using namespace System::Runtime::CompilerServices; - -// -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -// -[assembly:AssemblyTitleAttribute("")]; -[assembly:AssemblyDescriptionAttribute("")]; -[assembly:AssemblyConfigurationAttribute("")]; -[assembly:AssemblyCompanyAttribute("")]; -[assembly:AssemblyProductAttribute("")]; -[assembly:AssemblyCopyrightAttribute("")]; -[assembly:AssemblyTrademarkAttribute("")]; -[assembly:AssemblyCultureAttribute("")]; - -// -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the value or you can default the Revision and Build Numbers -// by using the '*' as shown below: - -[assembly:AssemblyVersionAttribute("1.0.*")]; - -// -// In order to sign your assembly you must specify a key to use. Refer to the -// Microsoft .NET Framework documentation for more information on assembly signing. -// -// Use the attributes below to control which key is used for signing. -// -// Notes: -// (*) If no key is specified, the assembly is not signed. -// (*) KeyName refers to a key that has been installed in the Crypto Service -// Provider (CSP) on your machine. KeyFile refers to a file which contains -// a key. -// (*) If the KeyFile and the KeyName values are both specified, the -// following processing occurs: -// (1) If the KeyName can be found in the CSP, that key is used. -// (2) If the KeyName does not exist and the KeyFile does exist, the key -// in the KeyFile is installed into the CSP and used. -// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. -// When specifying the KeyFile, the location of the KeyFile should be -// relative to the project directory. -// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework -// documentation for more information on this. -// -[assembly:AssemblyDelaySignAttribute(false)]; -[assembly:AssemblyKeyFileAttribute("")]; -[assembly:AssemblyKeyNameAttribute("")]; - diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/FreeImageIO.Net.cpp b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/FreeImageIO.Net.cpp deleted file mode 100644 index cbc88b7..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/FreeImageIO.Net.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// ========================================================== -// FreeImageIO.Net -// -// Design and implementation by -// - Marcos Pernambuco Motta (marcos.pernambuco@gmail.com) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#include "stdafx.h" -#include "FreeImageIO.Net.h" - - -extern "C" static unsigned __stdcall ReadProc (void *buffer, unsigned size, unsigned count, fi_handle handle) -{ - int total_read = 0; - struct UNMANAGED_HANDLER* puh = (struct UNMANAGED_HANDLER*)handle; - gcroot mbuffer = new unsigned char __gc[size]; - try - { - total_read = puh->_stream->Read(mbuffer,0,size); - Marshal::Copy(mbuffer,0,buffer,total_read); - } __finally { - mbuffer=NULL; - } - return (unsigned)total_read; -} - -extern "C" static unsigned __stdcall WriteProc (void *buffer, unsigned size, unsigned count, fi_handle handle) -{ - struct UNMANAGED_HANDLER* puh = (struct UNMANAGED_HANDLER*)handle; - gcroot mbuffer = new unsigned char __gc[size*count]; - try - { - - unsigned char __pin* pbuffer = &mbuffer[0]; - memcpy(pbuffer,buffer,size*count); - puh->_stream->Write(mbuffer,0,size); - } __finally { - mbuffer=NULL; - } - return count; -} - -extern "C" static int __stdcall SeekProc (fi_handle handle, long offset, int origin) -{ - struct UNMANAGED_HANDLER* puh = (struct UNMANAGED_HANDLER*)handle; - return (int)puh->_stream->Seek(offset,(SeekOrigin) origin); - -} - -extern "C" static long __stdcall TellProc(fi_handle handle) -{ - struct UNMANAGED_HANDLER* puh = (struct UNMANAGED_HANDLER*)handle; - return (long)puh->_stream->Position; -} - diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/FreeImageIO.Net.h b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/FreeImageIO.Net.h deleted file mode 100644 index 358e871..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/FreeImageIO.Net.h +++ /dev/null @@ -1,83 +0,0 @@ -// ========================================================== -// FreeImageIO.Net -// -// Design and implementation by -// - Marcos Pernambuco Motta (marcos.pernambuco@gmail.com) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#pragma once -#include -#include "FreeImage.h" - -using namespace System; -using namespace System::IO; -using namespace System::Runtime::InteropServices; - -extern "C" { - // forward decls - unsigned __stdcall ReadProc (void *buffer, unsigned size, unsigned count, fi_handle handle); - unsigned __stdcall WriteProc (void *buffer, unsigned size, unsigned count, fi_handle handle); - int __stdcall SeekProc (fi_handle handle, long offset, int origin); - long __stdcall TellProc(fi_handle handle); - - #pragma pack(push, 1) - __nogc struct UNMANAGED_HANDLER { - UNMANAGED_HANDLER() { - read_proc = &ReadProc; - write_proc = WriteProc; - seek_proc = SeekProc; - tell_proc = TellProc; - } - FI_ReadProc read_proc; // pointer to the function used to read data - FI_WriteProc write_proc; // pointer to the function used to write data - FI_SeekProc seek_proc; // pointer to the function used to seek - FI_TellProc tell_proc; // pointer to the function used to aquire the current position - gcroot _stream; - }; - #pragma pack(pop) -} - -#define FREEIMAGE_DLL "freeimaged.dll" - -namespace FreeImageIODotNet -{ - __gc public class FreeImageStream - { - private: - struct UNMANAGED_HANDLER* _pUnmanaged; - public: - FreeImageStream(System::IO::Stream* stream) - { - FreeImage_SaveToHandle((FREE_IMAGE_FORMAT) 1,0,0,0,0); - _pUnmanaged = new struct UNMANAGED_HANDLER; - _pUnmanaged->_stream = stream; - } - ~FreeImageStream() - { - _pUnmanaged->_stream = NULL; - delete _pUnmanaged; - } - - bool SaveImage(FREE_IMAGE_FORMAT fif, unsigned int dib, int flags) { - return (bool)FreeImage_SaveToHandle(fif,(FIBITMAP*) dib,(FreeImageIO*)_pUnmanaged,(fi_handle)_pUnmanaged,flags); - } - - unsigned int LoadImage(FREE_IMAGE_FORMAT fif, int flags) { - return (unsigned int)FreeImage_LoadFromHandle(fif,(FreeImageIO*)_pUnmanaged,(fi_handle)_pUnmanaged,flags); - } - }; -} diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/FreeImageIO.Net.vcproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/FreeImageIO.Net.vcproj deleted file mode 100644 index ddb942f..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/FreeImageIO.Net.vcproj +++ /dev/null @@ -1,176 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/FreeImageIO.sln b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/FreeImageIO.sln deleted file mode 100644 index 93bf45d..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/FreeImageIO.sln +++ /dev/null @@ -1,21 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeImageIO.Net", "FreeImageIO.Net.vcproj", "{E87923FF-1FBD-450D-9287-539A90DE9776}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {E87923FF-1FBD-450D-9287-539A90DE9776}.Debug.ActiveCfg = Debug|Win32 - {E87923FF-1FBD-450D-9287-539A90DE9776}.Debug.Build.0 = Debug|Win32 - {E87923FF-1FBD-450D-9287-539A90DE9776}.Release.ActiveCfg = Release|Win32 - {E87923FF-1FBD-450D-9287-539A90DE9776}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/ReadMe.txt b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/ReadMe.txt deleted file mode 100644 index 8412e57..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/ReadMe.txt +++ /dev/null @@ -1,27 +0,0 @@ -======================================================================== -FreeImageIO.Net - -Author: Marcos Pernambuco Motta (marcos.pernambuco@gmail.com) -======================================================================== - -This library allows programs that use FreeImage.Net to save images to or -to load images from .Net Streams. - -The class FreeImageStream implements a FreeImageIO handler and routes -IO calls (read,write,tell and seek) to a wrapped System.IO.Stream. - -Example: - -using FreeImageAPI; -using FreeImageIODotNet; - -uint dib = FreeImageAPI.FreeImage.Allocate(width,height,32,0,0,0); - -// ... Image handling code goes here - -System.IO.FileStream stream = new System.IO.FileStream(@"c:\sample.png",System.IO.FileMode.Create); -FreeImageStream imageStream = new FreeImageStream(stream); -imageStream.SaveImage((int)FREE_IMAGE_FORMAT.FIF_PNG,dib,0); -stream.Close(); - -Compile with VS2003. diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/Stdafx.cpp b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/Stdafx.cpp deleted file mode 100644 index 4f8b8cf..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/Stdafx.cpp +++ /dev/null @@ -1,5 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// FreeImageIO.Net.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/Stdafx.h b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/Stdafx.h deleted file mode 100644 index 07ec3fb..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/Stdafx.h +++ /dev/null @@ -1,6 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, -// but are changed infrequently - -#pragma once - diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/app.ico b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/app.ico deleted file mode 100644 index 3a5525f..0000000 Binary files a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/app.ico and /dev/null differ diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/app.rc b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/app.rc deleted file mode 100644 index b488dbd..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/app.rc +++ /dev/null @@ -1,52 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon placed first or with lowest ID value becomes application icon - -LANGUAGE 9, 1 -#pragma code_page(1252) -1 ICON "app.ico" - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" - "\0" -END - -#endif // APSTUDIO_INVOKED - -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/resource.h b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/resource.h deleted file mode 100644 index d5ac7c4..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/resource.h +++ /dev/null @@ -1,3 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by app.rc diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Bin/delete.me b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Bin/delete.me deleted file mode 100644 index ee53b98..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Bin/delete.me +++ /dev/null @@ -1 +0,0 @@ -You may safely delete this file. diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Content.txt b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Content.txt deleted file mode 100644 index 9d17916..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Content.txt +++ /dev/null @@ -1,43 +0,0 @@ - -This file gives you a short description of the .NET wrapper's folders -and what's located in them. - - -"Doc" -Sandcastle Help File Builder project file for creating a Microsoft Help API -documentation (CHM file). -FreeImage.NET uses Eric Woodruff's Sandcastle Help File Builder GUI to -generate the API documentation. See http://www.codeplex.com/SHFB - -"Library" -Source code of the C# .NET wrapper. Builds the FreeImageNET.dll. - -"Samples" -Example projects showing how to use the wrapper. - -"SourceFileMerger" -Program to merge all the wrapper's source files into a single source file -for easy integration into your projects on source code basis. - -"UnitTest" -NUnit-based test project for the .NET wrapper. NUnit needs to be installed -for this project to work. - -"UnitTestData" (not in CVS) -Several images in each available color depth used by "UnitTest". - -"clear.bat" -Batch file to clear the whole project, removing all temporary files. - -"FreeImage.chm" (not in CVS) -The .NET wrapper's API documentation. Build with Microsoft's Sandcastle -project from C# source code documentation. - -"FreeImage.NET.nunit" -NUnit project file. NUnit needs to be installed for this project to work. - -"FreeImage.NET.sln" -The Microsoft Visual Studio 2005 solution file. - -"Whats_New.NET.txt" -The changelog. \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Doc/3.11.0/FreeImage.NET.shfbproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Doc/3.11.0/FreeImage.NET.shfbproj deleted file mode 100644 index 1e4da12..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Doc/3.11.0/FreeImage.NET.shfbproj +++ /dev/null @@ -1,41 +0,0 @@ - - - - Debug - AnyCPU - 2.0 - {d68736d0-a80d-453c-a921-6ada865504b5} - 1.8.0.0 - - Documentation - Documentation - Documentation - - .\Out\ - FreeImage.NET - HtmlHelp1x - False - FreeImage - The productivity booster. FreeImage is licensed under the GNU General Public License %28GPL%29 and the FreeImage Public License %28FIPL%29. - FreeImage .NET Documentation - HashedMemberName - Msdn - AutoDocumentCtors - InheritedMembers, Protected - - - - - - - - - - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Doc/3.12.0/FreeImage.NET.shfbproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Doc/3.12.0/FreeImage.NET.shfbproj deleted file mode 100644 index 1e4da12..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Doc/3.12.0/FreeImage.NET.shfbproj +++ /dev/null @@ -1,41 +0,0 @@ - - - - Debug - AnyCPU - 2.0 - {d68736d0-a80d-453c-a921-6ada865504b5} - 1.8.0.0 - - Documentation - Documentation - Documentation - - .\Out\ - FreeImage.NET - HtmlHelp1x - False - FreeImage - The productivity booster. FreeImage is licensed under the GNU General Public License %28GPL%29 and the FreeImage Public License %28FIPL%29. - FreeImage .NET Documentation - HashedMemberName - Msdn - AutoDocumentCtors - InheritedMembers, Protected - - - - - - - - - - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Doc/3.13.0/FreeImage.NET.shfbproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Doc/3.13.0/FreeImage.NET.shfbproj deleted file mode 100644 index 1e4da12..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Doc/3.13.0/FreeImage.NET.shfbproj +++ /dev/null @@ -1,41 +0,0 @@ - - - - Debug - AnyCPU - 2.0 - {d68736d0-a80d-453c-a921-6ada865504b5} - 1.8.0.0 - - Documentation - Documentation - Documentation - - .\Out\ - FreeImage.NET - HtmlHelp1x - False - FreeImage - The productivity booster. FreeImage is licensed under the GNU General Public License %28GPL%29 and the FreeImage Public License %28FIPL%29. - FreeImage .NET Documentation - HashedMemberName - Msdn - AutoDocumentCtors - InheritedMembers, Protected - - - - - - - - - - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Doc/FreeImage.NET.shfbproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Doc/FreeImage.NET.shfbproj deleted file mode 100644 index fd76c1a..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Doc/FreeImage.NET.shfbproj +++ /dev/null @@ -1,52 +0,0 @@ - - - - Debug - AnyCPU - 2.0 - {d68736d0-a80d-453c-a921-6ada865504b5} - 1.8.0.0 - - Documentation - Documentation - Documentation - - .\Out\ - FreeImage.NET - HtmlHelp1x - False - FreeImage - The productivity booster. FreeImage is licensed under the GNU General Public License %28GPL%29 and the FreeImage Public License %28FIPL%29. - FreeImage .NET Documentation - HashedMemberName - Msdn - AutoDocumentCtors - InheritedMembers, Protected - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Doc/SHFB.txt b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Doc/SHFB.txt deleted file mode 100644 index fae9b3f..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Doc/SHFB.txt +++ /dev/null @@ -1,9 +0,0 @@ -Eric Woodruff's Sandcastle Help File Builder 1.6.x.x (SHFB) is needed for FreeImage.NET wrapper -help file creation. It can be downloaded from http://www.codeplex.com/SHFB - -As of FreeImage.NET version 1.08, version 1.8.01 of Sandcastle Help File Builder is used by FreeImage.NET -and thus needed for FreeImage.NET wrapper help file creation. It can still be downloaded -from http://www.codeplex.com/SHFB - -Microsoft's Sandcaste is also needed for SHFB to run correctly. It can be downloaded from -http://www.microsoft.com/downloads/details.aspx?FamilyId=E82EA71D-DA89-42EE-A715-696E3A4873B2&displaylang=en diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/FreeImage.NET.2005.sln b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/FreeImage.NET.2005.sln deleted file mode 100644 index c86757e..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/FreeImage.NET.2005.sln +++ /dev/null @@ -1,214 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Library", "Library\Library.2005.csproj", "{6598A7CD-8F27-4D3F-A675-5AE63113A7C3}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SourceFileMerger", "SourceFileMerger\SourceFileMerger.2005.csproj", "{2AD35641-C1EA-492C-B081-F4AA5AAE8FA1}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTest", "UnitTest\UnitTest.2005.csproj", "{FC7B3A04-FACE-4F07-9CFD-8C6ED06E3CDC}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample 01 - Loading and saving", "Samples\Sample 01 - Loading and saving\Sample 01 - Loading and saving.2005.csproj", "{0D294AB6-FAD4-4364-AAB6-43C1796116A9}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample 02 - Multipaged bitmaps", "Samples\Sample 02 - Multipaged bitmaps\Sample 02 - Multipaged bitmaps.2005.csproj", "{AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample 03 - Allocating", "Samples\Sample 03 - Allocating\Sample 03 - Allocating.2005.csproj", "{A7E452A1-1A43-47C4-8BF3-DA28E1402FB9}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample 04 - Getting bitmap informations", "Samples\Sample 04 - Getting bitmap informations\Sample 04 - Getting bitmap informations.2005.csproj", "{1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample 05 - Working with pixels", "Samples\Sample 05 - Working with pixels\Sample 05 - Working with pixels.2005.csproj", "{A501F134-8FB6-460B-AFE9-884A696C1C07}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample 06 - Converting", "Samples\Sample 06 - Converting\Sample 06 - Converting.2005.csproj", "{E2EA945D-E22C-47B3-9DD9-3A0B07FA3F81}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample 07 - ICC Profiles", "Samples\Sample 07 - ICC Profiles\Sample 07 - ICC Profiles.2005.csproj", "{3B1BB976-64A7-41FD-B7E2-59104161AF7E}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample 08 - Creating a plugin", "Samples\Sample 08 - Creating a plugin\Sample 08 - Creating a plugin.2005.csproj", "{491042DB-495B-420C-A3BE-5D13019707C5}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample 09 - Working with streams", "Samples\Sample 09 - Working with streams\Sample 09 - Working with streams.2005.csproj", "{92A454B2-67EF-4B70-99C9-F22B83B6FBFF}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample 10 - Metadata", "Samples\Sample 10 - Metadata\Sample 10 - Metadata.2005.csproj", "{55DCC37A-E56C-44D9-9C44-8DAB10CD3003}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample 11 - Using the FreeImageBitmap class", "Samples\Sample 11 - Using the FreeImageBitmap class\Sample 11 - Using the FreeImageBitmap class.2005.csproj", "{996068CD-D07A-42E0-856F-ACC71E8565EF}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3}.Debug|x64.ActiveCfg = Debug|x64 - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3}.Debug|x64.Build.0 = Debug|x64 - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3}.Debug|x86.ActiveCfg = Debug|x86 - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3}.Debug|x86.Build.0 = Debug|x86 - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3}.Release|Any CPU.Build.0 = Release|Any CPU - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3}.Release|x64.ActiveCfg = Release|x64 - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3}.Release|x64.Build.0 = Release|x64 - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3}.Release|x86.ActiveCfg = Release|x86 - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3}.Release|x86.Build.0 = Release|x86 - {2AD35641-C1EA-492C-B081-F4AA5AAE8FA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2AD35641-C1EA-492C-B081-F4AA5AAE8FA1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2AD35641-C1EA-492C-B081-F4AA5AAE8FA1}.Debug|x64.ActiveCfg = Debug|x64 - {2AD35641-C1EA-492C-B081-F4AA5AAE8FA1}.Debug|x64.Build.0 = Debug|x64 - {2AD35641-C1EA-492C-B081-F4AA5AAE8FA1}.Debug|x86.ActiveCfg = Debug|x86 - {2AD35641-C1EA-492C-B081-F4AA5AAE8FA1}.Debug|x86.Build.0 = Debug|x86 - {2AD35641-C1EA-492C-B081-F4AA5AAE8FA1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2AD35641-C1EA-492C-B081-F4AA5AAE8FA1}.Release|Any CPU.Build.0 = Release|Any CPU - {2AD35641-C1EA-492C-B081-F4AA5AAE8FA1}.Release|x64.ActiveCfg = Release|x64 - {2AD35641-C1EA-492C-B081-F4AA5AAE8FA1}.Release|x64.Build.0 = Release|x64 - {2AD35641-C1EA-492C-B081-F4AA5AAE8FA1}.Release|x86.ActiveCfg = Release|x86 - {2AD35641-C1EA-492C-B081-F4AA5AAE8FA1}.Release|x86.Build.0 = Release|x86 - {FC7B3A04-FACE-4F07-9CFD-8C6ED06E3CDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FC7B3A04-FACE-4F07-9CFD-8C6ED06E3CDC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FC7B3A04-FACE-4F07-9CFD-8C6ED06E3CDC}.Debug|x64.ActiveCfg = Debug|x64 - {FC7B3A04-FACE-4F07-9CFD-8C6ED06E3CDC}.Debug|x64.Build.0 = Debug|x64 - {FC7B3A04-FACE-4F07-9CFD-8C6ED06E3CDC}.Debug|x86.ActiveCfg = Debug|x86 - {FC7B3A04-FACE-4F07-9CFD-8C6ED06E3CDC}.Debug|x86.Build.0 = Debug|x86 - {FC7B3A04-FACE-4F07-9CFD-8C6ED06E3CDC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FC7B3A04-FACE-4F07-9CFD-8C6ED06E3CDC}.Release|Any CPU.Build.0 = Release|Any CPU - {FC7B3A04-FACE-4F07-9CFD-8C6ED06E3CDC}.Release|x64.ActiveCfg = Release|x64 - {FC7B3A04-FACE-4F07-9CFD-8C6ED06E3CDC}.Release|x64.Build.0 = Release|x64 - {FC7B3A04-FACE-4F07-9CFD-8C6ED06E3CDC}.Release|x86.ActiveCfg = Release|x86 - {FC7B3A04-FACE-4F07-9CFD-8C6ED06E3CDC}.Release|x86.Build.0 = Release|x86 - {0D294AB6-FAD4-4364-AAB6-43C1796116A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0D294AB6-FAD4-4364-AAB6-43C1796116A9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0D294AB6-FAD4-4364-AAB6-43C1796116A9}.Debug|x64.ActiveCfg = Debug|x64 - {0D294AB6-FAD4-4364-AAB6-43C1796116A9}.Debug|x64.Build.0 = Debug|x64 - {0D294AB6-FAD4-4364-AAB6-43C1796116A9}.Debug|x86.ActiveCfg = Debug|x86 - {0D294AB6-FAD4-4364-AAB6-43C1796116A9}.Debug|x86.Build.0 = Debug|x86 - {0D294AB6-FAD4-4364-AAB6-43C1796116A9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0D294AB6-FAD4-4364-AAB6-43C1796116A9}.Release|Any CPU.Build.0 = Release|Any CPU - {0D294AB6-FAD4-4364-AAB6-43C1796116A9}.Release|x64.ActiveCfg = Release|x64 - {0D294AB6-FAD4-4364-AAB6-43C1796116A9}.Release|x64.Build.0 = Release|x64 - {0D294AB6-FAD4-4364-AAB6-43C1796116A9}.Release|x86.ActiveCfg = Release|x86 - {0D294AB6-FAD4-4364-AAB6-43C1796116A9}.Release|x86.Build.0 = Release|x86 - {AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B}.Debug|x64.ActiveCfg = Debug|x64 - {AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B}.Debug|x64.Build.0 = Debug|x64 - {AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B}.Debug|x86.ActiveCfg = Debug|x86 - {AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B}.Debug|x86.Build.0 = Debug|x86 - {AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B}.Release|Any CPU.Build.0 = Release|Any CPU - {AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B}.Release|x64.ActiveCfg = Release|x64 - {AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B}.Release|x64.Build.0 = Release|x64 - {AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B}.Release|x86.ActiveCfg = Release|x86 - {AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B}.Release|x86.Build.0 = Release|x86 - {A7E452A1-1A43-47C4-8BF3-DA28E1402FB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A7E452A1-1A43-47C4-8BF3-DA28E1402FB9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A7E452A1-1A43-47C4-8BF3-DA28E1402FB9}.Debug|x64.ActiveCfg = Debug|x64 - {A7E452A1-1A43-47C4-8BF3-DA28E1402FB9}.Debug|x64.Build.0 = Debug|x64 - {A7E452A1-1A43-47C4-8BF3-DA28E1402FB9}.Debug|x86.ActiveCfg = Debug|x86 - {A7E452A1-1A43-47C4-8BF3-DA28E1402FB9}.Debug|x86.Build.0 = Debug|x86 - {A7E452A1-1A43-47C4-8BF3-DA28E1402FB9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A7E452A1-1A43-47C4-8BF3-DA28E1402FB9}.Release|Any CPU.Build.0 = Release|Any CPU - {A7E452A1-1A43-47C4-8BF3-DA28E1402FB9}.Release|x64.ActiveCfg = Release|x64 - {A7E452A1-1A43-47C4-8BF3-DA28E1402FB9}.Release|x64.Build.0 = Release|x64 - {A7E452A1-1A43-47C4-8BF3-DA28E1402FB9}.Release|x86.ActiveCfg = Release|x86 - {A7E452A1-1A43-47C4-8BF3-DA28E1402FB9}.Release|x86.Build.0 = Release|x86 - {1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A}.Debug|x64.ActiveCfg = Debug|x64 - {1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A}.Debug|x64.Build.0 = Debug|x64 - {1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A}.Debug|x86.ActiveCfg = Debug|x86 - {1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A}.Debug|x86.Build.0 = Debug|x86 - {1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A}.Release|Any CPU.Build.0 = Release|Any CPU - {1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A}.Release|x64.ActiveCfg = Release|x64 - {1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A}.Release|x64.Build.0 = Release|x64 - {1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A}.Release|x86.ActiveCfg = Release|x86 - {1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A}.Release|x86.Build.0 = Release|x86 - {A501F134-8FB6-460B-AFE9-884A696C1C07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A501F134-8FB6-460B-AFE9-884A696C1C07}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A501F134-8FB6-460B-AFE9-884A696C1C07}.Debug|x64.ActiveCfg = Debug|x64 - {A501F134-8FB6-460B-AFE9-884A696C1C07}.Debug|x64.Build.0 = Debug|x64 - {A501F134-8FB6-460B-AFE9-884A696C1C07}.Debug|x86.ActiveCfg = Debug|x86 - {A501F134-8FB6-460B-AFE9-884A696C1C07}.Debug|x86.Build.0 = Debug|x86 - {A501F134-8FB6-460B-AFE9-884A696C1C07}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A501F134-8FB6-460B-AFE9-884A696C1C07}.Release|Any CPU.Build.0 = Release|Any CPU - {A501F134-8FB6-460B-AFE9-884A696C1C07}.Release|x64.ActiveCfg = Release|x64 - {A501F134-8FB6-460B-AFE9-884A696C1C07}.Release|x64.Build.0 = Release|x64 - {A501F134-8FB6-460B-AFE9-884A696C1C07}.Release|x86.ActiveCfg = Release|x86 - {A501F134-8FB6-460B-AFE9-884A696C1C07}.Release|x86.Build.0 = Release|x86 - {E2EA945D-E22C-47B3-9DD9-3A0B07FA3F81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E2EA945D-E22C-47B3-9DD9-3A0B07FA3F81}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E2EA945D-E22C-47B3-9DD9-3A0B07FA3F81}.Debug|x64.ActiveCfg = Debug|x64 - {E2EA945D-E22C-47B3-9DD9-3A0B07FA3F81}.Debug|x64.Build.0 = Debug|x64 - {E2EA945D-E22C-47B3-9DD9-3A0B07FA3F81}.Debug|x86.ActiveCfg = Debug|x86 - {E2EA945D-E22C-47B3-9DD9-3A0B07FA3F81}.Debug|x86.Build.0 = Debug|x86 - {E2EA945D-E22C-47B3-9DD9-3A0B07FA3F81}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E2EA945D-E22C-47B3-9DD9-3A0B07FA3F81}.Release|Any CPU.Build.0 = Release|Any CPU - {E2EA945D-E22C-47B3-9DD9-3A0B07FA3F81}.Release|x64.ActiveCfg = Release|x64 - {E2EA945D-E22C-47B3-9DD9-3A0B07FA3F81}.Release|x64.Build.0 = Release|x64 - {E2EA945D-E22C-47B3-9DD9-3A0B07FA3F81}.Release|x86.ActiveCfg = Release|x86 - {E2EA945D-E22C-47B3-9DD9-3A0B07FA3F81}.Release|x86.Build.0 = Release|x86 - {3B1BB976-64A7-41FD-B7E2-59104161AF7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3B1BB976-64A7-41FD-B7E2-59104161AF7E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3B1BB976-64A7-41FD-B7E2-59104161AF7E}.Debug|x64.ActiveCfg = Debug|x64 - {3B1BB976-64A7-41FD-B7E2-59104161AF7E}.Debug|x64.Build.0 = Debug|x64 - {3B1BB976-64A7-41FD-B7E2-59104161AF7E}.Debug|x86.ActiveCfg = Debug|x86 - {3B1BB976-64A7-41FD-B7E2-59104161AF7E}.Debug|x86.Build.0 = Debug|x86 - {3B1BB976-64A7-41FD-B7E2-59104161AF7E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3B1BB976-64A7-41FD-B7E2-59104161AF7E}.Release|Any CPU.Build.0 = Release|Any CPU - {3B1BB976-64A7-41FD-B7E2-59104161AF7E}.Release|x64.ActiveCfg = Release|x64 - {3B1BB976-64A7-41FD-B7E2-59104161AF7E}.Release|x64.Build.0 = Release|x64 - {3B1BB976-64A7-41FD-B7E2-59104161AF7E}.Release|x86.ActiveCfg = Release|x86 - {3B1BB976-64A7-41FD-B7E2-59104161AF7E}.Release|x86.Build.0 = Release|x86 - {491042DB-495B-420C-A3BE-5D13019707C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {491042DB-495B-420C-A3BE-5D13019707C5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {491042DB-495B-420C-A3BE-5D13019707C5}.Debug|x64.ActiveCfg = Debug|x64 - {491042DB-495B-420C-A3BE-5D13019707C5}.Debug|x64.Build.0 = Debug|x64 - {491042DB-495B-420C-A3BE-5D13019707C5}.Debug|x86.ActiveCfg = Debug|x86 - {491042DB-495B-420C-A3BE-5D13019707C5}.Debug|x86.Build.0 = Debug|x86 - {491042DB-495B-420C-A3BE-5D13019707C5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {491042DB-495B-420C-A3BE-5D13019707C5}.Release|Any CPU.Build.0 = Release|Any CPU - {491042DB-495B-420C-A3BE-5D13019707C5}.Release|x64.ActiveCfg = Release|x64 - {491042DB-495B-420C-A3BE-5D13019707C5}.Release|x64.Build.0 = Release|x64 - {491042DB-495B-420C-A3BE-5D13019707C5}.Release|x86.ActiveCfg = Release|x86 - {491042DB-495B-420C-A3BE-5D13019707C5}.Release|x86.Build.0 = Release|x86 - {92A454B2-67EF-4B70-99C9-F22B83B6FBFF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {92A454B2-67EF-4B70-99C9-F22B83B6FBFF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {92A454B2-67EF-4B70-99C9-F22B83B6FBFF}.Debug|x64.ActiveCfg = Debug|x64 - {92A454B2-67EF-4B70-99C9-F22B83B6FBFF}.Debug|x64.Build.0 = Debug|x64 - {92A454B2-67EF-4B70-99C9-F22B83B6FBFF}.Debug|x86.ActiveCfg = Debug|x86 - {92A454B2-67EF-4B70-99C9-F22B83B6FBFF}.Debug|x86.Build.0 = Debug|x86 - {92A454B2-67EF-4B70-99C9-F22B83B6FBFF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {92A454B2-67EF-4B70-99C9-F22B83B6FBFF}.Release|Any CPU.Build.0 = Release|Any CPU - {92A454B2-67EF-4B70-99C9-F22B83B6FBFF}.Release|x64.ActiveCfg = Release|x64 - {92A454B2-67EF-4B70-99C9-F22B83B6FBFF}.Release|x64.Build.0 = Release|x64 - {92A454B2-67EF-4B70-99C9-F22B83B6FBFF}.Release|x86.ActiveCfg = Release|x86 - {92A454B2-67EF-4B70-99C9-F22B83B6FBFF}.Release|x86.Build.0 = Release|x86 - {55DCC37A-E56C-44D9-9C44-8DAB10CD3003}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {55DCC37A-E56C-44D9-9C44-8DAB10CD3003}.Debug|Any CPU.Build.0 = Debug|Any CPU - {55DCC37A-E56C-44D9-9C44-8DAB10CD3003}.Debug|x64.ActiveCfg = Debug|x64 - {55DCC37A-E56C-44D9-9C44-8DAB10CD3003}.Debug|x64.Build.0 = Debug|x64 - {55DCC37A-E56C-44D9-9C44-8DAB10CD3003}.Debug|x86.ActiveCfg = Debug|x86 - {55DCC37A-E56C-44D9-9C44-8DAB10CD3003}.Debug|x86.Build.0 = Debug|x86 - {55DCC37A-E56C-44D9-9C44-8DAB10CD3003}.Release|Any CPU.ActiveCfg = Release|Any CPU - {55DCC37A-E56C-44D9-9C44-8DAB10CD3003}.Release|Any CPU.Build.0 = Release|Any CPU - {55DCC37A-E56C-44D9-9C44-8DAB10CD3003}.Release|x64.ActiveCfg = Release|x64 - {55DCC37A-E56C-44D9-9C44-8DAB10CD3003}.Release|x64.Build.0 = Release|x64 - {55DCC37A-E56C-44D9-9C44-8DAB10CD3003}.Release|x86.ActiveCfg = Release|x86 - {55DCC37A-E56C-44D9-9C44-8DAB10CD3003}.Release|x86.Build.0 = Release|x86 - {996068CD-D07A-42E0-856F-ACC71E8565EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {996068CD-D07A-42E0-856F-ACC71E8565EF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {996068CD-D07A-42E0-856F-ACC71E8565EF}.Debug|x64.ActiveCfg = Debug|x64 - {996068CD-D07A-42E0-856F-ACC71E8565EF}.Debug|x64.Build.0 = Debug|x64 - {996068CD-D07A-42E0-856F-ACC71E8565EF}.Debug|x86.ActiveCfg = Debug|x86 - {996068CD-D07A-42E0-856F-ACC71E8565EF}.Debug|x86.Build.0 = Debug|x86 - {996068CD-D07A-42E0-856F-ACC71E8565EF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {996068CD-D07A-42E0-856F-ACC71E8565EF}.Release|Any CPU.Build.0 = Release|Any CPU - {996068CD-D07A-42E0-856F-ACC71E8565EF}.Release|x64.ActiveCfg = Release|x64 - {996068CD-D07A-42E0-856F-ACC71E8565EF}.Release|x64.Build.0 = Release|x64 - {996068CD-D07A-42E0-856F-ACC71E8565EF}.Release|x86.ActiveCfg = Release|x86 - {996068CD-D07A-42E0-856F-ACC71E8565EF}.Release|x86.Build.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/FreeImage.NET.nunit b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/FreeImage.NET.nunit deleted file mode 100644 index c1da949..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/FreeImage.NET.nunit +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/FreeImage.NET.sln b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/FreeImage.NET.sln deleted file mode 100644 index e2df94d..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/FreeImage.NET.sln +++ /dev/null @@ -1,214 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Library", "Library\Library.csproj", "{6598A7CD-8F27-4D3F-A675-5AE63113A7C3}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SourceFileMerger", "SourceFileMerger\SourceFileMerger.csproj", "{2AD35641-C1EA-492C-B081-F4AA5AAE8FA1}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTest", "UnitTest\UnitTest.csproj", "{FC7B3A04-FACE-4F07-9CFD-8C6ED06E3CDC}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample 01 - Loading and saving", "Samples\Sample 01 - Loading and saving\Sample 01 - Loading and saving.csproj", "{0D294AB6-FAD4-4364-AAB6-43C1796116A9}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample 02 - Multipaged bitmaps", "Samples\Sample 02 - Multipaged bitmaps\Sample 02 - Multipaged bitmaps.csproj", "{AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample 03 - Allocating", "Samples\Sample 03 - Allocating\Sample 03 - Allocating.csproj", "{A7E452A1-1A43-47C4-8BF3-DA28E1402FB9}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample 04 - Getting bitmap informations", "Samples\Sample 04 - Getting bitmap informations\Sample 04 - Getting bitmap informations.csproj", "{1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample 05 - Working with pixels", "Samples\Sample 05 - Working with pixels\Sample 05 - Working with pixels.csproj", "{A501F134-8FB6-460B-AFE9-884A696C1C07}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample 06 - Converting", "Samples\Sample 06 - Converting\Sample 06 - Converting.csproj", "{E2EA945D-E22C-47B3-9DD9-3A0B07FA3F81}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample 07 - ICC Profiles", "Samples\Sample 07 - ICC Profiles\Sample 07 - ICC Profiles.csproj", "{3B1BB976-64A7-41FD-B7E2-59104161AF7E}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample 08 - Creating a plugin", "Samples\Sample 08 - Creating a plugin\Sample 08 - Creating a plugin.csproj", "{491042DB-495B-420C-A3BE-5D13019707C5}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample 09 - Working with streams", "Samples\Sample 09 - Working with streams\Sample 09 - Working with streams.csproj", "{92A454B2-67EF-4B70-99C9-F22B83B6FBFF}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample 10 - Metadata", "Samples\Sample 10 - Metadata\Sample 10 - Metadata.csproj", "{55DCC37A-E56C-44D9-9C44-8DAB10CD3003}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample 11 - Using the FreeImageBitmap class", "Samples\Sample 11 - Using the FreeImageBitmap class\Sample 11 - Using the FreeImageBitmap class.csproj", "{996068CD-D07A-42E0-856F-ACC71E8565EF}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3}.Debug|x64.ActiveCfg = Debug|x64 - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3}.Debug|x64.Build.0 = Debug|x64 - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3}.Debug|x86.ActiveCfg = Debug|x86 - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3}.Debug|x86.Build.0 = Debug|x86 - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3}.Release|Any CPU.Build.0 = Release|Any CPU - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3}.Release|x64.ActiveCfg = Release|x64 - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3}.Release|x64.Build.0 = Release|x64 - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3}.Release|x86.ActiveCfg = Release|x86 - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3}.Release|x86.Build.0 = Release|x86 - {2AD35641-C1EA-492C-B081-F4AA5AAE8FA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2AD35641-C1EA-492C-B081-F4AA5AAE8FA1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2AD35641-C1EA-492C-B081-F4AA5AAE8FA1}.Debug|x64.ActiveCfg = Debug|x64 - {2AD35641-C1EA-492C-B081-F4AA5AAE8FA1}.Debug|x64.Build.0 = Debug|x64 - {2AD35641-C1EA-492C-B081-F4AA5AAE8FA1}.Debug|x86.ActiveCfg = Debug|x86 - {2AD35641-C1EA-492C-B081-F4AA5AAE8FA1}.Debug|x86.Build.0 = Debug|x86 - {2AD35641-C1EA-492C-B081-F4AA5AAE8FA1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2AD35641-C1EA-492C-B081-F4AA5AAE8FA1}.Release|Any CPU.Build.0 = Release|Any CPU - {2AD35641-C1EA-492C-B081-F4AA5AAE8FA1}.Release|x64.ActiveCfg = Release|x64 - {2AD35641-C1EA-492C-B081-F4AA5AAE8FA1}.Release|x64.Build.0 = Release|x64 - {2AD35641-C1EA-492C-B081-F4AA5AAE8FA1}.Release|x86.ActiveCfg = Release|x86 - {2AD35641-C1EA-492C-B081-F4AA5AAE8FA1}.Release|x86.Build.0 = Release|x86 - {FC7B3A04-FACE-4F07-9CFD-8C6ED06E3CDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FC7B3A04-FACE-4F07-9CFD-8C6ED06E3CDC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FC7B3A04-FACE-4F07-9CFD-8C6ED06E3CDC}.Debug|x64.ActiveCfg = Debug|x64 - {FC7B3A04-FACE-4F07-9CFD-8C6ED06E3CDC}.Debug|x64.Build.0 = Debug|x64 - {FC7B3A04-FACE-4F07-9CFD-8C6ED06E3CDC}.Debug|x86.ActiveCfg = Debug|x86 - {FC7B3A04-FACE-4F07-9CFD-8C6ED06E3CDC}.Debug|x86.Build.0 = Debug|x86 - {FC7B3A04-FACE-4F07-9CFD-8C6ED06E3CDC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FC7B3A04-FACE-4F07-9CFD-8C6ED06E3CDC}.Release|Any CPU.Build.0 = Release|Any CPU - {FC7B3A04-FACE-4F07-9CFD-8C6ED06E3CDC}.Release|x64.ActiveCfg = Release|x64 - {FC7B3A04-FACE-4F07-9CFD-8C6ED06E3CDC}.Release|x64.Build.0 = Release|x64 - {FC7B3A04-FACE-4F07-9CFD-8C6ED06E3CDC}.Release|x86.ActiveCfg = Release|x86 - {FC7B3A04-FACE-4F07-9CFD-8C6ED06E3CDC}.Release|x86.Build.0 = Release|x86 - {0D294AB6-FAD4-4364-AAB6-43C1796116A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0D294AB6-FAD4-4364-AAB6-43C1796116A9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0D294AB6-FAD4-4364-AAB6-43C1796116A9}.Debug|x64.ActiveCfg = Debug|x64 - {0D294AB6-FAD4-4364-AAB6-43C1796116A9}.Debug|x64.Build.0 = Debug|x64 - {0D294AB6-FAD4-4364-AAB6-43C1796116A9}.Debug|x86.ActiveCfg = Debug|x86 - {0D294AB6-FAD4-4364-AAB6-43C1796116A9}.Debug|x86.Build.0 = Debug|x86 - {0D294AB6-FAD4-4364-AAB6-43C1796116A9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0D294AB6-FAD4-4364-AAB6-43C1796116A9}.Release|Any CPU.Build.0 = Release|Any CPU - {0D294AB6-FAD4-4364-AAB6-43C1796116A9}.Release|x64.ActiveCfg = Release|x64 - {0D294AB6-FAD4-4364-AAB6-43C1796116A9}.Release|x64.Build.0 = Release|x64 - {0D294AB6-FAD4-4364-AAB6-43C1796116A9}.Release|x86.ActiveCfg = Release|x86 - {0D294AB6-FAD4-4364-AAB6-43C1796116A9}.Release|x86.Build.0 = Release|x86 - {AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B}.Debug|x64.ActiveCfg = Debug|x64 - {AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B}.Debug|x64.Build.0 = Debug|x64 - {AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B}.Debug|x86.ActiveCfg = Debug|x86 - {AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B}.Debug|x86.Build.0 = Debug|x86 - {AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B}.Release|Any CPU.Build.0 = Release|Any CPU - {AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B}.Release|x64.ActiveCfg = Release|x64 - {AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B}.Release|x64.Build.0 = Release|x64 - {AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B}.Release|x86.ActiveCfg = Release|x86 - {AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B}.Release|x86.Build.0 = Release|x86 - {A7E452A1-1A43-47C4-8BF3-DA28E1402FB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A7E452A1-1A43-47C4-8BF3-DA28E1402FB9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A7E452A1-1A43-47C4-8BF3-DA28E1402FB9}.Debug|x64.ActiveCfg = Debug|x64 - {A7E452A1-1A43-47C4-8BF3-DA28E1402FB9}.Debug|x64.Build.0 = Debug|x64 - {A7E452A1-1A43-47C4-8BF3-DA28E1402FB9}.Debug|x86.ActiveCfg = Debug|x86 - {A7E452A1-1A43-47C4-8BF3-DA28E1402FB9}.Debug|x86.Build.0 = Debug|x86 - {A7E452A1-1A43-47C4-8BF3-DA28E1402FB9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A7E452A1-1A43-47C4-8BF3-DA28E1402FB9}.Release|Any CPU.Build.0 = Release|Any CPU - {A7E452A1-1A43-47C4-8BF3-DA28E1402FB9}.Release|x64.ActiveCfg = Release|x64 - {A7E452A1-1A43-47C4-8BF3-DA28E1402FB9}.Release|x64.Build.0 = Release|x64 - {A7E452A1-1A43-47C4-8BF3-DA28E1402FB9}.Release|x86.ActiveCfg = Release|x86 - {A7E452A1-1A43-47C4-8BF3-DA28E1402FB9}.Release|x86.Build.0 = Release|x86 - {1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A}.Debug|x64.ActiveCfg = Debug|x64 - {1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A}.Debug|x64.Build.0 = Debug|x64 - {1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A}.Debug|x86.ActiveCfg = Debug|x86 - {1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A}.Debug|x86.Build.0 = Debug|x86 - {1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A}.Release|Any CPU.Build.0 = Release|Any CPU - {1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A}.Release|x64.ActiveCfg = Release|x64 - {1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A}.Release|x64.Build.0 = Release|x64 - {1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A}.Release|x86.ActiveCfg = Release|x86 - {1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A}.Release|x86.Build.0 = Release|x86 - {A501F134-8FB6-460B-AFE9-884A696C1C07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A501F134-8FB6-460B-AFE9-884A696C1C07}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A501F134-8FB6-460B-AFE9-884A696C1C07}.Debug|x64.ActiveCfg = Debug|x64 - {A501F134-8FB6-460B-AFE9-884A696C1C07}.Debug|x64.Build.0 = Debug|x64 - {A501F134-8FB6-460B-AFE9-884A696C1C07}.Debug|x86.ActiveCfg = Debug|x86 - {A501F134-8FB6-460B-AFE9-884A696C1C07}.Debug|x86.Build.0 = Debug|x86 - {A501F134-8FB6-460B-AFE9-884A696C1C07}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A501F134-8FB6-460B-AFE9-884A696C1C07}.Release|Any CPU.Build.0 = Release|Any CPU - {A501F134-8FB6-460B-AFE9-884A696C1C07}.Release|x64.ActiveCfg = Release|x64 - {A501F134-8FB6-460B-AFE9-884A696C1C07}.Release|x64.Build.0 = Release|x64 - {A501F134-8FB6-460B-AFE9-884A696C1C07}.Release|x86.ActiveCfg = Release|x86 - {A501F134-8FB6-460B-AFE9-884A696C1C07}.Release|x86.Build.0 = Release|x86 - {E2EA945D-E22C-47B3-9DD9-3A0B07FA3F81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E2EA945D-E22C-47B3-9DD9-3A0B07FA3F81}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E2EA945D-E22C-47B3-9DD9-3A0B07FA3F81}.Debug|x64.ActiveCfg = Debug|x64 - {E2EA945D-E22C-47B3-9DD9-3A0B07FA3F81}.Debug|x64.Build.0 = Debug|x64 - {E2EA945D-E22C-47B3-9DD9-3A0B07FA3F81}.Debug|x86.ActiveCfg = Debug|x86 - {E2EA945D-E22C-47B3-9DD9-3A0B07FA3F81}.Debug|x86.Build.0 = Debug|x86 - {E2EA945D-E22C-47B3-9DD9-3A0B07FA3F81}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E2EA945D-E22C-47B3-9DD9-3A0B07FA3F81}.Release|Any CPU.Build.0 = Release|Any CPU - {E2EA945D-E22C-47B3-9DD9-3A0B07FA3F81}.Release|x64.ActiveCfg = Release|x64 - {E2EA945D-E22C-47B3-9DD9-3A0B07FA3F81}.Release|x64.Build.0 = Release|x64 - {E2EA945D-E22C-47B3-9DD9-3A0B07FA3F81}.Release|x86.ActiveCfg = Release|x86 - {E2EA945D-E22C-47B3-9DD9-3A0B07FA3F81}.Release|x86.Build.0 = Release|x86 - {3B1BB976-64A7-41FD-B7E2-59104161AF7E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3B1BB976-64A7-41FD-B7E2-59104161AF7E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3B1BB976-64A7-41FD-B7E2-59104161AF7E}.Debug|x64.ActiveCfg = Debug|x64 - {3B1BB976-64A7-41FD-B7E2-59104161AF7E}.Debug|x64.Build.0 = Debug|x64 - {3B1BB976-64A7-41FD-B7E2-59104161AF7E}.Debug|x86.ActiveCfg = Debug|x86 - {3B1BB976-64A7-41FD-B7E2-59104161AF7E}.Debug|x86.Build.0 = Debug|x86 - {3B1BB976-64A7-41FD-B7E2-59104161AF7E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3B1BB976-64A7-41FD-B7E2-59104161AF7E}.Release|Any CPU.Build.0 = Release|Any CPU - {3B1BB976-64A7-41FD-B7E2-59104161AF7E}.Release|x64.ActiveCfg = Release|x64 - {3B1BB976-64A7-41FD-B7E2-59104161AF7E}.Release|x64.Build.0 = Release|x64 - {3B1BB976-64A7-41FD-B7E2-59104161AF7E}.Release|x86.ActiveCfg = Release|x86 - {3B1BB976-64A7-41FD-B7E2-59104161AF7E}.Release|x86.Build.0 = Release|x86 - {491042DB-495B-420C-A3BE-5D13019707C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {491042DB-495B-420C-A3BE-5D13019707C5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {491042DB-495B-420C-A3BE-5D13019707C5}.Debug|x64.ActiveCfg = Debug|x64 - {491042DB-495B-420C-A3BE-5D13019707C5}.Debug|x64.Build.0 = Debug|x64 - {491042DB-495B-420C-A3BE-5D13019707C5}.Debug|x86.ActiveCfg = Debug|x86 - {491042DB-495B-420C-A3BE-5D13019707C5}.Debug|x86.Build.0 = Debug|x86 - {491042DB-495B-420C-A3BE-5D13019707C5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {491042DB-495B-420C-A3BE-5D13019707C5}.Release|Any CPU.Build.0 = Release|Any CPU - {491042DB-495B-420C-A3BE-5D13019707C5}.Release|x64.ActiveCfg = Release|x64 - {491042DB-495B-420C-A3BE-5D13019707C5}.Release|x64.Build.0 = Release|x64 - {491042DB-495B-420C-A3BE-5D13019707C5}.Release|x86.ActiveCfg = Release|x86 - {491042DB-495B-420C-A3BE-5D13019707C5}.Release|x86.Build.0 = Release|x86 - {92A454B2-67EF-4B70-99C9-F22B83B6FBFF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {92A454B2-67EF-4B70-99C9-F22B83B6FBFF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {92A454B2-67EF-4B70-99C9-F22B83B6FBFF}.Debug|x64.ActiveCfg = Debug|x64 - {92A454B2-67EF-4B70-99C9-F22B83B6FBFF}.Debug|x64.Build.0 = Debug|x64 - {92A454B2-67EF-4B70-99C9-F22B83B6FBFF}.Debug|x86.ActiveCfg = Debug|x86 - {92A454B2-67EF-4B70-99C9-F22B83B6FBFF}.Debug|x86.Build.0 = Debug|x86 - {92A454B2-67EF-4B70-99C9-F22B83B6FBFF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {92A454B2-67EF-4B70-99C9-F22B83B6FBFF}.Release|Any CPU.Build.0 = Release|Any CPU - {92A454B2-67EF-4B70-99C9-F22B83B6FBFF}.Release|x64.ActiveCfg = Release|x64 - {92A454B2-67EF-4B70-99C9-F22B83B6FBFF}.Release|x64.Build.0 = Release|x64 - {92A454B2-67EF-4B70-99C9-F22B83B6FBFF}.Release|x86.ActiveCfg = Release|x86 - {92A454B2-67EF-4B70-99C9-F22B83B6FBFF}.Release|x86.Build.0 = Release|x86 - {55DCC37A-E56C-44D9-9C44-8DAB10CD3003}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {55DCC37A-E56C-44D9-9C44-8DAB10CD3003}.Debug|Any CPU.Build.0 = Debug|Any CPU - {55DCC37A-E56C-44D9-9C44-8DAB10CD3003}.Debug|x64.ActiveCfg = Debug|x64 - {55DCC37A-E56C-44D9-9C44-8DAB10CD3003}.Debug|x64.Build.0 = Debug|x64 - {55DCC37A-E56C-44D9-9C44-8DAB10CD3003}.Debug|x86.ActiveCfg = Debug|x86 - {55DCC37A-E56C-44D9-9C44-8DAB10CD3003}.Debug|x86.Build.0 = Debug|x86 - {55DCC37A-E56C-44D9-9C44-8DAB10CD3003}.Release|Any CPU.ActiveCfg = Release|Any CPU - {55DCC37A-E56C-44D9-9C44-8DAB10CD3003}.Release|Any CPU.Build.0 = Release|Any CPU - {55DCC37A-E56C-44D9-9C44-8DAB10CD3003}.Release|x64.ActiveCfg = Release|x64 - {55DCC37A-E56C-44D9-9C44-8DAB10CD3003}.Release|x64.Build.0 = Release|x64 - {55DCC37A-E56C-44D9-9C44-8DAB10CD3003}.Release|x86.ActiveCfg = Release|x86 - {55DCC37A-E56C-44D9-9C44-8DAB10CD3003}.Release|x86.Build.0 = Release|x86 - {996068CD-D07A-42E0-856F-ACC71E8565EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {996068CD-D07A-42E0-856F-ACC71E8565EF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {996068CD-D07A-42E0-856F-ACC71E8565EF}.Debug|x64.ActiveCfg = Debug|x64 - {996068CD-D07A-42E0-856F-ACC71E8565EF}.Debug|x64.Build.0 = Debug|x64 - {996068CD-D07A-42E0-856F-ACC71E8565EF}.Debug|x86.ActiveCfg = Debug|x86 - {996068CD-D07A-42E0-856F-ACC71E8565EF}.Debug|x86.Build.0 = Debug|x86 - {996068CD-D07A-42E0-856F-ACC71E8565EF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {996068CD-D07A-42E0-856F-ACC71E8565EF}.Release|Any CPU.Build.0 = Release|Any CPU - {996068CD-D07A-42E0-856F-ACC71E8565EF}.Release|x64.ActiveCfg = Release|x64 - {996068CD-D07A-42E0-856F-ACC71E8565EF}.Release|x64.Build.0 = Release|x64 - {996068CD-D07A-42E0-856F-ACC71E8565EF}.Release|x86.ActiveCfg = Release|x86 - {996068CD-D07A-42E0-856F-ACC71E8565EF}.Release|x86.Build.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/FreeImageBitmap.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/FreeImageBitmap.cs deleted file mode 100644 index f22d396..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/FreeImageBitmap.cs +++ /dev/null @@ -1,4378 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.12 $ -// $Date: 2011/12/22 14:54:22 $ -// $Id: FreeImageBitmap.cs,v 1.12 2011/12/22 14:54:22 drolon Exp $ -// ========================================================== - -using System; -using System.Drawing; -using System.Drawing.Imaging; -using System.IO; -using System.IO.Compression; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Collections; -using System.Collections.Generic; -using FreeImageAPI.Metadata; -using System.Diagnostics; - -namespace FreeImageAPI -{ - /// - /// Encapsulates a FreeImage-bitmap. - /// - [Serializable, Guid("64a4c935-b757-499c-ab8c-6110316a9e51")] - public class FreeImageBitmap : MarshalByRefObject, ICloneable, IDisposable, IEnumerable, ISerializable - { - #region Fields - - /// - /// Indicates whether this instance is disposed. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private bool disposed; - - /// - /// Tab object. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private object tag; - - /// - /// Object used to syncronize lock methods. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private object lockObject = new object(); - - /// - /// Holds information used by SaveAdd() methods. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private SaveInformation saveInformation = new SaveInformation(); - - /// - /// The stream that this instance was loaded from or - /// null if it has been cloned or deserialized. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private Stream stream; - - /// - /// True if the stream must be disposed with this - /// instance. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private bool disposeStream; - - /// - /// The number of frames contained by a mutlipage bitmap. - /// Default value is 1 and only changed if needed. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private int frameCount = 1; - - /// - /// The index of the loaded frame. - /// Default value is 0 and only changed if needed. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private int frameIndex = 0; - - /// - /// Format of the sourceimage. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private FREE_IMAGE_FORMAT originalFormat = FREE_IMAGE_FORMAT.FIF_UNKNOWN; - - /// - /// Handle to the encapsulated FreeImage-bitmap. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private FIBITMAP dib; - - private const string ErrorLoadingBitmap = "Unable to load bitmap."; - private const string ErrorLoadingFrame = "Unable to load frame."; - private const string ErrorCreatingBitmap = "Unable to create bitmap."; - private const string ErrorUnloadBitmap = "Unable to unload bitmap."; - - #endregion - - #region Constructors and Destructor - - /// - /// Initializes a new instance of the class. - /// - protected FreeImageBitmap() - { - } - - /// - /// Initializes a new instance of the class. - /// For internal use only. - /// - /// The operation failed. - internal protected FreeImageBitmap(FIBITMAP dib) - { - if (dib.IsNull) - { - throw new Exception(ErrorLoadingBitmap); - } - this.dib = dib; - AddMemoryPressure(); - } - - /// - /// Initializes a new instance of the class - /// bases on the specified image. - /// - /// The original to clone from. - /// The operation failed. - /// is a null reference. - public FreeImageBitmap(FreeImageBitmap original) - { - if (original == null) - { - throw new ArgumentNullException("original"); - } - original.EnsureNotDisposed(); - dib = FreeImage.Clone(original.dib); - if (dib.IsNull) - { - throw new Exception(ErrorLoadingBitmap); - } - originalFormat = original.originalFormat; - AddMemoryPressure(); - } - - /// - /// Initializes a new instance of the class - /// bases on the specified image with the specified size. - /// - /// The original to clone from. - /// The Size structure that represent the - /// size of the new . - /// The operation failed. - /// is a null reference. - /// - /// or are less or equal zero. - /// - public FreeImageBitmap(FreeImageBitmap original, Size newSize) - : this(original, newSize.Width, newSize.Height) - { - } - - /// - /// Initializes a new instance of the class - /// bases on the specified image with the specified size. - /// - /// The original to clone from. - /// Width of the new . - /// Height of the new . - /// The operation failed. - /// is a null reference. - /// - /// or are less or equal zero. - public FreeImageBitmap(FreeImageBitmap original, int width, int height) - { - if (original == null) - { - throw new ArgumentNullException("original"); - } - if (width <= 0) - { - throw new ArgumentOutOfRangeException("width"); - } - if (height <= 0) - { - throw new ArgumentOutOfRangeException("height"); - } - original.EnsureNotDisposed(); - dib = FreeImage.Rescale(original.dib, width, height, FREE_IMAGE_FILTER.FILTER_BICUBIC); - if (dib.IsNull) - { - throw new Exception(ErrorLoadingBitmap); - } - originalFormat = original.originalFormat; - AddMemoryPressure(); - } - - /// - /// Initializes a new instance of the class - /// bases on the specified image. - /// - /// The original to clone from. - /// - /// Although this constructor supports creating images in both formats - /// - /// and , bitmaps - /// created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - /// images respectively. Currently, there is no support for automatic premultiplying images in - /// . - /// - /// The operation failed. - public FreeImageBitmap(Image original) - : this(original as Bitmap) - { - } - - /// - /// Initializes a new instance of the class - /// bases on the specified image with the specified size. - /// - /// The original to clone from. - /// The Size structure that represent the - /// size of the new . - /// - /// Although this constructor supports creating images in both formats - /// - /// and , bitmaps - /// created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - /// images respectively. Currently, there is no support for automatic premultiplying images in - /// . - /// - /// The operation failed. - /// is a null reference. - /// - /// or are less or equal zero. - /// - public FreeImageBitmap(Image original, Size newSize) - : this(original as Bitmap, newSize.Width, newSize.Height) - { - } - - /// - /// Initializes a new instance of the class - /// bases on the specified image with the specified size. - /// - /// The original to clone from. - /// The width, in pixels, of the new . - /// The height, in pixels, of the new . - /// - /// Although this constructor supports creating images in both formats - /// - /// and , bitmaps - /// created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - /// images respectively. Currently, there is no support for automatic premultiplying images in - /// . - /// - /// The operation failed. - /// is a null reference. - /// - /// or are less or equal zero. - public FreeImageBitmap(Image original, int width, int height) - : this(original as Bitmap, width, height) - { - } - - /// - /// Initializes a new instance of the class - /// bases on the specified image. - /// - /// The original to clone from. - /// - /// Although this constructor supports creating images in both formats - /// - /// and , bitmaps - /// created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - /// images respectively. Currently, there is no support for automatic premultiplying images in - /// . - /// - /// is a null reference. - /// The operation failed. - public FreeImageBitmap(Bitmap original) - { - if (original == null) - { - throw new ArgumentNullException("original"); - } - dib = FreeImage.CreateFromBitmap(original, true); - if (dib.IsNull) - { - throw new Exception(ErrorLoadingBitmap); - } - originalFormat = FreeImage.GetFormat(original.RawFormat); - AddMemoryPressure(); - } - - /// - /// Initializes a new instance of the class - /// bases on the specified image with the specified size. - /// - /// The original to clone from. - /// The Size structure that represent the - /// size of the new . - /// - /// Although this constructor supports creating images in both formats - /// - /// and , bitmaps - /// created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - /// images respectively. Currently, there is no support for automatic premultiplying images in - /// . - /// - /// The operation failed. - /// is a null reference. - /// - /// or are less or equal zero. - /// - public FreeImageBitmap(Bitmap original, Size newSize) - : this(original, newSize.Width, newSize.Height) - { - } - - /// - /// Initializes a new instance of the class - /// bases on the specified image with the specified size. - /// - /// The original to clone from. - /// The width, in pixels, of the new . - /// The height, in pixels, of the new . - /// - /// Although this constructor supports creating images in both formats - /// - /// and , bitmaps - /// created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - /// images respectively. Currently, there is no support for automatic premultiplying images in - /// . - /// - /// The operation failed. - /// is a null reference. - /// - /// or are less or equal zero. - public FreeImageBitmap(Bitmap original, int width, int height) - { - if (original == null) - { - throw new ArgumentNullException("original"); - } - if (width <= 0) - { - throw new ArgumentOutOfRangeException("width"); - } - if (height <= 0) - { - throw new ArgumentOutOfRangeException("height"); - } - FIBITMAP temp = FreeImage.CreateFromBitmap(original, true); - if (temp.IsNull) - { - throw new Exception(ErrorLoadingBitmap); - } - dib = FreeImage.Rescale(temp, width, height, FREE_IMAGE_FILTER.FILTER_BICUBIC); - FreeImage.Unload(temp); - if (dib.IsNull) - { - throw new Exception(ErrorLoadingBitmap); - } - originalFormat = FreeImage.GetFormat(original.RawFormat); - AddMemoryPressure(); - } - - /// - /// Initializes a new instance of the class - /// bases on the specified stream. - /// - /// Stream to read from. - /// Ignored. - /// The operation failed. - /// is a null reference. - /// - /// You must keep the stream open for the lifetime of the . - /// - public FreeImageBitmap(Stream stream, bool useIcm) - : this(stream) - { - } - - /// - /// Initializes a new instance of the class - /// bases on the specified stream. - /// - /// Stream to read from. - /// The operation failed. - /// is a null reference. - /// - /// You must keep the stream open for the lifetime of the . - /// - public FreeImageBitmap(Stream stream) - : this(stream, FREE_IMAGE_FORMAT.FIF_UNKNOWN, FREE_IMAGE_LOAD_FLAGS.DEFAULT) - { - } - - /// - /// Initializes a new instance of the class - /// bases on the specified stream in the specified format. - /// - /// Stream to read from. - /// Format of the image. - /// The operation failed. - /// is a null reference. - /// - /// You must keep the stream open for the lifetime of the . - /// - public FreeImageBitmap(Stream stream, FREE_IMAGE_FORMAT format) - : this(stream, format, FREE_IMAGE_LOAD_FLAGS.DEFAULT) - { - } - - /// - /// Initializes a new instance of the class - /// bases on the specified stream with the specified loading flags. - /// - /// Stream to read from. - /// Flags to enable or disable plugin-features. - /// The operation failed. - /// is a null reference. - /// - /// You must keep the stream open for the lifetime of the . - /// - public FreeImageBitmap(Stream stream, FREE_IMAGE_LOAD_FLAGS flags) - : this(stream, FREE_IMAGE_FORMAT.FIF_UNKNOWN, flags) - { - } - - /// - /// Initializes a new instance of the class - /// bases on the specified stream in the specified format - /// with the specified loading flags. - /// - /// Stream to read from. - /// Format of the image. - /// Flags to enable or disable plugin-features. - /// The operation failed. - /// is a null reference. - /// - /// You must keep the stream open for the lifetime of the . - /// - public FreeImageBitmap(Stream stream, FREE_IMAGE_FORMAT format, FREE_IMAGE_LOAD_FLAGS flags) - { - if (stream == null) - { - throw new ArgumentNullException("stream"); - } - this.stream = stream; - disposeStream = false; - LoadFromStream(stream, format, flags); - } - - /// - /// Initializes a new instance of the class bases on the specified file. - /// - /// The complete name of the file to load. - /// The operation failed. - /// is a null reference. - /// does not exist. - public FreeImageBitmap(string filename) - : this(filename, FREE_IMAGE_LOAD_FLAGS.DEFAULT) - { - } - - /// - /// Initializes a new instance of the class bases on the specified file. - /// - /// The complete name of the file to load. - /// Ignored. - /// The operation failed. - /// is a null reference. - /// does not exist. - public FreeImageBitmap(string filename, bool useIcm) - : this(filename) - { - } - - /// - /// Initializes a new instance of the class bases on the specified file - /// with the specified loading flags. - /// - /// The complete name of the file to load. - /// Flags to enable or disable plugin-features. - /// The operation failed. - /// is a null reference. - /// does not exist. - public FreeImageBitmap(string filename, FREE_IMAGE_LOAD_FLAGS flags) - : this(filename, FREE_IMAGE_FORMAT.FIF_UNKNOWN, flags) - { - } - - /// - /// Initializes a new instance of the class bases on the specified file - /// in the specified format. - /// - /// The complete name of the file to load. - /// Format of the image. - /// The operation failed. - /// is a null reference. - /// does not exist. - public FreeImageBitmap(string filename, FREE_IMAGE_FORMAT format) - : this(filename, format, FREE_IMAGE_LOAD_FLAGS.DEFAULT) - { - } - - /// - /// Initializes a new instance of the class bases on the specified file - /// in the specified format with the specified loading flags. - /// - /// The complete name of the file to load. - /// Format of the image. - /// Flags to enable or disable plugin-features. - /// The operation failed. - /// is a null reference. - /// does not exist. - public FreeImageBitmap(string filename, FREE_IMAGE_FORMAT format, FREE_IMAGE_LOAD_FLAGS flags) - { - if (filename == null) - { - throw new ArgumentNullException("filename"); - } - if (!File.Exists(filename)) - { - throw new FileNotFoundException("filename"); - } - - saveInformation.filename = filename; - stream = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read); - disposeStream = true; - LoadFromStream(stream, format, flags); - } - - /// - /// Initializes a new instance of the class - /// bases on the specified size. - /// - /// The width, in pixels, of the new . - /// The height, in pixels, of the new . - /// The operation failed. - public FreeImageBitmap(int width, int height) - { - dib = FreeImage.Allocate( - width, - height, - 24, - FreeImage.FI_RGBA_RED_MASK, - FreeImage.FI_RGBA_GREEN_MASK, - FreeImage.FI_RGBA_BLUE_MASK); - if (dib.IsNull) - { - throw new Exception(ErrorCreatingBitmap); - } - AddMemoryPressure(); - } - - /// - /// Initializes a new instance of the class bases on the specified resource. - /// - /// The class used to extract the resource. - /// The name of the resource. - /// The operation failed. - public FreeImageBitmap(Type type, string resource) - : this(type.Module.Assembly.GetManifestResourceStream(type, resource)) - { - } - - /// - /// Initializes a new instance of the class bases on the specified size - /// and with the resolution of the specified object. - /// - /// The width, in pixels, of the new . - /// The height, in pixels, of the new . - /// The Graphics object that specifies the resolution for the new . - /// The operation failed. - /// is a null reference. - public FreeImageBitmap(int width, int height, Graphics g) - : this(width, height) - { - FreeImage.SetResolutionX(dib, (uint)g.DpiX); - FreeImage.SetResolutionY(dib, (uint)g.DpiY); - } - - /// - /// Initializes a new instance of the class bases on the specified size and format. - /// - /// The width, in pixels, of the new . - /// The height, in pixels, of the new . - /// The PixelFormat enumeration for the new . - /// - /// Although this constructor supports creating images in both formats - /// - /// and , bitmaps - /// created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - /// images respectively. Currently, there is no support for automatic premultiplying images in - /// . - /// - /// The operation failed. - /// is invalid. - /// - /// or are less or equal zero. - public FreeImageBitmap(int width, int height, PixelFormat format) - { - if (width <= 0) - { - throw new ArgumentOutOfRangeException("width"); - } - if (height <= 0) - { - throw new ArgumentOutOfRangeException("height"); - } - uint bpp, redMask, greenMask, blueMask; - FREE_IMAGE_TYPE type; - if (!FreeImage.GetFormatParameters(format, out type, out bpp, out redMask, out greenMask, out blueMask)) - { - throw new ArgumentException("format is invalid"); - } - dib = FreeImage.AllocateT(type, width, height, (int)bpp, redMask, greenMask, blueMask); - if (dib.IsNull) - { - throw new Exception(ErrorCreatingBitmap); - } - AddMemoryPressure(); - } - - /// - /// Initializes a new instance of the class bases on the specified size and type. - /// Only non standard bitmaps are supported. - /// - /// The width, in pixels, of the new . - /// The height, in pixels, of the new . - /// The type of the bitmap. - /// The operation failed. - /// - /// is FIT_BITMAP or FIT_UNKNOWN. - /// is invalid. - /// - /// or are less or equal zero. - public FreeImageBitmap(int width, int height, FREE_IMAGE_TYPE type) - { - if (width <= 0) - { - throw new ArgumentOutOfRangeException("width"); - } - if (height <= 0) - { - throw new ArgumentOutOfRangeException("height"); - } - if ((type == FREE_IMAGE_TYPE.FIT_BITMAP) || (type == FREE_IMAGE_TYPE.FIT_UNKNOWN)) - { - throw new ArgumentException("type is invalid."); - } - dib = FreeImage.AllocateT(type, width, height, 0, 0u, 0u, 0u); - if (dib.IsNull) - { - throw new Exception(ErrorCreatingBitmap); - } - AddMemoryPressure(); - } - - /// - /// Initializes a new instance of the class bases on the specified size, - /// pixel format and pixel data. - /// - /// The width, in pixels, of the new . - /// The height, in pixels, of the new . - /// Integer that specifies the byte offset between the beginning - /// of one scan line and the next. This is usually (but not necessarily) - /// the number of bytes in the pixel format (for example, 2 for 16 bits per pixel) - /// multiplied by the width of the bitmap. The value passed to this parameter must - /// be a multiple of four.. - /// The PixelFormat enumeration for the new . - /// Pointer to an array of bytes that contains the pixel data. - /// - /// Although this constructor supports creating images in both formats - /// - /// and , bitmaps - /// created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - /// images respectively. Currently, there is no support for automatic premultiplying images in - /// . - /// - /// The operation failed. - /// is invalid. - /// - /// or are less or equal zero. - public FreeImageBitmap(int width, int height, int stride, PixelFormat format, IntPtr scan0) - { - if (width <= 0) - { - throw new ArgumentOutOfRangeException("width"); - } - if (height <= 0) - { - throw new ArgumentOutOfRangeException("height"); - } - uint bpp, redMask, greenMask, blueMask; - FREE_IMAGE_TYPE type; - bool topDown = (stride > 0); - stride = (stride > 0) ? stride : (stride * -1); - - if (!FreeImage.GetFormatParameters(format, out type, out bpp, out redMask, out greenMask, out blueMask)) - { - throw new ArgumentException("format is invalid."); - } - - dib = FreeImage.ConvertFromRawBits( - scan0, type, width, height, stride, bpp, redMask, greenMask, blueMask, topDown); - - if (dib.IsNull) - { - throw new Exception(ErrorCreatingBitmap); - } - AddMemoryPressure(); - } - - /// - /// Initializes a new instance of the class bases on the specified size, - /// pixel format and pixel data. - /// - /// The width, in pixels, of the new . - /// The height, in pixels, of the new . - /// Integer that specifies the byte offset between the beginning - /// of one scan line and the next. This is usually (but not necessarily) - /// the number of bytes in the pixel format (for example, 2 for 16 bits per pixel) - /// multiplied by the width of the bitmap. The value passed to this parameter must - /// be a multiple of four.. - /// The PixelFormat enumeration for the new . - /// Array of bytes containing the bitmap data. - /// - /// Although this constructor supports creating images in both formats - /// - /// and , bitmaps - /// created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - /// images respectively. Currently, there is no support for automatic premultiplying images in - /// . - /// - /// The operation failed. - /// is invalid. - /// - /// or are less or equal zero. - /// is null - public FreeImageBitmap(int width, int height, int stride, PixelFormat format, byte[] bits) - { - if (width <= 0) - { - throw new ArgumentOutOfRangeException("width"); - } - if (height <= 0) - { - throw new ArgumentOutOfRangeException("height"); - } - if (bits == null) - { - throw new ArgumentNullException("bits"); - } - uint bpp, redMask, greenMask, blueMask; - FREE_IMAGE_TYPE type; - bool topDown = (stride > 0); - stride = (stride > 0) ? stride : (stride * -1); - - if (!FreeImage.GetFormatParameters(format, out type, out bpp, out redMask, out greenMask, out blueMask)) - { - throw new ArgumentException("format is invalid."); - } - - dib = FreeImage.ConvertFromRawBits( - bits, type, width, height, stride, bpp, redMask, greenMask, blueMask, topDown); - - if (dib.IsNull) - { - throw new Exception(ErrorCreatingBitmap); - } - AddMemoryPressure(); - } - - /// - /// Initializes a new instance of the class bases on the specified size, - /// pixel format and pixel data. - /// - /// The width, in pixels, of the new . - /// The height, in pixels, of the new . - /// Integer that specifies the byte offset between the beginning - /// of one scan line and the next. This is usually (but not necessarily) - /// the number of bytes in the pixel format (for example, 2 for 16 bits per pixel) - /// multiplied by the width of the bitmap. The value passed to this parameter must - /// be a multiple of four.. - /// The color depth of the new - /// The type for the new . - /// Pointer to an array of bytes that contains the pixel data. - /// The operation failed. - /// is invalid. - /// - /// or are less or equal zero. - public FreeImageBitmap(int width, int height, int stride, int bpp, FREE_IMAGE_TYPE type, IntPtr scan0) - { - if (width <= 0) - { - throw new ArgumentOutOfRangeException("width"); - } - if (height <= 0) - { - throw new ArgumentOutOfRangeException("height"); - } - uint redMask, greenMask, blueMask; - bool topDown = (stride > 0); - stride = (stride > 0) ? stride : (stride * -1); - - if (!FreeImage.GetTypeParameters(type, bpp, out redMask, out greenMask, out blueMask)) - { - throw new ArgumentException("bpp and type are invalid or not supported."); - } - - dib = FreeImage.ConvertFromRawBits( - scan0, type, width, height, stride, (uint)bpp, redMask, greenMask, blueMask, topDown); - - if (dib.IsNull) - { - throw new Exception(ErrorCreatingBitmap); - } - AddMemoryPressure(); - } - - /// - /// Initializes a new instance of the class bases on the specified size, - /// pixel format and pixel data. - /// - /// The width, in pixels, of the new . - /// The height, in pixels, of the new . - /// Integer that specifies the byte offset between the beginning - /// of one scan line and the next. This is usually (but not necessarily) - /// the number of bytes in the pixel format (for example, 2 for 16 bits per pixel) - /// multiplied by the width of the bitmap. The value passed to this parameter must - /// be a multiple of four.. - /// The color depth of the new - /// The type for the new . - /// Array of bytes containing the bitmap data. - /// The operation failed. - /// is invalid. - /// - /// or are less or equal zero. - /// is null - public FreeImageBitmap(int width, int height, int stride, int bpp, FREE_IMAGE_TYPE type, byte[] bits) - { - if (width <= 0) - { - throw new ArgumentOutOfRangeException("width"); - } - if (height <= 0) - { - throw new ArgumentOutOfRangeException("height"); - } - if (bits == null) - { - throw new ArgumentNullException("bits"); - } - uint redMask, greenMask, blueMask; - bool topDown = (stride > 0); - stride = (stride > 0) ? stride : (stride * -1); - - if (!FreeImage.GetTypeParameters(type, bpp, out redMask, out greenMask, out blueMask)) - { - throw new ArgumentException("bpp and type are invalid or not supported."); - } - - dib = FreeImage.ConvertFromRawBits( - bits, type, width, height, stride, (uint)bpp, redMask, greenMask, blueMask, topDown); - - if (dib.IsNull) - { - throw new Exception(ErrorCreatingBitmap); - } - AddMemoryPressure(); - } - - /// - /// Initializes a new instance of the class. - /// - /// The operation failed. - /// The operation failed. - public FreeImageBitmap(SerializationInfo info, StreamingContext context) - { - try - { - byte[] data = (byte[])info.GetValue("Bitmap Data", typeof(byte[])); - if ((data != null) && (data.Length > 0)) - { - MemoryStream memory = new MemoryStream(data); - FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_TIFF; - dib = FreeImage.LoadFromStream(memory, ref format); - - if (dib.IsNull) - { - throw new Exception(ErrorLoadingBitmap); - } - - AddMemoryPressure(); - } - } - catch (Exception ex) - { - throw new SerializationException("Deserialization failed.", ex); - } - } - - /// - /// Frees all managed and unmanaged ressources. - /// - ~FreeImageBitmap() - { - Dispose(false); - } - - #endregion - - #region Operators - - /// - /// Converts a instance to a instance. - /// - /// A instance. - /// A new instance of initialized to . - /// - /// The explicit conversion from into Bitmap - /// allows to create an instance on the fly and use it as if - /// was a Bitmap. This way it can be directly used with a - /// PixtureBox for example without having to call any - /// conversion operations. - /// - public static explicit operator Bitmap(FreeImageBitmap value) - { - return value.ToBitmap(); - } - - /// - /// Converts a instance to a instance. - /// - /// A instance. - /// A new instance of initialized to . - /// - /// The explicit conversion from into - /// allows to create an instance on the fly to perform - /// image processing operations and converting it back. - /// - public static explicit operator FreeImageBitmap(Bitmap value) - { - return new FreeImageBitmap(value); - } - - /// - /// Determines whether two specified objects have the same value. - /// - /// A or a null reference (Nothing in Visual Basic). - /// A or a null reference (Nothing in Visual Basic). - /// - /// true if the value of left is the same as the value of right; otherwise, false. - /// - public static bool operator ==(FreeImageBitmap left, FreeImageBitmap right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - else if (object.ReferenceEquals(left, null) || object.ReferenceEquals(right, null)) - { - return false; - } - else - { - left.EnsureNotDisposed(); - right.EnsureNotDisposed(); - return FreeImage.Compare(left.dib, right.dib, FREE_IMAGE_COMPARE_FLAGS.COMPLETE); - } - } - - /// - /// Determines whether two specified objects have different values. - /// - /// A or a null reference (Nothing in Visual Basic). - /// A or a null reference (Nothing in Visual Basic). - /// - /// true if the value of left is different from the value of right; otherwise, false. - /// - public static bool operator !=(FreeImageBitmap left, FreeImageBitmap right) - { - return (!(left == right)); - } - - #endregion - - #region Properties - - /// - /// Type of the bitmap. - /// - public FREE_IMAGE_TYPE ImageType - { - get - { - EnsureNotDisposed(); - return FreeImage.GetImageType(dib); - } - } - - /// - /// Number of palette entries. - /// - public int ColorsUsed - { - get - { - EnsureNotDisposed(); - return (int)FreeImage.GetColorsUsed(dib); - } - } - - /// - /// The number of unique colors actually used by the bitmap. This might be different from - /// what ColorsUsed returns, which actually returns the palette size for palletised images. - /// Works for FIT_BITMAP type bitmaps only. - /// - public int UniqueColors - { - get - { - EnsureNotDisposed(); - return FreeImage.GetUniqueColors(dib); - } - } - - /// - /// The size of one pixel in the bitmap in bits. - /// - public int ColorDepth - { - get - { - EnsureNotDisposed(); - return (int)FreeImage.GetBPP(dib); - } - } - - /// - /// Width of the bitmap in pixel units. - /// - public int Width - { - get - { - EnsureNotDisposed(); - return (int)FreeImage.GetWidth(dib); - } - } - - /// - /// Height of the bitmap in pixel units. - /// - public int Height - { - get - { - EnsureNotDisposed(); - return (int)FreeImage.GetHeight(dib); - } - } - - /// - /// Returns the width of the bitmap in bytes, rounded to the next 32-bit boundary. - /// - public int Pitch - { - get - { - EnsureNotDisposed(); - return (int)FreeImage.GetPitch(dib); - } - } - - /// - /// Size of the bitmap in memory. - /// - public int DataSize - { - get - { - EnsureNotDisposed(); - return (int)FreeImage.GetDIBSize(dib); - } - } - - /// - /// Returns a structure that represents the palette of a FreeImage bitmap. - /// - /// is false. - public Palette Palette - { - get - { - EnsureNotDisposed(); - if (HasPalette) - { - return new Palette(dib); - } - throw new InvalidOperationException("This bitmap does not have a palette."); - } - } - - /// - /// Gets whether the bitmap is RGB 555. - /// - public bool IsRGB555 - { - get - { - EnsureNotDisposed(); - return FreeImage.IsRGB555(dib); - } - } - - /// - /// Gets whether the bitmap is RGB 565. - /// - public bool IsRGB565 - { - get - { - EnsureNotDisposed(); - return FreeImage.IsRGB565(dib); - } - } - - /// - /// Gets the horizontal resolution, in pixels per inch, of this . - /// - public float HorizontalResolution - { - get - { - EnsureNotDisposed(); - return (float)FreeImage.GetResolutionX(dib); - } - private set - { - EnsureNotDisposed(); - FreeImage.SetResolutionX(dib, (uint)value); - } - } - - /// - /// Gets the vertical resolution, in pixels per inch, of this . - /// - public float VerticalResolution - { - get - { - EnsureNotDisposed(); - return (float)FreeImage.GetResolutionY(dib); - } - private set - { - EnsureNotDisposed(); - FreeImage.SetResolutionY(dib, (uint)value); - } - } - - /// - /// Returns the structure of this . - /// - public BITMAPINFOHEADER InfoHeader - { - get - { - EnsureNotDisposed(); - return FreeImage.GetInfoHeaderEx(dib); - } - } - - /// - /// Returns the structure of a this . - /// - public BITMAPINFO Info - { - get - { - EnsureNotDisposed(); - return FreeImage.GetInfoEx(dib); - } - } - - /// - /// Investigates the color type of this - /// by reading the bitmaps pixel bits and analysing them. - /// - public FREE_IMAGE_COLOR_TYPE ColorType - { - get - { - EnsureNotDisposed(); - return FreeImage.GetColorType(dib); - } - } - - /// - /// Bit pattern describing the red color component of a pixel in this . - /// - public uint RedMask - { - get - { - EnsureNotDisposed(); - return FreeImage.GetRedMask(dib); - } - } - - /// - /// Bit pattern describing the green color component of a pixel in this . - /// - public uint GreenMask - { - get - { - EnsureNotDisposed(); - return FreeImage.GetGreenMask(dib); - } - } - - /// - /// Bit pattern describing the blue color component of a pixel in this . - /// - public uint BlueMask - { - get - { - EnsureNotDisposed(); - return FreeImage.GetBlueMask(dib); - } - } - - /// - /// Number of transparent colors in a palletised . - /// - public int TransparencyCount - { - get - { - EnsureNotDisposed(); - return (int)FreeImage.GetTransparencyCount(dib); - } - } - - /// - /// Get or sets transparency table of this . - /// - public byte[] TransparencyTable - { - get - { - EnsureNotDisposed(); - return FreeImage.GetTransparencyTableEx(dib); - } - set - { - EnsureNotDisposed(); - FreeImage.SetTransparencyTable(dib, value); - } - } - - /// - /// Gets or sets whether this is transparent. - /// - public bool IsTransparent - { - get - { - EnsureNotDisposed(); - return FreeImage.IsTransparent(dib); - } - set - { - EnsureNotDisposed(); - FreeImage.SetTransparent(dib, value); - } - } - - /// - /// Gets whether this has a file background color. - /// - public bool HasBackgroundColor - { - get - { - EnsureNotDisposed(); - return FreeImage.HasBackgroundColor(dib); - } - } - - /// - /// Gets or sets the background color of this . - /// In case the value is null, the background color is removed. - /// - /// Get: There is no background color available. - /// Set: Setting background color failed. - public Color? BackgroundColor - { - get - { - EnsureNotDisposed(); - if (!FreeImage.HasBackgroundColor(dib)) - { - throw new InvalidOperationException("No background color available."); - } - RGBQUAD rgbq; - FreeImage.GetBackgroundColor(dib, out rgbq); - return rgbq.Color; - } - set - { - EnsureNotDisposed(); - if (!FreeImage.SetBackgroundColor(dib, (value.HasValue ? new RGBQUAD[] { value.Value } : null))) - { - throw new Exception("Setting background color failed."); - } - } - } - - /// - /// Pointer to the data-bits of this . - /// - public IntPtr Bits - { - get - { - EnsureNotDisposed(); - return FreeImage.GetBits(dib); - } - } - - /// - /// Width, in bytes, of this . - /// - public int Line - { - get - { - EnsureNotDisposed(); - return (int)FreeImage.GetLine(dib); - } - } - - /// - /// Pointer to the scanline of the top most pixel row of this . - /// - public IntPtr Scan0 - { - get - { - EnsureNotDisposed(); - return FreeImage.GetScanLine(dib, (int)(FreeImage.GetHeight(dib) - 1)); - } - } - - /// - /// Width, in bytes, of this . - /// In case this is top down Stride will be positive, else negative. - /// - public int Stride - { - get - { - return -Line; - } - } - - /// - /// Gets attribute flags for the pixel data of this . - /// - public unsafe int Flags - { - get - { - EnsureNotDisposed(); - int result = 0; - byte alpha; - int cd = ColorDepth; - - if ((cd == 32) || (FreeImage.GetTransparencyCount(dib) != 0)) - { - result += (int)ImageFlags.HasAlpha; - } - - if (cd == 32) - { - uint width = FreeImage.GetWidth(dib); - uint height = FreeImage.GetHeight(dib); - for (int y = 0; y < height; y++) - { - RGBQUAD* scanline = (RGBQUAD*)FreeImage.GetScanLine(dib, y); - for (int x = 0; x < width; x++) - { - alpha = scanline[x].Color.A; - if (alpha != byte.MinValue && alpha != byte.MaxValue) - { - result += (int)ImageFlags.HasTranslucent; - y = (int)height; - break; - } - } - } - } - else if (FreeImage.GetTransparencyCount(dib) != 0) - { - byte[] transTable = FreeImage.GetTransparencyTableEx(dib); - for (int i = 0; i < transTable.Length; i++) - { - if (transTable[i] != byte.MinValue && transTable[i] != byte.MaxValue) - { - result += (int)ImageFlags.HasTranslucent; - break; - } - } - } - - if (FreeImage.GetICCProfileEx(dib).IsCMYK) - { - result += (int)ImageFlags.ColorSpaceCmyk; - } - else - { - result += (int)ImageFlags.ColorSpaceRgb; - } - - if (FreeImage.GetColorType(dib) == FREE_IMAGE_COLOR_TYPE.FIC_MINISBLACK || - FreeImage.GetColorType(dib) == FREE_IMAGE_COLOR_TYPE.FIC_MINISWHITE) - { - result += (int)ImageFlags.ColorSpaceGray; - } - - if (originalFormat == FREE_IMAGE_FORMAT.FIF_BMP || - originalFormat == FREE_IMAGE_FORMAT.FIF_FAXG3 || - originalFormat == FREE_IMAGE_FORMAT.FIF_ICO || - originalFormat == FREE_IMAGE_FORMAT.FIF_JPEG || - originalFormat == FREE_IMAGE_FORMAT.FIF_PCX || - originalFormat == FREE_IMAGE_FORMAT.FIF_PNG || - originalFormat == FREE_IMAGE_FORMAT.FIF_PSD || - originalFormat == FREE_IMAGE_FORMAT.FIF_TIFF) - { - result += (int)ImageFlags.HasRealDpi; - } - - return result; - } - } - - /// - /// Gets the width and height of this . - /// - public SizeF PhysicalDimension - { - get - { - EnsureNotDisposed(); - return new SizeF((float)FreeImage.GetWidth(dib), (float)FreeImage.GetHeight(dib)); - } - } - - /// - /// Gets the pixel format for this . - /// - public PixelFormat PixelFormat - { - get - { - EnsureNotDisposed(); - return FreeImage.GetPixelFormat(dib); - } - } - - /// - /// Gets IDs of the property items stored in this . - /// - public int[] PropertyIdList - { - get - { - EnsureNotDisposed(); - List list = new List(); - ImageMetadata metaData = new ImageMetadata(dib, true); - - foreach (MetadataModel metadataModel in metaData) - { - foreach (MetadataTag metadataTag in metadataModel) - { - list.Add(metadataTag.ID); - } - } - - return list.ToArray(); - } - } - - /// - /// Gets all the property items (pieces of metadata) stored in this . - /// - public PropertyItem[] PropertyItems - { - get - { - EnsureNotDisposed(); - List list = new List(); - ImageMetadata metaData = new ImageMetadata(dib, true); - - foreach (MetadataModel metadataModel in metaData) - { - foreach (MetadataTag metadataTag in metadataModel) - { - list.Add(metadataTag.GetPropertyItem()); - } - } - - return list.ToArray(); - } - } - - /// - /// Gets the format of this . - /// - public ImageFormat RawFormat - { - get - { - EnsureNotDisposed(); - Attribute guidAttribute = - Attribute.GetCustomAttribute( - typeof(FreeImageBitmap), typeof(System.Runtime.InteropServices.GuidAttribute) - ); - return (guidAttribute == null) ? - null : - new ImageFormat(new Guid(((GuidAttribute)guidAttribute).Value)); - } - } - - /// - /// Gets the width and height, in pixels, of this . - /// - public Size Size - { - get - { - EnsureNotDisposed(); - return new Size(Width, Height); - } - } - - /// - /// Gets or sets an object that provides additional data about the . - /// - public Object Tag - { - get - { - EnsureNotDisposed(); - return tag; - } - set - { - EnsureNotDisposed(); - tag = value; - } - } - - /// - /// Gets whether this has been disposed. - /// - public bool IsDisposed - { - get - { - return disposed; - } - } - - /// - /// Gets a new instance of a metadata representing class. - /// - public ImageMetadata Metadata - { - get - { - EnsureNotDisposed(); - return new ImageMetadata(dib, true); - } - } - - /// - /// Gets or sets the comment of this . - /// Supported formats are JPEG, PNG and GIF. - /// - public string Comment - { - get - { - EnsureNotDisposed(); - return FreeImage.GetImageComment(dib); - } - set - { - EnsureNotDisposed(); - FreeImage.SetImageComment(dib, value); - } - } - - /// - /// Returns whether this has a palette. - /// - public bool HasPalette - { - get - { - EnsureNotDisposed(); - return (FreeImage.GetPalette(dib) != IntPtr.Zero); - } - } - - /// - /// Gets or sets the entry used as transparent color in this . - /// Only works for 1-, 4- and 8-bpp. - /// - public int TransparentIndex - { - get - { - EnsureNotDisposed(); - return FreeImage.GetTransparentIndex(dib); - } - set - { - EnsureNotDisposed(); - FreeImage.SetTransparentIndex(dib, value); - } - } - - /// - /// Gets the number of frames in this . - /// - public int FrameCount - { - get - { - EnsureNotDisposed(); - return frameCount; - } - } - - /// - /// Gets the ICCProfile structure of this . - /// - public FIICCPROFILE ICCProfile - { - get - { - EnsureNotDisposed(); - return FreeImage.GetICCProfileEx(dib); - } - } - - /// - /// Gets the format of the original image in case - /// this was loaded from a file or stream. - /// - public FREE_IMAGE_FORMAT ImageFormat - { - get - { - EnsureNotDisposed(); - return originalFormat; - } - } - - /// - /// Gets the encapsulated FIBITMAP. - /// - internal FIBITMAP Dib - { - get { EnsureNotDisposed(); return dib; } - } - - #endregion - - #region Methods - - /// - /// Gets the bounds of this in the specified unit. - /// - /// One of the values indicating - /// the unit of measure for the bounding rectangle. - /// The that represents the bounds of this - /// , in the specified unit. - public RectangleF GetBounds(ref GraphicsUnit pageUnit) - { - EnsureNotDisposed(); - pageUnit = GraphicsUnit.Pixel; - return new RectangleF( - 0f, - 0f, - (float)FreeImage.GetWidth(dib), - (float)FreeImage.GetHeight(dib)); - } - - /// - /// Gets the specified property item from this . - /// - /// The ID of the property item to get. - /// The this method gets. - public PropertyItem GetPropertyItem(int propid) - { - EnsureNotDisposed(); - ImageMetadata metadata = new ImageMetadata(dib, true); - foreach (MetadataModel metadataModel in metadata) - { - foreach (MetadataTag tag in metadataModel) - { - if (tag.ID == propid) - { - return tag.GetPropertyItem(); - } - } - } - return null; - } - - /// - /// Returns a thumbnail for this . - /// - /// The width, in pixels, of the requested thumbnail image. - /// The height, in pixels, of the requested thumbnail image. - /// Ignored. - /// Ignored. - /// A that represents the thumbnail. - public FreeImageBitmap GetThumbnailImage(int thumbWidth, int thumbHeight, - Image.GetThumbnailImageAbort callback, IntPtr callBackData) - { - EnsureNotDisposed(); - FreeImageBitmap result = null; - FIBITMAP newDib = FreeImage.Rescale( - dib, thumbWidth, thumbHeight, FREE_IMAGE_FILTER.FILTER_BICUBIC); - if (!newDib.IsNull) - { - result = new FreeImageBitmap(newDib); - } - return result; - } - - /// - /// Returns a thumbnail for this , keeping aspect ratio. - /// defines the maximum width or height - /// of the thumbnail. - /// - /// Thumbnail square size. - /// When true HDR images are transperantly - /// converted to standard images. - /// The thumbnail in a new instance. - public FreeImageBitmap GetThumbnailImage(int maxPixelSize, bool convert) - { - EnsureNotDisposed(); - FreeImageBitmap result = null; - FIBITMAP newDib = FreeImage.MakeThumbnail(dib, maxPixelSize, convert); - if (!newDib.IsNull) - { - result = new FreeImageBitmap(newDib); - } - return result; - } - - /// - /// Converts this instance to a instance. - /// - /// A new instance of initialized this instance. - public Bitmap ToBitmap() - { - EnsureNotDisposed(); - return FreeImage.GetBitmap(dib, true); - } - - /// - /// Returns an instance of , representing the scanline - /// specified by of this . - /// Since FreeImage bitmaps are always bottum up aligned, keep in mind that scanline 0 is the - /// bottom-most line of the image. - /// - /// Number of the scanline to retrieve. - /// An instance of representing the - /// th scanline. - /// - /// List of return-types of T: - /// - /// Color Depth / TypeResult Type - /// 1 () - /// 4 () - /// 8 () - /// 16 () - /// 16 - 555 () - /// 16 - 565 () - /// 24 () - /// 32 () - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// FreeImageBitmap bitmap = new FreeImageBitmap(@"C:\Pictures\picture.bmp"); - /// if (bitmap.ColorDepth == 32) - /// { - /// Scanline<RGBQUAD> scanline = bitmap.GetScanline<RGBQUAD>(0); - /// foreach (RGBQUAD pixel in scanline) - /// { - /// Console.WriteLine(pixel); - /// } - /// } - /// - /// - /// - /// The bitmap's type or color depth are not supported. - /// - /// - /// is no valid value. - /// - public Scanline GetScanline(int scanline) where T : struct - { - EnsureNotDisposed(); - return new Scanline(dib, scanline); - } - - /// - /// Returns an instance of , representing the scanline - /// specified by of this . - /// Since FreeImage bitmaps are always bottum up aligned, keep in mind that scanline 0 is the - /// bottom-most line of the image. - /// - /// Number of the scanline to retrieve. - /// An instance of representing the - /// th scanline. - /// - /// List of return-types of T: - /// - /// Color Depth / TypeResult Type - /// 1 () - /// 4 () - /// 8 () - /// 16 () - /// 16 - 555 () - /// 16 - 565 () - /// 24 () - /// 32 () - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// FreeImageBitmap bitmap = new FreeImageBitmap(@"C:\Pictures\picture.bmp"); - /// if (bitmap.ColorDepth == 32) - /// { - /// Scanline<RGBQUAD> scanline = (Scanline<RGBQUAD>)bitmap.GetScanline(0); - /// foreach (RGBQUAD pixel in scanline) - /// { - /// Console.WriteLine(pixel); - /// } - /// } - /// - /// - /// - /// The type of the bitmap or color depth are not supported. - /// - /// - /// is no valid value. - /// - public object GetScanline(int scanline) - { - EnsureNotDisposed(); - object result = null; - int width = (int)FreeImage.GetWidth(dib); - - switch (FreeImage.GetImageType(dib)) - { - case FREE_IMAGE_TYPE.FIT_BITMAP: - - switch (FreeImage.GetBPP(dib)) - { - case 1u: result = new Scanline(dib, scanline, width); break; - case 4u: result = new Scanline(dib, scanline, width); break; - case 8u: result = new Scanline(dib, scanline, width); break; - case 16u: - if ((RedMask == FreeImage.FI16_555_RED_MASK) && - (GreenMask == FreeImage.FI16_555_GREEN_MASK) && - (BlueMask == FreeImage.FI16_555_BLUE_MASK)) - { - result = new Scanline(dib, scanline, width); - } - else if ((RedMask == FreeImage.FI16_565_RED_MASK) && - (GreenMask == FreeImage.FI16_565_GREEN_MASK) && - (BlueMask == FreeImage.FI16_565_BLUE_MASK)) - { - result = new Scanline(dib, scanline, width); - } - else - { - result = new Scanline(dib, scanline, width); - } - break; - case 24u: result = new Scanline(dib, scanline, width); break; - case 32u: result = new Scanline(dib, scanline, width); break; - default: throw new ArgumentException("Color depth is not supported."); - } - break; - - case FREE_IMAGE_TYPE.FIT_COMPLEX: result = new Scanline(dib, scanline, width); break; - case FREE_IMAGE_TYPE.FIT_DOUBLE: result = new Scanline(dib, scanline, width); break; - case FREE_IMAGE_TYPE.FIT_FLOAT: result = new Scanline(dib, scanline, width); break; - case FREE_IMAGE_TYPE.FIT_INT16: result = new Scanline(dib, scanline, width); break; - case FREE_IMAGE_TYPE.FIT_INT32: result = new Scanline(dib, scanline, width); break; - case FREE_IMAGE_TYPE.FIT_RGB16: result = new Scanline(dib, scanline, width); break; - case FREE_IMAGE_TYPE.FIT_RGBA16: result = new Scanline(dib, scanline, width); break; - case FREE_IMAGE_TYPE.FIT_RGBAF: result = new Scanline(dib, scanline, width); break; - case FREE_IMAGE_TYPE.FIT_RGBF: result = new Scanline(dib, scanline, width); break; - case FREE_IMAGE_TYPE.FIT_UINT16: result = new Scanline(dib, scanline, width); break; - case FREE_IMAGE_TYPE.FIT_UINT32: result = new Scanline(dib, scanline, width); break; - case FREE_IMAGE_TYPE.FIT_UNKNOWN: - default: throw new ArgumentException("Type is not supported."); - } - - return result; - } - - /// - /// Returns a pointer to the specified scanline. - /// Due to FreeImage bitmaps are bottum up, - /// scanline 0 is the most bottom line of the image. - /// - /// Number of the scanline. - /// Pointer to the scanline. - public IntPtr GetScanlinePointer(int scanline) - { - EnsureNotDisposed(); - return FreeImage.GetScanLine(dib, scanline); - } - - /// - /// Returns a list of structures, representing the scanlines of this . - /// Due to FreeImage bitmaps are bottum up, scanline 0 is the - /// bottom-most line of the image. - /// Each color depth has a different representing structure due to different memory layouts. - /// - /// - /// List of return-types of T: - /// - /// Color Depth / TypeResult Type of IEnmuerable<Scanline<T>> - /// 1 () - /// 4 () - /// 8 () - /// 16 () - /// 16 - 555 () - /// 16 - 565 () - /// 24 () - /// 32 () - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public IList GetScanlines() - { - EnsureNotDisposed(); - - int height = (int)FreeImage.GetHeight(dib); - IList list; - - switch (FreeImage.GetImageType(dib)) - { - case FREE_IMAGE_TYPE.FIT_BITMAP: - - switch (FreeImage.GetBPP(dib)) - { - case 1u: list = new List>(height); break; - case 4u: list = new List>(height); break; - case 8u: list = new List>(height); break; - case 16u: - if (FreeImage.IsRGB555(dib)) - { - list = new List>(height); - } - else if (FreeImage.IsRGB565(dib)) - { - list = new List>(height); - } - else - { - list = new List>(height); - } - break; - case 24u: list = new List>(height); break; - case 32u: list = new List>(height); break; - default: throw new ArgumentException("Color depth is not supported."); - } - break; - - case FREE_IMAGE_TYPE.FIT_COMPLEX: list = new List>(height); break; - case FREE_IMAGE_TYPE.FIT_DOUBLE: list = new List>(height); break; - case FREE_IMAGE_TYPE.FIT_FLOAT: list = new List>(height); break; - case FREE_IMAGE_TYPE.FIT_INT16: list = new List>(height); break; - case FREE_IMAGE_TYPE.FIT_INT32: list = new List>(height); break; - case FREE_IMAGE_TYPE.FIT_RGB16: list = new List>(height); break; - case FREE_IMAGE_TYPE.FIT_RGBA16: list = new List>(height); break; - case FREE_IMAGE_TYPE.FIT_RGBAF: list = new List>(height); break; - case FREE_IMAGE_TYPE.FIT_RGBF: list = new List>(height); break; - case FREE_IMAGE_TYPE.FIT_UINT16: list = new List>(height); break; - case FREE_IMAGE_TYPE.FIT_UINT32: list = new List>(height); break; - case FREE_IMAGE_TYPE.FIT_UNKNOWN: - default: throw new ArgumentException("Type is not supported."); - } - - for (int i = 0; i < height; i++) - { - list.Add(GetScanline(i)); - } - - return list; - } - - /// - /// Removes the specified property item from this . - /// - /// The ID of the property item to remove. - public void RemovePropertyItem(int propid) - { - EnsureNotDisposed(); - ImageMetadata mdata = new ImageMetadata(dib, true); - foreach (MetadataModel model in mdata) - { - foreach (MetadataTag tag in model) - { - if (tag.ID == propid) - { - model.RemoveTag(tag.Key); - return; - } - } - } - } - - /// - /// This method rotates, flips, or rotates and flips this . - /// - /// A RotateFlipType member - /// that specifies the type of rotation and flip to apply to this . - public void RotateFlip(RotateFlipType rotateFlipType) - { - EnsureNotDisposed(); - - FIBITMAP newDib = new FIBITMAP(); - uint bpp = FreeImage.GetBPP(dib); - - switch (rotateFlipType) - { - case RotateFlipType.RotateNoneFlipX: - - FreeImage.FlipHorizontal(dib); - break; - - case RotateFlipType.RotateNoneFlipY: - - FreeImage.FlipVertical(dib); - break; - - case RotateFlipType.RotateNoneFlipXY: - - FreeImage.FlipHorizontal(dib); - FreeImage.FlipVertical(dib); - break; - - case RotateFlipType.Rotate90FlipNone: - - newDib = (bpp == 4u) ? FreeImage.Rotate4bit(dib, 90d) : FreeImage.Rotate(dib, 90d); - break; - - case RotateFlipType.Rotate90FlipX: - - newDib = (bpp == 4u) ? FreeImage.Rotate4bit(dib, 90d) : FreeImage.Rotate(dib, 90d); - FreeImage.FlipHorizontal(newDib); - break; - - case RotateFlipType.Rotate90FlipY: - - newDib = (bpp == 4u) ? FreeImage.Rotate4bit(dib, 90d) : FreeImage.Rotate(dib, 90d); - FreeImage.FlipVertical(newDib); - break; - - case RotateFlipType.Rotate90FlipXY: - - newDib = (bpp == 4u) ? FreeImage.Rotate4bit(dib, 90d) : FreeImage.Rotate(dib, 90d); - FreeImage.FlipHorizontal(newDib); - FreeImage.FlipVertical(newDib); - break; - - case RotateFlipType.Rotate180FlipXY: - newDib = FreeImage.Clone(dib); - break; - } - ReplaceDib(newDib); - } - - /// - /// Copies the metadata from another . - /// - /// The bitmap to read the metadata from. - /// - /// is a null reference. - /// - public void CloneMetadataFrom(FreeImageBitmap bitmap) - { - if (bitmap == null) - { - throw new ArgumentNullException("bitmap"); - } - EnsureNotDisposed(); - bitmap.EnsureNotDisposed(); - FreeImage.CloneMetadata(dib, bitmap.dib); - } - - /// - /// Copies the metadata from another using - /// the provided options. - /// - /// The bitmap to read the metadata from. - /// Specifies the way the metadata is copied. - /// - /// is a null reference. - /// - public void CloneMetadataFrom(FreeImageBitmap bitmap, FREE_IMAGE_METADATA_COPY flags) - { - if (bitmap == null) - { - throw new ArgumentNullException("bitmap"); - } - EnsureNotDisposed(); - bitmap.EnsureNotDisposed(); - FreeImage.CloneMetadataEx(bitmap.dib, dib, flags); - } - - /// - /// Saves this to the specified file. - /// - /// A string that contains the name of the file to which - /// to save this . - /// is null or empty. - /// Saving the image failed. - public void Save(string filename) - { - Save(filename, FREE_IMAGE_FORMAT.FIF_UNKNOWN, FREE_IMAGE_SAVE_FLAGS.DEFAULT); - } - - /// - /// Saves this to the specified file in the specified format. - /// - /// A string that contains the name of the file to which - /// to save this . - /// An that specifies the format of the saved image. - /// is null or empty. - /// Saving the image failed. - public void Save(string filename, FREE_IMAGE_FORMAT format) - { - Save(filename, format, FREE_IMAGE_SAVE_FLAGS.DEFAULT); - } - - /// - /// Saves this to the specified file in the specified format - /// using the specified saving flags. - /// - /// A string that contains the name of the file to which - /// to save this . - /// An that specifies the format of the saved image. - /// Flags to enable or disable plugin-features. - /// is null or empty. - /// Saving the image failed. - public void Save(string filename, FREE_IMAGE_FORMAT format, FREE_IMAGE_SAVE_FLAGS flags) - { - EnsureNotDisposed(); - if (string.IsNullOrEmpty(filename)) - { - throw new ArgumentException("filename"); - } - if (!FreeImage.SaveEx(dib, filename, format, flags)) - { - throw new Exception("Unable to save bitmap"); - } - - saveInformation.filename = filename; - saveInformation.format = format; - saveInformation.saveFlags = flags; - } - - /// - /// Saves this to the specified stream in the specified format. - /// - /// The stream where this will be saved. - /// An that specifies the format of the saved image. - /// is a null reference. - /// Saving the image failed. - public void Save(Stream stream, FREE_IMAGE_FORMAT format) - { - Save(stream, format, FREE_IMAGE_SAVE_FLAGS.DEFAULT); - } - - /// - /// Saves this to the specified stream in the specified format - /// using the specified saving flags. - /// - /// The stream where this will be saved. - /// An that specifies the format of the saved image. - /// Flags to enable or disable plugin-features. - /// is a null reference. - /// Saving the image failed. - public void Save(Stream stream, FREE_IMAGE_FORMAT format, FREE_IMAGE_SAVE_FLAGS flags) - { - EnsureNotDisposed(); - if (stream == null) - { - throw new ArgumentNullException("stream"); - } - if (!FreeImage.SaveToStream(dib, stream, format, flags)) - { - throw new Exception("Unable to save bitmap"); - } - - saveInformation.filename = null; - } - - /// - /// Adds a frame to the file specified in a previous call to the - /// method. - /// - /// - /// This instance has not been saved to a file using Save(...) before. - public void SaveAdd() - { - SaveAdd(this); - } - - /// - /// Adds a frame to the file specified in a previous call to the method. - /// - /// The position at which the frame should be inserted. - /// - /// This instance has not yet been saved to a file using the Save(...) method. - /// is out of range. - public void SaveAdd(int insertPosition) - { - SaveAdd(this, insertPosition); - } - - /// - /// Adds a frame to the file specified in a previous call to the method. - /// - /// A that contains the frame to add. - /// - /// This instance has not yet been saved to a file using the Save(...) method. - public void SaveAdd(FreeImageBitmap bitmap) - { - if (saveInformation.filename == null) - { - throw new InvalidOperationException("This operation requires a previous call of Save()."); - } - - SaveAdd( - saveInformation.filename, - bitmap, - saveInformation.format, - saveInformation.loadFlags, - saveInformation.saveFlags); - } - - /// - /// Adds a frame to the file specified in a previous call to the method. - /// - /// A that contains the frame to add. - /// The position at which the frame should be inserted. - /// - /// This instance has not yet been saved to a file using the Save(...) method. - /// is out of range. - public void SaveAdd(FreeImageBitmap bitmap, int insertPosition) - { - if (saveInformation.filename == null) - { - throw new InvalidOperationException("This operation requires a previous call of Save()."); - } - - SaveAdd( - saveInformation.filename, - bitmap, - insertPosition, - saveInformation.format, - saveInformation.loadFlags, - saveInformation.saveFlags); - } - - /// - /// Adds a frame to the file specified. - /// - /// File to add this frame to. - /// is a null reference. - /// does not exist. - /// Saving the image has failed. - public void SaveAdd(string filename) - { - SaveAdd( - filename, - this, - FREE_IMAGE_FORMAT.FIF_UNKNOWN, - FREE_IMAGE_LOAD_FLAGS.DEFAULT, - FREE_IMAGE_SAVE_FLAGS.DEFAULT); - } - - /// - /// Adds a frame to the file specified. - /// - /// File to add this frame to. - /// The position at which the frame should be inserted. - /// is a null reference. - /// does not exist. - /// Saving the image has failed. - /// is out of range. - public void SaveAdd(string filename, int insertPosition) - { - SaveAdd( - filename, - this, - insertPosition, - FREE_IMAGE_FORMAT.FIF_UNKNOWN, - FREE_IMAGE_LOAD_FLAGS.DEFAULT, - FREE_IMAGE_SAVE_FLAGS.DEFAULT); - } - - /// - /// Adds a frame to the file specified using the specified parameters. - /// - /// File to add this frame to. - /// Format of the image. - /// Flags to enable or disable plugin-features. - /// Flags to enable or disable plugin-features. - /// is a null reference. - /// does not exist. - /// Saving the image has failed. - public void SaveAdd( - string filename, - FREE_IMAGE_FORMAT format, - FREE_IMAGE_LOAD_FLAGS loadFlags, - FREE_IMAGE_SAVE_FLAGS saveFlags) - { - SaveAdd( - filename, - this, - format, - loadFlags, - saveFlags); - } - - /// - /// Adds a frame to the file specified using the specified parameters. - /// - /// File to add this frame to. - /// The position at which the frame should be inserted. - /// Format of the image. - /// Flags to enable or disable plugin-features. - /// Flags to enable or disable plugin-features. - /// is a null reference. - /// does not exist. - /// Saving the image has failed. - /// is out of range. - public void SaveAdd( - string filename, - int insertPosition, - FREE_IMAGE_FORMAT format, - FREE_IMAGE_LOAD_FLAGS loadFlags, - FREE_IMAGE_SAVE_FLAGS saveFlags) - { - SaveAdd( - filename, - this, - insertPosition, - format, - loadFlags, - saveFlags); - } - - /// - /// Selects the frame specified by the index. - /// - /// The index of the active frame. - /// - /// is out of range. - /// The operation failed. - /// The source of the bitmap is not available. - /// - public void SelectActiveFrame(int frameIndex) - { - EnsureNotDisposed(); - if ((frameIndex < 0) || (frameIndex >= frameCount)) - { - throw new ArgumentOutOfRangeException("frameIndex"); - } - - if (frameIndex != this.frameIndex) - { - if (stream == null) - { - throw new InvalidOperationException("No source available."); - } - - FREE_IMAGE_FORMAT format = originalFormat; - FIMULTIBITMAP mdib = FreeImage.OpenMultiBitmapFromStream(stream, ref format, saveInformation.loadFlags); - if (mdib.IsNull) - throw new Exception(ErrorLoadingBitmap); - - try - { - if (frameIndex >= FreeImage.GetPageCount(mdib)) - { - throw new ArgumentOutOfRangeException("frameIndex"); - } - - FIBITMAP newDib = FreeImage.LockPage(mdib, frameIndex); - if (newDib.IsNull) - { - throw new Exception(ErrorLoadingFrame); - } - - try - { - FIBITMAP clone = FreeImage.Clone(newDib); - if (clone.IsNull) - { - throw new Exception(ErrorCreatingBitmap); - } - ReplaceDib(clone); - } - finally - { - if (!newDib.IsNull) - { - FreeImage.UnlockPage(mdib, newDib, false); - } - } - } - finally - { - if (!FreeImage.CloseMultiBitmapEx(ref mdib)) - { - throw new Exception(ErrorUnloadBitmap); - } - } - - this.frameIndex = frameIndex; - } - } - - /// - /// Creates a GDI bitmap object from this . - /// - /// A handle to the GDI bitmap object that this method creates. - public IntPtr GetHbitmap() - { - EnsureNotDisposed(); - return FreeImage.GetHbitmap(dib, IntPtr.Zero, false); - } - - /// - /// Creates a GDI bitmap object from this . - /// - /// A structure that specifies the background color. - /// This parameter is ignored if the bitmap is totally opaque. - /// A handle to the GDI bitmap object that this method creates. - public IntPtr GetHbitmap(Color background) - { - EnsureNotDisposed(); - using (FreeImageBitmap temp = new FreeImageBitmap(this)) - { - temp.BackgroundColor = background; - return temp.GetHbitmap(); - } - } - - /// - /// Returns the handle to an icon. - /// - /// A Windows handle to an icon with the same image as this . - public IntPtr GetHicon() - { - EnsureNotDisposed(); - using (Bitmap bitmap = FreeImage.GetBitmap(dib, true)) - { - return bitmap.GetHicon(); - } - } - - /// - /// Creates a GDI bitmap object from this with the same - /// color depth as the primary device. - /// - /// A handle to the GDI bitmap object that this method creates. - public IntPtr GetHbitmapForDevice() - { - EnsureNotDisposed(); - return FreeImage.GetBitmapForDevice(dib, IntPtr.Zero, false); - } - - /// - /// Gets the of the specified pixel in this . - /// - /// The x-coordinate of the pixel to retrieve. - /// The y-coordinate of the pixel to retrieve. - /// A structure that represents the color of the specified pixel. - /// The operation failed. - /// The type of this bitmap is not supported. - public unsafe Color GetPixel(int x, int y) - { - EnsureNotDisposed(); - if (FreeImage.GetImageType(dib) == FREE_IMAGE_TYPE.FIT_BITMAP) - { - if (ColorDepth == 16 || ColorDepth == 24 || ColorDepth == 32) - { - RGBQUAD rgbq; - if (!FreeImage.GetPixelColor(dib, (uint)x, (uint)y, out rgbq)) - { - throw new Exception("FreeImage.GetPixelColor() failed"); - } - return rgbq.Color; - } - else if (ColorDepth == 1 || ColorDepth == 4 || ColorDepth == 8) - { - byte index; - if (!FreeImage.GetPixelIndex(dib, (uint)x, (uint)y, out index)) - { - throw new Exception("FreeImage.GetPixelIndex() failed"); - } - RGBQUAD* palette = (RGBQUAD*)FreeImage.GetPalette(dib); - return palette[index].Color; - } - } - throw new NotSupportedException("The type of the image is not supported"); - } - - /// - /// Makes the default transparent color transparent for this . - /// - public void MakeTransparent() - { - EnsureNotDisposed(); - MakeTransparent(Color.Transparent); - } - - /// - /// Makes the specified color transparent for this . - /// - /// The structure that represents - /// the color to make transparent. - /// - /// This method is not implemented. - public void MakeTransparent(Color transparentColor) - { - EnsureNotDisposed(); - throw new System.NotImplementedException(); - } - - /// - /// Sets the of the specified pixel in this . - /// - /// The x-coordinate of the pixel to set. - /// The y-coordinate of the pixel to set. - /// A structure that represents the color - /// to assign to the specified pixel. - /// The operation failed. - /// The type of this bitmap is not supported. - public unsafe void SetPixel(int x, int y, Color color) - { - EnsureNotDisposed(); - if (FreeImage.GetImageType(dib) == FREE_IMAGE_TYPE.FIT_BITMAP) - { - if (ColorDepth == 16 || ColorDepth == 24 || ColorDepth == 32) - { - RGBQUAD rgbq = color; - if (!FreeImage.SetPixelColor(dib, (uint)x, (uint)y, ref rgbq)) - { - throw new Exception("FreeImage.SetPixelColor() failed"); - } - return; - } - else if (ColorDepth == 1 || ColorDepth == 4 || ColorDepth == 8) - { - uint colorsUsed = FreeImage.GetColorsUsed(dib); - RGBQUAD* palette = (RGBQUAD*)FreeImage.GetPalette(dib); - for (int i = 0; i < colorsUsed; i++) - { - if (palette[i].Color == color) - { - byte index = (byte)i; - if (!FreeImage.SetPixelIndex(dib, (uint)x, (uint)y, ref index)) - { - throw new Exception("FreeImage.SetPixelIndex() failed"); - } - return; - } - } - throw new ArgumentOutOfRangeException("color"); - } - } - throw new NotSupportedException("The type of the image is not supported"); - } - - /// - /// Sets the resolution for this . - /// - /// The horizontal resolution, in dots per inch, of this . - /// The vertical resolution, in dots per inch, of this . - public void SetResolution(float xDpi, float yDpi) - { - EnsureNotDisposed(); - FreeImage.SetResolutionX(dib, (uint)xDpi); - FreeImage.SetResolutionY(dib, (uint)yDpi); - } - - /// - /// This function is not yet implemented. - /// - /// - /// This method is not implemented. - public BitmapData LockBits(Rectangle rect, ImageLockMode flags, PixelFormat format) - { - throw new NotImplementedException(); - } - - /// - /// This function is not yet implemented. - /// - /// - /// This method is not implemented. - public BitmapData LockBits(Rectangle rect, ImageLockMode flags, PixelFormat format, BitmapData bitmapData) - { - throw new NotImplementedException(); - } - - /// - /// This function is not yet implemented. - /// - /// - /// This method is not implemented. - public void UnlockBits(BitmapData bitmapdata) - { - throw new NotImplementedException(); - } - - /// - /// Converts this into a different color depth. - /// The parameter specifies color depth, greyscale conversion - /// and palette reorder. - /// Adding the flag - /// will first perform a convesion to greyscale. This can be done with any target - /// color depth. - /// Adding the flag - /// will allow the algorithm to reorder the palette. This operation will not be performed to - /// non-greyscale images to prevent data loss by mistake. - /// - /// A bitfield containing information about the conversion - /// to perform. - /// Returns true on success, false on failure. - public bool ConvertColorDepth(FREE_IMAGE_COLOR_DEPTH bpp) - { - EnsureNotDisposed(); - return ReplaceDib(FreeImage.ConvertColorDepth(dib, bpp, false)); - } - - /// - /// Converts this to - /// initializing a new instance. - /// In case source and destination type are the same, the operation fails. - /// An error message can be catched using the 'Message' event. - /// - /// Destination type. - /// True to scale linear, else false. - /// Returns true on success, false on failure. - public bool ConvertType(FREE_IMAGE_TYPE type, bool scaleLinear) - { - EnsureNotDisposed(); - return (ImageType == type) ? false : ReplaceDib(FreeImage.ConvertToType(dib, type, scaleLinear)); - } - - /// - /// Converts this to . - /// In case source and destination type are the same, the operation fails. - /// An error message can be catched using the 'Message' event. - /// - /// Destination type. - /// True to scale linear, else false. - /// The converted instance. - public FreeImageBitmap GetTypeConvertedInstance(FREE_IMAGE_TYPE type, bool scaleLinear) - { - EnsureNotDisposed(); - FreeImageBitmap result = null; - if (ImageType != type) - { - FIBITMAP newDib = FreeImage.ConvertToType(dib, type, scaleLinear); - if (!newDib.IsNull) - { - result = new FreeImageBitmap(newDib); - } - } - return result; - } - - /// - /// Converts this into a different color depth initializing - /// a new instance. - /// The parameter specifies color depth, greyscale conversion - /// and palette reorder. - /// Adding the flag will - /// first perform a convesion to greyscale. This can be done with any target color depth. - /// Adding the flag will - /// allow the algorithm to reorder the palette. This operation will not be performed to - /// non-greyscale images to prevent data loss by mistake. - /// - /// A bitfield containing information about the conversion - /// to perform. - /// The converted instance. - public FreeImageBitmap GetColorConvertedInstance(FREE_IMAGE_COLOR_DEPTH bpp) - { - EnsureNotDisposed(); - FreeImageBitmap result = null; - FIBITMAP newDib = FreeImage.ConvertColorDepth(dib, bpp, false); - if (newDib == dib) - { - newDib = FreeImage.Clone(dib); - } - if (!newDib.IsNull) - { - result = new FreeImageBitmap(newDib); - } - return result; - } - - /// - /// Rescales this to the specified size using the - /// specified filter. - /// - /// The Size structure that represent the - /// size of the new . - /// Filter to use for resizing. - /// Returns true on success, false on failure. - public bool Rescale(Size newSize, FREE_IMAGE_FILTER filter) - { - return Rescale(newSize.Width, newSize.Height, filter); - } - - /// - /// Rescales this to the specified size using the - /// specified filter. - /// - /// Width of the new . - /// Height of the new . - /// Filter to use for resizing. - /// Returns true on success, false on failure. - public bool Rescale(int width, int height, FREE_IMAGE_FILTER filter) - { - EnsureNotDisposed(); - return ReplaceDib(FreeImage.Rescale(dib, width, height, filter)); - } - - /// - /// Rescales this to the specified size using the - /// specified filter initializing a new instance. - /// - /// The Size structure that represent the - /// size of the new . - /// Filter to use for resizing. - /// The rescaled instance. - public FreeImageBitmap GetScaledInstance(Size newSize, FREE_IMAGE_FILTER filter) - { - return GetScaledInstance(newSize.Width, newSize.Height, filter); - } - - /// - /// Rescales this to the specified size using the - /// specified filter initializing a new instance. - /// - /// Width of the new . - /// Height of the new . - /// Filter to use for resizing. - /// The rescaled instance. - public FreeImageBitmap GetScaledInstance(int width, int height, FREE_IMAGE_FILTER filter) - { - EnsureNotDisposed(); - FreeImageBitmap result = null; - FIBITMAP newDib = FreeImage.Rescale(dib, width, height, filter); - if (!newDib.IsNull) - { - result = new FreeImageBitmap(newDib); - } - return result; - } - - /// - /// Enlarges or shrinks this selectively per side and fills - /// newly added areas with the specified background color. - /// See for further details. - /// - /// The type of the specified color. - /// The number of pixels, the image should be enlarged on its left side. - /// Negative values shrink the image on its left side. - /// The number of pixels, the image should be enlarged on its top side. - /// Negative values shrink the image on its top side. - /// The number of pixels, the image should be enlarged on its right side. - /// Negative values shrink the image on its right side. - /// The number of pixels, the image should be enlarged on its bottom side. - /// Negative values shrink the image on its bottom side. - /// The color, the enlarged sides of the image should be filled with. - /// true on success, false on failure. - public bool EnlargeCanvas(int left, int top, int right, int bottom, T? color) where T : struct - { - return EnlargeCanvas(left, top, right, bottom, color, FREE_IMAGE_COLOR_OPTIONS.FICO_DEFAULT); - } - - /// - /// Enlarges or shrinks this selectively per side and fills - /// newly added areas with the specified background color. - /// See for further details. - /// - /// The type of the specified color. - /// The number of pixels, the image should be enlarged on its left side. - /// Negative values shrink the image on its left side. - /// The number of pixels, the image should be enlarged on its top side. - /// Negative values shrink the image on its top side. - /// The number of pixels, the image should be enlarged on its right side. - /// Negative values shrink the image on its right side. - /// The number of pixels, the image should be enlarged on its bottom side. - /// Negative values shrink the image on its bottom side. - /// The color, the enlarged sides of the image should be filled with. - /// Options that affect the color search process for palletized images. - /// true on success, false on failure. - public bool EnlargeCanvas(int left, int top, int right, int bottom, - T? color, FREE_IMAGE_COLOR_OPTIONS options) where T : struct - { - EnsureNotDisposed(); - return ReplaceDib(FreeImage.EnlargeCanvas(dib, left, top, right, bottom, color, options)); - } - - /// - /// Enlarges or shrinks this selectively per side and fills - /// newly added areas with the specified background color returning a new instance. - /// See for further details. - /// - /// The type of the specified color. - /// The number of pixels, the image should be enlarged on its left side. - /// Negative values shrink the image on its left side. - /// The number of pixels, the image should be enlarged on its top side. - /// Negative values shrink the image on its top side. - /// The number of pixels, the image should be enlarged on its right side. - /// Negative values shrink the image on its right side. - /// The number of pixels, the image should be enlarged on its bottom side. - /// Negative values shrink the image on its bottom side. - /// The color, the enlarged sides of the image should be filled with. - /// The enlarged instance. - public FreeImageBitmap GetEnlargedInstance(int left, int top, int right, int bottom, - T? color) where T : struct - { - return GetEnlargedInstance(left, top, right, bottom, color, FREE_IMAGE_COLOR_OPTIONS.FICO_DEFAULT); - } - - /// - /// Enlarges or shrinks this selectively per side and fills - /// newly added areas with the specified background color returning a new instance. - /// See for further details. - /// - /// The type of the specified color. - /// The number of pixels, the image should be enlarged on its left side. - /// Negative values shrink the image on its left side. - /// The number of pixels, the image should be enlarged on its top side. - /// Negative values shrink the image on its top side. - /// The number of pixels, the image should be enlarged on its right side. - /// Negative values shrink the image on its right side. - /// The number of pixels, the image should be enlarged on its bottom side. - /// Negative values shrink the image on its bottom side. - /// The color, the enlarged sides of the image should be filled with. - /// Options that affect the color search process for palletized images. - /// The enlarged instance. - public FreeImageBitmap GetEnlargedInstance(int left, int top, int right, int bottom, - T? color, FREE_IMAGE_COLOR_OPTIONS options) where T : struct - { - EnsureNotDisposed(); - FreeImageBitmap result = null; - FIBITMAP newDib = FreeImage.EnlargeCanvas(dib, left, top, right, bottom, color, options); - if (!newDib.IsNull) - { - result = new FreeImageBitmap(newDib); - } - return result; - } - - /// - /// Quantizes this from 24 bit to 8bit creating a new - /// palette with the specified using the specified - /// . - /// - /// The color reduction algorithm to be used. - /// Size of the desired output palette. - /// Returns true on success, false on failure. - public bool Quantize(FREE_IMAGE_QUANTIZE algorithm, int paletteSize) - { - return Quantize(algorithm, paletteSize, 0, (RGBQUAD[])null); - } - - /// - /// Quantizes this from 24 bit to 8bit creating a new - /// palette with the specified using the specified - /// and the specified - /// palette up to the - /// specified length. - /// - /// The color reduction algorithm to be used. - /// Size of the desired output palette. - /// The provided palette. - /// Returns true on success, false on failure. - public bool Quantize(FREE_IMAGE_QUANTIZE algorithm, int paletteSize, Palette reservePalette) - { - return Quantize(algorithm, paletteSize, reservePalette.Length, reservePalette.Data); - } - - /// - /// Quantizes this from 24 bit to 8bit creating a new - /// palette with the specified using the specified - /// and the specified - /// palette up to the - /// specified length. - /// - /// The color reduction algorithm to be used. - /// Size of the desired output palette. - /// Size of the provided palette of ReservePalette. - /// The provided palette. - /// Returns true on success, false on failure. - public bool Quantize(FREE_IMAGE_QUANTIZE algorithm, int paletteSize, int reserveSize, Palette reservePalette) - { - return Quantize(algorithm, paletteSize, reserveSize, reservePalette.Data); - } - - /// - /// Quantizes this from 24 bit to 8bit creating a new - /// palette with the specified using the specified - /// and the specified - /// palette up to the - /// specified length. - /// - /// The color reduction algorithm to be used. - /// Size of the desired output palette. - /// Size of the provided palette of ReservePalette. - /// The provided palette. - /// Returns true on success, false on failure. - public bool Quantize(FREE_IMAGE_QUANTIZE algorithm, int paletteSize, int reserveSize, RGBQUAD[] reservePalette) - { - EnsureNotDisposed(); - return ReplaceDib(FreeImage.ColorQuantizeEx(dib, algorithm, paletteSize, reserveSize, reservePalette)); - } - - /// - /// Quantizes this from 24 bit, using the specified - /// initializing a new 8 bit instance with the - /// specified . - /// - /// The color reduction algorithm to be used. - /// Size of the desired output palette. - /// The quantized instance. - public FreeImageBitmap GetQuantizedInstance(FREE_IMAGE_QUANTIZE algorithm, int paletteSize) - { - return GetQuantizedInstance(algorithm, paletteSize, 0, (RGBQUAD[])null); - } - - /// - /// Quantizes this from 24 bit, using the specified - /// and palette - /// initializing a new 8 bit instance with the specified . - /// - /// The color reduction algorithm to be used. - /// Size of the desired output palette. - /// The provided palette. - /// The quantized instance. - public FreeImageBitmap GetQuantizedInstance(FREE_IMAGE_QUANTIZE algorithm, int paletteSize, Palette reservePalette) - { - return GetQuantizedInstance(algorithm, paletteSize, reservePalette.Length, reservePalette); - } - - /// - /// Quantizes this from 24 bit, using the specified - /// and up to - /// entries from palette initializing - /// a new 8 bit instance with the specified . - /// - /// The color reduction algorithm to be used. - /// Size of the desired output palette. - /// Size of the provided palette. - /// The provided palette. - /// The quantized instance. - public FreeImageBitmap GetQuantizedInstance(FREE_IMAGE_QUANTIZE algorithm, int paletteSize, int reserveSize, Palette reservePalette) - { - return GetQuantizedInstance(algorithm, paletteSize, reserveSize, reservePalette.Data); - } - - /// - /// Quantizes this from 24 bit, using the specified - /// and up to - /// entries from palette initializing - /// a new 8 bit instance with the specified . - /// - /// The color reduction algorithm to be used. - /// Size of the desired output palette. - /// Size of the provided palette. - /// The provided palette. - /// The quantized instance. - public FreeImageBitmap GetQuantizedInstance(FREE_IMAGE_QUANTIZE algorithm, int paletteSize, int reserveSize, RGBQUAD[] reservePalette) - { - EnsureNotDisposed(); - FreeImageBitmap result = null; - FIBITMAP newDib = FreeImage.ColorQuantizeEx(dib, algorithm, paletteSize, reserveSize, reservePalette); - if (!newDib.IsNull) - { - result = new FreeImageBitmap(newDib); - } - return result; - } - - /// - /// Converts a High Dynamic Range image to a 24-bit RGB image using a global - /// operator based on logarithmic compression of luminance values, imitating - /// the human response to light. - /// - /// A gamma correction that is applied after the tone mapping. - /// A value of 1 means no correction. - /// Scale factor allowing to adjust the brightness of the output image. - /// Returns true on success, false on failure. - public bool TmoDrago03(double gamma, double exposure) - { - EnsureNotDisposed(); - return ReplaceDib(FreeImage.TmoDrago03(dib, gamma, exposure)); - } - - /// - /// Converts a High Dynamic Range image to a 24-bit RGB image using a global operator inspired - /// by photoreceptor physiology of the human visual system. - /// - /// Controls the overall image intensity in the range [-8, 8]. - /// Controls the overall image contrast in the range [0.3, 1.0[. - /// Returns true on success, false on failure. - public bool TmoReinhard05(double intensity, double contrast) - { - EnsureNotDisposed(); - return ReplaceDib(FreeImage.TmoReinhard05(dib, intensity, contrast)); - } - - /// - /// Apply the Gradient Domain High Dynamic Range Compression to a RGBF image and convert to 24-bit RGB. - /// - /// Color saturation (s parameter in the paper) in [0.4..0.6] - /// Atenuation factor (beta parameter in the paper) in [0.8..0.9] - /// Returns true on success, false on failure. - public bool TmoFattal02(double color_saturation, double attenuation) - { - EnsureNotDisposed(); - return ReplaceDib(FreeImage.TmoFattal02(dib, color_saturation, attenuation)); - } - - /// - /// This method rotates a 1-, 4-, 8-bit greyscale or a 24-, 32-bit color image by means of 3 shears. - /// For 1- and 4-bit images, rotation is limited to angles whose value is an integer - /// multiple of 90. - /// - /// The angle of rotation. - /// Returns true on success, false on failure. - public bool Rotate(double angle) - { - EnsureNotDisposed(); - bool result = false; - if (ColorDepth == 4) - { - result = ReplaceDib(FreeImage.Rotate4bit(dib, angle)); - } - else - { - result = ReplaceDib(FreeImage.Rotate(dib, angle)); - } - return result; - } - - /// - /// This method rotates a 1-, 4-, 8-bit greyscale or a 24-, 32-bit color image by means of 3 shears. - /// For 1- and 4-bit images, rotation is limited to angles whose value is an integer - /// multiple of 90. - /// - /// The type of the color to use as background. - /// The angle of rotation. - /// The color used used to fill the bitmap's background. - /// Returns true on success, false on failure. - public bool Rotate(double angle, T? backgroundColor) where T : struct - { - EnsureNotDisposed(); - bool result = false; - if (ColorDepth == 4) - { - result = ReplaceDib(FreeImage.Rotate4bit(dib, angle)); - } - else - { - result = ReplaceDib(FreeImage.Rotate(dib, angle, backgroundColor)); - } - return result; - } - - /// - /// Rotates this by the specified angle initializing a new instance. - /// For 1- and 4-bit images, rotation is limited to angles whose value is an integer - /// multiple of 90. - /// - /// The type of the color to use as background. - /// The angle of rotation. - /// The color used used to fill the bitmap's background. - /// The rotated instance. - public FreeImageBitmap GetRotatedInstance(double angle, T? backgroundColor) where T : struct - { - EnsureNotDisposed(); - FreeImageBitmap result = null; - FIBITMAP newDib; - if (ColorDepth == 4) - { - newDib = FreeImage.Rotate4bit(dib, angle); - } - else - { - newDib = FreeImage.Rotate(dib, angle, backgroundColor); - } - if (!newDib.IsNull) - { - result = new FreeImageBitmap(newDib); - } - return result; - } - - /// - /// Rotates this by the specified angle initializing a new instance. - /// For 1- and 4-bit images, rotation is limited to angles whose value is an integer - /// multiple of 90. - /// - /// The angle of rotation. - /// The rotated instance. - public FreeImageBitmap GetRotatedInstance(double angle) - { - EnsureNotDisposed(); - FreeImageBitmap result = null; - FIBITMAP newDib; - if (ColorDepth == 4) - { - newDib = FreeImage.Rotate4bit(dib, angle); - } - else - { - newDib = FreeImage.Rotate(dib, angle); - } - if (!newDib.IsNull) - { - result = new FreeImageBitmap(newDib); - } - return result; - } - - /// - /// This method performs a rotation and / or translation of an 8-bit greyscale, - /// 24- or 32-bit image, using a 3rd order (cubic) B-Spline. - /// - /// The angle of rotation. - /// Horizontal image translation. - /// Vertical image translation. - /// Rotation center x-coordinate. - /// Rotation center y-coordinate. - /// When true the irrelevant part of the image is set to a black color, - /// otherwise, a mirroring technique is used to fill irrelevant pixels. - /// Returns true on success, false on failure. - public bool Rotate(double angle, double xShift, double yShift, - double xOrigin, double yOrigin, bool useMask) - { - EnsureNotDisposed(); - return ReplaceDib(FreeImage.RotateEx(dib, angle, xShift, yShift, xOrigin, yOrigin, useMask)); - } - - /// - /// This method performs a rotation and / or translation of an 8-bit greyscale, - /// 24- or 32-bit image, using a 3rd order (cubic) B-Spline initializing a new instance. - /// - /// The angle of rotation. - /// Horizontal image translation. - /// Vertical image translation. - /// Rotation center x-coordinate. - /// Rotation center y-coordinate. - /// When true the irrelevant part of the image is set to a black color, - /// otherwise, a mirroring technique is used to fill irrelevant pixels. - /// The rotated instance. - public FreeImageBitmap GetRotatedInstance(double angle, double xShift, double yShift, - double xOrigin, double yOrigin, bool useMask) - { - EnsureNotDisposed(); - FreeImageBitmap result = null; - FIBITMAP newDib = FreeImage.RotateEx( - dib, angle, xShift, yShift, xOrigin, yOrigin, useMask); - if (!newDib.IsNull) - { - result = new FreeImageBitmap(newDib); - } - return result; - } - - /// - /// Perfoms an histogram transformation on a 8-, 24- or 32-bit image. - /// - /// The lookup table (LUT). - /// It's size is assumed to be 256 in length. - /// The color channel to be transformed. - /// Returns true on success, false on failure. - public bool AdjustCurve(byte[] lookUpTable, FREE_IMAGE_COLOR_CHANNEL channel) - { - EnsureNotDisposed(); - return FreeImage.AdjustCurve(dib, lookUpTable, channel); - } - - /// - /// Performs gamma correction on a 8-, 24- or 32-bit image. - /// - /// The parameter represents the gamma value to use (gamma > 0). - /// A value of 1.0 leaves the image alone, less than one darkens it, and greater than one lightens it. - /// Returns true on success, false on failure. - public bool AdjustGamma(double gamma) - { - EnsureNotDisposed(); - return FreeImage.AdjustGamma(dib, gamma); - } - - /// - /// Adjusts the brightness of a 8-, 24- or 32-bit image by a certain amount. - /// - /// A value 0 means no change, - /// less than 0 will make the image darker and greater than 0 will make the image brighter. - /// Returns true on success, false on failure. - public bool AdjustBrightness(double percentage) - { - EnsureNotDisposed(); - return FreeImage.AdjustBrightness(dib, percentage); - } - - /// - /// Adjusts the contrast of a 8-, 24- or 32-bit image by a certain amount. - /// - /// A value 0 means no change, - /// less than 0 will decrease the contrast and greater than 0 will increase the contrast of the image. - /// Returns true on success, false on failure. - public bool AdjustContrast(double percentage) - { - EnsureNotDisposed(); - return FreeImage.AdjustContrast(dib, percentage); - } - - /// - /// Inverts each pixel data. - /// - /// Returns true on success, false on failure. - public bool Invert() - { - EnsureNotDisposed(); - return FreeImage.Invert(dib); - } - - /// - /// Computes the image histogram. - /// - /// Channel to compute from. - /// Array of integers containing the histogram. - /// Returns true on success, false on failure. - public bool GetHistogram(FREE_IMAGE_COLOR_CHANNEL channel, out int[] histogram) - { - EnsureNotDisposed(); - histogram = new int[256]; - return FreeImage.GetHistogram(dib, histogram, channel); - } - - /// - /// Retrieves the red, green, blue or alpha channel of a 24- or 32-bit image. - /// - /// The color channel to extract. - /// The color channel in a new instance. - public FreeImageBitmap GetChannel(FREE_IMAGE_COLOR_CHANNEL channel) - { - EnsureNotDisposed(); - FreeImageBitmap result = null; - FIBITMAP newDib = FreeImage.GetChannel(dib, channel); - if (!newDib.IsNull) - { - result = new FreeImageBitmap(newDib); - } - return result; - } - - /// - /// Insert a 8-bit dib into a 24- or 32-bit image. - /// Both images must have to same width and height. - /// - /// The to insert. - /// The color channel to replace. - /// Returns true on success, false on failure. - public bool SetChannel(FreeImageBitmap bitmap, FREE_IMAGE_COLOR_CHANNEL channel) - { - EnsureNotDisposed(); - bitmap.EnsureNotDisposed(); - return FreeImage.SetChannel(dib, bitmap.dib, channel); - } - - /// - /// Retrieves the real part, imaginary part, magnitude or phase of a complex image. - /// - /// The color channel to extract. - /// The color channel in a new instance. - public FreeImageBitmap GetComplexChannel(FREE_IMAGE_COLOR_CHANNEL channel) - { - EnsureNotDisposed(); - FreeImageBitmap result = null; - FIBITMAP newDib = FreeImage.GetComplexChannel(dib, channel); - if (!newDib.IsNull) - { - result = new FreeImageBitmap(newDib); - } - return result; - } - - /// - /// Set the real or imaginary part of a complex image. - /// Both images must have to same width and height. - /// - /// The to insert. - /// The color channel to replace. - /// Returns true on success, false on failure. - public bool SetComplexChannel(FreeImageBitmap bitmap, FREE_IMAGE_COLOR_CHANNEL channel) - { - EnsureNotDisposed(); - bitmap.EnsureNotDisposed(); - return FreeImage.SetComplexChannel(dib, bitmap.dib, channel); - } - - /// - /// Copy a sub part of this . - /// - /// The subpart to copy. - /// The sub part in a new instance. - public FreeImageBitmap Copy(Rectangle rect) - { - EnsureNotDisposed(); - return Copy(rect.Left, rect.Top, rect.Right, rect.Bottom); - } - - /// - /// Copy a sub part of this . - /// - /// Specifies the left position of the cropped rectangle. - /// Specifies the top position of the cropped rectangle. - /// Specifies the right position of the cropped rectangle. - /// Specifies the bottom position of the cropped rectangle. - /// The sub part in a new instance. - public FreeImageBitmap Copy(int left, int top, int right, int bottom) - { - EnsureNotDisposed(); - FreeImageBitmap result = null; - FIBITMAP newDib = FreeImage.Copy(dib, left, top, right, bottom); - if (!newDib.IsNull) - { - result = new FreeImageBitmap(newDib); - } - return result; - } - - /// - /// Alpha blend or combine a sub part image with this . - /// The bit depth of must be greater than or equal to the bit depth this instance. - /// - /// The to paste into this instance. - /// Specifies the left position of the sub image. - /// Specifies the top position of the sub image. - /// alpha blend factor. - /// The source and destination images are alpha blended if alpha=0..255. - /// If alpha > 255, then the source image is combined to the destination image. - /// Returns true on success, false on failure. - public bool Paste(FreeImageBitmap bitmap, int left, int top, int alpha) - { - EnsureNotDisposed(); - bitmap.EnsureNotDisposed(); - return FreeImage.Paste(dib, bitmap.dib, left, top, alpha); - } - - /// - /// Alpha blend or combine a sub part image with tthis . - /// The bit depth of must be greater than or equal to the bit depth this instance. - /// - /// The to paste into this instance. - /// Specifies the position of the sub image. - /// alpha blend factor. - /// The source and destination images are alpha blended if alpha=0..255. - /// If alpha > 255, then the source image is combined to the destination image. - /// Returns true on success, false on failure. - public bool Paste(FreeImageBitmap bitmap, Point point, int alpha) - { - EnsureNotDisposed(); - return Paste(bitmap, point.X, point.Y, alpha); - } - - /// - /// This method composite a transparent foreground image against a single background color or - /// against a background image. - /// In case is false and - /// and - /// are null, a checkerboard will be used as background. - /// - /// When true the background of this instance is used - /// if it contains one. - /// Backgroundcolor used in case is false - /// and is not null. - /// Background used in case - /// is false and is a null reference. - /// Returns true on success, false on failure. - public bool Composite(bool useBitmapBackground, Color? applicationBackground, FreeImageBitmap bitmapBackGround) - { - EnsureNotDisposed(); - bitmapBackGround.EnsureNotDisposed(); - RGBQUAD? rgb = applicationBackground; - return ReplaceDib( - FreeImage.Composite( - dib, - useBitmapBackground, - rgb.HasValue ? new RGBQUAD[] { rgb.Value } : null, - bitmapBackGround.dib)); - } - - /// - /// Applies the alpha value of each pixel to its color components. - /// The aplha value stays unchanged. - /// Only works with 32-bits color depth. - /// - /// Returns true on success, false on failure. - public bool PreMultiplyWithAlpha() - { - EnsureNotDisposed(); - return FreeImage.PreMultiplyWithAlpha(dib); - } - - /// - /// Solves a Poisson equation, remap result pixels to [0..1] and returns the solution. - /// - /// Number of cycles in the multigrid algorithm (usually 2 or 3) - /// Returns true on success, false on failure. - public bool MultigridPoissonSolver(int ncycle) - { - EnsureNotDisposed(); - return ReplaceDib(FreeImage.MultigridPoissonSolver(dib, ncycle)); - } - - /// - /// Adjusts an image's brightness, contrast and gamma as well as it may - /// optionally invert the image within a single operation. - /// - /// Percentage brightness value where -100 <= brightness <= 100. - /// A value of 0 means no change, less than 0 will make the image darker and greater - /// than 0 will make the image brighter. - /// Percentage contrast value where -100 <= contrast <= 100. - /// A value of 0 means no change, less than 0 will decrease the contrast - /// and greater than 0 will increase the contrast of the image. - /// Gamma value to be used for gamma correction. - /// A value of 1.0 leaves the image alone, less than one darkens it, - /// and greater than one lightens it. - /// This parameter must not be zero or smaller than zero. - /// If so, it will be ignored and no gamma correction will be performed on the image. - /// If set to true, the image will be inverted. - /// Returns true on success, false on failure. - public bool AdjustColors(double brightness, double contrast, double gamma, bool invert) - { - EnsureNotDisposed(); - return FreeImage.AdjustColors(dib, brightness, contrast, gamma, invert); - } - - /// - /// Applies color mapping for one or several colors on a 1-, 4- or 8-bit - /// palletized or a 16-, 24- or 32-bit high color image. - /// - /// Array of colors to be used as the mapping source. - /// Array of colors to be used as the mapping destination. - /// If true, 32-bit images and colors are treated as 24-bit. - /// If true, source and destination colors are swapped, that is, - /// each destination color is also mapped to the corresponding source color. - /// The total number of pixels changed. - /// - /// or is a null reference. - /// - /// - /// has a different length than . - /// - public uint ApplyColorMapping(RGBQUAD[] srccolors, RGBQUAD[] dstcolors, bool ignore_alpha, bool swap) - { - EnsureNotDisposed(); - if (srccolors == null) - { - throw new ArgumentNullException("srccolors"); - } - if (dstcolors == null) - { - throw new ArgumentNullException("dstcolors"); - } - if (srccolors.Length != dstcolors.Length) - { - throw new ArgumentException("srccolors and dstcolors must have the same length."); - } - return FreeImage.ApplyColorMapping(dib, srccolors, dstcolors, (uint)srccolors.Length, ignore_alpha, swap); - } - - /// - /// Swaps two specified colors on a 1-, 4- or 8-bit palletized - /// or a 16-, 24- or 32-bit high color image. - /// - /// One of the two colors to be swapped. - /// The other of the two colors to be swapped. - /// If true, 32-bit images and colors are treated as 24-bit. - /// The total number of pixels changed. - public uint SwapColors(RGBQUAD color_a, RGBQUAD color_b, bool ignore_alpha) - { - EnsureNotDisposed(); - return FreeImage.SwapColors(dib, ref color_a, ref color_b, ignore_alpha); - } - - /// - /// Applies palette index mapping for one or several indices - /// on a 1-, 4- or 8-bit palletized image. - /// - /// Array of palette indices to be used as the mapping source. - /// Array of palette indices to be used as the mapping destination. - /// The number of palette indices to be mapped. This is the size of both - /// srcindices and dstindices - /// If true, source and destination palette indices are swapped, that is, - /// each destination index is also mapped to the corresponding source index. - /// The total number of pixels changed. - /// - /// or is a null reference. - /// - /// - /// has a different length than . - /// - public uint ApplyPaletteIndexMapping(byte[] srcindices, byte[] dstindices, uint count, bool swap) - { - EnsureNotDisposed(); - if (srcindices == null) - { - throw new ArgumentNullException("srcindices"); - } - if (dstindices == null) - { - throw new ArgumentNullException("dstindices"); - } - if (srcindices.Length != dstindices.Length) - { - throw new ArgumentException("srcindices and dstindices must have the same length."); - } - return FreeImage.ApplyPaletteIndexMapping(dib, srcindices, dstindices, (uint)srcindices.Length, swap); - } - - /// - /// Swaps two specified palette indices on a 1-, 4- or 8-bit palletized image. - /// - /// One of the two palette indices to be swapped. - /// The other of the two palette indices to be swapped. - /// The total number of pixels changed. - public uint SwapPaletteIndices(byte index_a, byte index_b) - { - EnsureNotDisposed(); - return FreeImage.SwapPaletteIndices(dib, ref index_a, ref index_b); - } - - /// - /// Sets all pixels of this to the specified color. - /// See for further details. - /// - /// The type of the specified color. - /// The color to fill this with. - /// true on success, false on failure. - public bool FillBackground(T color) where T : struct - { - return FillBackground(color, FREE_IMAGE_COLOR_OPTIONS.FICO_DEFAULT); - } - - /// - /// Sets all pixels of this to the specified color. - /// See for further details. - /// - /// The type of the specified color. - /// The color to fill this with. - /// Options that affect the color search process for palletized images. - /// true on success, false on failure. - public bool FillBackground(T color, FREE_IMAGE_COLOR_OPTIONS options) where T : struct - { - EnsureNotDisposed(); - return FreeImage.FillBackground(dib, color, options); - } - - /// - /// Creates a new ICC-Profile. - /// - /// The data of the new ICC-Profile. - /// The new ICC-Profile of the bitmap. - /// is a null reference. - public FIICCPROFILE CreateICCProfile(byte[] data) - { - if (data == null) - { - throw new ArgumentNullException("data"); - } - return CreateICCProfile(data, data.Length); - } - - /// - /// Creates a new ICC-Profile. - /// - /// The data of the new ICC-Profile. - /// The number of bytes of to use. - /// The new ICC-Profile of the bitmap. - /// is null. - public FIICCPROFILE CreateICCProfile(byte[] data, int size) - { - EnsureNotDisposed(); - if (data == null) - { - throw new ArgumentNullException("data"); - } - return FreeImage.CreateICCProfileEx(dib, data, size); - } - - /// - /// Determines whether this and the specified instances are the same. - /// - /// The object to test. - /// true if this instance is the same - /// or if both are null references; otherwise, false. - public override bool Equals(object obj) - { - return ReferenceEquals(this, obj); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return dib.GetHashCode(); - } - - #endregion - - #region Static functions - - /// - /// Returns a value that indicates whether the pixel format for this contains alpha information. - /// - /// The to test. - /// true if pixfmt contains alpha information; otherwise, false. - public static bool IsAlphaPixelFormat(PixelFormat pixfmt) - { - return Bitmap.IsAlphaPixelFormat(pixfmt); - } - - /// - /// Returns a value that indicates whether the pixel format is 32 bits per pixel. - /// - /// The to test. - /// true if pixfmt is canonical; otherwise, false. - public static bool IsCanonicalPixelFormat(PixelFormat pixfmt) - { - return Bitmap.IsCanonicalPixelFormat(pixfmt); - } - - /// - /// Returns a value that indicates whether the pixel format is 64 bits per pixel. - /// - /// The enumeration to test. - /// true if pixfmt is extended; otherwise, false. - public static bool IsExtendedPixelFormat(PixelFormat pixfmt) - { - return Bitmap.IsExtendedPixelFormat(pixfmt); - } - - /// - /// Creates a from a Windows handle to an icon. - /// - /// A handle to an icon. - /// The that this method creates. - public static FreeImageBitmap FromHicon(IntPtr hicon) - { - using (Bitmap bitmap = Bitmap.FromHicon(hicon)) - { - return new FreeImageBitmap(bitmap); - } - } - - /// - /// Creates a from the specified Windows resource. - /// - /// A handle to an instance of the executable - /// file that contains the resource. - /// A string containing the name of the resource bitmap. - /// The that this method creates. - public static FreeImageBitmap FromResource(IntPtr hinstance, string bitmapName) - { - using (Bitmap bitmap = Bitmap.FromResource(hinstance, bitmapName)) - { - return new FreeImageBitmap(bitmap); - } - } - - /// - /// Creates a from the specified file. - /// - /// A string that contains the name of the file - /// from which to create the . - /// The this method creates. - public static FreeImageBitmap FromFile(string filename) - { - return new FreeImageBitmap(filename); - } - - /// - /// Creates a from the specified file - /// using embedded color management information in that file. - /// - /// A string that contains the - /// name of the file from which to create the . - /// Ignored. - /// The this method creates. - public static FreeImageBitmap FromFile(string filename, bool useEmbeddedColorManagement) - { - return new FreeImageBitmap(filename); - } - - /// - /// Creates a from a handle to a GDI bitmap. - /// - /// The GDI bitmap handle from which to create the . - /// The this method creates. - public static FreeImageBitmap FromHbitmap(IntPtr hbitmap) - { - FreeImageBitmap result = null; - FIBITMAP newDib = FreeImage.CreateFromHbitmap(hbitmap, IntPtr.Zero); - if (!newDib.IsNull) - { - result = new FreeImageBitmap(newDib); - } - return result; - } - - /// - /// Creates a from a handle to a GDI bitmap and a handle to a GDI palette. - /// - /// The GDI bitmap handle from which to create the . - /// Ignored. - /// The this method creates. - public static FreeImageBitmap FromHbitmap(IntPtr hbitmap, IntPtr hpalette) - { - return FromHbitmap(hbitmap); - } - - /// - /// Frees a bitmap handle. - /// - /// Handle to a bitmap. - /// true on success, false on failure. - public static bool FreeHbitmap(IntPtr hbitmap) - { - return FreeImage.FreeHbitmap(hbitmap); - } - - /// - /// Creates a from the specified data stream. - /// - /// A that contains the data for this . - /// The this method creates. - public static FreeImageBitmap FromStream(Stream stream) - { - return new FreeImageBitmap(stream); - } - - /// - /// Creates a from the specified data stream. - /// - /// A that contains the data for this . - /// Ignored. - /// The this method creates. - public static FreeImageBitmap FromStream(Stream stream, bool useEmbeddedColorManagement) - { - return new FreeImageBitmap(stream); - } - - /// - /// Creates a from the specified data stream. - /// - /// A that contains the data for this . - /// Ignored. - /// Ignored. - /// The this method creates. - public static FreeImageBitmap FromStream(Stream stream, bool useEmbeddedColorManagement, bool validateImageData) - { - return new FreeImageBitmap(stream); - } - - /// - /// Returns the color depth, in number of bits per pixel, - /// of the specified pixel format. - /// - /// The member that specifies - /// the format for which to find the size. - /// The color depth of the specified pixel format. - public static int GetPixelFormatSize(PixelFormat pixfmt) - { - return Bitmap.GetPixelFormatSize(pixfmt); - } - - /// - /// Performs a lossless rotation or flipping on a JPEG file. - /// - /// Source file. - /// Destination file; can be the source file; will be overwritten. - /// The operation to apply. - /// To avoid lossy transformation, you can set the perfect parameter to true. - /// Returns true on success, false on failure. - public static bool JPEGTransform(string source, string destination, FREE_IMAGE_JPEG_OPERATION operation, bool perfect) - { - return FreeImage.JPEGTransform(source, destination, operation, perfect); - } - - /// - /// Performs a lossless crop on a JPEG file. - /// - /// Source filename. - /// Destination filename. - /// Specifies the cropped rectangle. - /// Returns true on success, false on failure. - /// - /// or is null. - /// - /// - /// does not exist. - /// - public static bool JPEGCrop(string source, string destination, Rectangle rect) - { - if (source == null) - { - throw new ArgumentNullException("source"); - } - if (!File.Exists(source)) - { - throw new FileNotFoundException("source"); - } - if (destination == null) - { - throw new ArgumentNullException("destination"); - } - return JPEGCrop(source, destination, rect.Left, rect.Top, rect.Right, rect.Bottom); - } - - /// - /// Performs a lossless crop on a JPEG file. - /// - /// Source filename. - /// Destination filename. - /// Specifies the left position of the cropped rectangle. - /// Specifies the top position of the cropped rectangle. - /// Specifies the right position of the cropped rectangle. - /// Specifies the bottom position of the cropped rectangle. - /// Returns true on success, false on failure. - /// - /// or is null. - /// - /// - /// does not exist. - /// - public static bool JPEGCrop(string source, string destination, int left, int top, int right, int bottom) - { - if (source == null) - { - throw new ArgumentNullException("source"); - } - if (!File.Exists(source)) - { - throw new FileNotFoundException("source"); - } - if (destination == null) - { - throw new ArgumentNullException("destination"); - } - return FreeImage.JPEGCrop(source, destination, left, top, right, bottom); - } - - /// - /// Converts a X11 color name into a corresponding RGB value. - /// - /// Name of the color to convert. - /// Red component. - /// Green component. - /// Blue component. - /// Returns true on success, false on failure. - /// is null. - public static bool LookupX11Color(string color, out byte red, out byte green, out byte blue) - { - if (color == null) - { - throw new ArgumentNullException("color"); - } - return FreeImage.LookupX11Color(color, out red, out green, out blue); - } - - /// - /// Converts a SVG color name into a corresponding RGB value. - /// - /// Name of the color to convert. - /// Red component. - /// Green component. - /// Blue component. - /// Returns true on success, false on failure. - /// is null. - public static bool LookupSVGColor(string color, out byte red, out byte green, out byte blue) - { - if (color == null) - { - throw new ArgumentNullException("color"); - } - return FreeImage.LookupSVGColor(color, out red, out green, out blue); - } - - /// - /// Creates a lookup table to be used with AdjustCurve() which - /// may adjusts brightness and contrast, correct gamma and invert the image with a - /// single call to AdjustCurve(). - /// - /// Output lookup table to be used with AdjustCurve(). - /// The size of is assumed to be 256. - /// Percentage brightness value where -100 <= brightness <= 100. - /// A value of 0 means no change, less than 0 will make the image darker and greater - /// than 0 will make the image brighter. - /// Percentage contrast value where -100 <= contrast <= 100. - /// A value of 0 means no change, less than 0 will decrease the contrast - /// and greater than 0 will increase the contrast of the image. - /// Gamma value to be used for gamma correction. - /// A value of 1.0 leaves the image alone, less than one darkens it, - /// and greater than one lightens it. - /// If set to true, the image will be inverted. - /// The number of adjustments applied to the resulting lookup table - /// compared to a blind lookup table. - /// is null. - /// is not 256. - public static int GetAdjustColorsLookupTable(byte[] lookUpTable, double brightness, double contrast, double gamma, bool invert) - { - if (lookUpTable == null) - { - throw new ArgumentNullException("lookUpTable"); - } - if (lookUpTable.Length != 256) - { - throw new ArgumentException("lookUpTable"); - } - return FreeImage.GetAdjustColorsLookupTable(lookUpTable, brightness, contrast, gamma, invert); - } - - /// - /// Adds a specified frame to the file specified using the specified parameters. - /// Use this method to save selected frames from an to a multiple-frame image. - /// - /// File to add this frame to. - /// A that contains the frame to add. - /// Format of the image. - /// Flags to enable or disable plugin-features. - /// Flags to enable or disable plugin-features. - /// - /// or is null. - /// - /// does not exist. - /// Saving the image failed. - public static void SaveAdd( - string filename, - FreeImageBitmap bitmap, - FREE_IMAGE_FORMAT format, - FREE_IMAGE_LOAD_FLAGS loadFlags, - FREE_IMAGE_SAVE_FLAGS saveFlags) - { - if (filename == null) - { - throw new ArgumentNullException("filename"); - } - if (!File.Exists(filename)) - { - throw new FileNotFoundException("filename"); - } - if (bitmap == null) - { - throw new ArgumentNullException("bitmap"); - } - bitmap.EnsureNotDisposed(); - - FIBITMAP dib = bitmap.dib; - if (dib.IsNull) - throw new ArgumentNullException("bitmap"); - - FIMULTIBITMAP mpBitmap = - FreeImage.OpenMultiBitmapEx(filename, ref format, loadFlags, false, false, true); - - if (mpBitmap.IsNull) - throw new Exception(ErrorLoadingBitmap); - - FreeImage.AppendPage(mpBitmap, bitmap.dib); - - if (!FreeImage.CloseMultiBitmap(mpBitmap, saveFlags)) - throw new Exception(ErrorUnloadBitmap); - } - - /// - /// Adds a specified frame to the file specified using the specified parameters. - /// Use this method to save selected frames from an image to a multiple-frame image. - /// - /// File to add this frame to. - /// A that contains the frame to add. - /// The position of the inserted frame. - /// Format of the image. - /// Flags to enable or disable plugin-features. - /// Flags to enable or disable plugin-features. - /// - /// or is null. - /// - /// does not exist. - /// Saving the image failed. - /// is out of range. - public static void SaveAdd( - string filename, - FreeImageBitmap bitmap, - int insertPosition, - FREE_IMAGE_FORMAT format, - FREE_IMAGE_LOAD_FLAGS loadFlags, - FREE_IMAGE_SAVE_FLAGS saveFlags) - { - if (filename == null) - { - throw new ArgumentNullException("filename"); - } - if (!File.Exists(filename)) - { - throw new FileNotFoundException("filename"); - } - if (bitmap == null) - { - throw new ArgumentNullException("bitmap"); - } - if (insertPosition < 0) - { - throw new ArgumentOutOfRangeException("insertPosition"); - } - bitmap.EnsureNotDisposed(); - - FIBITMAP dib = bitmap.dib; - if (dib.IsNull) - throw new ArgumentNullException("bitmap"); - - FIMULTIBITMAP mpBitmap = - FreeImage.OpenMultiBitmapEx(filename, ref format, loadFlags, false, false, true); - - if (mpBitmap.IsNull) - throw new Exception(ErrorLoadingBitmap); - - int pageCount = FreeImage.GetPageCount(mpBitmap); - - if (insertPosition > pageCount) - throw new ArgumentOutOfRangeException("insertPosition"); - - if (insertPosition == pageCount) - FreeImage.AppendPage(mpBitmap, bitmap.dib); - else - FreeImage.InsertPage(mpBitmap, insertPosition, bitmap.dib); - - if (!FreeImage.CloseMultiBitmap(mpBitmap, saveFlags)) - throw new Exception(ErrorUnloadBitmap); - } - - /// - /// Returns a new instance of the class which - /// has no public accessible constructor. - /// - /// A new instace of . - public static PropertyItem CreateNewPropertyItem() - { - return FreeImage.CreatePropertyItem(); - } - - #endregion - - #region Helper functions - - /// - /// Throws an exception in case the instance has already been disposed. - /// - private void EnsureNotDisposed() - { - lock (lockObject) - { - if (!this.disposed) - { - return; - } - } - throw new ObjectDisposedException(ToString()); - } - - /// - /// Tries to replace the wrapped with a new one. - /// In case the new dib is null or the same as the already - /// wrapped one, nothing will be changed and the result will - /// be false. - /// Otherwise the wrapped will be unloaded and replaced. - /// - /// The new dib. - /// Returns true on success, false on failure. - private bool ReplaceDib(FIBITMAP newDib) - { - bool result = false; - if ((dib != newDib) && (!newDib.IsNull)) - { - UnloadDib(); - dib = newDib; - AddMemoryPressure(); - result = true; - } - return result; - } - - /// - /// Unloads currently wrapped or unlocks the locked page - /// in case it came from a multipaged bitmap. - /// - private void UnloadDib() - { - if (!dib.IsNull) - { - long size = FreeImage.GetDIBSize(dib); - FreeImage.UnloadEx(ref dib); - if (size > 0L) - GC.RemoveMemoryPressure(size); - } - } - - /// - /// Informs the runtime about unmanaged allocoted memory. - /// - private void AddMemoryPressure() - { - long dataSize; - if ((dataSize = DataSize) > 0L) - GC.AddMemoryPressure(dataSize); - } - - /// - /// Opens the stream and reads the number of available pages. - /// Then loads the first page to this instance. - /// - private void LoadFromStream(Stream stream, FREE_IMAGE_FORMAT format, FREE_IMAGE_LOAD_FLAGS flags) - { - FIMULTIBITMAP mdib = FreeImage.OpenMultiBitmapFromStream(stream, ref format, flags); - if (mdib.IsNull) - { - throw new Exception(ErrorLoadingBitmap); - } - try - { - frameCount = FreeImage.GetPageCount(mdib); - } - finally - { - if (!FreeImage.CloseMultiBitmapEx(ref mdib)) - { - throw new Exception(ErrorUnloadBitmap); - } - } - - dib = FreeImage.LoadFromStream(stream, flags, ref format); - if (dib.IsNull) - { - throw new Exception(ErrorLoadingBitmap); - } - - saveInformation.loadFlags = flags; - originalFormat = format; - AddMemoryPressure(); - } - - #endregion - - #region Interfaces - - /// - /// Helper class to store informations for . - /// - private sealed class SaveInformation : ICloneable - { - public string filename; - public FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_UNKNOWN; - public FREE_IMAGE_LOAD_FLAGS loadFlags = FREE_IMAGE_LOAD_FLAGS.DEFAULT; - public FREE_IMAGE_SAVE_FLAGS saveFlags = FREE_IMAGE_SAVE_FLAGS.DEFAULT; - - public object Clone() - { - return base.MemberwiseClone(); - } - } - - /// - /// Creates a deep copy of this . - /// - /// A deep copy of this . - public object Clone() - { - EnsureNotDisposed(); - FreeImageBitmap result = null; - FIBITMAP newDib = FreeImage.Clone(dib); - if (!dib.IsNull) - { - result = new FreeImageBitmap(newDib); - result.saveInformation = (SaveInformation)saveInformation.Clone(); - result.tag = tag; - result.originalFormat = originalFormat; - } - return result; - } - - /// - /// Performs application-defined tasks associated with freeing, - /// releasing, or resetting unmanaged resources. - /// - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - /// - /// Performs application-defined tasks associated with freeing, - /// releasing, or resetting unmanaged resources. - /// - /// If true managed ressources are released. - protected virtual void Dispose(bool disposing) - { - // Only clean up once - lock (lockObject) - { - if (disposed) - { - return; - } - disposed = true; - } - - // Clean up managed resources - if (disposing) - { - if (stream != null) - { - if (disposeStream) - { - stream.Dispose(); - } - stream = null; - } - } - - tag = null; - saveInformation = null; - - // Clean up unmanaged resources - UnloadDib(); - } - - /// - /// Retrieves an object that can iterate through the individual scanlines in this . - /// - /// An for the . - /// The bitmaps's type is not supported. - IEnumerator IEnumerable.GetEnumerator() - { - return GetScanlines().GetEnumerator(); - } - - void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) - { - EnsureNotDisposed(); - using (MemoryStream memory = new MemoryStream(DataSize)) - { - if (!FreeImage.SaveToStream(dib, memory, FREE_IMAGE_FORMAT.FIF_TIFF, FREE_IMAGE_SAVE_FLAGS.TIFF_LZW)) - { - throw new SerializationException(); - } - memory.Capacity = (int)memory.Length; - info.AddValue("Bitmap Data", memory.GetBuffer()); - } - } - - #endregion - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/FreeImageEngine.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/FreeImageEngine.cs deleted file mode 100644 index be287bc..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/FreeImageEngine.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Diagnostics; - -namespace FreeImageAPI -{ - /// - /// Class handling non-bitmap related functions. - /// - public static class FreeImageEngine - { - #region Callback - - // Callback delegate - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly OutputMessageFunction outputMessageFunction; - - static FreeImageEngine() - { - // Check if FreeImage.dll is present and cancel setting the callbackfuntion if not - if (!IsAvailable) - { - return; - } - // Create a delegate (function pointer) to 'OnMessage' - outputMessageFunction = new OutputMessageFunction(OnMessage); - // Set the callback - FreeImage.SetOutputMessage(outputMessageFunction); - } - - /// - /// Internal callback - /// - private static void OnMessage(FREE_IMAGE_FORMAT fif, string message) - { - // Get a local copy of the multicast-delegate - OutputMessageFunction m = Message; - - // Check the local copy instead of the static instance - // to prevent a second thread from setting the delegate - // to null, which would cause a nullreference exception - if (m != null) - { - // Invoke the multicast-delegate - m.Invoke(fif, message); - } - } - - /// - /// Gets a value indicating if the FreeImage DLL is available or not. - /// - public static bool IsAvailable - { - get - { - return FreeImage.IsAvailable(); - } - } - - /// - /// Internal errors in FreeImage generate a logstring that can be - /// captured by this event. - /// - public static event OutputMessageFunction Message; - - #endregion - - /// - /// Gets a string containing the current version of the library. - /// - public static string Version - { - get - { - return FreeImage.GetVersion(); - } - } - - /// - /// Gets a string containing a standard copyright message. - /// - public static string CopyrightMessage - { - get - { - return FreeImage.GetCopyrightMessage(); - } - } - - /// - /// Gets whether the platform is using Little Endian. - /// - public static bool IsLittleEndian - { - get - { - return FreeImage.IsLittleEndian(); - } - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/FreeImagePlugin.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/FreeImagePlugin.cs deleted file mode 100644 index 399d492..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/FreeImagePlugin.cs +++ /dev/null @@ -1,202 +0,0 @@ -using System; -using System.Diagnostics; - -namespace FreeImageAPI.Plugins -{ - /// - /// Class representing a FreeImage format. - /// - public sealed class FreeImagePlugin - { - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private readonly FREE_IMAGE_FORMAT fif; - - /// - /// Initializes a new instance of this class. - /// - /// The FreeImage format to wrap. - internal FreeImagePlugin(FREE_IMAGE_FORMAT fif) - { - this.fif = fif; - } - - /// - /// Gets the format of this instance. - /// - public FREE_IMAGE_FORMAT FIFormat - { - get - { - return fif; - } - } - - /// - /// Gets or sets whether this plugin is enabled. - /// - public bool Enabled - { - get - { - return (FreeImage.IsPluginEnabled(fif) == 1); - } - set - { - FreeImage.SetPluginEnabled(fif, value); - } - } - - /// - /// Gets a string describing the format. - /// - public string Format - { - get - { - return FreeImage.GetFormatFromFIF(fif); - } - } - - /// - /// Gets a comma-delimited file extension list describing the bitmap formats - /// this plugin can read and/or write. - /// - public string ExtentsionList - { - get - { - return FreeImage.GetFIFExtensionList(fif); - } - } - - /// - /// Gets a descriptive string that describes the bitmap formats - /// this plugin can read and/or write. - /// - public string Description - { - get - { - return FreeImage.GetFIFDescription(fif); - } - } - - /// - /// Returns a regular expression string that can be used by - /// a regular expression engine to identify the bitmap. - /// FreeImageQt makes use of this function. - /// - public string RegExpr - { - get - { - return FreeImage.GetFIFRegExpr(fif); - } - } - - /// - /// Gets whether this plugin can load bitmaps. - /// - public bool SupportsReading - { - get - { - return FreeImage.FIFSupportsReading(fif); - } - } - - /// - /// Gets whether this plugin can save bitmaps. - /// - public bool SupportsWriting - { - get - { - return FreeImage.FIFSupportsWriting(fif); - } - } - - /// - /// Checks whether this plugin can save a bitmap in the desired data type. - /// - /// The desired image type. - /// True if this plugin can save bitmaps as the desired type, else false. - public bool SupportsExportType(FREE_IMAGE_TYPE type) - { - return FreeImage.FIFSupportsExportType(fif, type); - } - - /// - /// Checks whether this plugin can save bitmaps in the desired bit depth. - /// - /// The desired bit depth. - /// True if this plugin can save bitmaps in the desired bit depth, else false. - public bool SupportsExportBPP(int bpp) - { - return FreeImage.FIFSupportsExportBPP(fif, bpp); - } - - /// - /// Gets whether this plugin can load or save an ICC profile. - /// - public bool SupportsICCProfiles - { - get - { - return FreeImage.FIFSupportsICCProfiles(fif); - } - } - - /// - /// Checks whether an extension is valid for this format. - /// - /// The desired extension. - /// True if the extension is valid for this format, false otherwise. - public bool ValidExtension(string extension) - { - return FreeImage.IsExtensionValidForFIF(fif, extension); - } - - /// - /// Checks whether an extension is valid for this format. - /// - /// The desired extension. - /// The string comparison type. - /// True if the extension is valid for this format, false otherwise. - public bool ValidExtension(string extension, StringComparison comparisonType) - { - return FreeImage.IsExtensionValidForFIF(fif, extension, comparisonType); - } - - /// - /// Checks whether a filename is valid for this format. - /// - /// The desired filename. - /// True if the filename is valid for this format, false otherwise. - public bool ValidFilename(string filename) - { - return FreeImage.IsFilenameValidForFIF(fif, filename); - } - - /// - /// Checks whether a filename is valid for this format. - /// - /// The desired filename. - /// The string comparison type. - /// True if the filename is valid for this format, false otherwise. - public bool ValidFilename(string filename, StringComparison comparisonType) - { - return FreeImage.IsFilenameValidForFIF(fif, filename, comparisonType); - } - - /// - /// Gets a descriptive string that describes the bitmap formats - /// this plugin can read and/or write. - /// - /// A descriptive string that describes the bitmap formats. - public override string ToString() - { - return Description; - } - } -} diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/FreeImageStreamIO.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/FreeImageStreamIO.cs deleted file mode 100644 index fa0bfc7..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/FreeImageStreamIO.cs +++ /dev/null @@ -1,167 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.5 $ -// $Date: 2009/09/15 11:47:46 $ -// $Id: FreeImageStreamIO.cs,v 1.5 2009/09/15 11:47:46 cklein05 Exp $ -// ========================================================== - -using System; -using System.IO; -using System.Runtime.InteropServices; -using System.Diagnostics; - -namespace FreeImageAPI.IO -{ - /// - /// Internal class wrapping stream io functions. - /// - /// - /// FreeImage can read files from a disk or a network drive but also allows the user to - /// implement their own loading or saving functions to load them directly from an ftp or web - /// server for example. - /// - /// In .NET streams are a common way to handle data. The FreeImageStreamIO class handles - /// the loading and saving from and to streams. It implements the funtions FreeImage needs - /// to load data from an an arbitrary source. - /// - /// The class is for internal use only. - /// - internal static class FreeImageStreamIO - { - /// - /// structure that can be used to read from streams via - /// . - /// - public static readonly FreeImageIO io; - - /// - /// Initializes a new instances which can be used to - /// create a FreeImage compatible structure. - /// - static FreeImageStreamIO() - { - io.readProc = new ReadProc(streamRead); - io.writeProc = new WriteProc(streamWrite); - io.seekProc = new SeekProc(streamSeek); - io.tellProc = new TellProc(streamTell); - } - - /// - /// Reads the requested data from the stream and writes it to the given address. - /// - static unsafe uint streamRead(IntPtr buffer, uint size, uint count, fi_handle handle) - { - Stream stream = handle.GetObject() as Stream; - if ((stream == null) || (!stream.CanRead)) - { - return 0; - } - uint readCount = 0; - byte* ptr = (byte*)buffer; - byte[] bufferTemp = new byte[size]; - int read; - while (readCount < count) - { - read = stream.Read(bufferTemp, 0, (int)size); - if (read != (int)size) - { - stream.Seek(-read, SeekOrigin.Current); - break; - } - for (int i = 0; i < read; i++, ptr++) - { - *ptr = bufferTemp[i]; - } - readCount++; - } - return (uint)readCount; - } - - /// - /// Reads the given data and writes it into the stream. - /// - static unsafe uint streamWrite(IntPtr buffer, uint size, uint count, fi_handle handle) - { - Stream stream = handle.GetObject() as Stream; - if ((stream == null) || (!stream.CanWrite)) - { - return 0; - } - uint writeCount = 0; - byte[] bufferTemp = new byte[size]; - byte* ptr = (byte*)buffer; - while (writeCount < count) - { - for (int i = 0; i < size; i++, ptr++) - { - bufferTemp[i] = *ptr; - } - try - { - stream.Write(bufferTemp, 0, bufferTemp.Length); - } - catch - { - return writeCount; - } - writeCount++; - } - return writeCount; - } - - /// - /// Moves the streams position. - /// - static int streamSeek(fi_handle handle, int offset, SeekOrigin origin) - { - Stream stream = handle.GetObject() as Stream; - if (stream == null) - { - return 1; - } - stream.Seek((long)offset, origin); - return 0; - } - - /// - /// Returns the streams current position - /// - static int streamTell(fi_handle handle) - { - Stream stream = handle.GetObject() as Stream; - if (stream == null) - { - return -1; - } - return (int)stream.Position; - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/GifInformation.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/GifInformation.cs deleted file mode 100644 index 75af8ad..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/GifInformation.cs +++ /dev/null @@ -1,131 +0,0 @@ -using System; -using System.Diagnostics; -using System.Drawing; - -namespace FreeImageAPI.Metadata -{ - /// - /// Provides additional information specific for GIF files. This class cannot be inherited. - /// - public class GifInformation : MDM_ANIMATION - { - /// - /// Initializes a new instance of the class - /// with the specified . - /// - /// A reference to a instance. - public GifInformation(FreeImageBitmap bitmap) - : base(bitmap.Dib) - { - } - - /// - /// Gets or sets a value indicating whether this frame uses the - /// GIF image's global palette. If set to false, this - /// frame uses its local palette. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public bool? UseGlobalPalette - { - get - { - byte? useGlobalPalette = GetTagValue("NoLocalPalette"); - return useGlobalPalette.HasValue ? (useGlobalPalette.Value != 0) : default(bool?); - } - set - { - byte? val = null; - if (value.HasValue) - { - val = (byte)(value.Value ? 1 : 0); - } - SetTagValue("NoLocalPalette", val); - } - } - - /// - /// Creates a global palette for the GIF image, intialized with all entries of the - /// current local palette. - /// The property will be set to true when - /// invoking this method. This effectively enables the newly created global palette. - /// - /// - /// The image does not have a palette. - /// - public void CreateGlobalPalette() - { - CreateGlobalPalette(new Palette(dib)); - } - - /// - /// Creates a global palette for the GIF image with the specified size, intialized - /// with the first entries of the current local palette. - /// The property will be set to true when - /// invoking this method. This effectively enables the newly created global palette. - /// - /// The size of the newly created global palette. - /// - /// is a null reference. - public void CreateGlobalPalette(int size) - { - CreateGlobalPalette(new Palette(dib), size); - } - - /// - /// Creates a global palette for the GIF image, intialized with the entries - /// of the specified palette. - /// The property will be set to true when - /// invoking this method. This effectively enables the newly created global palette. - /// - /// The palette that contains the initial values for - /// the newly created global palette. - /// - /// is a null reference. - public void CreateGlobalPalette(Palette palette) - { - if (palette == null) - { - throw new ArgumentNullException("palette"); - } - - GlobalPalette = palette; - UseGlobalPalette = true; - } - - /// - /// Creates a global palette for the GIF image with the specified size, intialized - /// with the first entries of the specified palette. - /// The property will be set to true when - /// invoking this method. This effectively enables the newly created global palette. - /// - /// The palette that contains the initial values for - /// the newly created global palette. - /// The size of the newly created global palette. - /// - /// is a null reference. - public void CreateGlobalPalette(Palette palette, int size) - { - if (palette == null) - { - throw new ArgumentNullException("palette"); - } - if (size <= 0) - { - throw new ArgumentOutOfRangeException("size"); - } - - Palette pal = new Palette(size); - pal.CopyFrom(palette); - GlobalPalette = palette; - UseGlobalPalette = true; - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/ImageMetadata.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/ImageMetadata.cs deleted file mode 100644 index d0bb44b..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/ImageMetadata.cs +++ /dev/null @@ -1,286 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.7 $ -// $Date: 2009/02/27 16:34:59 $ -// $Id: ImageMetadata.cs,v 1.7 2009/02/27 16:34:59 cklein05 Exp $ -// ========================================================== - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Reflection; -using System.Diagnostics; - -namespace FreeImageAPI.Metadata -{ - /// - /// Class handling metadata of a FreeImage bitmap. - /// - public class ImageMetadata : IEnumerable, IComparable, IComparable - { - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private readonly List data; - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private readonly FIBITMAP dib; - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private bool hideEmptyModels; - - /// - /// Initializes a new instance based on the specified , - /// showing all known models. - /// - /// Handle to a FreeImage bitmap. - public ImageMetadata(FIBITMAP dib) : this(dib, false) { } - - /// - /// Initializes a new instance based on the specified , - /// showing or hiding empry models. - /// - /// Handle to a FreeImage bitmap. - /// When true, empty metadata models - /// will be hidden until a tag to this model is added. - public ImageMetadata(FIBITMAP dib, bool hideEmptyModels) - { - if (dib.IsNull) throw new ArgumentNullException("dib"); - data = new List(FreeImage.FREE_IMAGE_MDMODELS.Length); - this.dib = dib; - this.hideEmptyModels = hideEmptyModels; - - data.Add(new MDM_ANIMATION(dib)); - data.Add(new MDM_COMMENTS(dib)); - data.Add(new MDM_CUSTOM(dib)); - data.Add(new MDM_EXIF_EXIF(dib)); - data.Add(new MDM_EXIF_GPS(dib)); - data.Add(new MDM_INTEROP(dib)); - data.Add(new MDM_EXIF_MAIN(dib)); - data.Add(new MDM_MAKERNOTE(dib)); - data.Add(new MDM_GEOTIFF(dib)); - data.Add(new MDM_IPTC(dib)); - data.Add(new MDM_NODATA(dib)); - data.Add(new MDM_XMP(dib)); - } - - /// - /// Gets or sets the of the specified type. - /// In case the getter returns null the model is not contained - /// by the list. - /// null can be used calling the setter to destroy the model. - /// - /// Type of the model. - /// The object of the specified type. - public MetadataModel this[FREE_IMAGE_MDMODEL model] - { - get - { - for (int i = 0; i < data.Count; i++) - { - if (data[i].Model == model) - { - if (!data[i].Exists && hideEmptyModels) - { - return null; - } - return data[i]; - } - } - return null; - } - } - - /// - /// Gets or sets the at the specified index. - /// In case the getter returns null the model is not contained - /// by the list. - /// null can be used calling the setter to destroy the model. - /// - /// Index of the within - /// this instance. - /// The - /// object at the specified index. - public MetadataModel this[int index] - { - get - { - if (index < 0 || index >= data.Count) - { - throw new ArgumentOutOfRangeException("index"); - } - return (hideEmptyModels && !data[index].Exists) ? null : data[index]; - } - } - - /// - /// Returns a list of all visible - /// MetadataModels. - /// - public List List - { - get - { - if (hideEmptyModels) - { - List result = new List(); - for (int i = 0; i < data.Count; i++) - { - if (data[i].Exists) - { - result.Add(data[i]); - } - } - return result; - } - else - { - return data; - } - } - } - - /// - /// Adds new tag to the bitmap or updates its value in case it already exists. - /// will be used as key. - /// - /// The tag to add or update. - /// Returns true on success, false on failure. - /// - /// is null. - public bool AddTag(MetadataTag tag) - { - for (int i = 0; i < data.Count; i++) - { - if (tag.Model == data[i].Model) - { - return data[i].AddTag(tag); - } - } - return false; - } - - /// - /// Returns the number of visible - /// MetadataModels. - /// - public int Count - { - get - { - if (hideEmptyModels) - { - int count = 0; - for (int i = 0; i < data.Count; i++) - { - if (data[i].Exists) - { - count++; - } - } - return count; - } - else - { - return data.Count; - } - } - } - - /// - /// Gets or sets whether empty - /// MetadataModels are hidden. - /// - public bool HideEmptyModels - { - get - { - return hideEmptyModels; - } - set - { - hideEmptyModels = value; - } - } - - /// - /// Retrieves an object that can iterate through the individual - /// MetadataModels - /// in this . - /// - /// An for this . - public IEnumerator GetEnumerator() - { - if (hideEmptyModels) - { - List tempList = new List(data.Count); - for (int i = 0; i < data.Count; i++) - { - if (data[i].Exists) - { - tempList.Add(data[i]); - } - } - return tempList.GetEnumerator(); - } - else - { - return data.GetEnumerator(); - } - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is ImageMetadata)) - { - throw new ArgumentException("obj"); - } - return CompareTo((ImageMetadata)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(ImageMetadata other) - { - return this.dib.CompareTo(other.dib); - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/LocalPlugin.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/LocalPlugin.cs deleted file mode 100644 index 4c6bbe8..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/LocalPlugin.cs +++ /dev/null @@ -1,466 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.9 $ -// $Date: 2009/09/15 11:47:46 $ -// $Id: LocalPlugin.cs,v 1.9 2009/09/15 11:47:46 cklein05 Exp $ -// ========================================================== - -using System; -using System.IO; -using System.Runtime.InteropServices; -using FreeImageAPI.IO; -using System.Diagnostics; - -namespace FreeImageAPI.Plugins -{ - /// - /// Class representing own FreeImage-Plugins. - /// - /// - /// FreeImages itself is plugin based. Each supported format is integrated by a seperat plugin, - /// that handles loading, saving, descriptions, identifing ect. - /// And of course the user can create own plugins and use them in FreeImage. - /// To do that the above mentioned predefined methodes need to be implemented. - /// - /// The class below handles the creation of such a plugin. The class itself is abstract - /// as well as some core functions that need to be implemented. - /// The class can be used to enable or disable the plugin in FreeImage after regististration or - /// retrieve the formatid, assigned by FreeImage. - /// The class handles the callback functions, garbage collector and pointer operation to make - /// the implementation as user friendly as possible. - /// - /// How to: - /// There are two functions that need to be implemented: - /// and - /// . - /// is used by the constructor - /// of the abstract class. FreeImage wants a list of the implemented functions. Each function is - /// represented by a function pointer (a .NET ). In case a function - /// is not implemented FreeImage receives an empty delegate). To tell the constructor - /// which functions have been implemented the information is represented by a disjunction of - /// . - /// - /// For example: - /// return MethodFlags.LoadProc | MethodFlags.SaveProc; - /// - /// The above statement means that LoadProc and SaveProc have been implemented by the user. - /// Keep in mind, that each function has a standard implementation that has static return - /// values that may cause errors if listed in - /// without a real implementation. - /// - /// is used by some checks of FreeImage and - /// must be implemented. for example can be - /// implemented if the plugin supports reading, but it doesn't have to, the plugin could only - /// be used to save an already loaded bitmap in a special format. - /// - public abstract class LocalPlugin - { - /// - /// Struct containing function pointers. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private Plugin plugin; - - /// - /// Delegate for register callback by FreeImage. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private InitProc initProc; - - /// - /// The format id assiged to the plugin. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_UNKNOWN; - - /// - /// When true the plugin was registered successfully else false. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected readonly bool registered = false; - - /// - /// A copy of the functions used to register. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected readonly MethodFlags implementedMethods; - - /// - /// MethodFlags defines values to fill a bitfield telling which - /// functions have been implemented by a plugin. - /// - [Flags] - protected enum MethodFlags - { - /// - /// No mothods implemented. - /// - None = 0x0, - - /// - /// DescriptionProc has been implemented. - /// - DescriptionProc = 0x1, - - /// - /// ExtensionListProc has been implemented. - /// - ExtensionListProc = 0x2, - - /// - /// RegExprProc has been implemented. - /// - RegExprProc = 0x4, - - /// - /// OpenProc has been implemented. - /// - OpenProc = 0x8, - - /// - /// CloseProc has been implemented. - /// - CloseProc = 0x10, - - /// - /// PageCountProc has been implemented. - /// - PageCountProc = 0x20, - - /// - /// PageCapabilityProc has been implemented. - /// - PageCapabilityProc = 0x40, - - /// - /// LoadProc has been implemented. - /// - LoadProc = 0x80, - - /// - /// SaveProc has been implemented. - /// - SaveProc = 0x100, - - /// - /// ValidateProc has been implemented. - /// - ValidateProc = 0x200, - - /// - /// MimeProc has been implemented. - /// - MimeProc = 0x400, - - /// - /// SupportsExportBPPProc has been implemented. - /// - SupportsExportBPPProc = 0x800, - - /// - /// SupportsExportTypeProc has been implemented. - /// - SupportsExportTypeProc = 0x1000, - - /// - /// SupportsICCProfilesProc has been implemented. - /// - SupportsICCProfilesProc = 0x2000 - } - - // Functions that must be implemented. - - /// - /// Function that returns a bitfield containing the - /// implemented methods. - /// - /// Bitfield of the implemented methods. - protected abstract MethodFlags GetImplementedMethods(); - - /// - /// Implementation of FormatProc - /// - /// A string containing the plugins format. - protected abstract string FormatProc(); - - // Functions that can be implemented. - - /// - /// Function that can be implemented. - /// - protected virtual string DescriptionProc() { return ""; } - /// - /// Function that can be implemented. - /// - protected virtual string ExtensionListProc() { return ""; } - /// - /// Function that can be implemented. - /// - protected virtual string RegExprProc() { return ""; } - /// - /// Function that can be implemented. - /// - protected virtual IntPtr OpenProc(ref FreeImageIO io, fi_handle handle, bool read) { return IntPtr.Zero; } - /// - /// Function that can be implemented. - /// - protected virtual void CloseProc(ref FreeImageIO io, fi_handle handle, IntPtr data) { } - /// - /// Function that can be implemented. - /// - protected virtual int PageCountProc(ref FreeImageIO io, fi_handle handle, IntPtr data) { return 0; } - /// - /// Function that can be implemented. - /// - protected virtual int PageCapabilityProc(ref FreeImageIO io, fi_handle handle, IntPtr data) { return 0; } - /// - /// Function that can be implemented. - /// - protected virtual FIBITMAP LoadProc(ref FreeImageIO io, fi_handle handle, int page, int flags, IntPtr data) { return FIBITMAP.Zero; } - /// - /// Function that can be implemented. - /// - protected virtual bool SaveProc(ref FreeImageIO io, FIBITMAP dib, fi_handle handle, int page, int flags, IntPtr data) { return false; } - /// - /// Function that can be implemented. - /// - protected virtual bool ValidateProc(ref FreeImageIO io, fi_handle handle) { return false; } - /// - /// Function that can be implemented. - /// - protected virtual string MimeProc() { return ""; } - /// - /// Function that can be implemented. - /// - protected virtual bool SupportsExportBPPProc(int bpp) { return false; } - /// - /// Function that can be implemented. - /// - protected virtual bool SupportsExportTypeProc(FREE_IMAGE_TYPE type) { return false; } - /// - /// Function that can be implemented. - /// - protected virtual bool SupportsICCProfilesProc() { return false; } - - /// - /// The constructor automatically registeres the plugin in FreeImage. - /// To do this it prepares a FreeImage defined structure with function pointers - /// to the implemented functions or null if not implemented. - /// Before registing the functions they are pinned in memory so the garbage collector - /// can't move them around in memory after we passed there addresses to FreeImage. - /// - public LocalPlugin() - { - implementedMethods = GetImplementedMethods(); - - if ((implementedMethods & MethodFlags.DescriptionProc) != 0) - { - plugin.descriptionProc = new DescriptionProc(DescriptionProc); - } - if ((implementedMethods & MethodFlags.ExtensionListProc) != 0) - { - plugin.extensionListProc = new ExtensionListProc(ExtensionListProc); - } - if ((implementedMethods & MethodFlags.RegExprProc) != 0) - { - plugin.regExprProc = new RegExprProc(RegExprProc); - } - if ((implementedMethods & MethodFlags.OpenProc) != 0) - { - plugin.openProc = new OpenProc(OpenProc); - } - if ((implementedMethods & MethodFlags.CloseProc) != 0) - { - plugin.closeProc = new CloseProc(CloseProc); - } - if ((implementedMethods & MethodFlags.PageCountProc) != 0) - { - plugin.pageCountProc = new PageCountProc(PageCountProc); - } - if ((implementedMethods & MethodFlags.PageCapabilityProc) != 0) - { - plugin.pageCapabilityProc = new PageCapabilityProc(PageCapabilityProc); - } - if ((implementedMethods & MethodFlags.LoadProc) != 0) - { - plugin.loadProc = new LoadProc(LoadProc); - } - if ((implementedMethods & MethodFlags.SaveProc) != 0) - { - plugin.saveProc = new SaveProc(SaveProc); - } - if ((implementedMethods & MethodFlags.ValidateProc) != 0) - { - plugin.validateProc = new ValidateProc(ValidateProc); - } - if ((implementedMethods & MethodFlags.MimeProc) != 0) - { - plugin.mimeProc = new MimeProc(MimeProc); - } - if ((implementedMethods & MethodFlags.SupportsExportBPPProc) != 0) - { - plugin.supportsExportBPPProc = new SupportsExportBPPProc(SupportsExportBPPProc); - } - if ((implementedMethods & MethodFlags.SupportsExportTypeProc) != 0) - { - plugin.supportsExportTypeProc = new SupportsExportTypeProc(SupportsExportTypeProc); - } - if ((implementedMethods & MethodFlags.SupportsICCProfilesProc) != 0) - { - plugin.supportsICCProfilesProc = new SupportsICCProfilesProc(SupportsICCProfilesProc); - } - - // FormatProc is always implemented - plugin.formatProc = new FormatProc(FormatProc); - - // InitProc is the register call back. - initProc = new InitProc(RegisterProc); - - // Register the plugin. The result will be saved and can be accessed later. - registered = FreeImage.RegisterLocalPlugin(initProc, null, null, null, null) != FREE_IMAGE_FORMAT.FIF_UNKNOWN; - if (registered) - { - PluginRepository.RegisterLocalPlugin(this); - } - } - - private void RegisterProc(ref Plugin plugin, int format_id) - { - // Copy the function pointers - plugin = this.plugin; - // Retrieve the format if assigned to this plugin by FreeImage. - format = (FREE_IMAGE_FORMAT)format_id; - } - - /// - /// Gets or sets if the plugin is enabled. - /// - public bool Enabled - { - get - { - if (registered) - { - return (FreeImage.IsPluginEnabled(format) > 0); - } - else - { - throw new ObjectDisposedException("plugin not registered"); - } - } - set - { - if (registered) - { - FreeImage.SetPluginEnabled(format, value); - } - else - { - throw new ObjectDisposedException("plugin not registered"); - } - } - } - - /// - /// Gets if the plugin was registered successfully. - /// - public bool Registered - { - get { return registered; } - } - - /// - /// Gets the FreeImage assigned to this plugin. - /// - public FREE_IMAGE_FORMAT Format - { - get - { - return format; - } - } - - /// - /// Reads from an unmanaged stream. - /// - protected unsafe int Read(FreeImageIO io, fi_handle handle, uint size, uint count, ref byte[] buffer) - { - fixed (byte* ptr = buffer) - { - return (int)io.readProc(new IntPtr(ptr), size, count, handle); - } - } - - /// - /// Reads a single byte from an unmanaged stream. - /// - protected unsafe int ReadByte(FreeImageIO io, fi_handle handle) - { - byte buffer = 0; - return (int)io.readProc(new IntPtr(&buffer), 1, 1, handle) > 0 ? buffer : -1; - } - - /// - /// Writes to an unmanaged stream. - /// - protected unsafe int Write(FreeImageIO io, fi_handle handle, uint size, uint count, ref byte[] buffer) - { - fixed (byte* ptr = buffer) - { - return (int)io.writeProc(new IntPtr(ptr), size, count, handle); - } - } - - /// - /// Writes a single byte to an unmanaged stream. - /// - protected unsafe int WriteByte(FreeImageIO io, fi_handle handle, byte value) - { - return (int)io.writeProc(new IntPtr(&value), 1, 1, handle); - } - - /// - /// Seeks in an unmanaged stream. - /// - protected int Seek(FreeImageIO io, fi_handle handle, int offset, SeekOrigin origin) - { - return io.seekProc(handle, offset, origin); - } - - /// - /// Retrieves the position of an unmanaged stream. - /// - protected int Tell(FreeImageIO io, fi_handle handle) - { - return io.tellProc(handle); - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/MemoryArray.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/MemoryArray.cs deleted file mode 100644 index a1ff887..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/MemoryArray.cs +++ /dev/null @@ -1,828 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Collections; -using System.Collections.Generic; -using System.Diagnostics; - -namespace FreeImageAPI -{ - /// - /// Represents unmanaged memory, containing an array of a given structure. - /// - /// Structuretype represented by the instance. - /// - /// and can not be marshalled. - /// - /// Use instead of and - /// instead of . - /// - public unsafe class MemoryArray : IDisposable, ICloneable, ICollection, IEnumerable, IEquatable> where T : struct - { - /// - /// Baseaddress of the wrapped memory. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected byte* baseAddress; - - /// - /// Number of elements being wrapped. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected int length; - - /// - /// Size, in bytes, of each element. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly int size; - - /// - /// Array of T containing a single element. - /// The array is used as a workaround, because there are no pointer for generic types. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected T[] buffer; - - /// - /// Pointer to the element of buffer. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected byte* ptr; - - /// - /// Handle for pinning buffer. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected GCHandle handle; - - /// - /// Indicates whether the wrapped memory is handled like a bitfield. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected readonly bool isOneBit; - - /// - /// Indicates whther the wrapped memory is handles like 4-bit blocks. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected readonly bool isFourBit; - - /// - /// An object that can be used to synchronize access to the . - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected object syncRoot = null; - - static MemoryArray() - { - T[] dummy = new T[2]; - long marshalledSize = Marshal.SizeOf(typeof(T)); - long structureSize = - Marshal.UnsafeAddrOfPinnedArrayElement(dummy, 1).ToInt64() - - Marshal.UnsafeAddrOfPinnedArrayElement(dummy, 0).ToInt64(); - if (marshalledSize != structureSize) - { - throw new NotSupportedException( - "The desired type can not be handled, " + - "because its managed and unmanaged size in bytes are different."); - } - - size = (int)marshalledSize; - } - - /// - /// Initializes a new instance. - /// - protected MemoryArray() - { - } - - /// - /// Initializes a new instance of the class. - /// - /// Address of the memory block. - /// Length of the array. - /// - /// is null. - /// - /// is less or equal zero. - /// - /// The type is not supported. - public MemoryArray(IntPtr baseAddress, int length) - : this(baseAddress.ToPointer(), length) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// Address of the memory block. - /// Length of the array. - /// - /// is null. - /// - /// is less or equal zero. - /// - /// The type is not supported. - public MemoryArray(void* baseAddress, int length) - { - if (typeof(T) == typeof(FI1BIT)) - { - isOneBit = true; - } - else if (typeof(T) == typeof(FI4BIT)) - { - isFourBit = true; - } - - if (baseAddress == null) - { - throw new ArgumentNullException("baseAddress"); - } - if (length < 1) - { - throw new ArgumentOutOfRangeException("length"); - } - - this.baseAddress = (byte*)baseAddress; - this.length = (int)length; - - if (!isOneBit && !isFourBit) - { - // Create an array containing a single element. - // Due to the fact, that it's not possible to create pointers - // of generic types, an array is used to obtain the memory - // address of an element of T. - this.buffer = new T[1]; - // The array is pinned immediately to prevent the GC from - // moving it to a different position in memory. - this.handle = GCHandle.Alloc(buffer, GCHandleType.Pinned); - // The array and its content have beed pinned, so that its address - // can be safely requested and stored for the whole lifetime - // of the instace. - this.ptr = (byte*)handle.AddrOfPinnedObject(); - } - } - - /// - /// Frees the allocated . - /// - ~MemoryArray() - { - Dispose(false); - } - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(MemoryArray left, MemoryArray right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - if (object.ReferenceEquals(right, null) || - object.ReferenceEquals(left, null) || - (left.length != right.length)) - { - return false; - } - if (left.baseAddress == right.baseAddress) - { - return true; - } - return FreeImage.CompareMemory(left.baseAddress, right.baseAddress, (uint)left.length); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(MemoryArray left, MemoryArray right) - { - return (!(left == right)); - } - - /// - /// Gets the value at the specified position. - /// - /// A 32-bit integer that represents the position - /// of the array element to get. - /// The value at the specified position. - /// - /// is outside the range of valid indexes - /// for the unmanaged array. - public T GetValue(int index) - { - if ((index >= this.length) || (index < 0)) - { - throw new ArgumentOutOfRangeException("index"); - } - - return GetValueInternal(index); - } - - private T GetValueInternal(int index) - { - EnsureNotDisposed(); - if (isOneBit) - { - return (T)(object)(FI1BIT)(((baseAddress[index / 8] & ((1 << (7 - (index % 8))))) == 0) ? 0 : 1); - } - else if (isFourBit) - { - return (T)(object)(FI4BIT)(((index % 2) == 0) ? (baseAddress[index / 2] >> 4) : (baseAddress[index / 2] & 0x0F)); - } - else - { - CopyMemory(ptr, baseAddress + (index * size), size); - return buffer[0]; - } - } - - /// - /// Sets a value to the element at the specified position. - /// - /// The new value for the specified element. - /// A 32-bit integer that represents the - /// position of the array element to set. - /// - /// is outside the range of valid indexes - /// for the unmanaged array. - public void SetValue(T value, int index) - { - if ((index >= this.length) || (index < 0)) - { - throw new ArgumentOutOfRangeException("index"); - } - SetValueInternal(value, index); - } - - private void SetValueInternal(T value, int index) - { - EnsureNotDisposed(); - if (isOneBit) - { - if ((FI1BIT)(object)value != 0) - { - baseAddress[index / 8] |= (byte)(1 << (7 - (index % 8))); - } - else - { - baseAddress[index / 8] &= (byte)(~(1 << (7 - (index % 8)))); - } - } - else if (isFourBit) - { - if ((index % 2) == 0) - { - baseAddress[index / 2] = (byte)((baseAddress[index / 2] & 0x0F) | ((FI4BIT)(object)value << 4)); - } - else - { - baseAddress[index / 2] = (byte)((baseAddress[index / 2] & 0xF0) | ((FI4BIT)(object)value & 0x0F)); - } - } - else - { - buffer[0] = value; - CopyMemory(baseAddress + (index * size), ptr, size); - } - } - - /// - /// Gets the values at the specified position and length. - /// - /// A 32-bit integer that represents the position - /// of the array elements to get. - /// A 32-bit integer that represents the length - /// of the array elements to get. - /// The values at the specified position and length. - /// - /// is outside the range of valid indexes - /// for the unmanaged array or is greater than the number of elements - /// from to the end of the unmanaged array. - public T[] GetValues(int index, int length) - { - EnsureNotDisposed(); - if ((index >= this.length) || (index < 0)) - { - throw new ArgumentOutOfRangeException("index"); - } - if (((index + length) > this.length) || (length < 1)) - { - throw new ArgumentOutOfRangeException("length"); - } - - T[] data = new T[length]; - if (isOneBit || isFourBit) - { - for (int i = 0; i < length; i++) - { - data[i] = GetValueInternal(i); - } - } - else - { - GCHandle handle = GCHandle.Alloc(data, GCHandleType.Pinned); - byte* dst = (byte*)Marshal.UnsafeAddrOfPinnedArrayElement(data, 0); - CopyMemory(dst, baseAddress + (size * index), size * length); - handle.Free(); - } - return data; - } - - /// - /// Sets the values at the specified position. - /// - /// An array containing the new values for the specified elements. - /// A 32-bit integer that represents the position - /// of the array elements to set. - /// - /// is a null reference (Nothing in Visual Basic). - /// - /// is outside the range of valid indexes - /// for the unmanaged array or is greater than the number of elements - /// from to the end of the array. - public void SetValues(T[] values, int index) - { - EnsureNotDisposed(); - if (values == null) - { - throw new ArgumentNullException("values"); - } - if ((index >= this.length) || (index < 0)) - { - throw new ArgumentOutOfRangeException("index"); - } - if ((index + values.Length) > this.length) - { - throw new ArgumentOutOfRangeException("values.Length"); - } - - if (isOneBit || isFourBit) - { - for (int i = 0; i != values.Length; ) - { - SetValueInternal(values[i++], index++); - } - } - else - { - GCHandle handle = GCHandle.Alloc(values, GCHandleType.Pinned); - byte* src = (byte*)Marshal.UnsafeAddrOfPinnedArrayElement(values, 0); - CopyMemory(baseAddress + (index * size), src, size * length); - handle.Free(); - } - } - - /// - /// Copies the entire array to a compatible one-dimensional , - /// starting at the specified index of the target array. - /// - /// The one-dimensional that is the destination - /// of the elements copied from . - /// The must have zero-based indexing. - /// The zero-based index in - /// at which copying begins. - public void CopyTo(Array array, int index) - { - EnsureNotDisposed(); - if (!(array is T[])) - { - throw new InvalidCastException("array"); - } - try - { - CopyTo((T[])array, 0, index, length); - } - catch (ArgumentOutOfRangeException ex) - { - throw new ArgumentException(ex.Message, ex); - } - } - - /// - /// Copies a range of elements from the unmanaged array starting at the specified - /// and pastes them to - /// starting at the specified . - /// The length and the indexes are specified as 32-bit integers. - /// - /// The array that receives the data. - /// A 32-bit integer that represents the index - /// in the unmanaged array at which copying begins. - /// A 32-bit integer that represents the index in - /// the destination array at which storing begins. - /// A 32-bit integer that represents the number of elements to copy. - /// - /// is a null reference (Nothing in Visual Basic). - /// - /// is outside the range of valid indexes - /// for the unmanaged array or is greater than the number of elements - /// from to the end of the unmanaged array - /// -or- - /// is outside the range of valid indexes - /// for the array or is greater than the number of elements - /// from to the end of the array. - /// - public void CopyTo(T[] array, int sourceIndex, int destinationIndex, int length) - { - EnsureNotDisposed(); - if (array == null) - { - throw new ArgumentNullException("array"); - } - if ((sourceIndex >= this.length) || (sourceIndex < 0)) - { - throw new ArgumentOutOfRangeException("sourceIndex"); - } - if ((destinationIndex >= array.Length) || (destinationIndex < 0)) - { - throw new ArgumentOutOfRangeException("destinationIndex"); - } - if ((sourceIndex + length > this.length) || - (destinationIndex + length > array.Length) || - (length < 1)) - { - throw new ArgumentOutOfRangeException("length"); - } - - if (isOneBit || isFourBit) - { - for (int i = 0; i != length; i++) - { - array[destinationIndex++] = GetValueInternal(sourceIndex++); - } - } - else - { - GCHandle handle = GCHandle.Alloc(array, GCHandleType.Pinned); - byte* dst = (byte*)Marshal.UnsafeAddrOfPinnedArrayElement(array, destinationIndex); - CopyMemory(dst, baseAddress + (size * sourceIndex), size * length); - handle.Free(); - } - } - - /// - /// Copies a range of elements from the array starting at the specified - /// and pastes them to the unmanaged array - /// starting at the specified . - /// The length and the indexes are specified as 32-bit integers. - /// - /// The array that holds the data. - /// A 32-bit integer that represents the index - /// in the array at which copying begins. - /// A 32-bit integer that represents the index in - /// the unmanaged array at which storing begins. - /// A 32-bit integer that represents the number of elements to copy. - /// - /// is a null reference (Nothing in Visual Basic). - /// - /// is outside the range of valid indexes - /// for the array or is greater than the number of elements - /// from to the end of the array - /// -or- - /// is outside the range of valid indexes - /// for the unmanaged array or is greater than the number of elements - /// from to the end of the unmanaged array. - /// - public void CopyFrom(T[] array, int sourceIndex, int destinationIndex, int length) - { - EnsureNotDisposed(); - if (array == null) - { - throw new ArgumentNullException("array"); - } - if ((destinationIndex >= this.length) || (destinationIndex < 0)) - { - throw new ArgumentOutOfRangeException("destinationIndex"); - } - if ((sourceIndex >= array.Length) || (sourceIndex < 0)) - { - throw new ArgumentOutOfRangeException("sourceIndex"); - } - if ((destinationIndex + length > this.length) || - (sourceIndex + length > array.Length) || - (length < 1)) - { - throw new ArgumentOutOfRangeException("length"); - } - - if (isOneBit || isFourBit) - { - for (int i = 0; i != length; i++) - { - SetValueInternal(array[sourceIndex++], destinationIndex++); - } - } - else - { - GCHandle handle = GCHandle.Alloc(array, GCHandleType.Pinned); - byte* src = (byte*)Marshal.UnsafeAddrOfPinnedArrayElement(array, sourceIndex); - CopyMemory(baseAddress + (size * destinationIndex), src, size * length); - handle.Free(); - } - } - - /// - /// Returns the represented block of memory as an array of . - /// - /// The represented block of memory. - public byte[] ToByteArray() - { - EnsureNotDisposed(); - byte[] result; - if (isOneBit) - { - result = new byte[(length + 7) / 8]; - } - else if (isFourBit) - { - result = new byte[(length + 3) / 4]; - } - else - { - result = new byte[size * length]; - } - fixed (byte* dst = result) - { - CopyMemory(dst, baseAddress, result.Length); - } - return result; - } - - /// - /// Gets or sets the value at the specified position in the array. - /// - /// A 32-bit integer that represents the position - /// of the array element to get. - /// The value at the specified position in the array. - /// - /// is outside the range of valid indexes - /// for the unmanaged array. - public T this[int index] - { - get - { - return GetValue(index); - } - set - { - SetValue(value, index); - } - } - - /// - /// Gets or sets the values of the unmanaged array. - /// - public T[] Data - { - get - { - return GetValues(0, length); - } - set - { - if (value == null) - { - throw new ArgumentNullException("value"); - } - if (value.Length != length) - { - throw new ArgumentOutOfRangeException("value.Lengt"); - } - SetValues(value, 0); - } - } - - /// - /// Gets the length of the unmanaged array. - /// - public int Length - { - get - { - EnsureNotDisposed(); - return length; - } - } - - /// - /// Gets the base address of the represented memory block. - /// - public IntPtr BaseAddress - { - get - { - EnsureNotDisposed(); - return new IntPtr(baseAddress); - } - } - - /// - /// Creates a shallow copy of the . - /// - /// A shallow copy of the . - public object Clone() - { - EnsureNotDisposed(); - return new MemoryArray(baseAddress, length); - } - - /// - /// Gets a 32-bit integer that represents the total number of elements - /// in the . - /// - public int Count - { - get { EnsureNotDisposed(); return length; } - } - - /// - /// Gets a value indicating whether access to the - /// is synchronized (thread safe). - /// - public bool IsSynchronized - { - get { EnsureNotDisposed(); return false; } - } - - /// - /// Gets an object that can be used to synchronize access to the . - /// - public object SyncRoot - { - get - { - EnsureNotDisposed(); - if (syncRoot == null) - { - System.Threading.Interlocked.CompareExchange(ref syncRoot, new object(), null); - } - return syncRoot; - } - } - - /// - /// Retrieves an object that can iterate through the individual - /// elements in this . - /// - /// An for the . - public IEnumerator GetEnumerator() - { - EnsureNotDisposed(); - T[] values = GetValues(0, length); - for (int i = 0; i != values.Length; i++) - { - yield return values[i]; - } - } - - /// - /// Retrieves an object that can iterate through the individual - /// elements in this . - /// - /// An for the . - IEnumerator IEnumerable.GetEnumerator() - { - EnsureNotDisposed(); - T[] values = GetValues(0, length); - for (int i = 0; i != values.Length; i++) - { - yield return values[i]; - } - } - - /// - /// Releases all ressources. - /// - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - /// - /// Releases allocated handles associated with this instance. - /// - /// true to release managed resources. - protected virtual void Dispose(bool disposing) - { - if (baseAddress != null) - { - if (handle.IsAllocated) - handle.Free(); - baseAddress = null; - buffer = null; - length = 0; - syncRoot = null; - } - } - - /// - /// Throws an if - /// this instance is disposed. - /// - protected virtual void EnsureNotDisposed() - { - if (baseAddress == null) - throw new ObjectDisposedException("This instance is disposed."); - } - - /// - /// Tests whether the specified structure is equivalent to this - /// structure. - /// - /// The structure to test. - /// true if is a - /// instance equivalent to this structure; otherwise, - /// false. - public override bool Equals(object obj) - { - EnsureNotDisposed(); - return ((obj is MemoryArray) && Equals((MemoryArray)obj)); - } - - /// - /// Tests whether the specified structure is equivalent to this - /// structure. - /// - /// The structure to test. - /// true if is equivalent to this - /// structure; otherwise, - /// false. - public bool Equals(MemoryArray other) - { - EnsureNotDisposed(); - return ((this.baseAddress == other.baseAddress) && (this.length == other.length)); - } - - /// - /// Serves as a hash function for a particular type. - /// - /// A hash code for the current . - public override int GetHashCode() - { - EnsureNotDisposed(); - return (int)baseAddress ^ length; - } - - /// - /// Copies a block of memory from one location to another. - /// - /// Pointer to the starting address of the copy destination. - /// Pointer to the starting address of the block of memory to be copied. - /// Size of the block of memory to copy, in bytes. - protected static unsafe void CopyMemory(byte* dest, byte* src, int len) - { - if (len >= 0x10) - { - do - { - *((int*)dest) = *((int*)src); - *((int*)(dest + 4)) = *((int*)(src + 4)); - *((int*)(dest + 8)) = *((int*)(src + 8)); - *((int*)(dest + 12)) = *((int*)(src + 12)); - dest += 0x10; - src += 0x10; - } - while ((len -= 0x10) >= 0x10); - } - if (len > 0) - { - if ((len & 8) != 0) - { - *((int*)dest) = *((int*)src); - *((int*)(dest + 4)) = *((int*)(src + 4)); - dest += 8; - src += 8; - } - if ((len & 4) != 0) - { - *((int*)dest) = *((int*)src); - dest += 4; - src += 4; - } - if ((len & 2) != 0) - { - *((short*)dest) = *((short*)src); - dest += 2; - src += 2; - } - if ((len & 1) != 0) - { - *dest = *src; - } - } - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/MetadataModel.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/MetadataModel.cs deleted file mode 100644 index c7ad248..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/MetadataModel.cs +++ /dev/null @@ -1,941 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.8 $ -// $Date: 2009/02/27 16:34:31 $ -// $Id: MetadataModel.cs,v 1.8 2009/02/27 16:34:31 cklein05 Exp $ -// ========================================================== - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text.RegularExpressions; -using System.Diagnostics; - -namespace FreeImageAPI.Metadata -{ - /// - /// Base class that represents a collection of all tags contained in a metadata model. - /// - /// - /// The MetedataModel class is an abstract base class, which is inherited by - /// several derived classes, one for each existing metadata model. - /// - public abstract class MetadataModel : IEnumerable - { - /// - /// Handle to the encapsulated FreeImage-bitmap. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected readonly FIBITMAP dib; - - /// - /// Initializes a new instance of this class. - /// - /// Handle to a FreeImage bitmap. - /// - /// is null. - protected MetadataModel(FIBITMAP dib) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - this.dib = dib; - } - - /// - /// Retrieves the datamodel that this instance represents. - /// - public abstract FREE_IMAGE_MDMODEL Model - { - get; - } - - /// - /// Adds new tag to the bitmap or updates its value in case it already exists. - /// will be used as key. - /// - /// The tag to add or update. - /// Returns true on success, false on failure. - /// - /// is null. - /// - /// The tags model differs from this instances model. - public bool AddTag(MetadataTag tag) - { - if (tag == null) - { - throw new ArgumentNullException("tag"); - } - if (tag.Model != Model) - { - throw new ArgumentException("tag.Model"); - } - return tag.AddToImage(dib); - } - - /// - /// Adds a list of tags to the bitmap or updates their values in case they already exist. - /// will be used as key. - /// - /// A list of tags to add or update. - /// Returns the number of successfully added tags. - /// - /// is null. - public int AddTag(IEnumerable list) - { - if (list == null) - { - throw new ArgumentNullException("list"); - } - int count = 0; - foreach (MetadataTag tag in list) - { - if (tag.Model == Model && tag.AddToImage(dib)) - { - count++; - } - } - return count; - } - - /// - /// Removes the specified tag from the bitmap. - /// - /// The key of the tag. - /// Returns true on success, false on failure. - /// - /// is null. - public bool RemoveTag(string key) - { - if (key == null) - { - throw new ArgumentNullException("key"); - } - return FreeImage.SetMetadata(Model, dib, key, FITAG.Zero); - } - - /// - /// Destroys the metadata model - /// which will remove all tags of this model from the bitmap. - /// - /// Returns true on success, false on failure. - public bool DestoryModel() - { - return FreeImage.SetMetadata(Model, dib, null, FITAG.Zero); - } - - /// - /// Returns the specified metadata tag. - /// - /// The key of the tag. - /// The metadata tag. - /// - /// is null. - public MetadataTag GetTag(string key) - { - if (key == null) - { - throw new ArgumentNullException("key"); - } - MetadataTag tag; - return FreeImage.GetMetadata(Model, dib, key, out tag) ? tag : null; - } - - /// - /// Returns whether the specified tag exists. - /// - /// The key of the tag. - /// True in case the tag exists, else false. - /// - /// is null. - public bool TagExists(string key) - { - if (key == null) - { - throw new ArgumentNullException("key"); - } - MetadataTag tag; - return FreeImage.GetMetadata(Model, dib, key, out tag); - } - - /// - /// Returns a list of all metadata tags this instance represents. - /// - public List List - { - get - { - List list = new List((int)FreeImage.GetMetadataCount(Model, dib)); - MetadataTag tag; - FIMETADATA mdHandle = FreeImage.FindFirstMetadata(Model, dib, out tag); - if (!mdHandle.IsNull) - { - do - { - list.Add(tag); - } - while (FreeImage.FindNextMetadata(mdHandle, out tag)); - FreeImage.FindCloseMetadata(mdHandle); - } - return list; - } - } - - /// - /// Returns the tag at the given index. - /// - /// Index of the tag to return. - /// The tag at the given index. - protected MetadataTag GetTagFromIndex(int index) - { - if (index >= Count || index < 0) - { - throw new ArgumentOutOfRangeException("index"); - } - MetadataTag tag; - int count = 0; - FIMETADATA mdHandle = FreeImage.FindFirstMetadata(Model, dib, out tag); - if (!mdHandle.IsNull) - { - try - { - do - { - if (count++ == index) - { - break; - } - } - while (FreeImage.FindNextMetadata(mdHandle, out tag)); - } - finally - { - FreeImage.FindCloseMetadata(mdHandle); - } - } - return tag; - } - - /// - /// Returns the metadata tag at the given index. This operation is slow when accessing all tags. - /// - /// Index of the tag. - /// The metadata tag. - /// - /// is greater or equal Count - /// or index is less than zero. - public MetadataTag this[int index] - { - get - { - return GetTagFromIndex(index); - } - } - - /// - /// Retrieves an object that can iterate through the individual MetadataTags in this MetadataModel. - /// - /// An for the - /// . - public IEnumerator GetEnumerator() - { - return List.GetEnumerator(); - } - - /// - /// Returns the number of metadata tags this instance represents. - /// - public int Count - { - get { return (int)FreeImage.GetMetadataCount(Model, dib); } - } - - /// - /// Returns whether this model exists in the bitmaps metadata structure. - /// - public bool Exists - { - get - { - return Count > 0; - } - } - - /// - /// Searches for a pattern in each metadata tag and returns the result as a list. - /// - /// The regular expression to use for the search. - /// A bitfield that controls which fields should be searched in. - /// A list containing all found metadata tags. - /// - /// is null. - /// - /// is empty. - public List RegexSearch(string searchPattern, MD_SEARCH_FLAGS flags) - { - if (searchPattern == null) - { - throw new ArgumentNullException("searchString"); - } - if (searchPattern.Length == 0) - { - throw new ArgumentException("searchString is empty"); - } - List result = new List(Count); - Regex regex = new Regex(searchPattern); - List list = List; - foreach (MetadataTag tag in list) - { - if (((flags & MD_SEARCH_FLAGS.KEY) > 0) && regex.Match(tag.Key).Success) - { - result.Add(tag); - continue; - } - if (((flags & MD_SEARCH_FLAGS.DESCRIPTION) > 0) && regex.Match(tag.Description).Success) - { - result.Add(tag); - continue; - } - if (((flags & MD_SEARCH_FLAGS.TOSTRING) > 0) && regex.Match(tag.ToString()).Success) - { - result.Add(tag); - continue; - } - } - result.Capacity = result.Count; - return result; - } - - /// - /// Returns the value of the specified tag. - /// - /// Type of the tag's data. - /// The key of the tag. - /// The value of the specified tag. - protected T? GetTagValue(string key) where T : struct - { - if (string.IsNullOrEmpty(key)) - { - throw new ArgumentNullException("key"); - } - MetadataTag tag = GetTag(key); - if (tag != null) - { - T[] value = tag.Value as T[]; - if ((value != null) && (value.Length != 0)) - { - return value[0]; - } - } - return null; - } - - /// - /// Returns an array containing the data of the specified tag. - /// - /// The type of the tag's data. - /// The key of the tag. - /// An array containing the data of the specified tag. - protected T[] GetTagArray(string key) where T : struct - { - if (string.IsNullOrEmpty(key)) - { - throw new ArgumentNullException("key"); - } - MetadataTag tag = GetTag(key); - return (tag == null) ? null : tag.Value as T[]; - } - - /// - /// Returns the string contained by the specified tag. - /// - /// The key of the tag. - /// The string contained by the specified tag. - protected string GetTagText(string key) - { - if (string.IsNullOrEmpty(key)) - { - throw new ArgumentNullException("key"); - } - MetadataTag tag = GetTag(key); - return (tag == null) ? null : tag.Value as string; - } - - /// - /// Returns an array containg the data of the specified tag - /// as unsigned 32bit integer. - /// - /// The key of the tag. - /// An array containg the data of the specified tag - /// as unsigned 32bit integer. - protected uint[] GetUInt32Array(string key) - { - if (string.IsNullOrEmpty(key)) - { - throw new ArgumentNullException("key"); - } - uint[] result = null; - MetadataTag tag = GetTag(key); - if (tag != null) - { - object value = tag.Value; - if (value != null) - { - if (value is ushort[]) - { - ushort[] array = (ushort[])value; - result = new uint[array.Length]; - for (int i = 0, j = array.Length; i < j; i++) - { - result[i] = (uint)array[i]; - } - } - else if (value is uint[]) - { - result = (uint[])value; - } - } - } - return result; - } - - /// - /// Returns the value of the tag as unsigned 32bit integer. - /// - /// The key of the tag. - /// The value of the tag as unsigned 32bit integer. - protected uint? GetUInt32Value(string key) - { - uint[] value = GetUInt32Array(key); - return value == null ? default(uint?) : value[0]; - } - - /// - /// Sets the value of the specified tag. - /// - /// The type of the tag's data. - /// The key of the tag. - /// The new value of the specified tag or null. - protected void SetTagValue(string key, T? value) where T : struct - { - SetTagValue(key, value.HasValue ? new T[] { value.Value } : null); - } - - /// - /// Sets the value of the specified tag. - /// - /// The key of the tag. - /// The new value of the specified tag or null. - protected void SetTagValue(string key, object value) - { - if (string.IsNullOrEmpty(key)) - { - throw new ArgumentNullException("key"); - } - if (value == null) - { - RemoveTag(key); - } - else - { - MetadataTag tag = GetTag(key); - if (tag == null) - { - tag = new MetadataTag(Model); - tag.Key = key; - tag.Value = value; - AddTag(tag); - } - else - { - tag.Value = value; - } - } - } - - /// - /// Sets the value of the specified tag as undefined. - /// - /// The key of the tag. - /// The new value of the specified tag or null. - protected void SetTagValueUndefined(string key, byte[] value) - { - if (string.IsNullOrEmpty(key)) - { - throw new ArgumentNullException("key"); - } - if (value == null) - { - RemoveTag(key); - } - else - { - MetadataTag tag = GetTag(key); - if (tag == null) - { - tag = new MetadataTag(Model); - tag.Key = key; - tag.SetValue(value, FREE_IMAGE_MDTYPE.FIDT_UNDEFINED); - AddTag(tag); - } - else - { - tag.Value = value; - } - } - } - - /// - /// Returns the equivalent for the - /// specified . - /// - /// The string containing the . - /// The equivalent for the - /// specified . - protected static DirectionReference? ToDirectionType(string s) - { - if (string.IsNullOrEmpty(s)) - return null; - switch (s[0]) - { - case 'T': - return DirectionReference.TrueDirection; - case 'M': - return DirectionReference.MagneticDirection; - default: - return DirectionReference.Undefined; - } - } - - /// - /// Returns the equivalent for the - /// specified . - /// - /// The to convert. - /// The equivalent for the - /// specified . - protected static string ToString(DirectionReference? type) - { - if (type.HasValue) - { - switch (type.Value) - { - case DirectionReference.TrueDirection: - return "T"; - case DirectionReference.MagneticDirection: - return "M"; - default: - return "\0"; - } - } - return null; - } - - /// - /// Returns the equivalent for the - /// specified . - /// - /// The string containing the . - /// The equivalent for the - /// specified . - protected static VelocityUnit? ToUnitType(string s) - { - if (string.IsNullOrEmpty(s)) - return null; - switch (s[0]) - { - case 'K': - return VelocityUnit.Kilometers; - case 'M': - return VelocityUnit.Miles; - case 'N': - return VelocityUnit.Knots; - default: - return VelocityUnit.Undefinied; - } - } - - /// - /// Returns the equivalent for the - /// specified . - /// - /// The to convert. - /// The equivalent for the - /// specified . - protected static string ToString(VelocityUnit? type) - { - if (type.HasValue) - { - switch (type.Value) - { - case VelocityUnit.Kilometers: - return "K"; - case VelocityUnit.Miles: - return "M"; - case VelocityUnit.Knots: - return "N"; - default: - return "\0"; - } - } - return null; - } - - /// - /// Returns the equivalent for the - /// specified . - /// - /// The string containing the . - /// The equivalent for the - /// specified . - protected static LongitudeType? ToLongitudeType(string s) - { - if (string.IsNullOrEmpty(s)) - return null; - switch (s[0]) - { - case 'E': - return LongitudeType.East; - case 'W': - return LongitudeType.West; - default: - return LongitudeType.Undefined; - } - } - - /// - /// Returns the equivalent for the - /// specified . - /// - /// The to convert. - /// The equivalent for the - /// specified . - protected static string ToString(LongitudeType? type) - { - if (type.HasValue) - { - switch (type.Value) - { - case LongitudeType.East: - return "E"; - case LongitudeType.West: - return "W"; - default: - return "\0"; - } - } - return null; - } - - /// - /// Returns the equivalent for the - /// specified . - /// - /// The string containing the . - /// The equivalent for the - /// specified . - protected static LatitudeType? ToLatitudeType(string s) - { - if (string.IsNullOrEmpty(s)) - return null; - switch (s[0]) - { - case 'N': - return LatitudeType.North; - case 'S': - return LatitudeType.South; - default: - return LatitudeType.Undefined; - } - } - - /// - /// Returns the equivalent for the - /// specified . - /// - /// The to convert. - /// The equivalent for the - /// specified . - protected static string ToString(LatitudeType? type) - { - if (type.HasValue) - { - switch (type.Value) - { - case LatitudeType.North: - return "N"; - case LatitudeType.South: - return "S"; - default: - return "\0"; - } - } - return null; - } - - /// - /// Returns the equivalent for the - /// specified . - /// - /// The string containing the . - /// The equivalent for the - /// specified . - protected static InteroperabilityMode? ToInteroperabilityType(string s) - { - if (string.IsNullOrEmpty(s)) - return null; - if (s.StartsWith("R98")) - return InteroperabilityMode.R98; - if (s.StartsWith("THM")) - return InteroperabilityMode.THM; - return InteroperabilityMode.Undefined; - } - - /// - /// Returns the equivalent for the - /// specified . - /// - /// The to convert. - /// The equivalent for the - /// specified . - protected static string ToString(InteroperabilityMode? type) - { - if (type.HasValue) - { - switch (type.Value) - { - case InteroperabilityMode.R98: - return "R98"; - case InteroperabilityMode.THM: - return "THM"; - default: - return "\0\0\0"; - } - } - return null; - } - - /// - /// Specified different unit types. - /// - public enum VelocityUnit - { - /// - /// No or unknown type. - /// - Undefinied, - - /// - /// Kilometers per hour. - /// - Kilometers, - - /// - /// Miles per hour. - /// - Miles, - - /// - /// Knots. - /// - Knots, - } - - /// - /// Specifies different direction types. - /// - public enum DirectionReference - { - /// - /// No or unknown direction type. - /// - Undefined, - - /// - /// True direction. - /// - TrueDirection, - - /// - /// Magnatic direction. - /// - MagneticDirection, - } - - /// - /// Specifies the type of a latitude value. - /// - public enum LatitudeType - { - /// - /// No or unknown type. - /// - Undefined, - - /// - /// North. - /// - North, - - /// - /// South. - /// - South, - } - - /// - /// Specifies the type of a longitude value. - /// - public enum LongitudeType - { - /// - /// No or unknown type. - /// - Undefined, - - /// - /// East. - /// - East, - - /// - /// West. - /// - West, - } - - /// - /// Specifies different altitude types. - /// - public enum AltitudeType - { - /// - /// No or unknown type. - /// - Undefined, - - /// - /// East. - /// - AboveSeaLevel, - - /// - /// West. - /// - BelowSeaLevel, - } - - /// - /// Specifies interoperability types. - /// - public enum InteroperabilityMode - { - /// - /// No or unknown type. - /// - Undefined, - - /// - /// Indicates a file conforming to R98 file specification of Recommended - /// Exif Interoperability Rules (ExifR98) or to DCF basic file stipulated - /// by Design Rule for Camera File System. - /// - R98, - - /// - /// Indicates a file conforming to DCF thumbnail file stipulated by Design - /// rule for Camera File System. - /// - THM, - } - - /// - /// Specifies orientation of images. - /// - public enum ExifImageOrientation : ushort - { - /// - /// Undefinied orientation. - /// - Undefined, - - /// - /// TopLeft. - /// - TopLeft = 1, - - /// - /// TopRight. - /// - TopRight, - - /// - /// BottomRight. - /// - BottomRight, - - /// - /// BottomLeft. - /// - BottomLeft, - - /// - /// LeftTop. - /// - LeftTop, - - /// - /// RightTop. - /// - RightTop, - - /// - /// RightBottom. - /// - RightBottom, - - /// - /// LeftBottom. - /// - LeftBottom, - } - - /// - /// Converts the model of the MetadataModel object to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return Model.ToString(); - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/MetadataModels.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/MetadataModels.cs deleted file mode 100644 index 4cd2835..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/MetadataModels.cs +++ /dev/null @@ -1,6724 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.6 $ -// $Date: 2009/09/15 11:49:24 $ -// $Id: MetadataModels.cs,v 1.6 2009/09/15 11:49:24 cklein05 Exp $ -// ========================================================== - -using System; -using System.Xml; -using System.IO; -using System.Text; - -namespace FreeImageAPI.Metadata -{ - /// - /// Represents a collection of all tags contained in the metadata model - /// . - /// - public class MDM_ANIMATION : MetadataModel - { - /// - /// Initializes a new instance of this class. - /// - /// Handle to a FreeImage bitmap. - public MDM_ANIMATION(FIBITMAP dib) : base(dib) { } - - /// - /// Retrieves the datamodel that this instance represents. - /// - public override FREE_IMAGE_MDMODEL Model - { - get { return FREE_IMAGE_MDMODEL.FIMD_ANIMATION; } - } - - /// - /// Gets or sets the width of the entire canvas area, that each page is displayed in. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public ushort? LogicalWidth - { - get - { - return GetTagValue("LogicalWidth"); - } - set - { - SetTagValue("LogicalWidth", value); - } - } - - /// - /// Gets or sets the height of the entire canvas area, that each page is displayed in. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public ushort? LogicalHeight - { - get - { - return GetTagValue("LogicalHeight"); - } - set - { - SetTagValue("LogicalHeight", value); - } - } - - /// - /// Gets or sets the global palette of the GIF image. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public Palette GlobalPalette - { - get - { - MetadataTag mdtag = GetTag("GlobalPalette"); - return (mdtag == null) ? null : new Palette(mdtag); - } - set - { - SetTagValue("GlobalPalette", (value != null) ? null : value.Data); - } - } - - /// - /// Gets or sets the number of replays for the animation. - /// Use 0 (zero) to specify an infinte number of replays. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public uint? LoopCount - { - get - { - return GetTagValue("Loop"); - } - set - { - SetTagValue("Loop", value); - } - } - - /// - /// Gets or sets the horizontal offset within the logical canvas area, this frame is to be displayed at. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public ushort? FrameLeft - { - get - { - return GetTagValue("FrameLeft"); - } - set - { - SetTagValue("FrameLeft", value); - } - } - - /// - /// Gets or sets the vertical offset within the logical canvas area, this frame is to be displayed at. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public ushort? FrameTop - { - get - { - return GetTagValue("FrameTop"); - } - set - { - SetTagValue("FrameTop", value); - } - } - - /// - /// Gets or sets a flag to supress saving the dib's attached palette - /// (making it use the global palette). The local palette is the palette used by a page. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public bool? NoLocalPalette - { - get - { - byte? useGlobalPalette = GetTagValue("NoLocalPalette"); - return useGlobalPalette.HasValue ? (useGlobalPalette.Value != 0) : default(bool?); - } - set - { - byte? val = null; - if (value.HasValue) - { - val = (byte)(value.Value ? 1 : 0); - } - SetTagValue("NoLocalPalette", val); - } - } - - /// - /// Gets or sets a value indicating whether the image is interlaced. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public bool? Interlaced - { - get - { - byte? useGlobalPalette = GetTagValue("Interlaced"); - return useGlobalPalette.HasValue ? (useGlobalPalette.Value != 0) : default(bool?); - } - set - { - byte? val = null; - if (value.HasValue) - { - val = (byte)(value.Value ? 1 : 0); - } - SetTagValue("Interlaced", val); - } - } - - /// - /// Gets or sets the amout of time in milliseconds this frame is to be displayed. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public uint? FrameTime - { - get - { - return GetTagValue("FrameTime"); - } - set - { - SetTagValue("FrameTime", value); - } - } - - /// - /// Gets or sets this frame's disposal method. Generally, this method defines, how to - /// remove or replace a frame when the next frame has to be drawn. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public DisposalMethodType? DisposalMethod - { - get - { - return GetTagValue("DisposalMethod"); - } - set - { - SetTagValue("DisposalMethod", value); - } - } - } - - /// - /// Represents a collection of all tags contained in the metadata model - /// . - /// - public class MDM_COMMENTS : MetadataModel - { - /// - /// Initializes a new instance of this class. - /// - /// Handle to a FreeImage bitmap. - public MDM_COMMENTS(FIBITMAP dib) : base(dib) { } - - /// - /// Retrieves the datamodel that this instance represents. - /// - public override FREE_IMAGE_MDMODEL Model - { - get { return FREE_IMAGE_MDMODEL.FIMD_COMMENTS; } - } - - /// - /// Gets or sets the comment of the image. - /// Supported formats are JPEG, PNG and GIF. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string Comment - { - get - { - return GetTagText("Comment"); - } - set - { - SetTagValue("Comment", value); - } - } - } - - /// - /// Represents a collection of all tags contained in the metadata model - /// . - /// - public class MDM_CUSTOM : MetadataModel - { - /// - /// Initializes a new instance of this class. - /// - /// Handle to a FreeImage bitmap. - public MDM_CUSTOM(FIBITMAP dib) : base(dib) { } - - /// - /// Retrieves the datamodel that this instance represents. - /// - public override FREE_IMAGE_MDMODEL Model - { - get { return FREE_IMAGE_MDMODEL.FIMD_CUSTOM; } - } - } - - /// - /// Represents a collection of all tags contained in the metadata model - /// . - /// - public class MDM_EXIF_EXIF : MetadataModel - { - /// - /// Initializes a new instance of this class. - /// - /// Handle to a FreeImage bitmap. - public MDM_EXIF_EXIF(FIBITMAP dib) : base(dib) { } - - /// - /// Retrieves the datamodel that this instance represents. - /// - public override FREE_IMAGE_MDMODEL Model - { - get { return FREE_IMAGE_MDMODEL.FIMD_EXIF_EXIF; } - } - - /// - /// Gets or sets the version of this standard supported. - /// Constant length or 4. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public byte[] ExifVersion - { - get - { - return GetTagArray("ExifVersion"); - } - set - { - FreeImage.Resize(ref value, 4); - SetTagValueUndefined("ExifVersion", value); - } - } - - /// - /// Gets or sets the Flashpix format version supported by a FPXR file. - /// Constant length or 4. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public byte[] FlashpixVersion - { - get - { - return GetTagArray("FlashpixVersion"); - } - set - { - FreeImage.Resize(ref value, 4); - SetTagValueUndefined("FlashpixVersion", value); - } - } - - /// - /// Gets or sets the color space information tag. - /// See remarks for further information. - /// - /// - /// The following values are defined: - /// - /// - /// ID - /// Description - /// - /// - /// 1 - /// sRGB (default) - /// - /// - /// 0xFFFF - /// uncalibrated - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? ColorSpace - { - get - { - return GetTagValue("ColorSpace"); - } - set - { - SetTagValue("ColorSpace", value); - } - } - - /// - /// Gets or sets the valid width of a compressed image. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public uint? PixelXDimension - { - get - { - return GetUInt32Value("PixelXDimension"); - } - set - { - RemoveTag("PixelXDimension"); - if (value.HasValue) - { - SetTagValue("PixelXDimension", value.Value); - } - } - } - - /// - /// Gets or sets the valid height of a compressed image. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public uint? PixelYDimension - { - get - { - return GetUInt32Value("PixelYDimension"); - } - set - { - RemoveTag("PixelYDimension"); - if (value.HasValue) - { - SetTagValue("PixelYDimension", value.Value); - } - } - } - - /// - /// Gets or sets components configuration. See remarks for further information. - /// Constant length of 4. - /// - /// - /// The channels of each component are arranged in order from the 1st component to the 4th. - /// For uncompressed data the data arrangement is given in the PhotometricInterpretation tag. - /// However, since PhotometricInterpretation can only express the order of Y,Cb and Cr, - /// this tag is provided for cases when compressed data uses components other than Y, Cb, - /// and Cr and to enable support of other sequences. - /// Default = 4 5 6 0 (if RGB uncompressed) - /// The following values are defined: - /// - /// - /// ID - /// Description - /// - /// - /// 0 - /// does not exist - /// - /// - /// 1 - /// Y - /// - /// - /// 2 - /// Cb - /// - /// - /// 3 - /// Cr - /// - /// - /// 4 - /// R - /// - /// - /// 5 - /// R - /// - /// - /// 6 - /// R - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public byte[] ComponentsConfiguration - { - get - { - return GetTagArray("ComponentsConfiguration"); - } - set - { - FreeImage.Resize(ref value, 4); - SetTagValueUndefined("ComponentsConfiguration", value); - } - } - - /// - /// Gets or sets compression mode used for a compressed image is indicated - /// in unit bits per pixel. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? CompressedBitsPerPixel - { - get - { - return GetTagValue("CompressedBitsPerPixel"); - } - set - { - SetTagValue("CompressedBitsPerPixel", value); - } - } - - /// - /// Gets or sets a tag for manufacturers of Exif writers to record any desired information. - /// The contents are up to the manufacturer, but this tag should not be used for any other - /// than its intended purpose. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public byte[] MakerNote - { - get - { - return GetTagArray("FlashpixVersion"); - } - set - { - SetTagValueUndefined("FlashpixVersion", value); - } - } - - /// - /// Gets or sets a tag for Exif users to write keywords or comments on the image besides - /// those in ImageDescription, and without the character code limitations of the ImageDescription tag. - /// Minimum length of 8. See remarks for further information. - /// - /// - /// The character code used in the UserComment tag is identified based on an ID code in a fixed 8-byte - /// area at the start of the tag data area. The unused portion of the area is padded with NULL. - /// The ID code for the UserComment area may be a Defined code such as JIS or ASCII, or may be Undefined. - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public byte[] UserComment - { - get - { - return GetTagArray("UserComment"); - } - set - { - FreeImage.Resize(ref value, 8, int.MaxValue); - SetTagValueUndefined("UserComment", value); - } - } - - /// - /// Gets or sets the name of an audio file related to the image data. - /// The format is 8.3. - /// Constant length of 12 - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string RelatedSoundFile - { - get - { - string text = GetTagText("RelatedSoundFile"); - if (!string.IsNullOrEmpty(text)) - { - text = text.Substring(0, text.Length - 1); - } - return text; - } - set - { - if (value != null) - { - FreeImage.Resize(ref value, 12); - value += '\0'; - } - SetTagValue("RelatedSoundFile", value); - } - } - - /// - /// Gets or sets the date and time when the original image data was generated. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public DateTime? DateTimeOriginal - { - get - { - DateTime? result = null; - string text = GetTagText("DateTimeOriginal"); - if (text != null) - { - try - { - result = System.DateTime.ParseExact(text, "yyyy:MM:dd HH:mm:ss\0", null); - } - catch - { - } - } - return result; - } - set - { - string val = null; - if (value.HasValue) - { - try - { - val = value.Value.ToString("yyyy:MM:dd HH:mm:ss\0"); - } - catch - { - } - } - SetTagValue("DateTimeOriginal", val); - } - } - - /// - /// Gets or sets the date and time when the image was stored as digital data. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public DateTime? DateTimeDigitized - { - get - { - DateTime? result = null; - string text = GetTagText("DateTimeDigitized"); - if (text != null) - { - try - { - result = System.DateTime.ParseExact(text, "yyyy:MM:dd HH:mm:ss\0", null); - } - catch - { - } - } - return result; - } - set - { - string val = null; - if (value.HasValue) - { - try - { - val = value.Value.ToString("yyyy:MM:dd HH:mm:ss\0"); - } - catch - { - } - } - SetTagValue("DateTimeDigitized", val); - } - } - - /// - /// Gets or sets a tag used to record fractions of seconds for the DateTime tag. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string SubsecTime - { - get - { - string text = GetTagText("SubsecTime"); - if (!string.IsNullOrEmpty(text)) - { - text = text.Substring(0, text.Length - 1); - } - return text; - } - set - { - if (value != null) - { - value += '\0'; - } - SetTagValue("SubsecTime", value); - } - } - - /// - /// Gets or sets a tag used to record fractions of seconds for the DateTimeOriginal tag. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string SubsecTimeOriginal - { - get - { - string text = GetTagText("SubsecTimeOriginal"); - if (!string.IsNullOrEmpty(text)) - { - text = text.Substring(0, text.Length - 1); - } - return text; - } - set - { - if (value != null) - { - value += '\0'; - } - SetTagValue("SubsecTimeOriginal", value); - } - } - - /// - /// Gets or sets a tag used to record fractions of seconds for the DateTimeDigitized tag. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string SubsecTimeDigitized - { - get - { - string text = GetTagText("SubsecTimeDigitized"); - if (!string.IsNullOrEmpty(text)) - { - text = text.Substring(0, text.Length - 1); - } - return text; - } - set - { - if (value != null) - { - value += '\0'; - } - SetTagValue("SubsecTimeDigitized", value); - } - } - - /// - /// Gets or the exposure time, given in seconds (sec). - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? ExposureTime - { - get - { - return GetTagValue("ExposureTime"); - } - set - { - SetTagValue("ExposureTime", value); - } - } - - /// - /// Gets or the F number. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? FNumber - { - get - { - return GetTagValue("FNumber"); - } - set - { - SetTagValue("FNumber", value); - } - } - - /// - /// Gets or sets the class of the program used by the camera to set exposure when the - /// picture is taken. - /// See remarks for further information. - /// - /// - /// The following values are defined: - /// - /// - /// ID - /// Description - /// - /// - /// 0 - /// not defined - /// - /// - /// 1 - /// manual - /// - /// - /// 2 - /// normal program - /// - /// - /// 3 - /// aperture priority - /// - /// - /// 4 - /// shutter priority - /// - /// - /// 5 - /// create program - /// - /// - /// 6 - /// action program - /// - /// - /// 7 - /// portrait mode - /// - /// - /// 8 - /// landscape mode - /// - /// - /// others - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? ExposureProgram - { - get - { - return GetTagValue("ExposureProgram"); - } - set - { - SetTagValue("ExposureProgram", value); - } - } - - /// - /// Gets or sets the spectral sensitivity of each channel of the camera used. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string SpectralSensitivity - { - get - { - string text = GetTagText("SpectralSensitivity"); - if (!string.IsNullOrEmpty(text)) - { - text = text.Substring(0, text.Length - 1); - } - return text; - } - set - { - if (value != null) - { - value += '\0'; - } - SetTagValue("SpectralSensitivity", value); - } - } - - /// - /// Gets or sets the the ISO Speed and ISO Latitude of the camera or input device as - /// specified in ISO 12232. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public ushort[] ISOSpeedRatings - { - get - { - return GetTagArray("ISOSpeedRatings"); - } - set - { - SetTagValue("ISOSpeedRatings", value); - } - } - - /// - /// Gets or sets the Opto-Electric Conversion Function (OECF) specified in ISO 14524. - /// OECF is the relationship between the camera optical input and the image values. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public byte[] OECF - { - get - { - return GetTagArray("OECF"); - } - set - { - SetTagValueUndefined("OECF", value); - } - } - - /// - /// Gets or sets the shutter speed. The unit is the APEX (Additive System of Photographic Exposure). - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIRational? ShutterSpeedValue - { - get - { - return GetTagValue("ShutterSpeedValue"); - } - set - { - SetTagValue("ShutterSpeedValue", value); - } - } - - /// - /// Gets or sets the lens aperture. The unit is the APEX value. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? ApertureValue - { - get - { - return GetTagValue("ApertureValue"); - } - set - { - SetTagValue("ApertureValue", value); - } - } - - /// - /// Gets or sets the value of brightness. The unit is the APEX value. - /// Ordinarily it is given in the range of -99.99 to 99.99. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIRational? BrightnessValue - { - get - { - return GetTagValue("BrightnessValue"); - } - set - { - SetTagValue("BrightnessValue", value); - } - } - - /// - /// Gets or sets the exposure bias. The unit is the APEX value. - /// Ordinarily it is given in the range of –99.99 to 99.99. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIRational? ExposureBiasValue - { - get - { - return GetTagValue("ExposureBiasValue"); - } - set - { - SetTagValue("ExposureBiasValue", value); - } - } - - /// - /// Gets or sets the smallest F number of the lens. The unit is the APEX value. - /// Ordinarily it is given in the range of 00.00 to 99.99, - /// but it is not limited to this range. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? MaxApertureValue - { - get - { - return GetTagValue("MaxApertureValue"); - } - set - { - SetTagValue("MaxApertureValue", value); - } - } - - /// - /// Gets or sets distance to the subject, given in meters. - /// Note that if the numerator of the recorded value is FFFFFFFF, infinity shall be indicated; - /// and if the numerator is 0, distance unknown shall be indicated. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? SubjectDistance - { - get - { - return GetTagValue("SubjectDistance"); - } - set - { - SetTagValue("SubjectDistance", value); - } - } - - /// - /// Gets or sets the metering mode. See remarks for further information. - /// - /// - /// The following values are defined: - /// - /// - /// ID - /// Description - /// - /// - /// 0 - /// unknown - /// - /// - /// 1 - /// average - /// - /// - /// 2 - /// center-weighted-average - /// - /// - /// 3 - /// spot - /// - /// - /// 4 - /// multi-spot - /// - /// - /// 5 - /// pattern - /// - /// - /// 6 - /// partial - /// - /// - /// other - /// reserved - /// - /// - /// 255 - /// other - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? MeteringMode - { - get - { - return GetTagValue("MeteringMode"); - } - set - { - SetTagValue("MeteringMode", value); - } - } - - /// - /// Gets or sets the kind of light source. - /// See remarks for further information. - /// - /// - /// The following values are defined: - /// - /// - /// ID - /// Description - /// - /// - /// 0 - /// unknown - /// - /// - /// 1 - /// daylight - /// - /// - /// 2 - /// fluorescent - /// - /// - /// 3 - /// tungsten - /// - /// - /// 4 - /// flash - /// - /// - /// 9 - /// fine weather - /// - /// - /// 10 - /// cloudy weather - /// - /// - /// 11 - /// shade - /// - /// - /// 12 - /// daylight fluorecent (D 5700 - 7100K) - /// - /// - /// 13 - /// day white fluorescent (N 4600 - 5400K) - /// - /// - /// 14 - /// cool white fluorescent (W 3900 - 4500K) - /// - /// - /// 15 - /// white fluorescent (WW 3200 - 3700K) - /// - /// - /// 17 - /// standard light A - /// - /// - /// 18 - /// standard light B - /// - /// - /// 19 - /// standard light C - /// - /// - /// 20 - /// D55 - /// - /// - /// 21 - /// D65 - /// - /// - /// 22 - /// D75 - /// - /// - /// 23 - /// D50 - /// - /// - /// 24 - /// ISO studio tungsten - /// - /// - /// 255 - /// other light source - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? LightSource - { - get - { - return GetTagValue("LightSource"); - } - set - { - SetTagValue("LightSource", value); - } - } - - /// - /// Gets or sets a value indicating the status of flash when the image was shot. - /// Bit 0 indicates the flash firing status, bits 1 and 2 indicate the flash return - /// status, bits 3 and 4 indicate the flash mode, bit 5 indicates whether the flash - /// function is present, and bit 6 indicates "red eye" mode. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public ushort? Flash - { - get - { - return GetTagValue("Flash"); - } - set - { - SetTagValue("Flash", value); - } - } - - /// - /// Gets or sets a value indicating the location and area of the main subject in - /// the overall scene. Variable length between 2 and 4. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public ushort[] SubjectArea - { - get - { - return GetTagArray("SubjectArea"); - } - set - { - FreeImage.Resize(ref value, 2, 4); - SetTagValue("SubjectArea", value); - } - } - - /// - /// Gets or sets the actual focal length of the lens, in mm. - /// Conversion is not made to the focal length of a 35 mm film camera. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? FocalLength - { - get - { - return GetTagValue("FocalLength"); - } - set - { - SetTagValue("FocalLength", value); - } - } - - /// - /// Gets or sets the strobe energy at the time the image is captured, - /// as measured in Beam Candle Power Seconds (BCPS). - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? FlashEnergy - { - get - { - return GetTagValue("FlashEnergy"); - } - set - { - SetTagValue("FlashEnergy", value); - } - } - - /// - /// Gets or sets the camera or input device spatial frequency table and SFR values - /// in the direction of image width, image height, and diagonal direction, - /// as specified in ISO 12233. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public byte[] SpatialFrequencyResponse - { - get - { - return GetTagArray("SpatialFrequencyResponse"); - } - set - { - SetTagValueUndefined("SpatialFrequencyResponse", value); - } - } - - /// - /// Gets or sets the number of pixels in the image width (X) direction per - /// FocalPlaneResolutionUnit on the camera focal plane. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? FocalPlaneXResolution - { - get - { - return GetTagValue("FocalPlaneXResolution"); - } - set - { - SetTagValue("FocalPlaneXResolution", value); - } - } - - /// - /// Gets or sets the number of pixels in the image height (Y) direction per - /// FocalPlaneResolutionUnit on the camera focal plane. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? FocalPlaneYResolution - { - get - { - return GetTagValue("FocalPlaneYResolution"); - } - set - { - SetTagValue("FocalPlaneYResolution", value); - } - } - - /// - /// Gets or sets the unit for measuring FocalPlaneXResolution and FocalPlaneYResolution. - /// This value is the same as the ResolutionUnit. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public ushort? FocalPlaneResolutionUnit - { - get - { - return GetTagValue("FocalPlaneResolutionUnit"); - } - set - { - SetTagValue("FocalPlaneResolutionUnit", value); - } - } - - /// - /// Gets or sets the location of the main subject in the scene. - /// The value of this tag represents the pixel at the center of the main subject - /// relative to the left edge, prior to rotation processing as per the Rotation tag. - /// The first value indicates the X column number and second indicates the Y row number. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public ushort? SubjectLocation - { - get - { - return GetTagValue("SubjectLocation"); - } - set - { - SetTagValue("SubjectLocation", value); - } - } - - /// - /// Gets or sets the exposure index selected on the camera or input device at the - /// time the image was captured. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? ExposureIndex - { - get - { - return GetTagValue("ExposureIndex"); - } - set - { - SetTagValue("ExposureIndex", value); - } - } - - /// - /// Gets or sets the image sensor type on the camera or input device. - /// See remarks for further information. - /// - /// - /// The following values are defined: - /// - /// - /// ID - /// Description - /// - /// - /// 1 - /// not defined - /// - /// - /// 2 - /// one-chip color area sensor - /// - /// - /// 3 - /// two-chip color area sensor - /// - /// - /// 4 - /// three-chip color area sensor - /// - /// - /// 5 - /// color sequential area sensor - /// - /// - /// 7 - /// trilinear sensor - /// - /// - /// 8 - /// color sequential linear sensor - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? SensingMethod - { - get - { - return GetTagValue("SensingMethod"); - } - set - { - SetTagValue("SensingMethod", value); - } - } - - /// - /// Gets or sets the image source. If a DSC recorded the image, this tag value of this - /// tag always be set to 3, indicating that the image was recorded on a DSC. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public byte? FileSource - { - get - { - return GetTagValue("FileSource"); - } - set - { - SetTagValueUndefined("FileSource", value.HasValue ? new byte[] { value.Value } : null); - } - } - - /// - /// Gets or sets the type of scene. If a DSC recorded the image, this tag value shall - /// always be set to 1, indicating that the image was directly photographed. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public byte? SceneType - { - get - { - return GetTagValue("SceneType"); - } - set - { - SetTagValueUndefined("SceneType", value.HasValue ? new byte[] { value.Value } : null); - } - } - - /// - /// Gets or sets the color filter array (CFA) geometric pattern of the image sensor - /// when a one-chip color area sensor is used. It does not apply to all sensing methods. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public byte[] CFAPattern - { - get - { - return GetTagArray("CFAPattern"); - } - set - { - SetTagValueUndefined("CFAPattern", value); - } - } - - /// - /// Gets or sets the use of special processing on image data, such as rendering geared to output. - /// When special processing is performed, the reader is expected to disable or minimize any - /// further processing. See remarks for further information. - /// - /// - /// The following values are definied: - /// - /// - /// ID - /// Description - /// - /// - /// 0 - /// normal process - /// - /// - /// 1 - /// custom process - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? CustomRendered - { - get - { - return GetTagValue("CustomRendered"); - } - set - { - SetTagValue("CustomRendered", value); - } - } - - /// - /// Gets or sets the exposure mode set when the image was shot. - /// In auto-bracketing mode, the camera shoots a series of frames of the same scene - /// at different exposure settings. See remarks for further information. - /// - /// - /// The following values are definied: - /// - /// - /// ID - /// Description - /// - /// - /// 0 - /// auto exposure - /// - /// - /// 1 - /// manual exposure - /// - /// - /// 2 - /// auto bracket - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? ExposureMode - { - get - { - return GetTagValue("ExposureMode"); - } - set - { - SetTagValue("ExposureMode", value); - } - } - - /// - /// Gets or sets the white balance mode set when the image was shot. - /// See remarks for further information. - /// - /// - /// The following values are definied: - /// - /// - /// ID - /// Description - /// - /// - /// 0 - /// auto white balance - /// - /// - /// 1 - /// manual white balance - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? WhiteBalance - { - get - { - return GetTagValue("WhiteBalance"); - } - set - { - SetTagValue("WhiteBalance", value); - } - } - - /// - /// Gets or sets the digital zoom ratio when the image was shot. - /// If the numerator of the recorded value is 0, this indicates that digital zoom was not used. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? DigitalZoomRatio - { - get - { - return GetTagValue("DigitalZoomRatio"); - } - set - { - SetTagValue("DigitalZoomRatio", value); - } - } - - /// - /// Gets or sets the equivalent focal length assuming a 35mm film camera, in mm. - /// A value of 0 means the focal length is unknown. Note that this tag differs - /// from the FocalLength tag. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public ushort? FocalLengthIn35mmFilm - { - get - { - return GetTagValue("DigitalZoomRatio"); - } - set - { - SetTagValue("DigitalZoomRatio", value); - } - } - - /// - /// Gets or sets the type of scene that was shot. - /// It can also be used to record the mode in which the image was shot. - /// See remarks for further information. - /// - /// - /// The following values are definied: - /// - /// - /// ID - /// Description - /// - /// - /// 0 - /// standard - /// - /// - /// 1 - /// landscape - /// - /// - /// 2 - /// portrait - /// - /// - /// 3 - /// night scene - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? SceneCaptureType - { - get - { - return GetTagValue("SceneCaptureType"); - } - set - { - SetTagValue("SceneCaptureType", value); - } - } - - /// - /// Gets or sets the degree of overall image gain adjustment. - /// See remarks for further information. - /// - /// - /// The following values are definied: - /// - /// - /// ID - /// Description - /// - /// - /// 0 - /// none - /// - /// - /// 1 - /// low gain up - /// - /// - /// 2 - /// high gain up - /// - /// - /// 3 - /// low gain down - /// - /// - /// 4 - /// high gain down - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? GainControl - { - get - { - return GetTagValue("GainControl"); - } - set - { - SetTagValue("GainControl", value); - } - } - - /// - /// Gets or sets the direction of contrast processing applied by the camera - /// when the image was shot. - /// See remarks for further information. - /// - /// - /// The following values are definied: - /// - /// - /// ID - /// Description - /// - /// - /// 0 - /// normal - /// - /// - /// 1 - /// soft - /// - /// - /// 2 - /// hard - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? Contrast - { - get - { - return GetTagValue("Contrast"); - } - set - { - SetTagValue("Contrast", value); - } - } - - /// - /// Gets or sets the direction of saturation processing applied by the camera - /// when the image was shot. - /// See remarks for further information. - /// - /// - /// The following values are definied: - /// - /// - /// ID - /// Description - /// - /// - /// 0 - /// normal - /// - /// - /// 1 - /// low saturation - /// - /// - /// 2 - /// high saturation - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? Saturation - { - get - { - return GetTagValue("Saturation"); - } - set - { - SetTagValue("Saturation", value); - } - } - - /// - /// Gets or sets the direction of sharpness processing applied by the camera - /// when the image was shot. - /// See remarks for further information. - /// - /// - /// The following values are definied: - /// - /// - /// ID - /// Description - /// - /// - /// 0 - /// normal - /// - /// - /// 1 - /// soft - /// - /// - /// 2 - /// hard - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? Sharpness - { - get - { - return GetTagValue("Sharpness"); - } - set - { - SetTagValue("Sharpness", value); - } - } - - /// - /// Gets or sets information on the picture-taking conditions of a particular camera model. - /// The tag is used only to indicate the picture-taking conditions in the reader. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public byte[] DeviceSettingDescription - { - get - { - return GetTagArray("DeviceSettingDescription"); - } - set - { - SetTagValueUndefined("DeviceSettingDescription", value); - } - } - - /// - /// Gets or sets the distance to the subject. - /// See remarks for further information. - /// - /// - /// The following values are definied: - /// - /// - /// ID - /// Description - /// - /// - /// 0 - /// unknown - /// - /// - /// 1 - /// macro - /// - /// - /// 2 - /// close view - /// - /// - /// 3 - /// distant view - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? SubjectDistanceRange - { - get - { - return GetTagValue("SubjectDistanceRange"); - } - set - { - SetTagValue("SubjectDistanceRange", value); - } - } - - /// - /// Gets or sets an identifier assigned uniquely to each image. - /// It is recorded as an ASCII string equivalent to hexadecimal notation and 128-bit fixed length. - /// Constant length of 32. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ImageUniqueID - { - get - { - string text = GetTagText("ImageUniqueID"); - if (!string.IsNullOrEmpty(text)) - { - text = text.Substring(0, text.Length - 1); - } - return text; - } - set - { - if (value != null) - { - FreeImage.Resize(ref value, 32); - value += '\0'; - } - SetTagValue("ImageUniqueID", value); - } - } - } - - /// - /// Represents a collection of all tags contained in the metadata model - /// . - /// - public class MDM_EXIF_GPS : MetadataModel - { - /// - /// Initializes a new instance of this class. - /// - /// Handle to a FreeImage bitmap. - public MDM_EXIF_GPS(FIBITMAP dib) : base(dib) { } - - /// - /// Retrieves the datamodel that this instance represents. - /// - public override FREE_IMAGE_MDMODEL Model - { - get { return FREE_IMAGE_MDMODEL.FIMD_EXIF_GPS; } - } - - /// - /// Gets or sets the GPS version ID. Constant length of 4. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public byte[] VersionID - { - get - { - return GetTagArray("GPSVersionID"); - } - set - { - FreeImage.Resize(ref value, 4); - SetTagValue("GPSVersionID", value); - } - } - - /// - /// Gets or sets a value indicating whether the - /// is north or south latitude. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public LatitudeType? LatitudeDirection - { - get - { - return ToLatitudeType(GetTagText("GPSLatitudeRef")); - } - set - { - SetTagValue("GPSLatitudeRef", ToString(value) + '\0'); - } - } - - /// - /// Gets or sets the latitude of the image. The latitude is expressed as three rational - /// values giving the degrees, minutes, and seconds, respectively. Constant length of 3. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - public FIURational[] Latitude - { - get - { - return GetTagArray("GPSLatitude"); - } - set - { - FreeImage.Resize(ref value, 3); - SetTagValue("GPSLatitude", value); - } - } - - /// - /// Gets or sets a value indicating whether - /// is east or west longitude. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public LongitudeType? LongitudeDirection - { - get - { - return ToLongitudeType(GetTagText("GPSLongitudeRef")); - } - set - { - SetTagValue("GPSLongitudeRef", ToString(value) + '\0'); - } - } - - /// - /// Gets or sets the longitude of the image. The longitude is expressed as three rational - /// values giving the degrees, minutes, and seconds, respectively. Constant length of 3. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - public FIURational[] Longitude - { - get - { - return GetTagArray("GPSLongitude"); - } - set - { - FreeImage.Resize(ref value, 3); - SetTagValue("GPSLongitude", value); - } - } - - /// - /// Gets a value indicating whether is sea level and the altitude - /// is above sea level. If the altitude is below sea level is - /// indicated as an absolute value. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public AltitudeType? AltitudeDirection - { - get - { - byte? flag = GetTagValue("GPSAltitudeRef"); - if (flag.HasValue) - { - switch (flag.Value) - { - case 0: - return AltitudeType.AboveSeaLevel; - case 1: - return AltitudeType.BelowSeaLevel; - default: - return AltitudeType.Undefined; - } - } - return null; - } - set - { - byte? val = null; - if (value.HasValue) - { - switch (value.Value) - { - case AltitudeType.AboveSeaLevel: - val = 0; - break; - - case AltitudeType.BelowSeaLevel: - val = 1; - break; - - default: - val = 2; - break; - } - } - SetTagValue("GPSAltitudeRef", val); - } - } - - /// - /// Gets or sets the altitude based on the reference in . - /// Altitude is expressed as one rational value. The reference unit is meters. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? Altitude - { - get - { - return GetTagValue("GPSAltitude"); - } - set - { - SetTagValue("GPSAltitude", value); - } - } - - /// - /// Gets or sets the sign of the . - /// - /// - /// This is a derived property. There is no metadata tag directly associated - /// with this property value. - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public int? AltitudeSign - { - get - { - AltitudeType? seaLevel = AltitudeDirection; - if (seaLevel.HasValue) - { - return (seaLevel.Value == AltitudeType.BelowSeaLevel) ? -1 : 1; - } - return null; - } - set - { - if (value.HasValue) - { - AltitudeDirection = value.Value >= 0 ? AltitudeType.AboveSeaLevel : AltitudeType.BelowSeaLevel; - } - else - { - AltitudeDirection = null; - } - } - } - - /// - /// Gets or sets the signed altitude. - /// Altitude is expressed as one rational value. The reference unit is meters. - /// - /// - /// Altitude is too large to fit into a FIRational. - /// - /// - /// This is a derived property. There is no metadata tag directly associated - /// with this property value. - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public FIRational? SignedAltitude - { - get - { - FIRational? result = null; - FIURational? altitude = Altitude; - if (altitude.HasValue) - { - int sign = AltitudeSign ?? 1; - if (((int)altitude.Value.Numerator < 0) || ((int)altitude.Value.Denominator < 0)) - throw new OverflowException(); - result = new FIRational((int)altitude.Value.Numerator * sign, (int)altitude.Value.Denominator); - } - return result; - } - set - { - FIURational? val = null; - if (value.HasValue) - { - if (value.Value < 0) - { - AltitudeSign = -1; - value = -value.Value; - } - else - { - AltitudeSign = 1; - } - val = new FIURational((uint)value.Value.Numerator, (uint)value.Value.Denominator); - } - Altitude = val; - } - } - - - /// - /// Gets or sets the time as UTC (Coordinated Universal Time). Constant length of 3. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public TimeSpan? TimeStamp - { - get - { - FIURational[] stamp = GetTagArray("GPSTimeStamp"); - if ((stamp == null) || stamp.Length != 3) - { - return null; - } - else - { - return new TimeSpan((int)stamp[0], (int)stamp[1], (int)stamp[2]); - } - } - set - { - FIURational[] stamp = null; - if (value.HasValue) - { - TimeSpan span = value.Value; - stamp = new FIURational[3]; - stamp[0] = span.Hours; - stamp[1] = span.Minutes; - stamp[2] = span.Seconds; - } - SetTagValue("GPSTimeStamp", stamp); - } - } - - /// - /// Gets or sets the GPS satellites used for measurements. This tag can be used to describe - /// the number of satellites, their ID number, angle of elevation, azimuth, SNR and other - /// information in ASCII notation. The format is not specified. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string Satellites - { - get - { - string result = GetTagText("GPSSatellites"); - if (!string.IsNullOrEmpty(result)) - { - result = result.Substring(0, result.Length - 1); - } - return result; - } - set - { - if (value != null) - { - value += '\0'; - } - SetTagValue("GPSTimeStamp", value); - } - } - - /// - /// Gets or sets a value indicating the status of the GPS receiver when the image was recorded. - /// true indicates measurement was in progress; - /// false indicates measurement was Interoperability. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public bool? Status - { - get - { - string text = GetTagText("GPSStatus"); - return string.IsNullOrEmpty(text) ? default(bool?) : text[0] == 'A'; - } - set - { - SetTagValue("GPSStatus", value.HasValue ? (value.Value ? "A\0" : "V\0") : null); - } - } - - /// - /// Gets or sets a value indicating the GPS measurement mode. - /// true indicates three-dimensional measurement; - /// false indicated two-dimensional measurement was in progress. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public bool? MeasureMode3D - { - get - { - string text = GetTagText("GPSMeasureMode"); - return string.IsNullOrEmpty(text) ? default(bool?) : text[0] == '3'; - } - set - { - SetTagValue("GPSMeasureMode", value.HasValue ? (value.Value ? "3\0" : "2\0") : null); - } - } - - /// - /// Gets or sets the GPS DOP (data degree of precision). An HDOP value is written during - /// two-dimensional measurement, and PDOP during three-dimensional measurement. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? DOP - { - get - { - return GetTagValue("GPSDOP"); - } - set - { - SetTagValue("GPSDOP", value); - } - } - - /// - /// Gets or sets the unit used to express the GPS receiver of movement. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - public VelocityUnit? SpeedUnit - { - get - { - return ToUnitType(GetTagText("GPSSpeedRef")); - } - set - { - SetTagValue("GPSSpeedRef", ToString(value) + '\0'); - } - } - - /// - /// Gets or sets the speed of GPS receiver movement. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - public FIURational? Speed - { - get - { - return GetTagValue("GPSSpeed"); - } - set - { - SetTagValue("GPSSpeed", value); - } - } - - /// - /// Gets or sets the reference for giving the direction of GPS receiver movement. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - public DirectionReference? TrackDirectionReference - { - get - { - return ToDirectionType(GetTagText("GPSTrackRef")); - } - set - { - SetTagValue("GPSTrackRef", ToString(value) + '\0'); - } - } - - /// - /// Gets or sets the direction of GPS receiver movement. - /// The range of values is from 0.00 to 359.99. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - public FIURational? Track - { - get - { - return GetTagValue("GPSTrack"); - } - set - { - SetTagValue("GPSTrack", value); - } - } - - /// - /// Gets or sets the reference for giving the direction of GPS receiver movement. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - public DirectionReference? ImageDirectionReference - { - get - { - return ToDirectionType(GetTagText("GPSImgDirectionRef")); - } - set - { - SetTagValue("GPSImgDirectionRef", ToString(value) + '\0'); - } - } - - /// - /// Gets or sets the direction of the image when it was captured. - /// The range of values is from 0.00 to 359.99. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - public FIURational? ImageDirection - { - get - { - return GetTagValue("GPSImgDirection"); - } - set - { - SetTagValue("GPSImgDirection", value); - } - } - - /// - /// Gets or sets the geodetic survey data used by the GPS receiver. If the survey data - /// is restricted to Japan, the value of this tag is 'TOKYO' or 'WGS-84'. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string MapDatum - { - get - { - string result = GetTagText("GPSMapDatum"); - if (!string.IsNullOrEmpty(result)) - { - result = result.Substring(0, result.Length - 1); - } - return result; - } - set - { - SetTagValue("GPSMapDatum", value + '\0'); - } - } - - /// - /// Gets or sets a value indicating whether the destination point - /// is north or south latitude. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - public LatitudeType? DestinationLatitudeDirection - { - get - { - return ToLatitudeType(GetTagText("GPSDestLatitudeRef")); - } - set - { - SetTagValue("GPSDestLatitudeRef", ToString(value) + '\0'); - } - } - - /// - /// Gets or sets the latitude of the destination point. The latitude is expressed as three rational - /// values giving the degrees, minutes, and seconds, respectively. Constant length of 3. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - public FIURational[] DestinationLatitude - { - get - { - return GetTagArray("GPSDestLatitude"); - } - set - { - FreeImage.Resize(ref value, 3); - SetTagValue("GPSDestLatitude", value); - } - } - - /// - /// Gets or sets a value indicating whether the destination point - /// is east or west longitude. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - public LongitudeType? DestinationLongitudeDirection - { - get - { - return ToLongitudeType(GetTagText("GPSDestLongitudeRef")); - } - set - { - SetTagValue("GPSDestLongitudeRef", ToString(value) + '\0'); - } - } - - /// - /// Gets or sets the longitude of the destination point. The longitude is expressed as three rational - /// values giving the degrees, minutes, and seconds, respectively. Constant length of 3. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational[] DestinationLongitude - { - get - { - return GetTagArray("GPSDestLongitude"); - } - set - { - FreeImage.Resize(ref value, 3); - SetTagValue("GPSDestLongitude", value); - } - } - - /// - /// Gets or sets the reference used for giving the bearing to the destination point. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - public DirectionReference? DestinationDirectionReference - { - get - { - return ToDirectionType(GetTagText("GPSDestBearingRef")); - } - set - { - SetTagValue("GPSDestBearingRef", ToString(value) + '\0'); - } - } - - /// - /// Gets or sets the bearing to the destination point. - /// The range of values is from 0.00 to 359.99. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - public FIURational? DestinationBearing - { - get - { - return GetTagValue("GPSDestBearing"); - } - set - { - SetTagValue("GPSDestBearing", value); - } - } - - /// - /// Gets or sets the unit used to express the distance to the destination point. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - public VelocityUnit? DestinationUnit - { - get - { - return ToUnitType(GetTagText("GPSDestDistanceRef")); - } - set - { - SetTagValue("GPSDestDistanceRef", ToString(value) + '\0'); - } - } - - /// - /// Gets or sets a character string recording the name of the method used - /// for location finding. The first byte indicates the character code used, - /// and this is followed by the name of the method. Since the Type is not ASCII, - /// NULL termination is not necessary. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public byte[] ProcessingMethod - { - get - { - return GetTagArray("GPSProcessingMethod"); - } - set - { - SetTagValue("GPSProcessingMethod", value); - } - } - - /// - /// Gets or sets a character string recording the name of the GPS area. - /// The first byte indicates the character code used, and this is followed by - /// the name of the GPS area. Since the Type is not ASCII, NULL termination is - /// not necessary. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public byte[] AreaInformation - { - get - { - return GetTagArray("GPSAreaInformation"); - } - set - { - SetTagValue("GPSAreaInformation", value); - } - } - - /// - /// Gets or sets date and time information relative to UTC (Coordinated Universal Time). - /// - /// - /// This is a derived property. There is no metadata tag directly associated - /// with this property value. - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public DateTime? DateTimeStamp - { - get - { - DateTime? date = DateStamp; - TimeSpan? time = TimeStamp; - if ((date == null) && (time == null)) - { - return null; - } - else - { - if (date == null) - { - date = DateTime.MinValue; - } - if (time == null) - { - time = TimeSpan.MinValue; - } - return date.Value.Add(time.Value); - } - } - set - { - if (value.HasValue) - { - DateStamp = value.Value.Date; - TimeStamp = value.Value.TimeOfDay; - } - else - { - DateStamp = null; - TimeStamp = null; - } - } - } - - /// - /// Gets or sets date information relative to UTC (Coordinated Universal Time). - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public DateTime? DateStamp - { - get - { - string stamp = GetTagText("GPSDateStamp"); - if (stamp != null) - { - try - { - return DateTime.ParseExact(stamp, "yyyy:MM:dd\0", null); - } - catch - { - } - } - return null; - } - set - { - string val = null; - if (value.HasValue) - { - try - { - val = value.Value.ToString("yyyy:MM:dd\0"); - } - catch - { - } - } - SetTagValue("GPSDateStamp", val); - } - } - - /// - /// Gets or sets a value indicating whether differential correction was applied to - /// the GPS receiver. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public bool? IsDifferential - { - get - { - ushort? value = GetTagValue("GPSDifferential"); - return value.HasValue ? (value != 0) : (default(bool?)); - } - set - { - SetTagValue("GPSDifferential", value.HasValue ? (object)(value.Value ? (ushort)1 : (ushort)0) : (null)); - } - } - } - - /// - /// Represents a collection of all tags contained in the metadata model - /// . - /// - public class MDM_INTEROP : MetadataModel - { - /// - /// Initializes a new instance of this class. - /// - /// Handle to a FreeImage bitmap. - public MDM_INTEROP(FIBITMAP dib) : base(dib) { } - - /// - /// Retrieves the datamodel that this instance represents. - /// - public override FREE_IMAGE_MDMODEL Model - { - get { return FREE_IMAGE_MDMODEL.FIMD_EXIF_INTEROP; } - } - - /// - /// Gets or sets the identification of the Interoperability rule. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public InteroperabilityMode? Identification - { - get - { - return ToInteroperabilityType(GetTagText("InteroperabilityIndex")); - } - set - { - SetTagValue("InteroperabilityIndex", ToString(value) + '\0'); - } - } - } - - /// - /// Represents a collection of all tags contained in the metadata model - /// . - /// - /// This class is obsolete. Use class instead. - /// - [Obsolete("To be removed in future releases. Use MDM_EXIF_MAIN instead.")] - public class MDM_MAIN : MDM_EXIF_MAIN - { - /// - /// Initializes a new instance of this class. - /// - /// Handle to a FreeImage bitmap. - public MDM_MAIN(FIBITMAP dib) : base(dib) { } - } - - /// - /// Represents a collection of all tags contained in the metadata model - /// . - /// - public class MDM_EXIF_MAIN : MetadataModel - { - /// - /// Initializes a new instance of this class. - /// - /// Handle to a FreeImage bitmap. - public MDM_EXIF_MAIN(FIBITMAP dib) : base(dib) { } - - /// - /// Retrieves the datamodel that this instance represents. - /// - public override FREE_IMAGE_MDMODEL Model - { - get { return FREE_IMAGE_MDMODEL.FIMD_EXIF_MAIN; } - } - - /// - /// Gets or sets the number of columns of image data, equal to the number - /// of pixels per row. In JPEG compressed data a JPEG marker is used - /// instead of this tag. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public uint? ImageWidth - { - get - { - return GetUInt32Value("ImageWidth"); - } - set - { - RemoveTag("ImageWidth"); - if (value.HasValue) - { - SetTagValue("ImageWidth", value); - } - } - } - - /// - /// Gets or sets number of rows of image data. In JPEG compressed data a JPEG marker - /// is used instead of this tag. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public uint? ImageHeight - { - get - { - return GetUInt32Value("ImageLength"); - } - set - { - RemoveTag("ImageLength"); - if (value.HasValue) - { - SetTagValue("ImageLength", value); - } - } - } - - /// - /// Gets or sets number of bits per image component. In this standard - /// each component of the image is 8 bits, so the value for this tag is 8. - /// Constant length of 3. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public ushort[] BitsPerSample - { - get - { - return GetTagArray("BitsPerSample"); - } - set - { - FreeImage.Resize(ref value, 3); - SetTagValue("BitsPerSample", value); - } - } - - /// - /// Gets or sets compression scheme used for the image data. When a primary image - /// is JPEG compressed, this designation is not necessary and is omitted. - /// When thumbnails use JPEG compression, this tag value is set to 6. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public ushort? Compression - { - get - { - return GetTagValue("Compression"); - } - set - { - SetTagValue("Compression", value); - } - } - - /// - /// Gets or sets pixel composition. In JPEG compressed data a JPEG marker is - /// used instead of this tag. See remarks for further information. - /// - /// - /// The following values are definied: - /// - /// - /// ID - /// Description - /// - /// - /// 2 - /// RGB - /// - /// - /// 6 - /// YCbCr - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? PhotometricInterpretation - { - get - { - return GetTagValue("PhotometricInterpretation"); - } - set - { - SetTagValue("PhotometricInterpretation", value); - } - } - - /// - /// Gets or sets the image orientation viewed in terms of rows and columns. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public ExifImageOrientation? Orientation - { - get - { - return (ExifImageOrientation?)GetTagValue("Orientation"); - } - set - { - SetTagValue("Orientation", (ushort?)value); - } - } - - /// - /// Gets or sets the number of components per pixel. Since this standard applies - /// to RGB and YCbCr images, the value set for this tag is 3. In JPEG compressed - /// data a JPEG marker is used instead of this tag. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public ushort? SamplesPerPixel - { - get - { - return GetTagValue("SamplesPerPixel"); - } - set - { - SetTagValue("SamplesPerPixel", value); - } - } - - /// - /// Gets or sets a value that indicates whether pixel components are recorded in - /// chunky or planar format. In JPEG compressed files a JPEG marker is used instead - /// of this tag. If this field does not exist, the TIFF default of 1 (chunky) is assumed. - /// See remarks for further information. - /// - /// - /// The following values are definied: - /// - /// - /// ID - /// Description - /// - /// - /// 1 - /// chunky format - /// - /// - /// 2 - /// planar format - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? PlanarConfiguration - { - get - { - return GetTagValue("PlanarConfiguration"); - } - set - { - SetTagValue("PlanarConfiguration", value); - } - } - - /// - /// Gets or sets the sampling ratio of chrominance components in relation to - /// the luminance component. In JPEG compressed dat a JPEG marker is used - /// instead of this tag. - /// See remarks for further information. - /// - /// - /// The following values are definied: - /// - /// - /// ID - /// Description - /// - /// - /// [2,1] - /// YCbCr4:2:2 - /// - /// - /// [2,2] - /// YCbCr4:2:0 - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort[] YCbCrSubSampling - { - get - { - return GetTagArray("YCbCrSubSampling"); - } - set - { - FreeImage.Resize(ref value, 2); - SetTagValue("YCbCrSubSampling", value); - } - } - - /// - /// Gets or sets position of chrominance components in relation to the luminance component. - /// See remarks for further information. - /// - /// - /// This field is designated only for JPEG compressed data or uncompressed YCbCr data. - /// The TIFF default is 1 (centered); but when Y:Cb:Cr = 4:2:2 it is recommended in - /// this standard that 2 (co-sited) be used to record data, in order to improve the - /// image quality when viewed on TV systems. - /// - /// When this field does not exist, the reader shall assume the TIFF default. - /// In the case of Y:Cb:Cr = 4:2:0, the TIFF default (centered) is recommended. - /// If the reader does not have the capability of supporting both kinds of YCbCrPositioning, - /// it shall follow the TIFF default regardless of the value in this field. - /// It is preferable that readers be able to support both centered and co-sited positioning. - /// - /// The following values are definied: - /// - /// - /// ID - /// Description - /// - /// - /// 1 - /// centered - /// - /// - /// 2 - /// co-sited - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? YCbCrPositioning - { - get - { - return GetTagValue("YCbCrPositioning"); - } - set - { - SetTagValue("YCbCrPositioning", value); - } - } - - /// - /// Gets or sets the number of pixels per - /// in the direction. When the image resolution is unknown, - /// 72 [dpi] is designated. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? XResolution - { - get - { - return GetTagValue("XResolution"); - } - set - { - SetTagValue("XResolution", value); - } - } - - /// - /// Gets or sets the number of pixels per - /// in the direction. When the image resolution is unknown, - /// 72 [dpi] is designated. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? YResolution - { - get - { - return GetTagValue("YResolution"); - } - set - { - SetTagValue("YResolution", value); - } - } - - /// - /// Gets or sets the unit for measuring and . - /// The same unit is used for both and . - /// If the image resolution in unknown, 2 (inches) is designated. - /// See remarks for further information. - /// - /// - /// The following values are definied: - /// - /// - /// ID - /// Description - /// - /// - /// 2 - /// inches - /// - /// - /// 3 - /// YCbCr4:2:0 - /// - /// - /// other - /// centimeters - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? ResolutionUnit - { - get - { - return GetTagValue("ResolutionUnit"); - } - set - { - SetTagValue("ResolutionUnit", value); - } - } - - /// - /// Gets or sets the byte offset of that strip. - /// It is recommended that this be selected so the number of strip bytes - /// does not exceed 64 Kbytes. - /// With JPEG compressed data this designation is not needed and is omitted. - /// Constant length of * StripsPerImage. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - /// - public uint[] StripOffsets - { - get - { - return GetUInt32Array("StripOffsets"); - } - set - { - RemoveTag("StripOffsets"); - if (value != null) - { - SetTagValue("StripOffsets", value); - } - } - } - - /// - /// Gets or sets number of rows per strip. This is the number of rows in the image of - /// one strip when an image is divided into strips. With JPEG compressed data this - /// designation is not needed and is omitted. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - public uint? RowsPerStrip - { - get - { - return GetUInt32Value("RowsPerStrip"); - } - set - { - RemoveTag("RowsPerStrip"); - if (value.HasValue) - { - SetTagValue("RowsPerStrip", value); - } - } - } - - /// - /// Gets or sets the total number of bytes in each strip. - /// With JPEG compressed data this designation is not needed and is omitted. - /// Constant length of * StripsPerImage. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public uint[] StripByteCounts - { - get - { - return GetUInt32Array("StripByteCounts"); - } - set - { - RemoveTag("StripByteCounts"); - if (value != null) - { - SetTagValue("StripByteCounts", value); - } - } - } - - /// - /// Gets or sets the offset to the start byte (SOI) of JPEG compressed thumbnail data. - /// This is not used for primary image JPEG data. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public uint? JPEGInterchangeFormat - { - get - { - return GetTagValue("JPEGInterchangeFormat"); - } - set - { - SetTagValue("JPEGInterchangeFormat", value); - } - } - - /// - /// Gets or sets the number of bytes of JPEG compressed thumbnail data. - /// - /// - /// This is not used for primary image JPEG data. - /// JPEG thumbnails are not divided but are recorded as a continuous - /// JPEG bitstream from SOI to EOI. APPn and COM markers should not be recorded. - /// Compressed thumbnails shall be recorded in no more than 64 Kbytes, - /// including all other data to be recorded in APP1. - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public uint? JPEGInterchangeFormatLength - { - get - { - return GetTagValue("JPEGInterchangeFormatLength"); - } - set - { - SetTagValue("JPEGInterchangeFormatLength", value); - } - } - - /// - /// Gets or sets a transfer function for the image, described in tabular style. - /// Constant length of 3 * 256. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public ushort[] TransferFunction - { - get - { - return GetTagArray("TransferFunction"); - } - set - { - FreeImage.Resize(ref value, 3 * 256); - SetTagValue("TransferFunction", value); - } - } - - /// - /// Gets or sets the chromaticity of the white point of the image. - /// Constant length of 2. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational[] WhitePoint - { - get - { - return GetTagArray("WhitePoint"); - } - set - { - FreeImage.Resize(ref value, 2); - SetTagValue("WhitePoint", value); - } - } - - /// - /// Gets or sets the chromaticity of the three primary colors of the image. - /// Constant length of 6. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational[] PrimaryChromaticities - { - get - { - return GetTagArray("PrimaryChromaticities"); - } - set - { - FreeImage.Resize(ref value, 6); - SetTagValue("PrimaryChromaticities", value); - } - } - - /// - /// Gets or sets the matrix coefficients for transformation from RGB to YCbCr image data. - /// Constant length of 3. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational[] YCbCrCoefficients - { - get - { - return GetTagArray("YCbCrCoefficients"); - } - set - { - FreeImage.Resize(ref value, 3); - SetTagValue("PrimaryChromaticities", value); - } - } - - /// - /// Gets or sets the reference black point value and reference white point value. - /// Constant length of 6. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational[] ReferenceBlackWhite - { - get - { - return GetTagArray("ReferenceBlackWhite"); - } - set - { - FreeImage.Resize(ref value, 6); - SetTagValue("ReferenceBlackWhite", value); - } - } - - /// - /// Gets or sets the date and time of image creation. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public DateTime? DateTime - { - get - { - DateTime? result = null; - string text = GetTagText("DateTime"); - if (text != null) - { - try - { - result = System.DateTime.ParseExact(text, "yyyy:MM:dd HH:mm:ss\0", null); - } - catch - { - } - } - return result; - } - set - { - string val = null; - if (value.HasValue) - { - try - { - val = value.Value.ToString("yyyy:MM:dd HH:mm:ss\0"); - } - catch - { - } - } - SetTagValue("DateTime", val); - } - } - - /// - /// Gets or sets a string giving the title of the image. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ImageDescription - { - get - { - string result = GetTagText("ImageDescription"); - if (!string.IsNullOrEmpty(result)) - { - result = result.Substring(0, result.Length - 1); - } - return result; - } - set - { - if (value != null) - { - value += '\0'; - } - SetTagValue("ImageDescription", value); - } - } - - /// - /// Gets or sets the manufacturer of the recording equipment. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string Make - { - get - { - string result = GetTagText("Make"); - if (!string.IsNullOrEmpty(result)) - { - result = result.Substring(0, result.Length - 1); - } - return result; - } - set - { - if (value != null) - { - value += '\0'; - } - SetTagValue("Make", value); - } - } - - /// - /// Gets or sets the model name or model number of the equipment. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string EquipmentModel - { - get - { - string result = GetTagText("Model"); - if (!string.IsNullOrEmpty(result)) - { - result = result.Substring(0, result.Length - 1); - } - return result; - } - set - { - if (value != null) - { - value += '\0'; - } - SetTagValue("Model", value); - } - } - - /// - /// Gets or sets the name and version of the software or firmware of the camera - /// or image input device used to generate the image. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string Software - { - get - { - string result = GetTagText("Software"); - if (!string.IsNullOrEmpty(result)) - { - result = result.Substring(0, result.Length - 1); - } - return result; - } - set - { - if (value != null) - { - value += '\0'; - } - SetTagValue("Software", value); - } - } - - /// - /// Gets or sets the name of the camera owner, photographer or image creator. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string Artist - { - get - { - string result = GetTagText("Artist"); - if (!string.IsNullOrEmpty(result)) - { - result = result.Substring(0, result.Length - 1); - } - return result; - } - set - { - if (value != null) - { - value += '\0'; - } - SetTagValue("Artist", value); - } - } - - /// - /// Gets or sets the photographer and editor copyrights. - /// Constant length of 1-2. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string[] Copyright - { - get - { - string[] result = null; - string text = GetTagText("Copyright"); - if (!string.IsNullOrEmpty(text)) - { - result = text.Split(new char[] { '\0' }, StringSplitOptions.RemoveEmptyEntries); - } - return result; - } - set - { - string val = null; - if (value != null) - { - if (value.Length == 1) - { - if (value[0] != null) - { - val = value[0] + '\0'; - } - } - else if (value.Length == 2) - { - if ((value[0] != null) && (value[1] != null)) - { - val = value[0] + '\0' + value[1] + '\0'; - } - } - } - SetTagValue("Copyright", val); - } - } - } - - /// - /// Represents a collection of all tags contained in the metadata model - /// . - /// - public class MDM_MAKERNOTE : MetadataModel - { - /// - /// Initializes a new instance of this class. - /// - /// Handle to a FreeImage bitmap. - public MDM_MAKERNOTE(FIBITMAP dib) : base(dib) { } - - /// - /// Retrieves the datamodel that this instance represents. - /// - public override FREE_IMAGE_MDMODEL Model - { - get { return FREE_IMAGE_MDMODEL.FIMD_EXIF_MAKERNOTE; } - } - } - - /// - /// Represents a collection of all tags contained in the metadata model - /// . - /// - public class MDM_GEOTIFF : MetadataModel - { - /// - /// Initializes a new instance of this class. - /// - /// Handle to a FreeImage bitmap. - public MDM_GEOTIFF(FIBITMAP dib) : base(dib) { } - - /// - /// Retrieves the datamodel that this instance represents. - /// - public override FREE_IMAGE_MDMODEL Model - { - get { return FREE_IMAGE_MDMODEL.FIMD_GEOTIFF; } - } - - /// - /// Gets or sets the value of the GeoTIFF GeoASCIIParamsTag. - /// - /// - /// The GeoASCIIParamsTag is used to store all of the valued - /// GeoKeys, referenced by the property. Since keys - /// defined in the GeoKeyDirectoryTag use offsets into this tag, any special - /// comments may be placed at the beginning of this tag. - /// For the most part, the only keys that are valued are - /// Citation keys, giving documentation and references for obscure - /// projections, datums, etc. - /// - /// Special handling is required for -valued keys. While it - /// is true that TIFF 6.0 permits multiple NULL-delimited strings within a single - /// ASCII tag, the secondary strings might not appear in the output of naive - /// tiffdump programs. For this reason, the NULL delimiter of each ASCII key - /// value shall be converted to a "|" (pipe) character before being installed - /// back into the holding tag, so that a dump of the tag - /// will look like this. - /// - /// AsciiTag="first_value|second_value|etc...last_value|" - /// - /// A baseline GeoTIFF-reader must check for and convert the final "|" pipe - /// character of a key back into a NULL before returning it to the client - /// software. - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public string GeoASCIIParams - { - get - { - string text = GetTagText("GeoASCIIParams"); - if (!string.IsNullOrEmpty(text)) - { - text = text.Substring(0, text.Length - 1); - } - return text; - } - set - { - if (value != null) - { - value += '\0'; - } - SetTagValue("GeoASCIIParams", value); - } - } - - /// - /// Gets or sets the value of the GeoTIFF GeoDoubleParamsTag. - /// - /// - /// The GeoDoubleParamsTag is used to store all of the valued - /// GeoKeys, referenced by the property. The meaning of - /// any value of this double array is determined from the GeoKeyDirectoryTag reference - /// pointing to it. values should first be converted to - /// and stored here. - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public double[] GeoDoubleParams - { - get - { - return GetTagArray("GeoDoubleParams"); - } - set - { - SetTagValue("GeoDoubleParams", value); - } - } - - /// - /// Gets or sets the value of the GeoTIFF GeoKeyDirectoryTag. - /// - /// - /// The GeoKeyDirectoryTag may be used to store the GeoKey Directory, which defines and - /// references the GeoKeys. - /// - /// The tag is an array of unsigned values, which are primarily - /// grouped into blocks of 4. The first 4 values are special, and contain GeoKey directory - /// header information. The header values consist of the following information, in order: - /// - /// Header={KeyDirectoryVersion, KeyRevision, MinorRevision, NumberOfKeys} - /// - /// where - /// - /// KeyDirectoryVersion indicates the current version of Key implementation, and will - /// only change if this Tag's Key structure is changed. (Similar to the TIFFVersion (42)). - /// The current DirectoryVersion number is 1. This value will most likely never change, - /// and may be used to ensure that this is a valid Key-implementation. - /// - /// KeyRevision indicates what revision of Key-Sets are used. - /// - /// MinorRevision indicates what set of Key-Codes are used. The complete revision number - /// is denoted <KeyRevision>.<MinorRevision>. - /// - /// NumberOfKeys indicates how many Keys are defined by the rest of this Tag. - /// - /// This header is immediately followed by a collection of <NumberOfKeys> KeyEntry - /// sets, each of which is also 4- long. Each KeyEntry is modeled on the - /// TIFFEntry format of the TIFF directory header, and is of the form: - /// - /// KeyEntry = { KeyID, TIFFTagLocation, Count, Value_Offset } - /// - /// where - /// - /// KeyID gives the Key-ID value of the Key (identical in function to TIFF tag ID, - /// but completely independent of TIFF tag-space), - /// - /// TIFFTagLocation indicates which TIFF tag contains the value(s) of the Key: if - /// TIFFTagLocation is 0, then the value is , and is contained in the - /// Value_Offset entry. Otherwise, the type (format) of the value is implied by the - /// TIFF-Type of the tag containing the value. - /// - /// Count indicates the number of values in this key. - /// - /// Value_Offset Value_Offset indicates the index-offset into the TagArray indicated - /// by TIFFTagLocation, if it is nonzero. If TIFFTagLocation is 0 (zero) , then Value_Offset - /// contains the actual () value of the Key, and Count=1 is implied. - /// Note that the offset is not a byte-offset, but rather an index based on the natural data - /// type of the specified tag array. - /// - /// Following the KeyEntry definitions, the KeyDirectory tag may also contain additional - /// values. For example, if a key requires multiple values, they shall - /// be placed at the end of this tag, and the KeyEntry will set - /// TIFFTagLocation=GeoKeyDirectoryTag, with the Value_Offset pointing to the location of the - /// value(s). - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort[] GeoKeyDirectory - { - get - { - return GetTagArray("GeoKeyDirectory"); - } - set - { - SetTagValue("GeoKeyDirectory", value); - } - } - - /// - /// Gets or sets the value of the GeoTIFF ModelPixelScaleTag. - /// - /// - /// The ModelPixelScaleTag tag may be used to specify the size of raster pixel spacing - /// in the model space units, when the raster space can be embedded in the model space - /// coordinate system without rotation, and consists of the following 3 values: - /// - /// ModelPixelScaleTag = (ScaleX, ScaleY, ScaleZ) - /// - /// where ScaleX and ScaleY give the horizontal and vertical spacing of - /// raster pixels. The ScaleZ is primarily used to map the pixel value of a - /// digital elevation model into the correct Z-scale, and so for most other purposes - /// this value should be zero (since most model spaces are 2-D, with Z=0). - /// - /// A single tiepoint in the tag, together with this tag, - /// completely determine the relationship between raster and model space; thus they - /// comprise the two tags which Baseline GeoTIFF files most often will use to place a - /// raster image into a "standard position" in model space. - /// - /// Like the tag, this tag information is independent of the - /// XPosition, YPosition, Resolution and Orientation tags of the standard TIFF 6.0 spec. - /// However, simple reversals of orientation between raster and model space - /// (e.g. horizontal or vertical flips) may be indicated by reversal of sign in the - /// corresponding component of the ModelPixelScaleTag. GeoTIFF compliant readers must - /// honor this signreversal convention. - /// - /// This tag must not be used if the raster image requires rotation or shearing to place - /// it into the standard model space. In such cases the transformation shall be defined - /// with the more general . - /// - ///
Naming differences - /// In the native FreeImage library and thus, in the FreeImage API documentation, this - /// property's key is named GeoPixelScale. Since the GeoTIFF specification - /// as well as Java's EXIFTIFFTagSet class call this tag - /// , this property was renamed accordingly. - /// However, when accessing this property's tag by its object, - /// the native FreeImage tag key GeoPixelScale must be used. - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public double[] ModelPixelScale - { - get - { - return GetTagArray("GeoPixelScale"); - } - set - { - SetTagValue("GeoPixelScale", value); - } - } - - /// - /// Gets or sets the value of the GeoTIFF GeoTiePointsTag. - /// - /// - /// The GeoTiePointsTag stores raster -> model tiepoint pairs in the order - /// - /// ModelTiePoints = (...,I,J,K, X,Y,Z...), - /// - /// where (I,J,K) is the point at location (I,J) in raster space with - /// pixel-value K, and (X,Y,Z) is a vector in model space. In most cases - /// the model space is only two-dimensional, in which case both K and Z should be set - /// to zero; this third dimension is provided in anticipation of future support for 3D - /// digital elevation models and vertical coordinate systems. - /// - /// A raster image may be georeferenced simply by specifying its location, size and - /// orientation in the model coordinate space M. This may be done by specifying the - /// location of three of the four bounding corner points. However, tiepoints are only - /// to be considered exact at the points specified; thus defining such a set of - /// bounding tiepoints does not imply that the model space locations of the interior - /// of the image may be exactly computed by a linear interpolation of these tiepoints. - /// - /// However, since the relationship between the Raster space and the model space will - /// often be an exact, affine transformation, this relationship can be defined using - /// one set of tiepoints and the , described below, which - /// gives the vertical and horizontal raster grid cell size, specified in model units. - /// - /// If possible, the first tiepoint placed in this tag shall be the one establishing - /// the location of the point (0,0) in raster space. However, if this is not possible - /// (for example, if (0,0) is goes to a part of model space in which the projection is - /// ill-defined), then there is no particular order in which the tiepoints need be - /// listed. - /// - /// For orthorectification or mosaicking applications a large number of tiepoints may - /// be specified on a mesh over the raster image. However, the definition of associated - /// grid interpolation methods is not in the scope of the current GeoTIFF spec. - /// - ///
Naming differences - /// In the native FreeImage library and thus, in the FreeImage API documentation, this - /// property's key is named GeoTiePoints. Since the GeoTIFF specification - /// as well as Java's EXIFTIFFTagSet class call this tag - /// , this property was renamed accordingly. - /// However, when accessing this property's tag by its object, - /// the native FreeImage tag key GeoTiePoints must be used. - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public double[] ModelTiePoints - { - get - { - return GetTagArray("GeoTiePoints"); - } - set - { - SetTagValue("GeoTiePoints", value); - } - } - - /// - /// Gets or sets the value of the GeoTIFF ModelTransformationMatrixTag. - /// - /// - /// This tag may be used to specify the transformation matrix between the raster space - /// (and its dependent pixel-value space) and the (possibly 3D) model space. - /// - ///
Naming differences - /// In the native FreeImage library and thus, in the FreeImage API documentation, this - /// property's key is named GeoTransformationMatrix. Since the GeoTIFF specification - /// as well as Java's EXIFTIFFTagSet class call this tag - /// , this property was renamed accordingly. - /// However, when accessing this property's tag by its object, - /// the native FreeImage tag key GeoTransformationMatrix must be used. - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public double[] ModelTransformationMatrix - { - get - { - return GetTagArray("GeoTransformationMatrix"); - } - set - { - SetTagValue("GeoTransformationMatrix", value); - } - } - - /// - /// Gets or sets the value of the GeoTIFF IntergraphTransformationMatrixTag. - /// - /// - /// The IntergraphTransformationMatrixTag conflicts with an internal software implementation - /// at Intergraph, and so its use is no longer encouraged. A GeoTIFF reader should look first - /// for the new tag, and only if it is not found should it check for this older tag. If found, - /// it should only consider it to be contain valid GeoTIFF matrix information if the tag-count - /// is 16; the Intergraph version uses 17 values. - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public double[] IntergraphTransformationMatrix - { - get - { - return GetTagArray("Intergraph TransformationMatrix"); - } - set - { - SetTagValue("Intergraph TransformationMatrix", value); - } - } - - /// - /// Gets or sets the value of the GeoTIFF JPLCartoIFDOffsetTag. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public uint? JPLCartoIFDOffset - { - get - { - return GetTagValue("JPL Carto IFD offset"); - } - set - { - SetTagValue("JPL Carto IFD offset", value); - } - } - } - - /// - /// Represents a collection of all tags contained in the metadata model - /// . - /// - public class MDM_IPTC : MetadataModel - { - /// - /// Initializes a new instance of this class. - /// - /// Handle to a FreeImage bitmap. - public MDM_IPTC(FIBITMAP dib) : base(dib) { } - - /// - /// Retrieves the datamodel that this instance represents. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public override FREE_IMAGE_MDMODEL Model - { - get { return FREE_IMAGE_MDMODEL.FIMD_IPTC; } - } - - /// - /// Gets the Application Record Version. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public short? ApplicationRecordVersion - { - get - { - return GetTagValue("ApplicationRecordVersion"); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Object Type Reference. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ObjectTypeReference - { - get - { - return GetTagText("ObjectTypeReference"); - } - set - { - SetTagValue("ObjectTypeReference", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Object Attribute Reference. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ObjectAttributeReference - { - get - { - return GetTagText("ObjectAttributeReference"); - } - set - { - SetTagValue("ObjectAttributeReference", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Object Name. - /// This is also referred to as Title. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ObjectName - { - get - { - return GetTagText("ObjectName"); - } - set - { - SetTagValue("ObjectName", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Edit Status. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string EditStatus - { - get - { - return GetTagText("EditStatus"); - } - set - { - SetTagValue("EditStatus", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Editorial Update. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string EditorialUpdate - { - get - { - return GetTagText("EditorialUpdate"); - } - set - { - SetTagValue("EditorialUpdate", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Urgency. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string Urgency - { - get - { - return GetTagText("Urgency"); - } - set - { - SetTagValue("Urgency", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Subject Reference. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string SubjectReference - { - get - { - return GetTagText("SubjectReference"); - } - set - { - SetTagValue("SubjectReference", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Category. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string Category - { - get - { - return GetTagText("Category"); - } - set - { - SetTagValue("Category", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Supplemental Categories. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string SupplementalCategories - { - get - { - return GetTagText("SupplementalCategories"); - } - set - { - SetTagValue("SupplementalCategories", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Fixture Identifier. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string FixtureIdentifier - { - get - { - return GetTagText("FixtureIdentifier"); - } - set - { - SetTagValue("FixtureIdentifier", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Keywords. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string Keywords - { - get - { - return GetTagText("Keywords"); - } - set - { - SetTagValue("Keywords", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Content Location Code. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ContentLocationCode - { - get - { - return GetTagText("ContentLocationCode"); - } - set - { - SetTagValue("ContentLocationCode", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Content Location Name. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ContentLocationName - { - get - { - return GetTagText("ContentLocationName"); - } - set - { - SetTagValue("ContentLocationName", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Release Date. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ReleaseDate - { - get - { - return GetTagText("ReleaseDate"); - } - set - { - SetTagValue("ReleaseDate", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Release Time. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ReleaseTime - { - get - { - return GetTagText("ReleaseTime"); - } - set - { - SetTagValue("ReleaseTime", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Expiration Date. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ExpirationDate - { - get - { - return GetTagText("ExpirationDate"); - } - set - { - SetTagValue("ExpirationDate", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Expiration Time. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ExpirationTime - { - get - { - return GetTagText("ExpirationTime"); - } - set - { - SetTagValue("ExpirationTime", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Special Instructions. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string SpecialInstructions - { - get - { - return GetTagText("SpecialInstructions"); - } - set - { - SetTagValue("SpecialInstructions", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Action Advised. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ActionAdvised - { - get - { - return GetTagText("ActionAdvised"); - } - set - { - SetTagValue("ActionAdvised", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Reference Service. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ReferenceService - { - get - { - return GetTagText("ReferenceService"); - } - set - { - SetTagValue("ReferenceService", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Reference Date. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ReferenceDate - { - get - { - return GetTagText("ReferenceDate"); - } - set - { - SetTagValue("ReferenceDate", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Reference Number. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ReferenceNumber - { - get - { - return GetTagText("ReferenceNumber"); - } - set - { - SetTagValue("ReferenceNumber", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Date Created. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string DateCreated - { - get - { - return GetTagText("DateCreated"); - } - set - { - SetTagValue("DateCreated", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Time Created. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string TimeCreated - { - get - { - return GetTagText("TimeCreated"); - } - set - { - SetTagValue("TimeCreated", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Digital Creation Date. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string DigitalCreationDate - { - get - { - return GetTagText("DigitalCreationDate"); - } - set - { - SetTagValue("DigitalCreationDate", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Digital Creation Time. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string DigitalCreationTime - { - get - { - return GetTagText("DigitalCreationTime"); - } - set - { - SetTagValue("DigitalCreationTime", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Originating Program. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string OriginatingProgram - { - get - { - return GetTagText("OriginatingProgram"); - } - set - { - SetTagValue("OriginatingProgram", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Program Version. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ProgramVersion - { - get - { - return GetTagText("ProgramVersion"); - } - set - { - SetTagValue("ProgramVersion", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Object Cycle. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ObjectCycle - { - get - { - return GetTagText("ObjectCycle"); - } - set - { - SetTagValue("ObjectCycle", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag By Line. - /// This is the author's name. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ByLine - { - get - { - return GetTagText("By-line"); - } - set - { - SetTagValue("By-line", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag By Line Title. - /// This is the author's position. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ByLineTitle - { - get - { - return GetTagText("By-lineTitle"); - } - set - { - SetTagValue("By-lineTitle", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag City. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string City - { - get - { - return GetTagText("City"); - } - set - { - SetTagValue("City", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Sub Location. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string SubLocation - { - get - { - return GetTagText("SubLocation"); - } - set - { - SetTagValue("SubLocation", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Province State. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ProvinceState - { - get - { - return GetTagText("ProvinceState"); - } - set - { - SetTagValue("ProvinceState", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Country Primary Location Code. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string CountryPrimaryLocationCode - { - get - { - return GetTagText("Country-PrimaryLocationCode"); - } - set - { - SetTagValue("Country-PrimaryLocationCode", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Country Primary Location Name. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string CountryPrimaryLocationName - { - get - { - return GetTagText("Country-PrimaryLocationName"); - } - set - { - SetTagValue("Country-PrimaryLocationName", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Original Transmission Reference. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string OriginalTransmissionReference - { - get - { - return GetTagText("OriginalTransmissionReference"); - } - set - { - SetTagValue("OriginalTransmissionReference", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Headline. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string Headline - { - get - { - return GetTagText("Headline"); - } - set - { - SetTagValue("Headline", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Credit. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string Credit - { - get - { - return GetTagText("Credit"); - } - set - { - SetTagValue("Credit", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Source. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string Source - { - get - { - return GetTagText("Source"); - } - set - { - SetTagValue("Source", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Copyright Notice. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string CopyrightNotice - { - get - { - return GetTagText("CopyrightNotice"); - } - set - { - SetTagValue("CopyrightNotice", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Contact. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string Contact - { - get - { - return GetTagText("Contact"); - } - set - { - SetTagValue("Contact", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Caption Abstract. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string CaptionAbstract - { - get - { - return GetTagText("CaptionAbstract"); - } - set - { - SetTagValue("CaptionAbstract", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Writer Editor. - /// This is also referred to as Caption Writer. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string WriterEditor - { - get - { - return GetTagText("WriterEditor"); - } - set - { - SetTagValue("WriterEditor", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Rasterized Caption. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string RasterizedCaption - { - get - { - return GetTagText("RasterizedCaption"); - } - set - { - SetTagValue("RasterizedCaption", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Image Type. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ImageType - { - get - { - return GetTagText("ImageType"); - } - set - { - SetTagValue("ImageType", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Image Orientation. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ImageOrientation - { - get - { - return GetTagText("ImageOrientation"); - } - set - { - SetTagValue("ImageOrientation", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Language Identifier. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string LanguageIdentifier - { - get - { - return GetTagText("LanguageIdentifier"); - } - set - { - SetTagValue("LanguageIdentifier", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Audio Type. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string AudioType - { - get - { - return GetTagText("AudioType"); - } - set - { - SetTagValue("AudioType", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Audio Sampling Rate. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string AudioSamplingRate - { - get - { - return GetTagText("AudioSamplingRate"); - } - set - { - SetTagValue("AudioSamplingRate", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Audio Sampling Resolution. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string AudioSamplingResolution - { - get - { - return GetTagText("AudioSamplingResolution"); - } - set - { - SetTagValue("AudioSamplingResolution", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Audio Duration. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string AudioDuration - { - get - { - return GetTagText("AudioDuration"); - } - set - { - SetTagValue("AudioDuration", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Audio Outcue. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string AudioOutcue - { - get - { - return GetTagText("AudioOutcue"); - } - set - { - SetTagValue("AudioOutcue", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Job I D. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string JobID - { - get - { - return GetTagText("JobID"); - } - set - { - SetTagValue("JobID", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Master Document I D. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string MasterDocumentID - { - get - { - return GetTagText("MasterDocumentID"); - } - set - { - SetTagValue("MasterDocumentID", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Short Document I D. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ShortDocumentID - { - get - { - return GetTagText("ShortDocumentID"); - } - set - { - SetTagValue("ShortDocumentID", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Unique Document I D. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string UniqueDocumentID - { - get - { - return GetTagText("UniqueDocumentID"); - } - set - { - SetTagValue("UniqueDocumentID", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Owner I D. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string OwnerID - { - get - { - return GetTagText("OwnerID"); - } - set - { - SetTagValue("OwnerID", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Object Preview File Format. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ObjectPreviewFileFormat - { - get - { - return GetTagText("ObjectPreviewFileFormat"); - } - set - { - SetTagValue("ObjectPreviewFileFormat", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Object Preview File Version. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ObjectPreviewFileVersion - { - get - { - return GetTagText("ObjectPreviewFileVersion"); - } - set - { - SetTagValue("ObjectPreviewFileVersion", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Object Preview Data. - /// This is also referred to as Audio Outcue. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ObjectPreviewData - { - get - { - return GetTagText("ObjectPreviewData"); - } - set - { - SetTagValue("ObjectPreviewData", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Prefs. - /// This is also referred to as photo-mechanic preferences. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string Prefs - { - get - { - return GetTagText("Prefs"); - } - set - { - SetTagValue("Prefs", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Classify State. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ClassifyState - { - get - { - return GetTagText("ClassifyState"); - } - set - { - SetTagValue("ClassifyState", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Similarity Index. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string SimilarityIndex - { - get - { - return GetTagText("SimilarityIndex"); - } - set - { - SetTagValue("SimilarityIndex", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Document Notes. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string DocumentNotes - { - get - { - return GetTagText("DocumentNotes"); - } - set - { - SetTagValue("DocumentNotes", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Document History. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string DocumentHistory - { - get - { - return GetTagText("DocumentHistory"); - } - set - { - SetTagValue("DocumentHistory", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Exif Camera Info. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ExifCameraInfo - { - get - { - return GetTagText("ExifCameraInfo"); - } - set - { - SetTagValue("ExifCameraInfo", value); - } - } - } - - /// - /// Represents a collection of all tags contained in the metadata model - /// . - /// - public class MDM_NODATA : MetadataModel - { - /// - /// Initializes a new instance of this class. - /// - /// Handle to a FreeImage bitmap. - public MDM_NODATA(FIBITMAP dib) : base(dib) { } - - /// - /// Retrieves the datamodel that this instance represents. - /// - public override FREE_IMAGE_MDMODEL Model - { - get { return FREE_IMAGE_MDMODEL.FIMD_NODATA; } - } - } - - /// - /// Represents a collection of all tags contained in the metadata model - /// . - /// - public class MDM_XMP : MetadataModel - { - /// - /// Initializes a new instance of this class. - /// - /// Handle to a FreeImage bitmap. - public MDM_XMP(FIBITMAP dib) : base(dib) { } - - /// - /// Retrieves the datamodel that this instance represents. - /// - public override FREE_IMAGE_MDMODEL Model - { - get { return FREE_IMAGE_MDMODEL.FIMD_XMP; } - } - - /// - /// Gets or sets the XMP XML content. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string Xml - { - get - { - return GetTagText("XMLPacket"); - } - set - { - SetTagValue("XMLPacket", value); - } - } - - /// - /// Gets an initialized to read the XMP XML content. - /// Returns null, if the metadata tag XMLPacket is not present in - /// this model. - /// - public XmlReader XmlReader - { - get - { - string xmlString = Xml; - if (xmlString == null) - { - return null; - } - else - { - MemoryStream stream = new MemoryStream(); - StreamWriter writer = new StreamWriter(stream); - writer.Write(xmlString); - return XmlReader.Create(stream); - } - } - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/MetadataTag.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/MetadataTag.cs deleted file mode 100644 index 8fa580d..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/MetadataTag.cs +++ /dev/null @@ -1,757 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.9 $ -// $Date: 2009/02/27 16:35:12 $ -// $Id: MetadataTag.cs,v 1.9 2009/02/27 16:35:12 cklein05 Exp $ -// ========================================================== - -using System; -using System.Text; -using System.Runtime.InteropServices; -using System.Collections.Generic; -using System.Diagnostics; - -namespace FreeImageAPI.Metadata -{ - /// - /// Manages metadata objects and operations. - /// - public sealed class MetadataTag : IComparable, IComparable, ICloneable, IEquatable, IDisposable - { - /// - /// The encapsulated FreeImage-tag. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - internal FITAG tag; - - /// - /// The metadata model of . - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private FREE_IMAGE_MDMODEL model; - - /// - /// Indicates whether this instance has already been disposed. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private bool disposed = false; - - /// - /// Indicates whether this instance was created by FreeImage or - /// by the user. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private bool selfCreated; - - /// - /// List linking metadata-model and Type. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly Dictionary idList; - - /// - /// List linking Type and metadata-model. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly Dictionary typeList; - - /// - /// Initializes a new instance of this class. - /// - private MetadataTag() - { - } - - /// - /// Initializes a new instance of this class. - /// - /// The new model the tag should be of. - public MetadataTag(FREE_IMAGE_MDMODEL model) - { - this.model = model; - tag = FreeImage.CreateTag(); - selfCreated = true; - - if (model == FREE_IMAGE_MDMODEL.FIMD_XMP) - { - Key = "XMLPacket"; - } - } - - /// - /// Initializes a new instance of this class. - /// - /// The to represent. - /// The bitmap was extracted from. - public MetadataTag(FITAG tag, FIBITMAP dib) - { - if (tag.IsNull) - { - throw new ArgumentNullException("tag"); - } - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - this.tag = tag; - model = GetModel(dib, tag); - selfCreated = false; - - if (model == FREE_IMAGE_MDMODEL.FIMD_XMP) - { - Key = "XMLPacket"; - } - } - - /// - /// Initializes a new instance of this class. - /// - /// The to represent. - /// The model of . - public MetadataTag(FITAG tag, FREE_IMAGE_MDMODEL model) - { - if (tag.IsNull) - { - throw new ArgumentNullException("tag"); - } - this.tag = tag; - this.model = model; - selfCreated = false; - - if (model == FREE_IMAGE_MDMODEL.FIMD_XMP) - { - Key = "XMLPacket"; - } - } - - static MetadataTag() - { - idList = new Dictionary(); - idList.Add(FREE_IMAGE_MDTYPE.FIDT_BYTE, typeof(byte)); - idList.Add(FREE_IMAGE_MDTYPE.FIDT_SHORT, typeof(ushort)); - idList.Add(FREE_IMAGE_MDTYPE.FIDT_LONG, typeof(uint)); - idList.Add(FREE_IMAGE_MDTYPE.FIDT_RATIONAL, typeof(FIURational)); - idList.Add(FREE_IMAGE_MDTYPE.FIDT_SBYTE, typeof(sbyte)); - idList.Add(FREE_IMAGE_MDTYPE.FIDT_UNDEFINED, typeof(byte)); - idList.Add(FREE_IMAGE_MDTYPE.FIDT_SSHORT, typeof(short)); - idList.Add(FREE_IMAGE_MDTYPE.FIDT_SLONG, typeof(int)); - idList.Add(FREE_IMAGE_MDTYPE.FIDT_SRATIONAL, typeof(FIRational)); - idList.Add(FREE_IMAGE_MDTYPE.FIDT_FLOAT, typeof(float)); - idList.Add(FREE_IMAGE_MDTYPE.FIDT_DOUBLE, typeof(double)); - idList.Add(FREE_IMAGE_MDTYPE.FIDT_IFD, typeof(uint)); - idList.Add(FREE_IMAGE_MDTYPE.FIDT_PALETTE, typeof(RGBQUAD)); - - typeList = new Dictionary(); - typeList.Add(typeof(ushort), FREE_IMAGE_MDTYPE.FIDT_SHORT); - typeList.Add(typeof(ushort[]), FREE_IMAGE_MDTYPE.FIDT_SHORT); - typeList.Add(typeof(string), FREE_IMAGE_MDTYPE.FIDT_ASCII); - typeList.Add(typeof(uint), FREE_IMAGE_MDTYPE.FIDT_LONG); - typeList.Add(typeof(uint[]), FREE_IMAGE_MDTYPE.FIDT_LONG); - typeList.Add(typeof(FIURational), FREE_IMAGE_MDTYPE.FIDT_RATIONAL); - typeList.Add(typeof(FIURational[]), FREE_IMAGE_MDTYPE.FIDT_RATIONAL); - typeList.Add(typeof(sbyte), FREE_IMAGE_MDTYPE.FIDT_SBYTE); - typeList.Add(typeof(sbyte[]), FREE_IMAGE_MDTYPE.FIDT_SBYTE); - typeList.Add(typeof(byte), FREE_IMAGE_MDTYPE.FIDT_BYTE); - typeList.Add(typeof(byte[]), FREE_IMAGE_MDTYPE.FIDT_BYTE); - typeList.Add(typeof(short), FREE_IMAGE_MDTYPE.FIDT_SSHORT); - typeList.Add(typeof(short[]), FREE_IMAGE_MDTYPE.FIDT_SSHORT); - typeList.Add(typeof(int), FREE_IMAGE_MDTYPE.FIDT_SLONG); - typeList.Add(typeof(int[]), FREE_IMAGE_MDTYPE.FIDT_SLONG); - typeList.Add(typeof(FIRational), FREE_IMAGE_MDTYPE.FIDT_SRATIONAL); - typeList.Add(typeof(FIRational[]), FREE_IMAGE_MDTYPE.FIDT_SRATIONAL); - typeList.Add(typeof(float), FREE_IMAGE_MDTYPE.FIDT_FLOAT); - typeList.Add(typeof(float[]), FREE_IMAGE_MDTYPE.FIDT_FLOAT); - typeList.Add(typeof(double), FREE_IMAGE_MDTYPE.FIDT_DOUBLE); - typeList.Add(typeof(double[]), FREE_IMAGE_MDTYPE.FIDT_DOUBLE); - typeList.Add(typeof(RGBQUAD), FREE_IMAGE_MDTYPE.FIDT_PALETTE); - typeList.Add(typeof(RGBQUAD[]), FREE_IMAGE_MDTYPE.FIDT_PALETTE); - } - - /// - /// Releases all resources used by the instance. - /// - ~MetadataTag() - { - Dispose(); - } - - /// - /// Determines whether two specified objects have the same value. - /// - /// A or a null reference (Nothing in Visual Basic). - /// A or a null reference (Nothing in Visual Basic). - /// - /// true if the value of left is the same as the value of right; otherwise, false. - /// - public static bool operator ==(MetadataTag left, MetadataTag right) - { - // Check whether both are null - if ((object)left == (object)right) - { - return true; - } - else if ((object)left == null || (object)right == null) - { - return false; - } - left.CheckDisposed(); - right.CheckDisposed(); - // Check all properties - if ((left.Key != right.Key) || - (left.ID != right.ID) || - (left.Description != right.Description) || - (left.Count != right.Count) || - (left.Length != right.Length) || - (left.Model != right.Model) || - (left.Type != right.Type)) - { - return false; - } - if (left.Length == 0) - { - return true; - } - IntPtr ptr1 = FreeImage.GetTagValue(left.tag); - IntPtr ptr2 = FreeImage.GetTagValue(right.tag); - return FreeImage.CompareMemory(ptr1, ptr2, left.Length); - } - - /// - /// Determines whether two specified objects have different values. - /// - /// A or a null reference (Nothing in Visual Basic). - /// A or a null reference (Nothing in Visual Basic). - /// - /// true if the value of left is different from the value of right; otherwise, false. - /// - public static bool operator !=(MetadataTag left, MetadataTag right) - { - return !(left == right); - } - - /// - /// Extracts the value of a instance to a handle. - /// - /// A instance. - /// A new instance of initialized to . - public static implicit operator FITAG(MetadataTag value) - { - return value.tag; - } - - private static FREE_IMAGE_MDMODEL GetModel(FIBITMAP dib, FITAG tag) - { - FITAG value; - foreach (FREE_IMAGE_MDMODEL model in FreeImage.FREE_IMAGE_MDMODELS) - { - FIMETADATA mData = FreeImage.FindFirstMetadata(model, dib, out value); - if (mData.IsNull) - { - continue; - } - try - { - do - { - if (value == tag) - { - return model; - } - } - while (FreeImage.FindNextMetadata(mData, out value)); - } - finally - { - if (!mData.IsNull) - { - FreeImage.FindCloseMetadata(mData); - } - } - } - throw new ArgumentException("'tag' is no metadata object of 'dib'"); - } - - /// - /// Gets the model of the metadata. - /// - public FREE_IMAGE_MDMODEL Model - { - get { CheckDisposed(); return model; } - } - - /// - /// Gets or sets the key of the metadata. - /// - public string Key - { - get { CheckDisposed(); return FreeImage.GetTagKey(tag); } - set - { - CheckDisposed(); - if ((model != FREE_IMAGE_MDMODEL.FIMD_XMP) || (value == "XMLPacket")) - { - FreeImage.SetTagKey(tag, value); - } - } - } - - /// - /// Gets or sets the description of the metadata. - /// - public string Description - { - get { CheckDisposed(); return FreeImage.GetTagDescription(tag); } - set { CheckDisposed(); FreeImage.SetTagDescription(tag, value); } - } - - /// - /// Gets or sets the ID of the metadata. - /// - public ushort ID - { - get { CheckDisposed(); return FreeImage.GetTagID(tag); } - set { CheckDisposed(); FreeImage.SetTagID(tag, value); } - } - - /// - /// Gets the type of the metadata. - /// - public FREE_IMAGE_MDTYPE Type - { - get { CheckDisposed(); return FreeImage.GetTagType(tag); } - internal set { FreeImage.SetTagType(tag, value); } - } - - /// - /// Gets the number of elements the metadata object contains. - /// - public uint Count - { - get { CheckDisposed(); return FreeImage.GetTagCount(tag); } - private set { FreeImage.SetTagCount(tag, value); } - } - - /// - /// Gets the length of the value in bytes. - /// - public uint Length - { - get { CheckDisposed(); return FreeImage.GetTagLength(tag); } - private set { FreeImage.SetTagLength(tag, value); } - } - - private unsafe byte[] GetData() - { - uint length = Length; - byte[] value = new byte[length]; - byte* ptr = (byte*)FreeImage.GetTagValue(tag); - for (int i = 0; i < length; i++) - { - value[i] = ptr[i]; - } - return value; - } - - /// - /// Gets or sets the value of the metadata. - /// - public object Value - { - get - { - unsafe - { - CheckDisposed(); - int cnt = (int)Count; - - if (Type == FREE_IMAGE_MDTYPE.FIDT_ASCII) - { - byte* value = (byte*)FreeImage.GetTagValue(tag); - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < cnt; i++) - { - sb.Append(Convert.ToChar(value[i])); - } - return sb.ToString(); - } - else if (Type == FREE_IMAGE_MDTYPE.FIDT_NOTYPE) - { - return null; - } - - Array array = Array.CreateInstance(idList[Type], Count); - void* src = (void*)FreeImage.GetTagValue(tag); - FreeImage.CopyMemory(array, src, Length); - return array; - } - } - set - { - SetValue(value); - } - } - - /// - /// Sets the value of the metadata. - /// In case value is of byte or byte[] is assumed. - /// In case value is of uint or uint[] is assumed. - /// - /// New data of the metadata. - /// True on success, false on failure. - /// - /// The data format is not supported. - /// - /// is null. - public bool SetValue(object value) - { - Type type = value.GetType(); - if (!typeList.ContainsKey(type)) - { - throw new NotSupportedException("The type of value is not supported"); - } - return SetValue(value, typeList[type]); - } - - /// - /// Sets the value of the metadata. - /// - /// New data of the metadata. - /// Type of the data. - /// True on success, false on failure. - /// - /// The data type is not supported. - /// - /// is null. - /// - /// and to not fit. - public bool SetValue(object value, FREE_IMAGE_MDTYPE type) - { - CheckDisposed(); - if ((!value.GetType().IsArray) && (!(value is string))) - { - Array array = Array.CreateInstance(value.GetType(), 1); - array.SetValue(value, 0); - return SetArrayValue(array, type); - } - return SetArrayValue(value, type); - } - - /// - /// Sets the value of this tag to the value of - /// using the given type. - /// - /// New value of the tag. - /// Data-type of the tag. - /// - /// - /// is a null reference. - /// - /// - /// is FIDT_ASCII and - /// is not String. - /// is not FIDT_ASCII and - /// is not Array. - /// - /// is FIDT_NOTYPE. - private unsafe bool SetArrayValue(object value, FREE_IMAGE_MDTYPE type) - { - if (value == null) - { - throw new ArgumentNullException("value"); - } - - byte[] data = null; - - if (type == FREE_IMAGE_MDTYPE.FIDT_ASCII) - { - string tempValue = value as string; - if (tempValue == null) - { - throw new ArgumentException("value"); - } - Type = type; - Length = Count = (uint)tempValue.Length; - data = new byte[Length]; - - for (int i = 0; i < tempValue.Length; i++) - { - data[i] = (byte)tempValue[i]; - } - } - else if (type == FREE_IMAGE_MDTYPE.FIDT_NOTYPE) - { - throw new NotSupportedException("type is not supported."); - } - else - { - Array array = value as Array; - if (array == null) - { - throw new ArgumentException("value"); - } - - if (array.Length != 0) - if (!CheckType(array.GetValue(0).GetType(), type)) - throw new ArgumentException("The type of value is incorrect."); - - Type = type; - Count = (uint)array.Length; - Length = (uint)(array.Length * Marshal.SizeOf(idList[type])); - data = new byte[Length]; - FreeImage.CopyMemory(data, array, Length); - } - - return FreeImage.SetTagValue(tag, data); - } - - private static bool CheckType(Type dataType, FREE_IMAGE_MDTYPE type) - { - if (dataType != null) - switch (type) - { - case FREE_IMAGE_MDTYPE.FIDT_ASCII: - return dataType == typeof(string); - case FREE_IMAGE_MDTYPE.FIDT_BYTE: - return dataType == typeof(byte); - case FREE_IMAGE_MDTYPE.FIDT_DOUBLE: - return dataType == typeof(double); - case FREE_IMAGE_MDTYPE.FIDT_FLOAT: - return dataType == typeof(float); - case FREE_IMAGE_MDTYPE.FIDT_IFD: - return dataType == typeof(uint); - case FREE_IMAGE_MDTYPE.FIDT_LONG: - return dataType == typeof(uint); - case FREE_IMAGE_MDTYPE.FIDT_NOTYPE: - return false; - case FREE_IMAGE_MDTYPE.FIDT_PALETTE: - return dataType == typeof(RGBQUAD); - case FREE_IMAGE_MDTYPE.FIDT_RATIONAL: - return dataType == typeof(FIURational); - case FREE_IMAGE_MDTYPE.FIDT_SBYTE: - return dataType == typeof(sbyte); - case FREE_IMAGE_MDTYPE.FIDT_SHORT: - return dataType == typeof(ushort); - case FREE_IMAGE_MDTYPE.FIDT_SLONG: - return dataType == typeof(int); - case FREE_IMAGE_MDTYPE.FIDT_SRATIONAL: - return dataType == typeof(FIRational); - case FREE_IMAGE_MDTYPE.FIDT_SSHORT: - return dataType == typeof(short); - case FREE_IMAGE_MDTYPE.FIDT_UNDEFINED: - return dataType == typeof(byte); - } - return false; - } - - /// - /// Add this metadata to an image. - /// - /// Handle to a FreeImage bitmap. - /// True on success, false on failure. - public bool AddToImage(FIBITMAP dib) - { - CheckDisposed(); - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - if (Key == null) - { - throw new ArgumentNullException("Key"); - } - if (!selfCreated) - { - tag = FreeImage.CloneTag(tag); - if (tag.IsNull) - { - throw new Exception("FreeImage.CloneTag() failed."); - } - selfCreated = true; - } - if (!FreeImage.SetMetadata(Model, dib, Key, tag)) - { - return false; - } - FREE_IMAGE_MDMODEL _model = Model; - string _key = Key; - selfCreated = false; - FreeImage.DeleteTag(tag); - return FreeImage.GetMetadata(_model, dib, _key, out tag); - } - - /// - /// Gets a .NET PropertyItem for this metadata tag. - /// - /// The .NET PropertyItem. - public unsafe System.Drawing.Imaging.PropertyItem GetPropertyItem() - { - System.Drawing.Imaging.PropertyItem item = FreeImage.CreatePropertyItem(); - item.Id = ID; - item.Len = (int)Length; - item.Type = (short)Type; - FreeImage.CopyMemory(item.Value = new byte[item.Len], FreeImage.GetTagValue(tag), item.Len); - return item; - } - - /// - /// Converts the value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - CheckDisposed(); - string fiString = FreeImage.TagToString(model, tag, 0); - - if (String.IsNullOrEmpty(fiString)) - { - return tag.ToString(); - } - else - { - return fiString; - } - } - - /// - /// Creates a deep copy of this . - /// - /// A deep copy of this . - public object Clone() - { - CheckDisposed(); - MetadataTag clone = new MetadataTag(); - clone.model = model; - clone.tag = FreeImage.CloneTag(tag); - clone.selfCreated = true; - return clone; - } - - /// - /// Tests whether the specified object is a instance - /// and is equivalent to this instance. - /// - /// The object to test. - /// true if is a instance - /// equivalent to this instance; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is MetadataTag) && (Equals((MetadataTag)obj))); - } - - /// - /// Tests whether the specified instance is equivalent to this instance. - /// - /// A instance to compare to this instance. - /// true if equivalent to this instance; - /// otherwise, false. - public bool Equals(MetadataTag other) - { - return (this == other); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return tag.GetHashCode(); - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is MetadataTag)) - { - throw new ArgumentException("obj"); - } - return CompareTo((MetadataTag)obj); - } - - /// - /// Compares the current instance with another object of the same type. - /// - /// An object to compare with this instance. - /// A 32-bit signed integer that indicates the relative order of the objects being compared. - public int CompareTo(MetadataTag other) - { - CheckDisposed(); - other.CheckDisposed(); - return tag.CompareTo(other.tag); - } - - /// - /// Releases all resources used by the instance. - /// - public void Dispose() - { - if (!disposed) - { - disposed = true; - if (selfCreated) - { - FreeImage.DeleteTag(tag); - tag = FITAG.Zero; - } - } - } - - /// - /// Gets whether this instance has already been disposed. - /// - public bool Disposed - { - get { return disposed; } - } - - /// - /// Throwns an in case - /// this instance has already been disposed. - /// - private void CheckDisposed() - { - if (disposed) - { - throw new ObjectDisposedException("The object has already been disposed."); - } - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/Palette.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/Palette.cs deleted file mode 100644 index c5cdfbe..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/Palette.cs +++ /dev/null @@ -1,422 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Drawing; -using System.IO; -using FreeImageAPI.Metadata; -using System.Runtime.InteropServices; -using System.Diagnostics; - -namespace FreeImageAPI -{ - /// - /// Provides methods for working with the standard bitmap palette. - /// - public sealed class Palette : MemoryArray - { - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private GCHandle paletteHandle; - - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private RGBQUAD[] array; - - /// - /// Initializes a new instance for the given FreeImage bitmap. - /// - /// Handle to a FreeImage bitmap. - /// is null. - /// is not - /// -or- - /// has more than 8bpp. - public Palette(FIBITMAP dib) - : base(FreeImage.GetPalette(dib), (int)FreeImage.GetColorsUsed(dib)) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - if (FreeImage.GetImageType(dib) != FREE_IMAGE_TYPE.FIT_BITMAP) - { - throw new ArgumentException("dib"); - } - if (FreeImage.GetBPP(dib) > 8u) - { - throw new ArgumentException("dib"); - } - } - - /// - /// Initializes a new instance for the given FITAG that contains - /// a palette. - /// - /// The tag containing the palette. - /// is null. - /// is not - /// . - public Palette(FITAG tag) - : base(FreeImage.GetTagValue(tag), (int)FreeImage.GetTagCount(tag)) - { - if (FreeImage.GetTagType(tag) != FREE_IMAGE_MDTYPE.FIDT_PALETTE) - { - throw new ArgumentException("tag"); - } - } - - /// - /// Initializes a new instance for the given MetadataTag that contains - /// a palette. - /// - /// The tag containing the palette. - /// is null. - /// is not - /// . - public Palette(MetadataTag tag) - : base(FreeImage.GetTagValue(tag.tag), (int)tag.Count) - { - if (FreeImage.GetTagType(tag) != FREE_IMAGE_MDTYPE.FIDT_PALETTE) - { - throw new ArgumentException("tag"); - } - } - - /// - /// Initializes a new instance for the given array of that contains - /// a palette. - /// - /// A RGBQUAD array containing the palette data to initialize this instance. - public Palette(RGBQUAD[] palette) - { - unsafe - { - this.array = (RGBQUAD[])palette.Clone(); - this.paletteHandle = GCHandle.Alloc(array, GCHandleType.Pinned); - - base.baseAddress = (byte*)this.paletteHandle.AddrOfPinnedObject(); - base.length = (int)this.array.Length; - - // Create an array containing a single element. - // Due to the fact, that it's not possible to create pointers - // of generic types, an array is used to obtain the memory - // address of an element of T. - base.buffer = new RGBQUAD[1]; - // The array is pinned immediately to prevent the GC from - // moving it to a different position in memory. - base.handle = GCHandle.Alloc(buffer, GCHandleType.Pinned); - // The array and its content have beed pinned, so that its address - // can be safely requested and stored for the whole lifetime - // of the instace. - base.ptr = (byte*)base.handle.AddrOfPinnedObject(); - } - } - - /// - /// Initializes a new instance for the given array of that contains - /// a palette. - /// - /// A Color array containing the palette data to initialize this instance. - public Palette(Color[] palette) - : this(RGBQUAD.ToRGBQUAD(palette)) - { - } - - /// - /// Initializes a new instance with the specified size. - /// - /// The size of the palette. - public Palette(int size) - : this(new RGBQUAD[size]) - { - } - - /// - /// Gets or sets the palette through an array of . - /// - public RGBQUAD[] AsArray - { - get - { - return Data; - } - set - { - Data = value; - } - } - - /// - /// Get an array of that the block of memory represents. - /// This property is used for internal palette operations. - /// - internal unsafe Color[] ColorData - { - get - { - EnsureNotDisposed(); - Color[] data = new Color[length]; - for (int i = 0; i < length; i++) - { - data[i] = Color.FromArgb((int)(((uint*)baseAddress)[i] | 0xFF000000)); - } - return data; - } - } - - /// - /// Returns the palette as an array of . - /// - /// The palette as an array of . - public RGBQUAD[] ToArray() - { - return Data; - } - - /// - /// Creates a linear palette based on the provided . - /// - /// The used to colorize the palette. - /// - /// Only call this method on linear palettes. - /// - public void Colorize(Color color) - { - Colorize(color, 0.5d); - } - - /// - /// Creates a linear palette based on the provided . - /// - /// The used to colorize the palette. - /// The position of the color within the new palette. - /// 0 < < 1. - /// - /// Only call this method on linear palettes. - /// - public void Colorize(Color color, double splitSize) - { - Colorize(color, (int)(length * splitSize)); - } - - /// - /// Creates a linear palette based on the provided . - /// - /// The used to colorize the palette. - /// The position of the color within the new palette. - /// 0 < < . - /// - /// Only call this method on linear palettes. - /// - public void Colorize(Color color, int splitSize) - { - EnsureNotDisposed(); - if (splitSize < 1 || splitSize >= length) - { - throw new ArgumentOutOfRangeException("splitSize"); - } - - RGBQUAD[] pal = new RGBQUAD[length]; - - double red = color.R; - double green = color.G; - double blue = color.B; - - int i = 0; - double r, g, b; - - r = red / splitSize; - g = green / splitSize; - b = blue / splitSize; - - for (; i <= splitSize; i++) - { - pal[i].rgbRed = (byte)(i * r); - pal[i].rgbGreen = (byte)(i * g); - pal[i].rgbBlue = (byte)(i * b); - } - - r = (255 - red) / (length - splitSize); - g = (255 - green) / (length - splitSize); - b = (255 - blue) / (length - splitSize); - - for (; i < length; i++) - { - pal[i].rgbRed = (byte)(red + ((i - splitSize) * r)); - pal[i].rgbGreen = (byte)(green + ((i - splitSize) * g)); - pal[i].rgbBlue = (byte)(blue + ((i - splitSize) * b)); - } - - Data = pal; - } - - /// - /// Creates a linear grayscale palette. - /// - public void CreateGrayscalePalette() - { - Colorize(Color.White, length - 1); - } - - /// - /// Creates a linear grayscale palette. - /// - /// true to create an inverse grayscale palette. - public void CreateGrayscalePalette(bool inverse) - { - Colorize(Color.White, inverse ? 0 : length - 1); - } - - /// - /// Creates a linear palette with the specified . - /// - /// - /// A linear grayscale palette contains all shades of colors from - /// black to white. This method creates a similar palette with the white - /// color being replaced by the specified color. - /// - /// The used to create the palette. - /// true to create an inverse palette. - public void CreateGrayscalePalette(Color color, bool inverse) - { - Colorize(color, inverse ? 0 : length - 1); - } - - /// - /// Reverses the palette. - /// - public void Reverse() - { - EnsureNotDisposed(); - if (array != null) - { - Array.Reverse(array); - } - else - { - RGBQUAD[] localArray = Data; - Array.Reverse(localArray); - Data = localArray; - } - } - - /// - /// Copies the values from the specified to this instance. - /// - /// The palette to copy from. - /// - /// is a null reference. - public void CopyFrom(Palette palette) - { - EnsureNotDisposed(); - if (palette == null) - { - throw new ArgumentNullException("palette"); - } - CopyFrom(palette.Data, 0, 0, Math.Min(palette.Length, this.Length)); - } - - /// - /// Copies the values from the specified to this instance, - /// starting at the specified . - /// - /// The palette to copy from. - /// The position in this instance where the values - /// will be copied to. - /// - /// is a null reference. - /// - /// is outside the range of valid indexes. - public void CopyFrom(Palette palette, int offset) - { - EnsureNotDisposed(); - CopyFrom(palette.Data, 0, offset, Math.Min(palette.Length, this.Length - offset)); - } - - /// - /// Saves this to the specified file. - /// - /// - /// A string that contains the name of the file to which to save this . - /// - public void Save(string filename) - { - using (Stream stream = new FileStream(filename, FileMode.Create, FileAccess.Write)) - { - Save(stream); - } - } - - /// - /// Saves this to the specified stream. - /// - /// - /// The where the image will be saved. - /// - public void Save(Stream stream) - { - Save(new BinaryWriter(stream)); - } - - /// - /// Saves this using the specified writer. - /// - /// - /// The used to save the image. - /// - public void Save(BinaryWriter writer) - { - EnsureNotDisposed(); - writer.Write(ToByteArray()); - } - - /// - /// Loads a palette from the specified file. - /// - /// The name of the palette file. - public void Load(string filename) - { - using (Stream stream = new FileStream(filename, FileMode.Open, FileAccess.Read)) - { - Load(stream); - } - } - - /// - /// Loads a palette from the specified stream. - /// - /// The stream to load the palette from. - public void Load(Stream stream) - { - Load(new BinaryReader(stream)); - } - - /// - /// Loads a palette from the reader. - /// - /// The reader to load the palette from. - public void Load(BinaryReader reader) - { - EnsureNotDisposed(); - unsafe - { - int size = length * sizeof(RGBQUAD); - byte[] data = reader.ReadBytes(size); - fixed (byte* src = data) - { - CopyMemory(baseAddress, src, data.Length); - } - } - } - - /// - /// Releases allocated handles associated with this instance. - /// - /// true to release managed resources. - protected override void Dispose(bool disposing) - { - if (paletteHandle.IsAllocated) - paletteHandle.Free(); - array = null; - - base.Dispose(disposing); - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/PluginRepository.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/PluginRepository.cs deleted file mode 100644 index cc658a7..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/PluginRepository.cs +++ /dev/null @@ -1,449 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; - -namespace FreeImageAPI.Plugins -{ - /// - /// Class representing all registered in FreeImage. - /// - public static class PluginRepository - { - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly List plugins = null; - - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly List localPlugins = null; - - static PluginRepository() - { - plugins = new List(FreeImage.GetFIFCount()); - localPlugins = new List(0); - for (int i = 0; i < plugins.Capacity; i++) - { - plugins.Add(new FreeImagePlugin((FREE_IMAGE_FORMAT)i)); - } - } - - /// - /// Adds local plugin to this class. - /// - /// The registered plugin. - internal static void RegisterLocalPlugin(LocalPlugin localPlugin) - { - FreeImagePlugin plugin = new FreeImagePlugin(localPlugin.Format); - plugins.Add(plugin); - localPlugins.Add(plugin); - } - - /// - /// Returns an instance of , representing the given format. - /// - /// The representing format. - /// An instance of . - public static FreeImagePlugin Plugin(FREE_IMAGE_FORMAT fif) - { - return Plugin((int)fif); - } - - /// - /// Returns an instance of , - /// representing the format at the given index. - /// - /// The index of the representing format. - /// An instance of . - public static FreeImagePlugin Plugin(int index) - { - return (index >= 0) ? plugins[index] : null; - } - - /// - /// Returns an instance of . - /// is searched in: - /// Format, RegExpr, - /// ValidExtension and ValidFilename. - /// - /// The expression to search for. - /// An instance of . - public static FreeImagePlugin Plugin(string expression) - { - FreeImagePlugin result = null; - expression = expression.ToLower(); - - foreach (FreeImagePlugin plugin in plugins) - { - if (plugin.Format.ToLower().Contains(expression) || - plugin.RegExpr.ToLower().Contains(expression) || - plugin.ValidExtension(expression, StringComparison.CurrentCultureIgnoreCase) || - plugin.ValidFilename(expression, StringComparison.CurrentCultureIgnoreCase)) - { - result = plugin; - break; - } - } - - return result; - } - - /// - /// Returns an instance of for the given format. - /// - /// The format of the Plugin. - /// An instance of . - public static FreeImagePlugin PluginFromFormat(string format) - { - return Plugin(FreeImage.GetFIFFromFormat(format)); - } - - /// - /// Returns an instance of for the given filename. - /// - /// The valid filename for the plugin. - /// An instance of . - public static FreeImagePlugin PluginFromFilename(string filename) - { - return Plugin(FreeImage.GetFIFFromFilename(filename)); - } - - /// - /// Returns an instance of for the given mime. - /// - /// The valid mime for the plugin. - /// An instance of . - public static FreeImagePlugin PluginFromMime(string mime) - { - return Plugin(FreeImage.GetFIFFromMime(mime)); - } - - /// - /// Gets the number of registered plugins. - /// - public static int FIFCount - { - get - { - return FreeImage.GetFIFCount(); - } - } - - /// - /// Gets a readonly collection of all plugins. - /// - public static ReadOnlyCollection PluginList - { - get - { - return plugins.AsReadOnly(); - } - } - - /// - /// Gets a list of plugins that are only able to - /// read but not to write. - /// - public static List ReadOnlyPlugins - { - get - { - List list = new List(); - foreach (FreeImagePlugin p in plugins) - { - if (p.SupportsReading && !p.SupportsWriting) - { - list.Add(p); - } - } - return list; - } - } - - /// - /// Gets a list of plugins that are only able to - /// write but not to read. - /// - public static List WriteOnlyPlugins - { - get - { - List list = new List(); - foreach (FreeImagePlugin p in plugins) - { - if (!p.SupportsReading && p.SupportsWriting) - { - list.Add(p); - } - } - return list; - } - } - - /// - /// Gets a list of plugins that are not able to - /// read or write. - /// - public static List StupidPlugins - { - get - { - List list = new List(); - foreach (FreeImagePlugin p in plugins) - { - if (!p.SupportsReading && !p.SupportsWriting) - { - list.Add(p); - } - } - return list; - } - } - - /// - /// Gets a list of plugins that are able to read. - /// - public static List ReadablePlugins - { - get - { - List list = new List(); - foreach (FreeImagePlugin p in plugins) - { - if (p.SupportsReading) - { - list.Add(p); - } - } - return list; - } - } - - /// - /// Gets a list of plugins that are able to write. - /// - public static List WriteablePlugins - { - get - { - List list = new List(); - foreach (FreeImagePlugin p in plugins) - { - if (p.SupportsWriting) - { - list.Add(p); - } - } - return list; - } - } - - /// - /// Gets a list of local plugins. - /// - public static ReadOnlyCollection LocalPlugins - { - get - { - return localPlugins.AsReadOnly(); - } - } - - /// - /// Gets a list of built-in plugins. - /// - public static List BuiltInPlugins - { - get - { - List list = new List(); - foreach (FreeImagePlugin p in plugins) - { - if (!localPlugins.Contains(p)) - { - list.Add(p); - } - } - return list; - } - } - - /// - /// Windows or OS/2 Bitmap File (*.BMP) - /// - public static FreeImagePlugin BMP { get { return plugins[0]; } } - - /// - /// Independent JPEG Group (*.JPG, *.JIF, *.JPEG, *.JPE) - /// - public static FreeImagePlugin ICO { get { return plugins[1]; } } - - /// - /// Independent JPEG Group (*.JPG, *.JIF, *.JPEG, *.JPE) - /// - public static FreeImagePlugin JPEG { get { return plugins[2]; } } - - /// - /// JPEG Network Graphics (*.JNG) - /// - public static FreeImagePlugin JNG { get { return plugins[3]; } } - - /// - /// Commodore 64 Koala format (*.KOA) - /// - public static FreeImagePlugin KOALA { get { return plugins[4]; } } - - /// - /// Amiga IFF (*.IFF, *.LBM) - /// - public static FreeImagePlugin LBM { get { return plugins[5]; } } - - /// - /// Amiga IFF (*.IFF, *.LBM) - /// - public static FreeImagePlugin IFF { get { return plugins[5]; } } - - /// - /// Multiple Network Graphics (*.MNG) - /// - public static FreeImagePlugin MNG { get { return plugins[6]; } } - - /// - /// Portable Bitmap (ASCII) (*.PBM) - /// - public static FreeImagePlugin PBM { get { return plugins[7]; } } - - /// - /// Portable Bitmap (BINARY) (*.PBM) - /// - public static FreeImagePlugin PBMRAW { get { return plugins[8]; } } - - /// - /// Kodak PhotoCD (*.PCD) - /// - public static FreeImagePlugin PCD { get { return plugins[9]; } } - - /// - /// Zsoft Paintbrush PCX bitmap format (*.PCX) - /// - public static FreeImagePlugin PCX { get { return plugins[10]; } } - - /// - /// Portable Graymap (ASCII) (*.PGM) - /// - public static FreeImagePlugin PGM { get { return plugins[11]; } } - - /// - /// Portable Graymap (BINARY) (*.PGM) - /// - public static FreeImagePlugin PGMRAW { get { return plugins[12]; } } - - /// - /// Portable Network Graphics (*.PNG) - /// - public static FreeImagePlugin PNG { get { return plugins[13]; } } - - /// - /// Portable Pixelmap (ASCII) (*.PPM) - /// - public static FreeImagePlugin PPM { get { return plugins[14]; } } - - /// - /// Portable Pixelmap (BINARY) (*.PPM) - /// - public static FreeImagePlugin PPMRAW { get { return plugins[15]; } } - - /// - /// Sun Rasterfile (*.RAS) - /// - public static FreeImagePlugin RAS { get { return plugins[16]; } } - - /// - /// truevision Targa files (*.TGA, *.TARGA) - /// - public static FreeImagePlugin TARGA { get { return plugins[17]; } } - - /// - /// Tagged Image File Format (*.TIF, *.TIFF) - /// - public static FreeImagePlugin TIFF { get { return plugins[18]; } } - - /// - /// Wireless Bitmap (*.WBMP) - /// - public static FreeImagePlugin WBMP { get { return plugins[19]; } } - - /// - /// Adobe Photoshop (*.PSD) - /// - public static FreeImagePlugin PSD { get { return plugins[20]; } } - - /// - /// Dr. Halo (*.CUT) - /// - public static FreeImagePlugin CUT { get { return plugins[21]; } } - - /// - /// X11 Bitmap Format (*.XBM) - /// - public static FreeImagePlugin XBM { get { return plugins[22]; } } - - /// - /// X11 Pixmap Format (*.XPM) - /// - public static FreeImagePlugin XPM { get { return plugins[23]; } } - - /// - /// DirectDraw Surface (*.DDS) - /// - public static FreeImagePlugin DDS { get { return plugins[24]; } } - - /// - /// Graphics Interchange Format (*.GIF) - /// - public static FreeImagePlugin GIF { get { return plugins[25]; } } - - /// - /// High Dynamic Range (*.HDR) - /// - public static FreeImagePlugin HDR { get { return plugins[26]; } } - - /// - /// Raw Fax format CCITT G3 (*.G3) - /// - public static FreeImagePlugin FAXG3 { get { return plugins[27]; } } - - /// - /// Silicon Graphics SGI image format (*.SGI) - /// - public static FreeImagePlugin SGI { get { return plugins[28]; } } - - /// - /// OpenEXR format (*.EXR) - /// - public static FreeImagePlugin EXR { get { return plugins[29]; } } - - /// - /// JPEG-2000 format (*.J2K, *.J2C) - /// - public static FreeImagePlugin J2K { get { return plugins[30]; } } - - /// - /// JPEG-2000 format (*.JP2) - /// - public static FreeImagePlugin JP2 { get { return plugins[31]; } } - - /// - /// Portable FloatMap (*.PFM) - /// - public static FreeImagePlugin PFM { get { return plugins[32]; } } - - /// - /// Macintosh PICT (*.PICT) - /// - public static FreeImagePlugin PICT { get { return plugins[33]; } } - - /// - /// RAW camera image (*.*) - /// - public static FreeImagePlugin RAW { get { return plugins[34]; } } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/Scanline.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/Scanline.cs deleted file mode 100644 index 6ad592d..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/Scanline.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Runtime.InteropServices; - -namespace FreeImageAPI -{ - /// - /// Provides methods for working with generic bitmap scanlines. - /// - /// Type of the bitmaps' scanlines. - public sealed class Scanline : MemoryArray where T : struct - { - /// - /// Initializes a new instance based on the specified FreeImage bitmap. - /// - /// Handle to a FreeImage bitmap. - public Scanline(FIBITMAP dib) - : this(dib, 0) - { - } - - /// - /// Initializes a new instance based on the specified FreeImage bitmap. - /// - /// Handle to a FreeImage bitmap. - /// Index of the zero based scanline. - public Scanline(FIBITMAP dib, int scanline) - : this(dib, scanline, (int)(typeof(T) == typeof(FI1BIT) ? - FreeImage.GetBPP(dib) * FreeImage.GetWidth(dib) : - typeof(T) == typeof(FI4BIT) ? - FreeImage.GetBPP(dib) * FreeImage.GetWidth(dib) / 4 : - (FreeImage.GetBPP(dib) * FreeImage.GetWidth(dib)) / (Marshal.SizeOf(typeof(T)) * 8))) - { - } - - internal Scanline(FIBITMAP dib, int scanline, int length) - : base(FreeImage.GetScanLine(dib, scanline), length) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - if ((scanline < 0) || (scanline >= FreeImage.GetHeight(dib))) - { - throw new ArgumentOutOfRangeException("scanline"); - } - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/StreamWrapper.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/StreamWrapper.cs deleted file mode 100644 index 2b8cba7..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Classes/StreamWrapper.cs +++ /dev/null @@ -1,312 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.6 $ -// $Date: 2009/02/23 12:28:56 $ -// $Id: StreamWrapper.cs,v 1.6 2009/02/23 12:28:56 cklein05 Exp $ -// ========================================================== - -using System; -using System.IO; -using System.Diagnostics; - -namespace FreeImageAPI.IO -{ - /// - /// Class wrapping streams, implementing a buffer for read data, - /// so that seek operations can be made. - /// - /// - /// FreeImage can load bitmaps from arbitrary sources. - /// .NET works with different streams like File- or NetConnection-strams. - /// NetConnection streams, which are used to load files from web servers, - /// for example cannot seek. - /// But FreeImage frequently uses the seek operation when loading bitmaps. - /// StreamWrapper wrapps a stream and makes it seekable by caching all read - /// data into an internal MemoryStream to jump back- and forward. - /// StreamWapper is for internal use and only for loading from streams. - /// - internal class StreamWrapper : Stream - { - /// - /// The stream to wrap - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private readonly Stream stream; - - /// - /// The caching stream - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private MemoryStream memoryStream = new MemoryStream(); - - /// - /// Indicates if the wrapped stream reached its end - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private bool eos = false; - - /// - /// Tells the wrapper to block readings or not - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private bool blocking = false; - - /// - /// Indicates if the wrapped stream is disposed or not - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private bool disposed = false; - - /// - /// Initializes a new instance based on the specified . - /// - /// The stream to wrap. - /// When true the wrapper always tries to read the requested - /// amount of data from the wrapped stream. - public StreamWrapper(Stream stream, bool blocking) - { - if (!stream.CanRead) - { - throw new ArgumentException("stream is not capable of reading."); - } - this.stream = stream; - this.blocking = blocking; - } - - /// - /// Releases all resources used by the instance. - /// - ~StreamWrapper() - { - Dispose(false); - } - - // The wrapper only accepts readable streams - public override bool CanRead - { - get { checkDisposed(); return true; } - } - - // We implement that feature - public override bool CanSeek - { - get { checkDisposed(); return true; } - } - - // The wrapper is readonly - public override bool CanWrite - { - get { checkDisposed(); return false; } - } - - // Just forward it - public override void Flush() - { - checkDisposed(); - stream.Flush(); - } - - // Calling this property will cause the wrapper to read the stream - // to its end and cache it completely. - public override long Length - { - get - { - checkDisposed(); - if (!eos) - { - Fill(); - } - return memoryStream.Length; - } - } - - // Gets or sets the current position - public override long Position - { - get - { - checkDisposed(); - return memoryStream.Position; - } - set - { - checkDisposed(); - Seek(value, SeekOrigin.Begin); - } - } - - // Implements the reading feature - public override int Read(byte[] buffer, int offset, int count) - { - checkDisposed(); - // total bytes read from memory-stream - int memoryBytes = 0; - // total bytes read from the original stream - int streamBytes = 0; - memoryBytes = memoryStream.Read(buffer, offset, count); - if ((count > memoryBytes) && (!eos)) - { - // read the rest from the original stream (can be 0 bytes) - do - { - int read = stream.Read( - buffer, - offset + memoryBytes + streamBytes, - count - memoryBytes - streamBytes); - streamBytes += read; - if (read == 0) - { - eos = true; - break; - } - if (!blocking) - { - break; - } - } while ((memoryBytes + streamBytes) < count); - // copy the bytes from the original stream into the memory stream - // if 0 bytes were read we write 0 so the memory-stream is not changed - memoryStream.Write(buffer, offset + memoryBytes, streamBytes); - } - return memoryBytes + streamBytes; - } - - // Implements the seeking feature - public override long Seek(long offset, SeekOrigin origin) - { - checkDisposed(); - long newPosition = 0L; - // get new position - switch (origin) - { - case SeekOrigin.Begin: - newPosition = offset; - break; - case SeekOrigin.Current: - newPosition = memoryStream.Position + offset; - break; - case SeekOrigin.End: - // to seek from the end have have to read to the end first - if (!eos) - { - Fill(); - } - newPosition = memoryStream.Length + offset; - break; - default: - throw new ArgumentOutOfRangeException("origin"); - } - // in case the new position is beyond the memory-streams end - // and the original streams end hasn't been reached - // the original stream is read until either the stream ends or - // enough bytes have been read - if ((newPosition > memoryStream.Length) && (!eos)) - { - memoryStream.Position = memoryStream.Length; - int bytesToRead = (int)(newPosition - memoryStream.Length); - byte[] buffer = new byte[1024]; - do - { - bytesToRead -= Read(buffer, 0, (bytesToRead >= buffer.Length) ? buffer.Length : bytesToRead); - } while ((bytesToRead > 0) && (!eos)); - } - memoryStream.Position = (newPosition <= memoryStream.Length) ? newPosition : memoryStream.Length; - return 0; - } - - // No write-support - public override void SetLength(long value) - { - throw new Exception("The method or operation is not implemented."); - } - - // No write-support - public override void Write(byte[] buffer, int offset, int count) - { - throw new Exception("The method or operation is not implemented."); - } - - public void Reset() - { - checkDisposed(); - Position = 0; - } - - // Reads the wrapped stream until its end. - private void Fill() - { - if (!eos) - { - memoryStream.Position = memoryStream.Length; - int bytesRead = 0; - byte[] buffer = new byte[1024]; - do - { - bytesRead = stream.Read(buffer, 0, buffer.Length); - memoryStream.Write(buffer, 0, bytesRead); - } while (bytesRead != 0); - eos = true; - } - } - - public new void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - private new void Dispose(bool disposing) - { - if (!disposed) - { - disposed = true; - if (disposing) - { - if (memoryStream != null) - { - memoryStream.Dispose(); - } - } - } - } - - public bool Disposed - { - get { return disposed; } - } - - private void checkDisposed() - { - if (disposed) throw new ObjectDisposedException("StreamWrapper"); - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Delegates.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Delegates.cs deleted file mode 100644 index ff8847e..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Delegates.cs +++ /dev/null @@ -1,191 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.4 $ -// $Date: 2009/09/15 11:39:10 $ -// $Id: Delegates.cs,v 1.4 2009/09/15 11:39:10 cklein05 Exp $ -// ========================================================== - -using System; -using System.IO; -using System.Runtime.InteropServices; -using FreeImageAPI.IO; - -namespace FreeImageAPI -{ - // Delegates used by the FreeImageIO structure - - /// - /// Delegate for capturing FreeImage error messages. - /// - /// The format of the image. - /// The errormessage. - // DLL_API is missing in the definition of the callbackfuntion. - [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi, ThrowOnUnmappableChar = false)] - public delegate void OutputMessageFunction(FREE_IMAGE_FORMAT fif, string message); -} - -namespace FreeImageAPI.IO -{ - /// - /// Delegate to the C++ function fread. - /// - /// Pointer to read from. - /// Item size in bytes. - /// Maximum number of items to be read. - /// Handle/stream to read from. - /// Number of full items actually read, - /// which may be less than count if an error occurs or - /// if the end of the file is encountered before reaching count. - public delegate uint ReadProc(IntPtr buffer, uint size, uint count, fi_handle handle); - - /// - /// Delegate to the C++ function fwrite. - /// - /// Pointer to data to be written. - /// Item size in bytes. - /// Maximum number of items to be written. - /// Handle/stream to write to. - /// Number of full items actually written, - /// which may be less than count if an error occurs. - /// Also, if an error occurs, the file-position indicator cannot be determined. - public delegate uint WriteProc(IntPtr buffer, uint size, uint count, fi_handle handle); - - /// - /// Delegate to the C++ function fseek. - /// - /// Handle/stream to seek in. - /// Number of bytes from origin. - /// Initial position. - /// If successful 0 is returned; otherwise a nonzero value. - public delegate int SeekProc(fi_handle handle, int offset, SeekOrigin origin); - - /// - /// Delegate to the C++ function ftell. - /// - /// Handle/stream to retrieve its currents position from. - /// The current position. - public delegate int TellProc(fi_handle handle); - - // Delegates used by 'Plugin' structure -} - -namespace FreeImageAPI.Plugins -{ - /// - /// Delegate to a function that returns a string which describes - /// the plugins format. - /// - public delegate string FormatProc(); - - /// - /// Delegate to a function that returns a string which contains - /// a more detailed description. - /// - public delegate string DescriptionProc(); - - /// - /// Delegate to a function that returns a comma seperated list - /// of file extensions the plugin can read or write. - /// - public delegate string ExtensionListProc(); - - /// - /// Delegate to a function that returns a regular expression that - /// can be used to idientify whether a file can be handled by the plugin. - /// - public delegate string RegExprProc(); - - /// - /// Delegate to a function that opens a file. - /// - public delegate IntPtr OpenProc(ref FreeImageIO io, fi_handle handle, bool read); - - /// - /// Delegate to a function that closes a previosly opened file. - /// - public delegate void CloseProc(ref FreeImageIO io, fi_handle handle, IntPtr data); - - /// - /// Delegate to a function that returns the number of pages of a multipage - /// bitmap if the plugin is capable of handling multipage bitmaps. - /// - public delegate int PageCountProc(ref FreeImageIO io, fi_handle handle, IntPtr data); - - /// - /// UNKNOWN - /// - public delegate int PageCapabilityProc(ref FreeImageIO io, fi_handle handle, IntPtr data); - - /// - /// Delegate to a function that loads and decodes a bitmap into memory. - /// - public delegate FIBITMAP LoadProc(ref FreeImageIO io, fi_handle handle, int page, int flags, IntPtr data); - - /// - /// Delegate to a function that saves a bitmap. - /// - public delegate bool SaveProc(ref FreeImageIO io, FIBITMAP dib, fi_handle handle, int page, int flags, IntPtr data); - - /// - /// Delegate to a function that determines whether the source defined - /// by and is a valid image. - /// - public delegate bool ValidateProc(ref FreeImageIO io, fi_handle handle); - - /// - /// Delegate to a function that returns a string which contains - /// the plugin's mime type. - /// - public delegate string MimeProc(); - - /// - /// Delegate to a function that returns whether the plugin can handle the - /// specified color depth. - /// - public delegate bool SupportsExportBPPProc(int bpp); - - /// - /// Delegate to a function that returns whether the plugin can handle the - /// specified image type. - /// - public delegate bool SupportsExportTypeProc(FREE_IMAGE_TYPE type); - - /// - /// Delegate to a function that returns whether the plugin can handle - /// ICC-Profiles. - /// - public delegate bool SupportsICCProfilesProc(); - - /// - /// Callback function used by FreeImage to register plugins. - /// - public delegate void InitProc(ref Plugin plugin, int format_id); -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/DisposalMethodType.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/DisposalMethodType.cs deleted file mode 100644 index ac2c1ee..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/DisposalMethodType.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace FreeImageAPI.Metadata -{ - /// - /// Specifies how a single frame will be handled after being displayed. - /// - public enum DisposalMethodType : byte - { - /// - /// Same behavior as but should not be used. - /// - Unspecified, - - /// - /// The image is left in place and will be overdrawn by the next image. - /// - Leave, - - /// - /// The area of the image will be blanked out by its background. - /// - Background, - - /// - /// Restores the the area of the image to the state it was before it - /// has been dawn. - /// - Previous, - } -} diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_COLOR_CHANNEL.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_COLOR_CHANNEL.cs deleted file mode 100644 index 859b7d1..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_COLOR_CHANNEL.cs +++ /dev/null @@ -1,84 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.1 $ -// $Date: 2007/11/28 15:33:40 $ -// $Id: FREE_IMAGE_COLOR_CHANNEL.cs,v 1.1 2007/11/28 15:33:40 cklein05 Exp $ -// ========================================================== - -namespace FreeImageAPI -{ - /// - /// Color channels. Constants used in color manipulation routines. - /// - public enum FREE_IMAGE_COLOR_CHANNEL - { - /// - /// Use red, green and blue channels - /// - FICC_RGB = 0, - /// - /// Use red channel - /// - FICC_RED = 1, - /// - /// Use green channel - /// - FICC_GREEN = 2, - /// - /// Use blue channel - /// - FICC_BLUE = 3, - /// - /// Use alpha channel - /// - FICC_ALPHA = 4, - /// - /// Use black channel - /// - FICC_BLACK = 5, - /// - /// Complex images: use real part - /// - FICC_REAL = 6, - /// - /// Complex images: use imaginary part - /// - FICC_IMAG = 7, - /// - /// Complex images: use magnitude - /// - FICC_MAG = 8, - /// - /// Complex images: use phase - /// - FICC_PHASE = 9 - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_COLOR_DEPTH.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_COLOR_DEPTH.cs deleted file mode 100644 index 2479ce7..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_COLOR_DEPTH.cs +++ /dev/null @@ -1,105 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.1 $ -// $Date: 2007/11/28 15:33:39 $ -// $Id: FREE_IMAGE_COLOR_DEPTH.cs,v 1.1 2007/11/28 15:33:39 cklein05 Exp $ -// ========================================================== - -namespace FreeImageAPI -{ - /// - /// Enumeration used for color conversions. - /// FREE_IMAGE_COLOR_DEPTH contains several colors to convert to. - /// The default value 'FICD_AUTO'. - /// - [System.Flags] - public enum FREE_IMAGE_COLOR_DEPTH - { - /// - /// Unknown. - /// - FICD_UNKNOWN = 0, - /// - /// Auto selected by the used algorithm. - /// - FICD_AUTO = FICD_UNKNOWN, - /// - /// 1-bit. - /// - FICD_01_BPP = 1, - /// - /// 1-bit using dithering. - /// - FICD_01_BPP_DITHER = FICD_01_BPP, - /// - /// 1-bit using threshold. - /// - FICD_01_BPP_THRESHOLD = FICD_01_BPP | 2, - /// - /// 4-bit. - /// - FICD_04_BPP = 4, - /// - /// 8-bit. - /// - FICD_08_BPP = 8, - /// - /// 16-bit 555 (1 bit remains unused). - /// - FICD_16_BPP_555 = FICD_16_BPP | 2, - /// - /// 16-bit 565 (all bits are used). - /// - FICD_16_BPP = 16, - /// - /// 24-bit. - /// - FICD_24_BPP = 24, - /// - /// 32-bit. - /// - FICD_32_BPP = 32, - /// - /// Reorder palette (make it linear). Only affects 1-, 4- and 8-bit images. - /// The palette is only reordered in case the image is greyscale - /// (all palette entries have the same red, green and blue value). - /// - FICD_REORDER_PALETTE = 1024, - /// - /// Converts the image to greyscale. - /// - FICD_FORCE_GREYSCALE = 2048, - /// - /// Flag to mask out all non color depth flags. - /// - FICD_COLOR_MASK = FICD_01_BPP | FICD_04_BPP | FICD_08_BPP | FICD_16_BPP | FICD_24_BPP | FICD_32_BPP - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_COLOR_OPTIONS.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_COLOR_OPTIONS.cs deleted file mode 100644 index 302f6bb..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_COLOR_OPTIONS.cs +++ /dev/null @@ -1,68 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.1 $ -// $Date: 2009/09/15 11:44:24 $ -// $Id: FREE_IMAGE_COLOR_OPTIONS.cs,v 1.1 2009/09/15 11:44:24 cklein05 Exp $ -// ========================================================== - -namespace FreeImageAPI -{ - /// - /// Constants used in color filling routines. - /// - public enum FREE_IMAGE_COLOR_OPTIONS - { - /// - /// Default value. - /// - FICO_DEFAULT = 0x0, - /// - /// color is RGB color (contains no valid alpha channel). - /// - FICO_RGB = 0x0, - /// - /// color is RGBA color (contains a valid alpha channel). - /// - FICO_RGBA = 0x1, - /// - /// Lookup nearest RGB color from palette. - /// - FICO_NEAREST_COLOR = 0x0, - /// - /// Lookup equal RGB color from palette. - /// - FICO_EQUAL_COLOR = 0x2, - /// - /// contains the palette index to be used. - /// - FICO_ALPHA_IS_INDEX = 0x4, - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_COLOR_TYPE.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_COLOR_TYPE.cs deleted file mode 100644 index f69c64d..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_COLOR_TYPE.cs +++ /dev/null @@ -1,68 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.1 $ -// $Date: 2007/11/28 15:33:40 $ -// $Id: FREE_IMAGE_COLOR_TYPE.cs,v 1.1 2007/11/28 15:33:40 cklein05 Exp $ -// ========================================================== - -namespace FreeImageAPI -{ - /// - /// Image color types used in FreeImage. - /// - public enum FREE_IMAGE_COLOR_TYPE - { - /// - /// min value is white - /// - FIC_MINISWHITE = 0, - /// - /// min value is black - /// - FIC_MINISBLACK = 1, - /// - /// RGB color model - /// - FIC_RGB = 2, - /// - /// color map indexed - /// - FIC_PALETTE = 3, - /// - /// RGB color model with alpha channel - /// - FIC_RGBALPHA = 4, - /// - /// CMYK color model - /// - FIC_CMYK = 5 - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_COMPARE_FLAGS.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_COMPARE_FLAGS.cs deleted file mode 100644 index 69b3035..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_COMPARE_FLAGS.cs +++ /dev/null @@ -1,65 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.1 $ -// $Date: 2007/11/28 15:33:40 $ -// $Id: FREE_IMAGE_COMPARE_FLAGS.cs,v 1.1 2007/11/28 15:33:40 cklein05 Exp $ -// ========================================================== - -namespace FreeImageAPI -{ - /// - /// List of combinable compare modes. - /// - [System.Flags] - public enum FREE_IMAGE_COMPARE_FLAGS - { - /// - /// Compare headers. - /// - HEADER = 0x1, - /// - /// Compare palettes. - /// - PALETTE = 0x2, - /// - /// Compare pixel data. - /// - DATA = 0x4, - /// - /// Compare meta data. - /// - METADATA = 0x8, - /// - /// Compare everything. - /// - COMPLETE = (HEADER | PALETTE | DATA | METADATA) - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_DITHER.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_DITHER.cs deleted file mode 100644 index c1c87f8..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_DITHER.cs +++ /dev/null @@ -1,73 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.1 $ -// $Date: 2007/11/28 15:33:40 $ -// $Id: FREE_IMAGE_DITHER.cs,v 1.1 2007/11/28 15:33:40 cklein05 Exp $ -// ========================================================== - -namespace FreeImageAPI -{ - /// - /// Dithering algorithms. - /// Constants used in FreeImage_Dither. - /// - public enum FREE_IMAGE_DITHER - { - /// - /// Floyd and Steinberg error diffusion - /// - FID_FS = 0, - /// - /// Bayer ordered dispersed dot dithering (order 2 dithering matrix) - /// - FID_BAYER4x4 = 1, - /// - /// Bayer ordered dispersed dot dithering (order 3 dithering matrix) - /// - FID_BAYER8x8 = 2, - /// - /// Ordered clustered dot dithering (order 3 - 6x6 matrix) - /// - FID_CLUSTER6x6 = 3, - /// - /// Ordered clustered dot dithering (order 4 - 8x8 matrix) - /// - FID_CLUSTER8x8 = 4, - /// - /// Ordered clustered dot dithering (order 8 - 16x16 matrix) - /// - FID_CLUSTER16x16 = 5, - /// - /// Bayer ordered dispersed dot dithering (order 4 dithering matrix) - /// - FID_BAYER16x16 = 6 - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_FILTER.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_FILTER.cs deleted file mode 100644 index 3d54566..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_FILTER.cs +++ /dev/null @@ -1,68 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.1 $ -// $Date: 2007/11/28 15:33:39 $ -// $Id: FREE_IMAGE_FILTER.cs,v 1.1 2007/11/28 15:33:39 cklein05 Exp $ -// ========================================================== - -namespace FreeImageAPI -{ - /// - /// Upsampling / downsampling filters. Constants used in FreeImage_Rescale. - /// - public enum FREE_IMAGE_FILTER - { - /// - /// Box, pulse, Fourier window, 1st order (constant) b-spline - /// - FILTER_BOX = 0, - /// - /// Mitchell and Netravali's two-param cubic filter - /// - FILTER_BICUBIC = 1, - /// - /// Bilinear filter - /// - FILTER_BILINEAR = 2, - /// - /// 4th order (cubic) b-spline - /// - FILTER_BSPLINE = 3, - /// - /// Catmull-Rom spline, Overhauser spline - /// - FILTER_CATMULLROM = 4, - /// - /// Lanczos3 filter - /// - FILTER_LANCZOS3 = 5 - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_FORMAT.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_FORMAT.cs deleted file mode 100644 index e57fb0e..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_FORMAT.cs +++ /dev/null @@ -1,192 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.2 $ -// $Date: 2009/09/15 11:44:42 $ -// $Id: FREE_IMAGE_FORMAT.cs,v 1.2 2009/09/15 11:44:42 cklein05 Exp $ -// ========================================================== - -namespace FreeImageAPI -{ - /// - /// I/O image format identifiers. - /// - public enum FREE_IMAGE_FORMAT - { - /// - /// Unknown format (returned value only, never use it as input value) - /// - FIF_UNKNOWN = -1, - /// - /// Windows or OS/2 Bitmap File (*.BMP) - /// - FIF_BMP = 0, - /// - /// Windows Icon (*.ICO) - /// - FIF_ICO = 1, - /// - /// Independent JPEG Group (*.JPG, *.JIF, *.JPEG, *.JPE) - /// - FIF_JPEG = 2, - /// - /// JPEG Network Graphics (*.JNG) - /// - FIF_JNG = 3, - /// - /// Commodore 64 Koala format (*.KOA) - /// - FIF_KOALA = 4, - /// - /// Amiga IFF (*.IFF, *.LBM) - /// - FIF_LBM = 5, - /// - /// Amiga IFF (*.IFF, *.LBM) - /// - FIF_IFF = 5, - /// - /// Multiple Network Graphics (*.MNG) - /// - FIF_MNG = 6, - /// - /// Portable Bitmap (ASCII) (*.PBM) - /// - FIF_PBM = 7, - /// - /// Portable Bitmap (BINARY) (*.PBM) - /// - FIF_PBMRAW = 8, - /// - /// Kodak PhotoCD (*.PCD) - /// - FIF_PCD = 9, - /// - /// Zsoft Paintbrush PCX bitmap format (*.PCX) - /// - FIF_PCX = 10, - /// - /// Portable Graymap (ASCII) (*.PGM) - /// - FIF_PGM = 11, - /// - /// Portable Graymap (BINARY) (*.PGM) - /// - FIF_PGMRAW = 12, - /// - /// Portable Network Graphics (*.PNG) - /// - FIF_PNG = 13, - /// - /// Portable Pixelmap (ASCII) (*.PPM) - /// - FIF_PPM = 14, - /// - /// Portable Pixelmap (BINARY) (*.PPM) - /// - FIF_PPMRAW = 15, - /// - /// Sun Rasterfile (*.RAS) - /// - FIF_RAS = 16, - /// - /// truevision Targa files (*.TGA, *.TARGA) - /// - FIF_TARGA = 17, - /// - /// Tagged Image File Format (*.TIF, *.TIFF) - /// - FIF_TIFF = 18, - /// - /// Wireless Bitmap (*.WBMP) - /// - FIF_WBMP = 19, - /// - /// Adobe Photoshop (*.PSD) - /// - FIF_PSD = 20, - /// - /// Dr. Halo (*.CUT) - /// - FIF_CUT = 21, - /// - /// X11 Bitmap Format (*.XBM) - /// - FIF_XBM = 22, - /// - /// X11 Pixmap Format (*.XPM) - /// - FIF_XPM = 23, - /// - /// DirectDraw Surface (*.DDS) - /// - FIF_DDS = 24, - /// - /// Graphics Interchange Format (*.GIF) - /// - FIF_GIF = 25, - /// - /// High Dynamic Range (*.HDR) - /// - FIF_HDR = 26, - /// - /// Raw Fax format CCITT G3 (*.G3) - /// - FIF_FAXG3 = 27, - /// - /// Silicon Graphics SGI image format (*.SGI) - /// - FIF_SGI = 28, - /// - /// OpenEXR format (*.EXR) - /// - FIF_EXR = 29, - /// - /// JPEG-2000 format (*.J2K, *.J2C) - /// - FIF_J2K = 30, - /// - /// JPEG-2000 format (*.JP2) - /// - FIF_JP2 = 31, - /// - /// Portable FloatMap (*.PFM) - /// - FIF_PFM = 32, - /// - /// Macintosh PICT (*.PICT) - /// - FIF_PICT = 33, - /// - /// RAW camera image (*.*) - /// - FIF_RAW = 34, - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_JPEG_OPERATION.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_JPEG_OPERATION.cs deleted file mode 100644 index e76dc22..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_JPEG_OPERATION.cs +++ /dev/null @@ -1,76 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.1 $ -// $Date: 2007/11/28 15:33:38 $ -// $Id: FREE_IMAGE_JPEG_OPERATION.cs,v 1.1 2007/11/28 15:33:38 cklein05 Exp $ -// ========================================================== - -namespace FreeImageAPI -{ - /// - /// Lossless JPEG transformations constants used in FreeImage_JPEGTransform. - /// - public enum FREE_IMAGE_JPEG_OPERATION - { - /// - /// no transformation - /// - FIJPEG_OP_NONE = 0, - /// - /// horizontal flip - /// - FIJPEG_OP_FLIP_H = 1, - /// - /// vertical flip - /// - FIJPEG_OP_FLIP_V = 2, - /// - /// transpose across UL-to-LR axis - /// - FIJPEG_OP_TRANSPOSE = 3, - /// - /// transpose across UR-to-LL axis - /// - FIJPEG_OP_TRANSVERSE = 4, - /// - /// 90-degree clockwise rotation - /// - FIJPEG_OP_ROTATE_90 = 5, - /// - /// 180-degree rotation - /// - FIJPEG_OP_ROTATE_180 = 6, - /// - /// 270-degree clockwise (or 90 ccw) - /// - FIJPEG_OP_ROTATE_270 = 7 - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_LOAD_FLAGS.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_LOAD_FLAGS.cs deleted file mode 100644 index 0f8c91b..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_LOAD_FLAGS.cs +++ /dev/null @@ -1,111 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.2 $ -// $Date: 2009/09/15 11:45:16 $ -// $Id: FREE_IMAGE_LOAD_FLAGS.cs,v 1.2 2009/09/15 11:45:16 cklein05 Exp $ -// ========================================================== - -namespace FreeImageAPI -{ - /// - /// Flags used in load functions. - /// - [System.Flags] - public enum FREE_IMAGE_LOAD_FLAGS - { - /// - /// Default option for all types. - /// - DEFAULT = 0, - /// - /// Load the image as a 256 color image with ununsed palette entries, if it's 16 or 2 color. - /// - GIF_LOAD256 = 1, - /// - /// 'Play' the GIF to generate each frame (as 32bpp) instead of returning raw frame data when loading. - /// - GIF_PLAYBACK = 2, - /// - /// Convert to 32bpp and create an alpha channel from the AND-mask when loading. - /// - ICO_MAKEALPHA = 1, - /// - /// Load the file as fast as possible, sacrificing some quality. - /// - JPEG_FAST = 0x0001, - /// - /// Load the file with the best quality, sacrificing some speed. - /// - JPEG_ACCURATE = 0x0002, - /// - /// Load separated CMYK "as is" (use | to combine with other load flags). - /// - JPEG_CMYK = 0x0004, - /// - /// Load and rotate according to Exif 'Orientation' tag if available. - /// - JPEG_EXIFROTATE = 0x0008, - /// - /// Load the bitmap sized 768 x 512. - /// - PCD_BASE = 1, - /// - /// Load the bitmap sized 384 x 256. - /// - PCD_BASEDIV4 = 2, - /// - /// Load the bitmap sized 192 x 128. - /// - PCD_BASEDIV16 = 3, - /// - /// Avoid gamma correction. - /// - PNG_IGNOREGAMMA = 1, - /// - /// If set the loader converts RGB555 and ARGB8888 -> RGB888. - /// - TARGA_LOAD_RGB888 = 1, - /// - /// Reads tags for separated CMYK. - /// - TIFF_CMYK = 0x0001, - /// - /// Tries to load the JPEG preview image, embedded in - /// Exif Metadata or load the image as RGB 24-bit if no - /// preview image is available. - /// - RAW_PREVIEW = 0x1, - /// - /// Loads the image as RGB 24-bit. - /// - RAW_DISPLAY = 0x2, - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_MDMODEL.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_MDMODEL.cs deleted file mode 100644 index 4fb4f66..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_MDMODEL.cs +++ /dev/null @@ -1,92 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.1 $ -// $Date: 2007/11/28 15:33:39 $ -// $Id: FREE_IMAGE_MDMODEL.cs,v 1.1 2007/11/28 15:33:39 cklein05 Exp $ -// ========================================================== - -namespace FreeImageAPI -{ - /// - /// Metadata models supported by FreeImage. - /// - public enum FREE_IMAGE_MDMODEL - { - /// - /// No data - /// - FIMD_NODATA = -1, - /// - /// single comment or keywords - /// - FIMD_COMMENTS = 0, - /// - /// Exif-TIFF metadata - /// - FIMD_EXIF_MAIN = 1, - /// - /// Exif-specific metadata - /// - FIMD_EXIF_EXIF = 2, - /// - /// Exif GPS metadata - /// - FIMD_EXIF_GPS = 3, - /// - /// Exif maker note metadata - /// - FIMD_EXIF_MAKERNOTE = 4, - /// - /// Exif interoperability metadata - /// - FIMD_EXIF_INTEROP = 5, - /// - /// IPTC/NAA metadata - /// - FIMD_IPTC = 6, - /// - /// Abobe XMP metadata - /// - FIMD_XMP = 7, - /// - /// GeoTIFF metadata - /// - FIMD_GEOTIFF = 8, - /// - /// Animation metadata - /// - FIMD_ANIMATION = 9, - /// - /// Used to attach other metadata types to a dib - /// - FIMD_CUSTOM = 10 - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_MDTYPE.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_MDTYPE.cs deleted file mode 100644 index 60a0d11..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_MDTYPE.cs +++ /dev/null @@ -1,105 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.1 $ -// $Date: 2007/11/28 15:33:39 $ -// $Id: FREE_IMAGE_MDTYPE.cs,v 1.1 2007/11/28 15:33:39 cklein05 Exp $ -// ========================================================== - -namespace FreeImageAPI -{ - /// - /// Tag data type information (based on TIFF specifications) - /// Note: RATIONALs are the ratio of two 32-bit integer values. - /// - public enum FREE_IMAGE_MDTYPE - { - /// - /// placeholder - /// - FIDT_NOTYPE = 0, - /// - /// 8-bit unsigned integer - /// - FIDT_BYTE = 1, - /// - /// 8-bit bytes w/ last byte null - /// - FIDT_ASCII = 2, - /// - /// 16-bit unsigned integer - /// - FIDT_SHORT = 3, - /// - /// 32-bit unsigned integer - /// - FIDT_LONG = 4, - /// - /// 64-bit unsigned fraction - /// - FIDT_RATIONAL = 5, - /// - /// 8-bit signed integer - /// - FIDT_SBYTE = 6, - /// - /// 8-bit untyped data - /// - FIDT_UNDEFINED = 7, - /// - /// 16-bit signed integer - /// - FIDT_SSHORT = 8, - /// - /// 32-bit signed integer - /// - FIDT_SLONG = 9, - /// - /// 64-bit signed fraction - /// - FIDT_SRATIONAL = 10, - /// - /// 32-bit IEEE floating point - /// - FIDT_FLOAT = 11, - /// - /// 64-bit IEEE floating point - /// - FIDT_DOUBLE = 12, - /// - /// 32-bit unsigned integer (offset) - /// - FIDT_IFD = 13, - /// - /// 32-bit RGBQUAD - /// - FIDT_PALETTE = 14 - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_METADATA_COPY.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_METADATA_COPY.cs deleted file mode 100644 index f0d4a8c..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_METADATA_COPY.cs +++ /dev/null @@ -1,56 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.1 $ -// $Date: 2007/11/28 15:33:39 $ -// $Id: FREE_IMAGE_METADATA_COPY.cs,v 1.1 2007/11/28 15:33:39 cklein05 Exp $ -// ========================================================== - -namespace FreeImageAPI -{ - /// - /// Flags for copying data from a bitmap to another. - /// - public enum FREE_IMAGE_METADATA_COPY - { - /// - /// Exisiting metadata will remain unchanged. - /// - KEEP_EXISITNG = 0x0, - /// - /// Existing metadata will be cleared. - /// - CLEAR_EXISTING = 0x1, - /// - /// Existing metadata will be overwritten. - /// - REPLACE_EXISTING = 0x2 - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_QUANTIZE.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_QUANTIZE.cs deleted file mode 100644 index 3aeace2..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_QUANTIZE.cs +++ /dev/null @@ -1,53 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.1 $ -// $Date: 2007/11/28 15:33:39 $ -// $Id: FREE_IMAGE_QUANTIZE.cs,v 1.1 2007/11/28 15:33:39 cklein05 Exp $ -// ========================================================== - -namespace FreeImageAPI -{ - /// - /// Color quantization algorithms. - /// Constants used in FreeImage_ColorQuantize. - /// - public enum FREE_IMAGE_QUANTIZE - { - /// - /// Xiaolin Wu color quantization algorithm - /// - FIQ_WUQUANT = 0, - /// - /// NeuQuant neural-net quantization algorithm by Anthony Dekker - /// - FIQ_NNQUANT = 1 - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_SAVE_FLAGS.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_SAVE_FLAGS.cs deleted file mode 100644 index ad1fc55..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_SAVE_FLAGS.cs +++ /dev/null @@ -1,191 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.3 $ -// $Date: 2011/12/22 14:53:28 $ -// $Id: FREE_IMAGE_SAVE_FLAGS.cs,v 1.3 2011/12/22 14:53:28 drolon Exp $ -// ========================================================== - -namespace FreeImageAPI -{ - /// - /// Flags used in save functions. - /// - [System.Flags] - public enum FREE_IMAGE_SAVE_FLAGS - { - /// - /// Default option for all types. - /// - DEFAULT = 0, - /// - /// Save with run length encoding. - /// - BMP_SAVE_RLE = 1, - /// - /// Save data as float instead of as half (not recommended). - /// - EXR_FLOAT = 0x0001, - /// - /// Save with no compression. - /// - EXR_NONE = 0x0002, - /// - /// Save with zlib compression, in blocks of 16 scan lines. - /// - EXR_ZIP = 0x0004, - /// - /// Save with piz-based wavelet compression. - /// - EXR_PIZ = 0x0008, - /// - /// Save with lossy 24-bit float compression. - /// - EXR_PXR24 = 0x0010, - /// - /// Save with lossy 44% float compression - goes to 22% when combined with EXR_LC. - /// - EXR_B44 = 0x0020, - /// - /// Save images with one luminance and two chroma channels, rather than as RGB (lossy compression). - /// - EXR_LC = 0x0040, - /// - /// Save with superb quality (100:1). - /// - JPEG_QUALITYSUPERB = 0x80, - /// - /// Save with good quality (75:1). - /// - JPEG_QUALITYGOOD = 0x0100, - /// - /// Save with normal quality (50:1). - /// - JPEG_QUALITYNORMAL = 0x0200, - /// - /// Save with average quality (25:1). - /// - JPEG_QUALITYAVERAGE = 0x0400, - /// - /// Save with bad quality (10:1). - /// - JPEG_QUALITYBAD = 0x0800, - /// - /// Save as a progressive-JPEG (use | to combine with other save flags). - /// - JPEG_PROGRESSIVE = 0x2000, - /// - /// Save with high 4x1 chroma subsampling (4:1:1). - /// - JPEG_SUBSAMPLING_411 = 0x1000, - /// - /// Save with medium 2x2 medium chroma (4:2:0). - /// - JPEG_SUBSAMPLING_420 = 0x4000, - /// - /// Save with low 2x1 chroma subsampling (4:2:2). - /// - JPEG_SUBSAMPLING_422 = 0x8000, - /// - /// Save with no chroma subsampling (4:4:4). - /// - JPEG_SUBSAMPLING_444 = 0x10000, - /// - /// On saving, compute optimal Huffman coding tables (can reduce a few percent of file size). - /// - JPEG_OPTIMIZE = 0x20000, - /// - /// save basic JPEG, without metadata or any markers. - /// - JPEG_BASELINE = 0x40000, - /// - /// Save using ZLib level 1 compression flag - /// (default value is ). - /// - PNG_Z_BEST_SPEED = 0x0001, - /// - /// Save using ZLib level 6 compression flag (default recommended value). - /// - PNG_Z_DEFAULT_COMPRESSION = 0x0006, - /// - /// save using ZLib level 9 compression flag - /// (default value is ). - /// - PNG_Z_BEST_COMPRESSION = 0x0009, - /// - /// Save without ZLib compression. - /// - PNG_Z_NO_COMPRESSION = 0x0100, - /// - /// Save using Adam7 interlacing (use | to combine with other save flags). - /// - PNG_INTERLACED = 0x0200, - /// - /// If set the writer saves in ASCII format (i.e. P1, P2 or P3). - /// - PNM_SAVE_ASCII = 1, - /// - /// Stores tags for separated CMYK (use | to combine with compression flags). - /// - TIFF_CMYK = 0x0001, - /// - /// Save using PACKBITS compression. - /// - TIFF_PACKBITS = 0x0100, - /// - /// Save using DEFLATE compression (a.k.a. ZLIB compression). - /// - TIFF_DEFLATE = 0x0200, - /// - /// Save using ADOBE DEFLATE compression. - /// - TIFF_ADOBE_DEFLATE = 0x0400, - /// - /// Save without any compression. - /// - TIFF_NONE = 0x0800, - /// - /// Save using CCITT Group 3 fax encoding. - /// - TIFF_CCITTFAX3 = 0x1000, - /// - /// Save using CCITT Group 4 fax encoding. - /// - TIFF_CCITTFAX4 = 0x2000, - /// - /// Save using LZW compression. - /// - TIFF_LZW = 0x4000, - /// - /// Save using JPEG compression. - /// - TIFF_JPEG = 0x8000 - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_TMO.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_TMO.cs deleted file mode 100644 index 5f3b9fd..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_TMO.cs +++ /dev/null @@ -1,56 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.1 $ -// $Date: 2007/11/28 15:33:39 $ -// $Id: FREE_IMAGE_TMO.cs,v 1.1 2007/11/28 15:33:39 cklein05 Exp $ -// ========================================================== - -namespace FreeImageAPI -{ - /// - /// Tone mapping operators. Constants used in FreeImage_ToneMapping. - /// - public enum FREE_IMAGE_TMO - { - /// - /// Adaptive logarithmic mapping (F. Drago, 2003) - /// - FITMO_DRAGO03 = 0, - /// - /// Dynamic range reduction inspired by photoreceptor physiology (E. Reinhard, 2005) - /// - FITMO_REINHARD05 = 1, - /// - /// Gradient domain high dynamic range compression (R. Fattal, 2002) - /// - FITMO_FATTAL02 - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_TYPE.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_TYPE.cs deleted file mode 100644 index eeeb43e..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/FREE_IMAGE_TYPE.cs +++ /dev/null @@ -1,96 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.1 $ -// $Date: 2007/11/28 15:33:40 $ -// $Id: FREE_IMAGE_TYPE.cs,v 1.1 2007/11/28 15:33:40 cklein05 Exp $ -// ========================================================== - -namespace FreeImageAPI -{ - /// - /// Image types used in FreeImage. - /// - public enum FREE_IMAGE_TYPE - { - /// - /// unknown type - /// - FIT_UNKNOWN = 0, - /// - /// standard image : 1-, 4-, 8-, 16-, 24-, 32-bit - /// - FIT_BITMAP = 1, - /// - /// array of unsigned short : unsigned 16-bit - /// - FIT_UINT16 = 2, - /// - /// array of short : signed 16-bit - /// - FIT_INT16 = 3, - /// - /// array of unsigned long : unsigned 32-bit - /// - FIT_UINT32 = 4, - /// - /// array of long : signed 32-bit - /// - FIT_INT32 = 5, - /// - /// array of float : 32-bit IEEE floating point - /// - FIT_FLOAT = 6, - /// - /// array of double : 64-bit IEEE floating point - /// - FIT_DOUBLE = 7, - /// - /// array of FICOMPLEX : 2 x 64-bit IEEE floating point - /// - FIT_COMPLEX = 8, - /// - /// 48-bit RGB image : 3 x 16-bit - /// - FIT_RGB16 = 9, - /// - /// 64-bit RGBA image : 4 x 16-bit - /// - FIT_RGBA16 = 10, - /// - /// 96-bit RGB float image : 3 x 32-bit IEEE floating point - /// - FIT_RGBF = 11, - /// - /// 128-bit RGBA float image : 4 x 32-bit IEEE floating point - /// - FIT_RGBAF = 12 - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/ICC_FLAGS.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/ICC_FLAGS.cs deleted file mode 100644 index cf1f6cd..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/ICC_FLAGS.cs +++ /dev/null @@ -1,53 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.1 $ -// $Date: 2007/11/28 15:33:38 $ -// $Id: ICC_FLAGS.cs,v 1.1 2007/11/28 15:33:38 cklein05 Exp $ -// ========================================================== - -namespace FreeImageAPI -{ - /// - /// Flags for ICC profiles. - /// - [System.Flags] - public enum ICC_FLAGS : ushort - { - /// - /// Default value. - /// - FIICC_DEFAULT = 0x00, - /// - /// The color is CMYK. - /// - FIICC_COLOR_IS_CMYK = 0x01 - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/MD_SEARCH_FLAGS.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/MD_SEARCH_FLAGS.cs deleted file mode 100644 index aa91715..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Enumerations/MD_SEARCH_FLAGS.cs +++ /dev/null @@ -1,57 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.1 $ -// $Date: 2007/11/28 15:33:40 $ -// $Id: MD_SEARCH_FLAGS.cs,v 1.1 2007/11/28 15:33:40 cklein05 Exp $ -// ========================================================== - -namespace FreeImageAPI -{ - /// - /// List different search modes. - /// - [System.Flags] - public enum MD_SEARCH_FLAGS - { - /// - /// The key of the metadata. - /// - KEY = 0x1, - /// - /// The description of the metadata - /// - DESCRIPTION = 0x2, - /// - /// The ToString value of the metadata - /// - TOSTRING = 0x4, - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/FreeImageStaticImports.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/FreeImageStaticImports.cs deleted file mode 100644 index 54c8f7f..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/FreeImageStaticImports.cs +++ /dev/null @@ -1,2369 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.9 $ -// $Date: 2009/09/15 11:41:37 $ -// $Id: FreeImageStaticImports.cs,v 1.9 2009/09/15 11:41:37 cklein05 Exp $ -// ========================================================== - -using System; -using System.Runtime.InteropServices; -using FreeImageAPI.Plugins; -using FreeImageAPI.IO; - -namespace FreeImageAPI -{ - public static partial class FreeImage - { - #region Constants - - /// - /// Filename of the FreeImage library. - /// - private const string FreeImageLibrary = "FreeImage"; - - /// - /// Number of bytes to shift left within a 4 byte block. - /// - public const int FI_RGBA_RED = 2; - - /// - /// Number of bytes to shift left within a 4 byte block. - /// - public const int FI_RGBA_GREEN = 1; - - /// - /// Number of bytes to shift left within a 4 byte block. - /// - public const int FI_RGBA_BLUE = 0; - - /// - /// Number of bytes to shift left within a 4 byte block. - /// - public const int FI_RGBA_ALPHA = 3; - - /// - /// Mask indicating the position of the given color. - /// - public const uint FI_RGBA_RED_MASK = 0x00FF0000; - - /// - /// Mask indicating the position of the given color. - /// - public const uint FI_RGBA_GREEN_MASK = 0x0000FF00; - - /// - /// Mask indicating the position of the given color. - /// - public const uint FI_RGBA_BLUE_MASK = 0x000000FF; - - /// - /// Mask indicating the position of the given color. - /// - public const uint FI_RGBA_ALPHA_MASK = 0xFF000000; - - /// - /// Number of bits to shift left within a 32 bit block. - /// - public const int FI_RGBA_RED_SHIFT = 16; - - /// - /// Number of bits to shift left within a 32 bit block. - /// - public const int FI_RGBA_GREEN_SHIFT = 8; - - /// - /// Number of bits to shift left within a 32 bit block. - /// - public const int FI_RGBA_BLUE_SHIFT = 0; - - /// - /// Number of bits to shift left within a 32 bit block. - /// - public const int FI_RGBA_ALPHA_SHIFT = 24; - - /// - /// Mask indicating the position of color components of a 32 bit color. - /// - public const uint FI_RGBA_RGB_MASK = (FI_RGBA_RED_MASK | FI_RGBA_GREEN_MASK | FI_RGBA_BLUE_MASK); - - /// - /// Mask indicating the position of the given color. - /// - public const int FI16_555_RED_MASK = 0x7C00; - - /// - /// Mask indicating the position of the given color. - /// - public const int FI16_555_GREEN_MASK = 0x03E0; - - /// - /// Mask indicating the position of the given color. - /// - public const int FI16_555_BLUE_MASK = 0x001F; - - /// - /// Number of bits to shift left within a 16 bit block. - /// - public const int FI16_555_RED_SHIFT = 10; - - /// - /// Number of bits to shift left within a 16 bit block. - /// - public const int FI16_555_GREEN_SHIFT = 5; - - /// - /// Number of bits to shift left within a 16 bit block. - /// - public const int FI16_555_BLUE_SHIFT = 0; - - /// - /// Mask indicating the position of the given color. - /// - public const int FI16_565_RED_MASK = 0xF800; - - /// - /// Mask indicating the position of the given color. - /// - public const int FI16_565_GREEN_MASK = 0x07E0; - - /// - /// Mask indicating the position of the given color. - /// - public const int FI16_565_BLUE_MASK = 0x001F; - - /// - /// Number of bits to shift left within a 16 bit block. - /// - public const int FI16_565_RED_SHIFT = 11; - - /// - /// Number of bits to shift left within a 16 bit block. - /// - public const int FI16_565_GREEN_SHIFT = 5; - - /// - /// Number of bits to shift left within a 16 bit block. - /// - public const int FI16_565_BLUE_SHIFT = 0; - - #endregion - - #region General functions - - /// - /// Initialises the library. - /// - /// - /// When the is true, FreeImage won't make use of external plugins. - /// - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_Initialise")] - private static extern void Initialise(bool load_local_plugins_only); - - /// - /// Deinitialises the library. - /// - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_DeInitialise")] - private static extern void DeInitialise(); - - /// - /// Returns a string containing the current version of the library. - /// - /// The current version of the library. - public static unsafe string GetVersion() { return PtrToStr(GetVersion_()); } - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_GetVersion")] - private static unsafe extern byte* GetVersion_(); - - /// - /// Returns a string containing a standard copyright message. - /// - /// A standard copyright message. - public static unsafe string GetCopyrightMessage() { return PtrToStr(GetCopyrightMessage_()); } - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_GetCopyrightMessage")] - private static unsafe extern byte* GetCopyrightMessage_(); - - /// - /// Calls the set error message function in FreeImage. - /// - /// Format of the bitmaps. - /// The error message. - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_OutputMessageProc")] - public static extern void OutputMessageProc(FREE_IMAGE_FORMAT fif, string message); - - /// - /// You use the function FreeImage_SetOutputMessage to capture the log string - /// so that you can show it to the user of the program. - /// The callback is implemented in the event of this class. - /// - /// The function is private because FreeImage can only have a single - /// callback function. To use the callback use the - /// event of this class. - /// Handler to the callback function. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetOutputMessage")] - internal static extern void SetOutputMessage(OutputMessageFunction omf); - - #endregion - - #region Bitmap management functions - - /// - /// Creates a new bitmap in memory. - /// - /// Width of the new bitmap. - /// Height of the new bitmap. - /// Bit depth of the new Bitmap. - /// Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmap - /// Red part of the color layout. - /// eg: 0xFF0000 - /// Green part of the color layout. - /// eg: 0x00FF00 - /// Blue part of the color layout. - /// eg: 0x0000FF - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_Allocate")] - public static extern FIBITMAP Allocate(int width, int height, int bpp, - uint red_mask, uint green_mask, uint blue_mask); - - /// - /// Creates a new bitmap in memory. - /// - /// Type of the image. - /// Width of the new bitmap. - /// Height of the new bitmap. - /// Bit depth of the new Bitmap. - /// Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmap - /// Red part of the color layout. - /// eg: 0xFF0000 - /// Green part of the color layout. - /// eg: 0x00FF00 - /// Blue part of the color layout. - /// eg: 0x0000FF - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_AllocateT")] - public static extern FIBITMAP AllocateT(FREE_IMAGE_TYPE type, int width, int height, int bpp, - uint red_mask, uint green_mask, uint blue_mask); - - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_AllocateEx")] - internal static extern FIBITMAP AllocateEx(int width, int height, int bpp, - IntPtr color, FREE_IMAGE_COLOR_OPTIONS options, RGBQUAD[] palette, - uint red_mask, uint green_mask, uint blue_mask); - - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_AllocateExT")] - internal static extern FIBITMAP AllocateExT(FREE_IMAGE_TYPE type, int width, int height, int bpp, - IntPtr color, FREE_IMAGE_COLOR_OPTIONS options, RGBQUAD[] palette, - uint red_mask, uint green_mask, uint blue_mask); - - /// - /// Makes an exact reproduction of an existing bitmap, including metadata and attached profile if any. - /// - /// Handle to a FreeImage bitmap. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_Clone")] - public static extern FIBITMAP Clone(FIBITMAP dib); - - /// - /// Deletes a previously loaded FIBITMAP from memory. - /// - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_Unload")] - public static extern void Unload(FIBITMAP dib); - - /// - /// Decodes a bitmap, allocates memory for it and returns it as a FIBITMAP. - /// - /// Type of the bitmap. - /// Name of the file to decode. - /// Flags to enable or disable plugin-features. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, CharSet = CharSet.Unicode, EntryPoint = "FreeImage_LoadU")] - public static extern FIBITMAP Load(FREE_IMAGE_FORMAT fif, string filename, FREE_IMAGE_LOAD_FLAGS flags); - - /// - /// Decodes a bitmap, allocates memory for it and returns it as a FIBITMAP. - /// The filename supports UNICODE. - /// - /// Type of the bitmap. - /// Name of the file to decode. - /// Flags to enable or disable plugin-features. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, CharSet = CharSet.Unicode, EntryPoint = "FreeImage_LoadU")] - private static extern FIBITMAP LoadU(FREE_IMAGE_FORMAT fif, string filename, FREE_IMAGE_LOAD_FLAGS flags); - - /// - /// Loads a bitmap from an arbitrary source. - /// - /// Type of the bitmap. - /// A FreeImageIO structure with functionpointers to handle the source. - /// A handle to the source. - /// Flags to enable or disable plugin-features. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_LoadFromHandle")] - public static extern FIBITMAP LoadFromHandle(FREE_IMAGE_FORMAT fif, ref FreeImageIO io, fi_handle handle, FREE_IMAGE_LOAD_FLAGS flags); - - /// - /// Saves a previosly loaded FIBITMAP to a file. - /// - /// Type of the bitmap. - /// Handle to a FreeImage bitmap. - /// Name of the file to save to. - /// Flags to enable or disable plugin-features. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, CharSet = CharSet.Unicode, EntryPoint = "FreeImage_SaveU")] - public static extern bool Save(FREE_IMAGE_FORMAT fif, FIBITMAP dib, string filename, FREE_IMAGE_SAVE_FLAGS flags); - - /// - /// Saves a previosly loaded FIBITMAP to a file. - /// The filename supports UNICODE. - /// - /// Type of the bitmap. - /// Handle to a FreeImage bitmap. - /// Name of the file to save to. - /// Flags to enable or disable plugin-features. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, CharSet = CharSet.Unicode, EntryPoint = "FreeImage_SaveU")] - private static extern bool SaveU(FREE_IMAGE_FORMAT fif, FIBITMAP dib, string filename, FREE_IMAGE_SAVE_FLAGS flags); - - /// - /// Saves a bitmap to an arbitrary source. - /// - /// Type of the bitmap. - /// Handle to a FreeImage bitmap. - /// A FreeImageIO structure with functionpointers to handle the source. - /// A handle to the source. - /// Flags to enable or disable plugin-features. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SaveToHandle")] - public static extern bool SaveToHandle(FREE_IMAGE_FORMAT fif, FIBITMAP dib, ref FreeImageIO io, fi_handle handle, - FREE_IMAGE_SAVE_FLAGS flags); - - #endregion - - #region Memory I/O streams - - /// - /// Open a memory stream. - /// - /// Pointer to the data in memory. - /// Length of the data in byte. - /// Handle to a memory stream. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_OpenMemory")] - public static extern FIMEMORY OpenMemory(IntPtr data, uint size_in_bytes); - - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_OpenMemory")] - internal static extern FIMEMORY OpenMemoryEx(byte[] data, uint size_in_bytes); - - /// - /// Close and free a memory stream. - /// - /// Handle to a memory stream. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_CloseMemory")] - public static extern void CloseMemory(FIMEMORY stream); - - /// - /// Decodes a bitmap from a stream, allocates memory for it and returns it as a FIBITMAP. - /// - /// Type of the bitmap. - /// Handle to a memory stream. - /// Flags to enable or disable plugin-features. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_LoadFromMemory")] - public static extern FIBITMAP LoadFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY stream, FREE_IMAGE_LOAD_FLAGS flags); - - /// - /// Saves a previosly loaded FIBITMAP to a stream. - /// - /// Type of the bitmap. - /// Handle to a FreeImage bitmap. - /// Handle to a memory stream. - /// Flags to enable or disable plugin-features. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SaveToMemory")] - public static extern bool SaveToMemory(FREE_IMAGE_FORMAT fif, FIBITMAP dib, FIMEMORY stream, FREE_IMAGE_SAVE_FLAGS flags); - - /// - /// Gets the current position of a memory handle. - /// - /// Handle to a memory stream. - /// The current file position if successful, -1 otherwise. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_TellMemory")] - public static extern int TellMemory(FIMEMORY stream); - - /// - /// Moves the memory handle to a specified location. - /// - /// Handle to a memory stream. - /// Number of bytes from origin. - /// Initial position. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SeekMemory")] - public static extern bool SeekMemory(FIMEMORY stream, int offset, System.IO.SeekOrigin origin); - - /// - /// Provides a direct buffer access to a memory stream. - /// - /// The target memory stream. - /// Pointer to the data in memory. - /// Size of the data in bytes. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_AcquireMemory")] - public static extern bool AcquireMemory(FIMEMORY stream, ref IntPtr data, ref uint size_in_bytes); - - /// - /// Reads data from a memory stream. - /// - /// The buffer to store the data in. - /// Size in bytes of the items. - /// Number of items to read. - /// The stream to read from. - /// The memory pointer associated with stream is increased by the number of bytes actually read. - /// The number of full items actually read. - /// May be less than count on error or stream-end. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ReadMemory")] - public static extern uint ReadMemory(byte[] buffer, uint size, uint count, FIMEMORY stream); - - /// - /// Writes data to a memory stream. - /// - /// The buffer to read the data from. - /// Size in bytes of the items. - /// Number of items to write. - /// The stream to write to. - /// The memory pointer associated with stream is increased by the number of bytes actually written. - /// The number of full items actually written. - /// May be less than count on error or stream-end. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_WriteMemory")] - public static extern uint WriteMemory(byte[] buffer, uint size, uint count, FIMEMORY stream); - - /// - /// Open a multi-page bitmap from a memory stream. - /// - /// Type of the bitmap. - /// The stream to decode. - /// Flags to enable or disable plugin-features. - /// Handle to a FreeImage multi-paged bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_LoadMultiBitmapFromMemory")] - public static extern FIMULTIBITMAP LoadMultiBitmapFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY stream, FREE_IMAGE_LOAD_FLAGS flags); - - #endregion - - #region Plugin functions - - /// - /// Registers a new plugin to be used in FreeImage. - /// - /// Pointer to the function that initialises the plugin. - /// A string describing the format of the plugin. - /// A string describing the plugin. - /// A string witha comma sperated list of extensions. f.e: "pl,pl2,pl4" - /// A regular expression used to identify the bitmap. - /// The format idientifier assigned by FreeImage. - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_RegisterLocalPlugin")] - public static extern FREE_IMAGE_FORMAT RegisterLocalPlugin(InitProc proc_address, - string format, string description, string extension, string regexpr); - - /// - /// Registers a new plugin to be used in FreeImage. The plugin is residing in a DLL. - /// The Init function must be called “Init” and must use the stdcall calling convention. - /// - /// Complete path to the dll file hosting the plugin. - /// A string describing the format of the plugin. - /// A string describing the plugin. - /// A string witha comma sperated list of extensions. f.e: "pl,pl2,pl4" - /// A regular expression used to identify the bitmap. - /// The format idientifier assigned by FreeImage. - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_RegisterExternalPlugin")] - public static extern FREE_IMAGE_FORMAT RegisterExternalPlugin(string path, - string format, string description, string extension, string regexpr); - - /// - /// Retrieves the number of FREE_IMAGE_FORMAT identifiers being currently registered. - /// - /// The number of registered formats. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetFIFCount")] - public static extern int GetFIFCount(); - - /// - /// Enables or disables a plugin. - /// - /// The plugin to enable or disable. - /// True: enable the plugin. false: disable the plugin. - /// The previous state of the plugin. - /// 1 - enabled. 0 - disables. -1 plugin does not exist. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetPluginEnabled")] - public static extern int SetPluginEnabled(FREE_IMAGE_FORMAT fif, bool enable); - - /// - /// Retrieves the state of a plugin. - /// - /// The plugin to check. - /// 1 - enabled. 0 - disables. -1 plugin does not exist. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_IsPluginEnabled")] - public static extern int IsPluginEnabled(FREE_IMAGE_FORMAT fif); - - /// - /// Returns a identifier from the format string that was used to register the FIF. - /// - /// The string that was used to register the plugin. - /// A identifier from the format. - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_GetFIFFromFormat")] - public static extern FREE_IMAGE_FORMAT GetFIFFromFormat(string format); - - /// - /// Returns a identifier from a MIME content type string - /// (MIME stands for Multipurpose Internet Mail Extension). - /// - /// A MIME content type. - /// A identifier from the MIME. - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_GetFIFFromMime")] - public static extern FREE_IMAGE_FORMAT GetFIFFromMime(string mime); - - /// - /// Returns the string that was used to register a plugin from the system assigned . - /// - /// The assigned . - /// The string that was used to register the plugin. - public static unsafe string GetFormatFromFIF(FREE_IMAGE_FORMAT fif) { return PtrToStr(GetFormatFromFIF_(fif)); } - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetFormatFromFIF")] - private static unsafe extern byte* GetFormatFromFIF_(FREE_IMAGE_FORMAT fif); - - /// - /// Returns a comma-delimited file extension list describing the bitmap formats the given plugin can read and/or write. - /// - /// The desired . - /// A comma-delimited file extension list. - public static unsafe string GetFIFExtensionList(FREE_IMAGE_FORMAT fif) { return PtrToStr(GetFIFExtensionList_(fif)); } - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetFIFExtensionList")] - private static unsafe extern byte* GetFIFExtensionList_(FREE_IMAGE_FORMAT fif); - - /// - /// Returns a descriptive string that describes the bitmap formats the given plugin can read and/or write. - /// - /// The desired . - /// A descriptive string that describes the bitmap formats. - public static unsafe string GetFIFDescription(FREE_IMAGE_FORMAT fif) { return PtrToStr(GetFIFDescription_(fif)); } - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetFIFDescription")] - private static unsafe extern byte* GetFIFDescription_(FREE_IMAGE_FORMAT fif); - - /// - /// Returns a regular expression string that can be used by a regular expression engine to identify the bitmap. - /// FreeImageQt makes use of this function. - /// - /// The desired . - /// A regular expression string. - public static unsafe string GetFIFRegExpr(FREE_IMAGE_FORMAT fif) { return PtrToStr(GetFIFRegExpr_(fif)); } - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetFIFRegExpr")] - private static unsafe extern byte* GetFIFRegExpr_(FREE_IMAGE_FORMAT fif); - - /// - /// Given a identifier, returns a MIME content type string (MIME stands for Multipurpose Internet Mail Extension). - /// - /// The desired . - /// A MIME content type string. - public static unsafe string GetFIFMimeType(FREE_IMAGE_FORMAT fif) { return PtrToStr(GetFIFMimeType_(fif)); } - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetFIFMimeType")] - private static unsafe extern byte* GetFIFMimeType_(FREE_IMAGE_FORMAT fif); - - /// - /// This function takes a filename or a file-extension and returns the plugin that can - /// read/write files with that extension in the form of a identifier. - /// - /// The filename or -extension. - /// The of the plugin. - [DllImport(FreeImageLibrary, CharSet = CharSet.Unicode, EntryPoint = "FreeImage_GetFIFFromFilenameU")] - public static extern FREE_IMAGE_FORMAT GetFIFFromFilename(string filename); - - /// - /// This function takes a filename or a file-extension and returns the plugin that can - /// read/write files with that extension in the form of a identifier. - /// Supports UNICODE filenames. - /// - /// The filename or -extension. - /// The of the plugin. - [DllImport(FreeImageLibrary, CharSet = CharSet.Unicode, EntryPoint = "FreeImage_GetFIFFromFilenameU")] - private static extern FREE_IMAGE_FORMAT GetFIFFromFilenameU(string filename); - - /// - /// Checks if a plugin can load bitmaps. - /// - /// The of the plugin. - /// True if the plugin can load bitmaps, else false. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_FIFSupportsReading")] - public static extern bool FIFSupportsReading(FREE_IMAGE_FORMAT fif); - - /// - /// Checks if a plugin can save bitmaps. - /// - /// The of the plugin. - /// True if the plugin can save bitmaps, else false. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_FIFSupportsWriting")] - public static extern bool FIFSupportsWriting(FREE_IMAGE_FORMAT fif); - - /// - /// Checks if a plugin can save bitmaps in the desired bit depth. - /// - /// The of the plugin. - /// The desired bit depth. - /// True if the plugin can save bitmaps in the desired bit depth, else false. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_FIFSupportsExportBPP")] - public static extern bool FIFSupportsExportBPP(FREE_IMAGE_FORMAT fif, int bpp); - - /// - /// Checks if a plugin can save a bitmap in the desired data type. - /// - /// The of the plugin. - /// The desired image type. - /// True if the plugin can save bitmaps as the desired type, else false. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_FIFSupportsExportType")] - public static extern bool FIFSupportsExportType(FREE_IMAGE_FORMAT fif, FREE_IMAGE_TYPE type); - - /// - /// Checks if a plugin can load or save an ICC profile. - /// - /// The of the plugin. - /// True if the plugin can load or save an ICC profile, else false. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_FIFSupportsICCProfiles")] - public static extern bool FIFSupportsICCProfiles(FREE_IMAGE_FORMAT fif); - - #endregion - - #region Multipage functions - - /// - /// Loads a FreeImage multi-paged bitmap. - /// Load flags can be provided by the flags parameter. - /// - /// Format of the image. - /// The complete name of the file to load. - /// When true a new bitmap is created. - /// When true the bitmap will be loaded read only. - /// When true performance is increased at the cost of memory. - /// Flags to enable or disable plugin-features. - /// Handle to a FreeImage multi-paged bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_OpenMultiBitmap")] - public static extern FIMULTIBITMAP OpenMultiBitmap(FREE_IMAGE_FORMAT fif, string filename, bool create_new, - bool read_only, bool keep_cache_in_memory, FREE_IMAGE_LOAD_FLAGS flags); - - /// - /// Loads a FreeImage multi-pages bitmap from the specified handle - /// using the specified functions. - /// Load flags can be provided by the flags parameter. - /// - /// Format of the image. - /// IO functions used to read from the specified handle. - /// The handle to load the bitmap from. - /// Flags to enable or disable plugin-features. - /// Handle to a FreeImage multi-paged bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_OpenMultiBitmapFromHandle")] - public static extern FIMULTIBITMAP OpenMultiBitmapFromHandle(FREE_IMAGE_FORMAT fif, ref FreeImageIO io, - fi_handle handle, FREE_IMAGE_LOAD_FLAGS flags); - - /// - /// Closes a previously opened multi-page bitmap and, when the bitmap was not opened read-only, applies any changes made to it. - /// - /// Handle to a FreeImage multi-paged bitmap. - /// Flags to enable or disable plugin-features. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_CloseMultiBitmap")] - private static extern bool CloseMultiBitmap_(FIMULTIBITMAP bitmap, FREE_IMAGE_SAVE_FLAGS flags); - - /// - /// Returns the number of pages currently available in the multi-paged bitmap. - /// - /// Handle to a FreeImage multi-paged bitmap. - /// Number of pages. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetPageCount")] - public static extern int GetPageCount(FIMULTIBITMAP bitmap); - - /// - /// Appends a new page to the end of the bitmap. - /// - /// Handle to a FreeImage multi-paged bitmap. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_AppendPage")] - public static extern void AppendPage(FIMULTIBITMAP bitmap, FIBITMAP data); - - /// - /// Inserts a new page before the given position in the bitmap. - /// - /// Handle to a FreeImage multi-paged bitmap. - /// Page has to be a number smaller than the current number of pages available in the bitmap. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_InsertPage")] - public static extern void InsertPage(FIMULTIBITMAP bitmap, int page, FIBITMAP data); - - /// - /// Deletes the page on the given position. - /// - /// Handle to a FreeImage multi-paged bitmap. - /// Number of the page to delete. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_DeletePage")] - public static extern void DeletePage(FIMULTIBITMAP bitmap, int page); - - /// - /// Locks a page in memory for editing. - /// - /// Handle to a FreeImage multi-paged bitmap. - /// Number of the page to lock. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_LockPage")] - public static extern FIBITMAP LockPage(FIMULTIBITMAP bitmap, int page); - - /// - /// Unlocks a previously locked page and gives it back to the multi-page engine. - /// - /// Handle to a FreeImage multi-paged bitmap. - /// Handle to a FreeImage bitmap. - /// If true, the page is applied to the multi-page bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_UnlockPage")] - public static extern void UnlockPage(FIMULTIBITMAP bitmap, FIBITMAP data, bool changed); - - /// - /// Moves the source page to the position of the target page. - /// - /// Handle to a FreeImage multi-paged bitmap. - /// New position of the page. - /// Old position of the page. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_MovePage")] - public static extern bool MovePage(FIMULTIBITMAP bitmap, int target, int source); - - /// - /// Returns an array of page-numbers that are currently locked in memory. - /// When the pages parameter is null, the size of the array is returned in the count variable. - /// - /// - /// - /// int[] lockedPages = null; - /// int count = 0; - /// GetLockedPageNumbers(dib, lockedPages, ref count); - /// lockedPages = new int[count]; - /// GetLockedPageNumbers(dib, lockedPages, ref count); - /// - /// - /// Handle to a FreeImage multi-paged bitmap. - /// The list of locked pages in the multi-pages bitmap. - /// If set to null, count will contain the number of pages. - /// If is set to null count will contain the number of locked pages. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetLockedPageNumbers")] - public static extern bool GetLockedPageNumbers(FIMULTIBITMAP bitmap, int[] pages, ref int count); - - #endregion - - #region Filetype functions - - /// - /// Orders FreeImage to analyze the bitmap signature. - /// - /// Name of the file to analyze. - /// Reserved parameter - use 0. - /// Type of the bitmap. - [DllImport(FreeImageLibrary, CharSet = CharSet.Unicode, EntryPoint = "FreeImage_GetFileTypeU")] - public static extern FREE_IMAGE_FORMAT GetFileType(string filename, int size); - - - /// - /// Orders FreeImage to analyze the bitmap signature. - /// Supports UNICODE filenames. - /// - /// Name of the file to analyze. - /// Reserved parameter - use 0. - /// Type of the bitmap. - [DllImport(FreeImageLibrary, CharSet = CharSet.Unicode, EntryPoint = "FreeImage_GetFileTypeU")] - private static extern FREE_IMAGE_FORMAT GetFileTypeU(string filename, int size); - - /// - /// Uses the structure as described in the topic bitmap management functions - /// to identify a bitmap type. - /// - /// A structure with functionpointers to handle the source. - /// A handle to the source. - /// Size in bytes of the source. - /// Type of the bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetFileTypeFromHandle")] - public static extern FREE_IMAGE_FORMAT GetFileTypeFromHandle(ref FreeImageIO io, fi_handle handle, int size); - - /// - /// Uses a memory handle to identify a bitmap type. - /// - /// Pointer to the stream. - /// Size in bytes of the source. - /// Type of the bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetFileTypeFromMemory")] - public static extern FREE_IMAGE_FORMAT GetFileTypeFromMemory(FIMEMORY stream, int size); - - #endregion - - #region Helper functions - - /// - /// Returns whether the platform is using Little Endian. - /// - /// Returns true if the platform is using Litte Endian, else false. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_IsLittleEndian")] - public static extern bool IsLittleEndian(); - - /// - /// Converts a X11 color name into a corresponding RGB value. - /// - /// Name of the color to convert. - /// Red component. - /// Green component. - /// Blue component. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_LookupX11Color")] - public static extern bool LookupX11Color(string szColor, out byte nRed, out byte nGreen, out byte nBlue); - - /// - /// Converts a SVG color name into a corresponding RGB value. - /// - /// Name of the color to convert. - /// Red component. - /// Green component. - /// Blue component. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_LookupSVGColor")] - public static extern bool LookupSVGColor(string szColor, out byte nRed, out byte nGreen, out byte nBlue); - - #endregion - - #region Pixel access functions - - /// - /// Returns a pointer to the data-bits of the bitmap. - /// - /// Handle to a FreeImage bitmap. - /// Pointer to the data-bits. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetBits")] - public static extern IntPtr GetBits(FIBITMAP dib); - - /// - /// Returns a pointer to the start of the given scanline in the bitmap's data-bits. - /// - /// Handle to a FreeImage bitmap. - /// Number of the scanline. - /// Pointer to the scanline. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetScanLine")] - public static extern IntPtr GetScanLine(FIBITMAP dib, int scanline); - - /// - /// Get the pixel index of a palettized image at position (x, y), including range check (slow access). - /// - /// Handle to a FreeImage bitmap. - /// Pixel position in horizontal direction. - /// Pixel position in vertical direction. - /// The pixel index. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetPixelIndex")] - public static extern bool GetPixelIndex(FIBITMAP dib, uint x, uint y, out byte value); - - /// - /// Get the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow access). - /// - /// Handle to a FreeImage bitmap. - /// Pixel position in horizontal direction. - /// Pixel position in vertical direction. - /// The pixel color. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetPixelColor")] - public static extern bool GetPixelColor(FIBITMAP dib, uint x, uint y, out RGBQUAD value); - - /// - /// Set the pixel index of a palettized image at position (x, y), including range check (slow access). - /// - /// Handle to a FreeImage bitmap. - /// Pixel position in horizontal direction. - /// Pixel position in vertical direction. - /// The new pixel index. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetPixelIndex")] - public static extern bool SetPixelIndex(FIBITMAP dib, uint x, uint y, ref byte value); - - /// - /// Set the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow access). - /// - /// Handle to a FreeImage bitmap. - /// Pixel position in horizontal direction. - /// Pixel position in vertical direction. - /// The new pixel color. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetPixelColor")] - public static extern bool SetPixelColor(FIBITMAP dib, uint x, uint y, ref RGBQUAD value); - - #endregion - - #region Bitmap information functions - - /// - /// Retrieves the type of the bitmap. - /// - /// Handle to a FreeImage bitmap. - /// Type of the bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetImageType")] - public static extern FREE_IMAGE_TYPE GetImageType(FIBITMAP dib); - - /// - /// Returns the number of colors used in a bitmap. - /// - /// Handle to a FreeImage bitmap. - /// Palette-size for palletised bitmaps, and 0 for high-colour bitmaps. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetColorsUsed")] - public static extern uint GetColorsUsed(FIBITMAP dib); - - /// - /// Returns the size of one pixel in the bitmap in bits. - /// - /// Handle to a FreeImage bitmap. - /// Size of one pixel in the bitmap in bits. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetBPP")] - public static extern uint GetBPP(FIBITMAP dib); - - /// - /// Returns the width of the bitmap in pixel units. - /// - /// Handle to a FreeImage bitmap. - /// With of the bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetWidth")] - public static extern uint GetWidth(FIBITMAP dib); - - /// - /// Returns the height of the bitmap in pixel units. - /// - /// Handle to a FreeImage bitmap. - /// Height of the bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetHeight")] - public static extern uint GetHeight(FIBITMAP dib); - - /// - /// Returns the width of the bitmap in bytes. - /// - /// Handle to a FreeImage bitmap. - /// With of the bitmap in bytes. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetLine")] - public static extern uint GetLine(FIBITMAP dib); - - /// - /// Returns the width of the bitmap in bytes, rounded to the next 32-bit boundary, - /// also known as pitch or stride or scan width. - /// - /// Handle to a FreeImage bitmap. - /// With of the bitmap in bytes. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetPitch")] - public static extern uint GetPitch(FIBITMAP dib); - - /// - /// Returns the size of the DIB-element of a FIBITMAP in memory. - /// - /// Handle to a FreeImage bitmap. - /// Size of the DIB-element - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetDIBSize")] - public static extern uint GetDIBSize(FIBITMAP dib); - - /// - /// Returns a pointer to the bitmap's palette. - /// - /// Handle to a FreeImage bitmap. - /// Pointer to the bitmap's palette. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetPalette")] - public static extern IntPtr GetPalette(FIBITMAP dib); - - /// - /// Returns the horizontal resolution, in pixels-per-meter, of the target device for the bitmap. - /// - /// Handle to a FreeImage bitmap. - /// The horizontal resolution, in pixels-per-meter. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetDotsPerMeterX")] - public static extern uint GetDotsPerMeterX(FIBITMAP dib); - - /// - /// Returns the vertical resolution, in pixels-per-meter, of the target device for the bitmap. - /// - /// Handle to a FreeImage bitmap. - /// The vertical resolution, in pixels-per-meter. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetDotsPerMeterY")] - public static extern uint GetDotsPerMeterY(FIBITMAP dib); - - /// - /// Set the horizontal resolution, in pixels-per-meter, of the target device for the bitmap. - /// - /// Handle to a FreeImage bitmap. - /// The new horizontal resolution. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetDotsPerMeterX")] - public static extern void SetDotsPerMeterX(FIBITMAP dib, uint res); - - /// - /// Set the vertical resolution, in pixels-per-meter, of the target device for the bitmap. - /// - /// Handle to a FreeImage bitmap. - /// The new vertical resolution. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetDotsPerMeterY")] - public static extern void SetDotsPerMeterY(FIBITMAP dib, uint res); - - /// - /// Returns a pointer to the of the DIB-element in a FIBITMAP. - /// - /// Handle to a FreeImage bitmap. - /// Poiter to the header of the bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetInfoHeader")] - public static extern IntPtr GetInfoHeader(FIBITMAP dib); - - /// - /// Alias for FreeImage_GetInfoHeader that returns a pointer to a - /// rather than to a . - /// - /// Handle to a FreeImage bitmap. - /// Pointer to the structure for the bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetInfo")] - public static extern IntPtr GetInfo(FIBITMAP dib); - - /// - /// Investigates the color type of the bitmap by reading the bitmap's pixel bits and analysing them. - /// - /// Handle to a FreeImage bitmap. - /// The color type of the bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetColorType")] - public static extern FREE_IMAGE_COLOR_TYPE GetColorType(FIBITMAP dib); - - /// - /// Returns a bit pattern describing the red color component of a pixel in a FreeImage bitmap. - /// - /// Handle to a FreeImage bitmap. - /// The bit pattern for RED. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetRedMask")] - public static extern uint GetRedMask(FIBITMAP dib); - - /// - /// Returns a bit pattern describing the green color component of a pixel in a FreeImage bitmap. - /// - /// Handle to a FreeImage bitmap. - /// The bit pattern for green. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetGreenMask")] - public static extern uint GetGreenMask(FIBITMAP dib); - - /// - /// Returns a bit pattern describing the blue color component of a pixel in a FreeImage bitmap. - /// - /// Handle to a FreeImage bitmap. - /// The bit pattern for blue. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetBlueMask")] - public static extern uint GetBlueMask(FIBITMAP dib); - - /// - /// Returns the number of transparent colors in a palletised bitmap. - /// - /// Handle to a FreeImage bitmap. - /// The number of transparent colors in a palletised bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetTransparencyCount")] - public static extern uint GetTransparencyCount(FIBITMAP dib); - - /// - /// Returns a pointer to the bitmap's transparency table. - /// - /// Handle to a FreeImage bitmap. - /// Pointer to the bitmap's transparency table. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetTransparencyTable")] - public static extern IntPtr GetTransparencyTable(FIBITMAP dib); - - /// - /// Tells FreeImage if it should make use of the transparency table - /// or the alpha channel that may accompany a bitmap. - /// - /// Handle to a FreeImage bitmap. - /// True to enable the transparency, false to disable. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetTransparent")] - public static extern void SetTransparent(FIBITMAP dib, bool enabled); - - /// - /// Set the bitmap's transparency table. Only affects palletised bitmaps. - /// - /// Handle to a FreeImage bitmap. - /// Pointer to the bitmap's new transparency table. - /// The number of transparent colors in the new transparency table. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetTransparencyTable")] - internal static extern void SetTransparencyTable(FIBITMAP dib, byte[] table, int count); - - /// - /// Returns whether the transparency table is enabled. - /// - /// Handle to a FreeImage bitmap. - /// Returns true when the transparency table is enabled (1-, 4- or 8-bit images) - /// or when the input dib contains alpha values (32-bit images). Returns false otherwise. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_IsTransparent")] - public static extern bool IsTransparent(FIBITMAP dib); - - /// - /// Returns whether the bitmap has a file background color. - /// - /// Handle to a FreeImage bitmap. - /// Returns true when the image has a file background color, false otherwise. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_HasBackgroundColor")] - public static extern bool HasBackgroundColor(FIBITMAP dib); - - /// - /// Returns the file background color of an image. - /// For 8-bit images, the color index in the palette is returned in the - /// rgbReserved member of the bkcolor parameter. - /// - /// Handle to a FreeImage bitmap. - /// The background color. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetBackgroundColor")] - public static extern bool GetBackgroundColor(FIBITMAP dib, out RGBQUAD bkcolor); - - /// - /// Set the file background color of an image. - /// When saving an image to PNG, this background color is transparently saved to the PNG file. - /// - /// Handle to a FreeImage bitmap. - /// The new background color. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetBackgroundColor")] - public static unsafe extern bool SetBackgroundColor(FIBITMAP dib, ref RGBQUAD bkcolor); - - /// - /// Set the file background color of an image. - /// When saving an image to PNG, this background color is transparently saved to the PNG file. - /// When the bkcolor parameter is null, the background color is removed from the image. - /// - /// This overloaded version of the function with an array parameter is provided to allow - /// passing null in the parameter. This is similar to the - /// original C/C++ function. Passing null as parameter will - /// unset the dib's previously set background color. - /// - /// - /// Handle to a FreeImage bitmap. - /// The new background color. - /// The first entry in the array is used. - /// Returns true on success, false on failure. - /// - /// - /// // create a RGBQUAD color - /// RGBQUAD color = new RGBQUAD(Color.Green); - /// - /// // set the dib's background color (using the other version of the function) - /// FreeImage.SetBackgroundColor(dib, ref color); - /// - /// // remove it again (this only works due to the array parameter RGBQUAD[]) - /// FreeImage.SetBackgroundColor(dib, null); - /// - /// - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetBackgroundColor")] - public static unsafe extern bool SetBackgroundColor(FIBITMAP dib, RGBQUAD[] bkcolor); - - /// - /// Sets the index of the palette entry to be used as transparent color - /// for the image specified. Does nothing on high color images. - /// - /// Handle to a FreeImage bitmap. - /// The index of the palette entry to be set as transparent color. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetTransparentIndex")] - public static extern void SetTransparentIndex(FIBITMAP dib, int index); - - /// - /// Returns the palette entry used as transparent color for the image specified. - /// Works for palletised images only and returns -1 for high color - /// images or if the image has no color set to be transparent. - /// - /// Handle to a FreeImage bitmap. - /// the index of the palette entry used as transparent color for - /// the image specified or -1 if there is no transparent color found - /// (e.g. the image is a high color image). - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetTransparentIndex")] - public static extern int GetTransparentIndex(FIBITMAP dib); - - #endregion - - #region ICC profile functions - - /// - /// Retrieves the data of the bitmap. - /// This function can also be called safely, when the original format does not support profiles. - /// - /// Handle to a FreeImage bitmap. - /// The data of the bitmap. - public static FIICCPROFILE GetICCProfileEx(FIBITMAP dib) { unsafe { return *(FIICCPROFILE*)FreeImage.GetICCProfile(dib); } } - - /// - /// Retrieves a pointer to the data of the bitmap. - /// This function can also be called safely, when the original format does not support profiles. - /// - /// Handle to a FreeImage bitmap. - /// Pointer to the data of the bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetICCProfile")] - public static extern IntPtr GetICCProfile(FIBITMAP dib); - - /// - /// Creates a new block from ICC profile data previously read from a file - /// or built by a color management system. The profile data is attached to the bitmap. - /// - /// Handle to a FreeImage bitmap. - /// Pointer to the new data. - /// Size of the data. - /// Pointer to the created structure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_CreateICCProfile")] - public static extern IntPtr CreateICCProfile(FIBITMAP dib, byte[] data, int size); - - /// - /// This function destroys an previously created by . - /// After this call the bitmap will contain no profile information. - /// This function should be called to ensure that a stored bitmap will not contain any profile information. - /// - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_DestroyICCProfile")] - public static extern void DestroyICCProfile(FIBITMAP dib); - - #endregion - - #region Conversion functions - - /// - /// Converts a bitmap to 4 bits. - /// If the bitmap was a high-color bitmap (16, 24 or 32-bit) or if it was a - /// monochrome or greyscale bitmap (1 or 8-bit), the end result will be a - /// greyscale bitmap, otherwise (1-bit palletised bitmaps) it will be a palletised bitmap. - /// - /// Handle to a FreeImage bitmap. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ConvertTo4Bits")] - public static extern FIBITMAP ConvertTo4Bits(FIBITMAP dib); - - /// - /// Converts a bitmap to 8 bits. If the bitmap was a high-color bitmap (16, 24 or 32-bit) - /// or if it was a monochrome or greyscale bitmap (1 or 4-bit), the end result will be a - /// greyscale bitmap, otherwise (1 or 4-bit palletised bitmaps) it will be a palletised bitmap. - /// - /// Handle to a FreeImage bitmap. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ConvertTo8Bits")] - public static extern FIBITMAP ConvertTo8Bits(FIBITMAP dib); - - /// - /// Converts a bitmap to a 8-bit greyscale image with a linear ramp. - /// - /// Handle to a FreeImage bitmap. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ConvertToGreyscale")] - public static extern FIBITMAP ConvertToGreyscale(FIBITMAP dib); - - /// - /// Converts a bitmap to 16 bits, where each pixel has a color pattern of - /// 5 bits red, 5 bits green and 5 bits blue. One bit in each pixel is unused. - /// - /// Handle to a FreeImage bitmap. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ConvertTo16Bits555")] - public static extern FIBITMAP ConvertTo16Bits555(FIBITMAP dib); - - /// - /// Converts a bitmap to 16 bits, where each pixel has a color pattern of - /// 5 bits red, 6 bits green and 5 bits blue. - /// - /// Handle to a FreeImage bitmap. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ConvertTo16Bits565")] - public static extern FIBITMAP ConvertTo16Bits565(FIBITMAP dib); - - /// - /// Converts a bitmap to 24 bits. A clone of the input bitmap is returned for 24-bit bitmaps. - /// - /// Handle to a FreeImage bitmap. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ConvertTo24Bits")] - public static extern FIBITMAP ConvertTo24Bits(FIBITMAP dib); - - /// - /// Converts a bitmap to 32 bits. A clone of the input bitmap is returned for 32-bit bitmaps. - /// - /// Handle to a FreeImage bitmap. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ConvertTo32Bits")] - public static extern FIBITMAP ConvertTo32Bits(FIBITMAP dib); - - /// - /// Quantizes a high-color 24-bit bitmap to an 8-bit palette color bitmap. - /// - /// Handle to a FreeImage bitmap. - /// Specifies the color reduction algorithm to be used. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ColorQuantize")] - public static extern FIBITMAP ColorQuantize(FIBITMAP dib, FREE_IMAGE_QUANTIZE quantize); - - /// - /// ColorQuantizeEx is an extension to the method that - /// provides additional options used to quantize a 24-bit image to any - /// number of colors (up to 256), as well as quantize a 24-bit image using a - /// partial or full provided palette. - /// - /// Handle to a FreeImage bitmap. - /// Specifies the color reduction algorithm to be used. - /// Size of the desired output palette. - /// Size of the provided palette of ReservePalette. - /// The provided palette. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ColorQuantizeEx")] - public static extern FIBITMAP ColorQuantizeEx(FIBITMAP dib, FREE_IMAGE_QUANTIZE quantize, int PaletteSize, int ReserveSize, RGBQUAD[] ReservePalette); - - /// - /// Converts a bitmap to 1-bit monochrome bitmap using a threshold T between [0..255]. - /// The function first converts the bitmap to a 8-bit greyscale bitmap. - /// Then, any brightness level that is less than T is set to zero, otherwise to 1. - /// For 1-bit input bitmaps, the function clones the input bitmap and builds a monochrome palette. - /// - /// Handle to a FreeImage bitmap. - /// The threshold. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_Threshold")] - public static extern FIBITMAP Threshold(FIBITMAP dib, byte t); - - /// - /// Converts a bitmap to 1-bit monochrome bitmap using a dithering algorithm. - /// For 1-bit input bitmaps, the function clones the input bitmap and builds a monochrome palette. - /// - /// Handle to a FreeImage bitmap. - /// The dithering algorithm to use. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_Dither")] - public static extern FIBITMAP Dither(FIBITMAP dib, FREE_IMAGE_DITHER algorithm); - - /// - /// Converts a raw bitmap to a FreeImage bitmap. - /// - /// Pointer to the memory block containing the raw bitmap. - /// The width in pixels of the raw bitmap. - /// The height in pixels of the raw bitmap. - /// Defines the total width of a scanline in the raw bitmap, - /// including padding bytes. - /// The bit depth (bits per pixel) of the raw bitmap. - /// The bit mask describing the bits used to store a single - /// pixel's red component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// The bit mask describing the bits used to store a single - /// pixel's green component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// The bit mask describing the bits used to store a single - /// pixel's blue component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// If true, the raw bitmap is stored in top-down order (top-left pixel first) - /// and in bottom-up order (bottom-left pixel first) otherwise. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ConvertFromRawBits")] - public static extern FIBITMAP ConvertFromRawBits(IntPtr bits, int width, int height, int pitch, - uint bpp, uint red_mask, uint green_mask, uint blue_mask, bool topdown); - - /// - /// Converts a raw bitmap to a FreeImage bitmap. - /// - /// Array of bytes containing the raw bitmap. - /// The width in pixels of the raw bitmap. - /// The height in pixels of the raw bitmap. - /// Defines the total width of a scanline in the raw bitmap, - /// including padding bytes. - /// The bit depth (bits per pixel) of the raw bitmap. - /// The bit mask describing the bits used to store a single - /// pixel's red component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// The bit mask describing the bits used to store a single - /// pixel's green component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// The bit mask describing the bits used to store a single - /// pixel's blue component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// If true, the raw bitmap is stored in top-down order (top-left pixel first) - /// and in bottom-up order (bottom-left pixel first) otherwise. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ConvertFromRawBits")] - public static extern FIBITMAP ConvertFromRawBits(byte[] bits, int width, int height, int pitch, - uint bpp, uint red_mask, uint green_mask, uint blue_mask, bool topdown); - - /// - /// Converts a FreeImage bitmap to a raw bitmap, that is a raw piece of memory. - /// - /// Pointer to the memory block receiving the raw bitmap. - /// Handle to a FreeImage bitmap. - /// The desired total width in bytes of a scanline in the raw bitmap, - /// including any padding bytes. - /// The desired bit depth (bits per pixel) of the raw bitmap. - /// The desired bit mask describing the bits used to store a single - /// pixel's red component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// The desired bit mask describing the bits used to store a single - /// pixel's green component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// The desired bit mask describing the bits used to store a single - /// pixel's blue component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// If true, the raw bitmap will be stored in top-down order (top-left pixel first) - /// and in bottom-up order (bottom-left pixel first) otherwise. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ConvertToRawBits")] - public static extern void ConvertToRawBits(IntPtr bits, FIBITMAP dib, int pitch, uint bpp, - uint red_mask, uint green_mask, uint blue_mask, bool topdown); - - /// - /// Converts a FreeImage bitmap to a raw bitmap, that is a raw piece of memory. - /// - /// Array of bytes receiving the raw bitmap. - /// Handle to a FreeImage bitmap. - /// The desired total width in bytes of a scanline in the raw bitmap, - /// including any padding bytes. - /// The desired bit depth (bits per pixel) of the raw bitmap. - /// The desired bit mask describing the bits used to store a single - /// pixel's red component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// The desired bit mask describing the bits used to store a single - /// pixel's green component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// The desired bit mask describing the bits used to store a single - /// pixel's blue component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// If true, the raw bitmap will be stored in top-down order (top-left pixel first) - /// and in bottom-up order (bottom-left pixel first) otherwise. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ConvertToRawBits")] - public static extern void ConvertToRawBits(byte[] bits, FIBITMAP dib, int pitch, uint bpp, - uint red_mask, uint green_mask, uint blue_mask, bool topdown); - - /// - /// Converts a 24- or 32-bit RGB(A) standard image or a 48-bit RGB image to a FIT_RGBF type image. - /// - /// Handle to a FreeImage bitmap. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ConvertToRGBF")] - public static extern FIBITMAP ConvertToRGBF(FIBITMAP dib); - - /// - /// Converts a non standard image whose color type is FIC_MINISBLACK - /// to a standard 8-bit greyscale image. - /// - /// Handle to a FreeImage bitmap. - /// When true the conversion is done by scaling linearly - /// each pixel value from [min, max] to an integer value between [0..255], - /// where min and max are the minimum and maximum pixel values in the image. - /// When false the conversion is done by rounding each pixel value to an integer between [0..255]. - /// - /// Rounding is done using the following formula: - /// - /// dst_pixel = (BYTE) MIN(255, MAX(0, q)) where int q = int(src_pixel + 0.5); - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ConvertToStandardType")] - public static extern FIBITMAP ConvertToStandardType(FIBITMAP src, bool scale_linear); - - /// - /// Converts an image of any type to type dst_type. - /// - /// Handle to a FreeImage bitmap. - /// Destination type. - /// True to scale linear, else false. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ConvertToType")] - public static extern FIBITMAP ConvertToType(FIBITMAP src, FREE_IMAGE_TYPE dst_type, bool scale_linear); - - #endregion - - #region Tone mapping operators - - /// - /// Converts a High Dynamic Range image (48-bit RGB or 96-bit RGBF) to a 24-bit RGB image, suitable for display. - /// - /// Handle to a FreeImage bitmap. - /// The tone mapping operator to be used. - /// Parmeter depending on the used algorithm - /// Parmeter depending on the used algorithm - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ToneMapping")] - public static extern FIBITMAP ToneMapping(FIBITMAP dib, FREE_IMAGE_TMO tmo, double first_param, double second_param); - - /// - /// Converts a High Dynamic Range image to a 24-bit RGB image using a global - /// operator based on logarithmic compression of luminance values, imitating the human response to light. - /// - /// Handle to a FreeImage bitmap. - /// A gamma correction that is applied after the tone mapping. - /// A value of 1 means no correction. - /// Scale factor allowing to adjust the brightness of the output image. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_TmoDrago03")] - public static extern FIBITMAP TmoDrago03(FIBITMAP src, double gamma, double exposure); - - /// - /// Converts a High Dynamic Range image to a 24-bit RGB image using a global operator inspired - /// by photoreceptor physiology of the human visual system. - /// - /// Handle to a FreeImage bitmap. - /// Controls the overall image intensity in the range [-8, 8]. - /// Controls the overall image contrast in the range [0.3, 1.0[. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_TmoReinhard05")] - public static extern FIBITMAP TmoReinhard05(FIBITMAP src, double intensity, double contrast); - - /// - /// Apply the Gradient Domain High Dynamic Range Compression to a RGBF image and convert to 24-bit RGB. - /// - /// Handle to a FreeImage bitmap. - /// Color saturation (s parameter in the paper) in [0.4..0.6] - /// Atenuation factor (beta parameter in the paper) in [0.8..0.9] - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_TmoFattal02")] - public static extern FIBITMAP TmoFattal02(FIBITMAP src, double color_saturation, double attenuation); - - #endregion - - #region Compression functions - - /// - /// Compresses a source buffer into a target buffer, using the ZLib library. - /// - /// Pointer to the target buffer. - /// Size of the target buffer. - /// Must be at least 0.1% larger than source_size plus 12 bytes. - /// Pointer to the source buffer. - /// Size of the source buffer. - /// The actual size of the compressed buffer, or 0 if an error occurred. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ZLibCompress")] - public static extern uint ZLibCompress(byte[] target, uint target_size, byte[] source, uint source_size); - - /// - /// Decompresses a source buffer into a target buffer, using the ZLib library. - /// - /// Pointer to the target buffer. - /// Size of the target buffer. - /// Must have been saved outlide of zlib. - /// Pointer to the source buffer. - /// Size of the source buffer. - /// The actual size of the uncompressed buffer, or 0 if an error occurred. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ZLibUncompress")] - public static extern uint ZLibUncompress(byte[] target, uint target_size, byte[] source, uint source_size); - - /// - /// Compresses a source buffer into a target buffer, using the ZLib library. - /// - /// Pointer to the target buffer. - /// Size of the target buffer. - /// Must be at least 0.1% larger than source_size plus 24 bytes. - /// Pointer to the source buffer. - /// Size of the source buffer. - /// The actual size of the compressed buffer, or 0 if an error occurred. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ZLibGZip")] - public static extern uint ZLibGZip(byte[] target, uint target_size, byte[] source, uint source_size); - - /// - /// Decompresses a source buffer into a target buffer, using the ZLib library. - /// - /// Pointer to the target buffer. - /// Size of the target buffer. - /// Must have been saved outlide of zlib. - /// Pointer to the source buffer. - /// Size of the source buffer. - /// The actual size of the uncompressed buffer, or 0 if an error occurred. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ZLibGUnzip")] - public static extern uint ZLibGUnzip(byte[] target, uint target_size, byte[] source, uint source_size); - - /// - /// Generates a CRC32 checksum. - /// - /// The CRC32 checksum to begin with. - /// Pointer to the source buffer. - /// If the value is 0, the function returns the required initial value for the crc. - /// Size of the source buffer. - /// - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ZLibCRC32")] - public static extern uint ZLibCRC32(uint crc, byte[] source, uint source_size); - - #endregion - - #region Tag creation and destruction - - /// - /// Allocates a new object. - /// This object must be destroyed with a call to - /// when no longer in use. - /// - /// The new . - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_CreateTag")] - public static extern FITAG CreateTag(); - - /// - /// Delete a previously allocated object. - /// - /// The to destroy. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_DeleteTag")] - public static extern void DeleteTag(FITAG tag); - - /// - /// Creates and returns a copy of a object. - /// - /// The to clone. - /// The new . - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_CloneTag")] - public static extern FITAG CloneTag(FITAG tag); - - #endregion - - #region Tag accessors - - /// - /// Returns the tag field name (unique inside a metadata model). - /// - /// The tag field. - /// The field name. - public static unsafe string GetTagKey(FITAG tag) { return PtrToStr(GetTagKey_(tag)); } - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_GetTagKey")] - private static unsafe extern byte* GetTagKey_(FITAG tag); - - /// - /// Returns the tag description. - /// - /// The tag field. - /// The description or NULL if unavailable. - public static unsafe string GetTagDescription(FITAG tag) { return PtrToStr(GetTagDescription_(tag)); } - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_GetTagDescription")] - private static unsafe extern byte* GetTagDescription_(FITAG tag); - - /// - /// Returns the tag ID. - /// - /// The tag field. - /// The ID or 0 if unavailable. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetTagID")] - public static extern ushort GetTagID(FITAG tag); - - /// - /// Returns the tag data type. - /// - /// The tag field. - /// The tag type. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetTagType")] - public static extern FREE_IMAGE_MDTYPE GetTagType(FITAG tag); - - /// - /// Returns the number of components in the tag (in tag type units). - /// - /// The tag field. - /// The number of components. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetTagCount")] - public static extern uint GetTagCount(FITAG tag); - - /// - /// Returns the length of the tag value in bytes. - /// - /// The tag field. - /// The length of the tag value. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetTagLength")] - public static extern uint GetTagLength(FITAG tag); - - /// - /// Returns the tag value. - /// It is up to the programmer to interpret the returned pointer correctly, - /// according to the results of GetTagType and GetTagCount. - /// - /// The tag field. - /// Pointer to the value. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetTagValue")] - public static extern IntPtr GetTagValue(FITAG tag); - - /// - /// Sets the tag field name. - /// - /// The tag field. - /// The new name. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_SetTagKey")] - public static extern bool SetTagKey(FITAG tag, string key); - - /// - /// Sets the tag description. - /// - /// The tag field. - /// The new description. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_SetTagDescription")] - public static extern bool SetTagDescription(FITAG tag, string description); - - /// - /// Sets the tag ID. - /// - /// The tag field. - /// The new ID. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetTagID")] - public static extern bool SetTagID(FITAG tag, ushort id); - - /// - /// Sets the tag data type. - /// - /// The tag field. - /// The new type. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetTagType")] - public static extern bool SetTagType(FITAG tag, FREE_IMAGE_MDTYPE type); - - /// - /// Sets the number of data in the tag. - /// - /// The tag field. - /// New number of data. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetTagCount")] - public static extern bool SetTagCount(FITAG tag, uint count); - - /// - /// Sets the length of the tag value in bytes. - /// - /// The tag field. - /// The new length. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetTagLength")] - public static extern bool SetTagLength(FITAG tag, uint length); - - /// - /// Sets the tag value. - /// - /// The tag field. - /// Pointer to the new value. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetTagValue")] - public static extern bool SetTagValue(FITAG tag, byte[] value); - - #endregion - - #region Metadata iterator - - /// - /// Provides information about the first instance of a tag that matches the metadata model. - /// - /// The model to match. - /// Handle to a FreeImage bitmap. - /// Tag that matches the metadata model. - /// Unique search handle that can be used to call FindNextMetadata or FindCloseMetadata. - /// Null if the metadata model does not exist. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_FindFirstMetadata")] - public static extern FIMETADATA FindFirstMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP dib, out FITAG tag); - - /// - /// Find the next tag, if any, that matches the metadata model argument in a previous call - /// to FindFirstMetadata, and then alters the tag object contents accordingly. - /// - /// Unique search handle provided by FindFirstMetadata. - /// Tag that matches the metadata model. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_FindNextMetadata")] - public static extern bool FindNextMetadata(FIMETADATA mdhandle, out FITAG tag); - - /// - /// Closes the specified metadata search handle and releases associated resources. - /// - /// The handle to close. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_FindCloseMetadata")] - private static extern void FindCloseMetadata_(FIMETADATA mdhandle); - - #endregion - - #region Metadata setter and getter - - /// - /// Retrieve a metadata attached to a dib. - /// - /// The metadata model to look for. - /// Handle to a FreeImage bitmap. - /// The metadata field name. - /// A FITAG structure returned by the function. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_GetMetadata")] - public static extern bool GetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP dib, string key, out FITAG tag); - - /// - /// Attach a new FreeImage tag to a dib. - /// - /// The metadata model used to store the tag. - /// Handle to a FreeImage bitmap. - /// The tag field name. - /// The FreeImage tag to be attached. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_SetMetadata")] - public static extern bool SetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP dib, string key, FITAG tag); - - #endregion - - #region Metadata helper functions - - /// - /// Returns the number of tags contained in the model metadata model attached to the input dib. - /// - /// The metadata model. - /// Handle to a FreeImage bitmap. - /// Number of tags contained in the metadata model. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetMetadataCount")] - public static extern uint GetMetadataCount(FREE_IMAGE_MDMODEL model, FIBITMAP dib); - - /// - /// Copies the metadata of FreeImage bitmap to another. - /// - /// The FreeImage bitmap to copy the metadata to. - /// The FreeImage bitmap to copy the metadata from. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_CloneMetadata")] - public static extern bool CloneMetadata(FIBITMAP dst, FIBITMAP src); - - /// - /// Converts a FreeImage tag structure to a string that represents the interpreted tag value. - /// The function is not thread safe. - /// - /// The metadata model. - /// The interpreted tag value. - /// Reserved. - /// The representing string. - public static unsafe string TagToString(FREE_IMAGE_MDMODEL model, FITAG tag, uint Make) { return PtrToStr(TagToString_(model, tag, Make)); } - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_TagToString")] - private static unsafe extern byte* TagToString_(FREE_IMAGE_MDMODEL model, FITAG tag, uint Make); - - #endregion - - #region Rotation and flipping - - /// - /// This function rotates a 1-, 8-bit greyscale or a 24-, 32-bit color image by means of 3 shears. - /// 1-bit images rotation is limited to integer multiple of 90°. - /// null is returned for other values. - /// - /// Handle to a FreeImage bitmap. - /// The angle of rotation. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_RotateClassic")] - [Obsolete("RotateClassic is deprecated (use Rotate instead).")] - public static extern FIBITMAP RotateClassic(FIBITMAP dib, double angle); - - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_Rotate")] - internal static extern FIBITMAP Rotate(FIBITMAP dib, double angle, IntPtr backgroundColor); - - /// - /// This function performs a rotation and / or translation of an 8-bit greyscale, - /// 24- or 32-bit image, using a 3rd order (cubic) B-Spline. - /// - /// Handle to a FreeImage bitmap. - /// The angle of rotation. - /// Horizontal image translation. - /// Vertical image translation. - /// Rotation center x-coordinate. - /// Rotation center y-coordinate. - /// When true the irrelevant part of the image is set to a black color, - /// otherwise, a mirroring technique is used to fill irrelevant pixels. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_RotateEx")] - public static extern FIBITMAP RotateEx(FIBITMAP dib, double angle, - double x_shift, double y_shift, double x_origin, double y_origin, bool use_mask); - - /// - /// Flip the input dib horizontally along the vertical axis. - /// - /// Handle to a FreeImage bitmap. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_FlipHorizontal")] - public static extern bool FlipHorizontal(FIBITMAP dib); - - /// - /// Flip the input dib vertically along the horizontal axis. - /// - /// Handle to a FreeImage bitmap. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_FlipVertical")] - public static extern bool FlipVertical(FIBITMAP dib); - - /// - /// Performs a lossless rotation or flipping on a JPEG file. - /// - /// Source file. - /// Destination file; can be the source file; will be overwritten. - /// The operation to apply. - /// To avoid lossy transformation, you can set the perfect parameter to true. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, CharSet = CharSet.Unicode, EntryPoint = "FreeImage_JPEGTransformU")] - public static extern bool JPEGTransform(string src_file, string dst_file, - FREE_IMAGE_JPEG_OPERATION operation, bool perfect); - - #endregion - - #region Upsampling / downsampling - - /// - /// Performs resampling (or scaling, zooming) of a greyscale or RGB(A) image - /// to the desired destination width and height. - /// - /// Handle to a FreeImage bitmap. - /// Destination width. - /// Destination height. - /// The filter to apply. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_Rescale")] - public static extern FIBITMAP Rescale(FIBITMAP dib, int dst_width, int dst_height, FREE_IMAGE_FILTER filter); - - /// - /// Creates a thumbnail from a greyscale or RGB(A) image, keeping aspect ratio. - /// - /// Handle to a FreeImage bitmap. - /// Thumbnail square size. - /// When true HDR images are transperantly converted to standard images. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_MakeThumbnail")] - public static extern FIBITMAP MakeThumbnail(FIBITMAP dib, int max_pixel_size, bool convert); - - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_EnlargeCanvas")] - internal static extern FIBITMAP EnlargeCanvas(FIBITMAP dib, - int left, int top, int right, int bottom, IntPtr color, FREE_IMAGE_COLOR_OPTIONS options); - - #endregion - - #region Color manipulation - - /// - /// Perfoms an histogram transformation on a 8-, 24- or 32-bit image. - /// - /// Handle to a FreeImage bitmap. - /// The lookup table. - /// It's size is assumed to be 256 in length. - /// The color channel to be transformed. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_AdjustCurve")] - public static extern bool AdjustCurve(FIBITMAP dib, byte[] lookUpTable, FREE_IMAGE_COLOR_CHANNEL channel); - - /// - /// Performs gamma correction on a 8-, 24- or 32-bit image. - /// - /// Handle to a FreeImage bitmap. - /// The parameter represents the gamma value to use (gamma > 0). - /// A value of 1.0 leaves the image alone, less than one darkens it, and greater than one lightens it. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_AdjustGamma")] - public static extern bool AdjustGamma(FIBITMAP dib, double gamma); - - /// - /// Adjusts the brightness of a 8-, 24- or 32-bit image by a certain amount. - /// - /// Handle to a FreeImage bitmap. - /// A value 0 means no change, - /// less than 0 will make the image darker and greater than 0 will make the image brighter. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_AdjustBrightness")] - public static extern bool AdjustBrightness(FIBITMAP dib, double percentage); - - /// - /// Adjusts the contrast of a 8-, 24- or 32-bit image by a certain amount. - /// - /// Handle to a FreeImage bitmap. - /// A value 0 means no change, - /// less than 0 will decrease the contrast and greater than 0 will increase the contrast of the image. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_AdjustContrast")] - public static extern bool AdjustContrast(FIBITMAP dib, double percentage); - - /// - /// Inverts each pixel data. - /// - /// Handle to a FreeImage bitmap. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_Invert")] - public static extern bool Invert(FIBITMAP dib); - - /// - /// Computes the image histogram. - /// - /// Handle to a FreeImage bitmap. - /// Array of integers with a size of 256. - /// Channel to compute from. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetHistogram")] - public static extern bool GetHistogram(FIBITMAP dib, int[] histo, FREE_IMAGE_COLOR_CHANNEL channel); - - #endregion - - #region Channel processing - - /// - /// Retrieves the red, green, blue or alpha channel of a 24- or 32-bit image. - /// - /// Handle to a FreeImage bitmap. - /// The color channel to extract. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetChannel")] - public static extern FIBITMAP GetChannel(FIBITMAP dib, FREE_IMAGE_COLOR_CHANNEL channel); - - /// - /// Insert a 8-bit dib into a 24- or 32-bit image. - /// Both images must have to same width and height. - /// - /// Handle to a FreeImage bitmap. - /// Handle to the bitmap to insert. - /// The color channel to replace. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetChannel")] - public static extern bool SetChannel(FIBITMAP dib, FIBITMAP dib8, FREE_IMAGE_COLOR_CHANNEL channel); - - /// - /// Retrieves the real part, imaginary part, magnitude or phase of a complex image. - /// - /// Handle to a FreeImage bitmap. - /// The color channel to extract. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetComplexChannel")] - public static extern FIBITMAP GetComplexChannel(FIBITMAP src, FREE_IMAGE_COLOR_CHANNEL channel); - - /// - /// Set the real or imaginary part of a complex image. - /// Both images must have to same width and height. - /// - /// Handle to a FreeImage bitmap. - /// Handle to a FreeImage bitmap. - /// The color channel to replace. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetComplexChannel")] - public static extern bool SetComplexChannel(FIBITMAP dst, FIBITMAP src, FREE_IMAGE_COLOR_CHANNEL channel); - - #endregion - - #region Copy / Paste / Composite routines - - /// - /// Copy a sub part of the current dib image. - /// - /// Handle to a FreeImage bitmap. - /// Specifies the left position of the cropped rectangle. - /// Specifies the top position of the cropped rectangle. - /// Specifies the right position of the cropped rectangle. - /// Specifies the bottom position of the cropped rectangle. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_Copy")] - public static extern FIBITMAP Copy(FIBITMAP dib, int left, int top, int right, int bottom); - - /// - /// Alpha blend or combine a sub part image with the current dib image. - /// The bit depth of the dst bitmap must be greater than or equal to the bit depth of the src. - /// - /// Handle to a FreeImage bitmap. - /// Handle to a FreeImage bitmap. - /// Specifies the left position of the sub image. - /// Specifies the top position of the sub image. - /// alpha blend factor. - /// The source and destination images are alpha blended if alpha=0..255. - /// If alpha > 255, then the source image is combined to the destination image. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_Paste")] - public static extern bool Paste(FIBITMAP dst, FIBITMAP src, int left, int top, int alpha); - - /// - /// This function composite a transparent foreground image against a single background color or - /// against a background image. - /// - /// Handle to a FreeImage bitmap. - /// When true the background of fg is used if it contains one. - /// The application background is used if useFileBkg is false. - /// Image used as background when useFileBkg is false or fg has no background - /// and appBkColor is null. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_Composite")] - public static extern FIBITMAP Composite(FIBITMAP fg, bool useFileBkg, ref RGBQUAD appBkColor, FIBITMAP bg); - - /// - /// This function composite a transparent foreground image against a single background color or - /// against a background image. - /// - /// Handle to a FreeImage bitmap. - /// When true the background of fg is used if it contains one. - /// The application background is used if useFileBkg is false - /// and 'appBkColor' is not null. - /// Image used as background when useFileBkg is false or fg has no background - /// and appBkColor is null. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_Composite")] - public static extern FIBITMAP Composite(FIBITMAP fg, bool useFileBkg, RGBQUAD[] appBkColor, FIBITMAP bg); - - /// - /// Performs a lossless crop on a JPEG file. - /// - /// Source filename. - /// Destination filename. - /// Specifies the left position of the cropped rectangle. - /// Specifies the top position of the cropped rectangle. - /// Specifies the right position of the cropped rectangle. - /// Specifies the bottom position of the cropped rectangle. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, CharSet = CharSet.Unicode, EntryPoint = "FreeImage_JPEGCropU")] - public static extern bool JPEGCrop(string src_file, string dst_file, int left, int top, int right, int bottom); - - /// - /// Applies the alpha value of each pixel to its color components. - /// The aplha value stays unchanged. - /// Only works with 32-bits color depth. - /// - /// Handle to a FreeImage bitmap. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_PreMultiplyWithAlpha")] - public static extern bool PreMultiplyWithAlpha(FIBITMAP dib); - - #endregion - - #region Miscellaneous algorithms - - /// - /// Solves a Poisson equation, remap result pixels to [0..1] and returns the solution. - /// - /// Handle to a FreeImage bitmap. - /// Number of cycles in the multigrid algorithm (usually 2 or 3) - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_MultigridPoissonSolver")] - public static extern FIBITMAP MultigridPoissonSolver(FIBITMAP Laplacian, int ncycle); - - #endregion - - #region Colors - - /// - /// Creates a lookup table to be used with which may adjusts brightness and - /// contrast, correct gamma and invert the image with a single call to . - /// - /// Output lookup table to be used with . - /// The size of 'lookUpTable' is assumed to be 256. - /// Percentage brightness value where -100 <= brightness <= 100. - /// A value of 0 means no change, less than 0 will make the image darker and greater - /// than 0 will make the image brighter. - /// Percentage contrast value where -100 <= contrast <= 100. - /// A value of 0 means no change, less than 0 will decrease the contrast - /// and greater than 0 will increase the contrast of the image. - /// Gamma value to be used for gamma correction. - /// A value of 1.0 leaves the image alone, less than one darkens it, - /// and greater than one lightens it. - /// If set to true, the image will be inverted. - /// The number of adjustments applied to the resulting lookup table - /// compared to a blind lookup table. - /// - /// This function creates a lookup table to be used with which may adjust - /// brightness and contrast, correct gamma and invert the image with a single call to - /// . If more than one of these image display properties need to be adjusted, - /// using a combined lookup table should be preferred over calling each adjustment function - /// separately. That's particularly true for huge images or if performance is an issue. Then, - /// the expensive process of iterating over all pixels of an image is performed only once and - /// not up to four times. - /// - /// Furthermore, the lookup table created does not depend on the order, in which each single - /// adjustment operation is performed. Due to rounding and byte casting issues, it actually - /// matters in which order individual adjustment operations are performed. Both of the following - /// snippets most likely produce different results: - /// - /// - /// // snippet 1: contrast, brightness - /// AdjustContrast(dib, 15.0); - /// AdjustBrightness(dib, 50.0); - /// - /// - /// - /// // snippet 2: brightness, contrast - /// AdjustBrightness(dib, 50.0); - /// AdjustContrast(dib, 15.0); - /// - /// - /// Better and even faster would be snippet 3: - /// - /// - /// // snippet 3: - /// byte[] lut = new byte[256]; - /// GetAdjustColorsLookupTable(lut, 50.0, 15.0, 1.0, false); - /// AdjustCurve(dib, lut, FREE_IMAGE_COLOR_CHANNEL.FICC_RGB); - /// - /// - /// This function is also used internally by , which does not return the - /// lookup table, but uses it to call on the passed image. - /// - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetAdjustColorsLookupTable")] - public static extern int GetAdjustColorsLookupTable(byte[] lookUpTable, double brightness, double contrast, double gamma, bool invert); - - /// - /// Adjusts an image's brightness, contrast and gamma as well as it may - /// optionally invert the image within a single operation. - /// - /// Handle to a FreeImage bitmap. - /// Percentage brightness value where -100 <= brightness <= 100. - /// A value of 0 means no change, less than 0 will make the image darker and greater - /// than 0 will make the image brighter. - /// Percentage contrast value where -100 <= contrast <= 100. - /// A value of 0 means no change, less than 0 will decrease the contrast - /// and greater than 0 will increase the contrast of the image. - /// Gamma value to be used for gamma correction. - /// A value of 1.0 leaves the image alone, less than one darkens it, - /// and greater than one lightens it. - /// This parameter must not be zero or smaller than zero. - /// If so, it will be ignored and no gamma correction will be performed on the image. - /// If set to true, the image will be inverted. - /// Returns true on success, false on failure. - /// - /// This function adjusts an image's brightness, contrast and gamma as well as it - /// may optionally invert the image within a single operation. If more than one of - /// these image display properties need to be adjusted, using this function should - /// be preferred over calling each adjustment function separately. That's particularly - /// true for huge images or if performance is an issue. - /// - /// This function relies on , - /// which creates a single lookup table, that combines all adjustment operations requested. - /// - /// Furthermore, the lookup table created by does - /// not depend on the order, in which each single adjustment operation is performed. - /// Due to rounding and byte casting issues, it actually matters in which order individual - /// adjustment operations are performed. Both of the following snippets most likely produce - /// different results: - /// - /// - /// // snippet 1: contrast, brightness - /// AdjustContrast(dib, 15.0); - /// AdjustBrightness(dib, 50.0); - /// - /// - /// - /// // snippet 2: brightness, contrast - /// AdjustBrightness(dib, 50.0); - /// AdjustContrast(dib, 15.0); - /// - /// - /// Better and even faster would be snippet 3: - /// - /// - /// // snippet 3: - /// AdjustColors(dib, 50.0, 15.0, 1.0, false); - /// - /// - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_AdjustColors")] - public static extern bool AdjustColors(FIBITMAP dib, double brightness, double contrast, double gamma, bool invert); - - /// - /// Applies color mapping for one or several colors on a 1-, 4- or 8-bit - /// palletized or a 16-, 24- or 32-bit high color image. - /// - /// Handle to a FreeImage bitmap. - /// Array of colors to be used as the mapping source. - /// Array of colors to be used as the mapping destination. - /// The number of colors to be mapped. This is the size of both - /// srccolors and dstcolors. - /// If true, 32-bit images and colors are treated as 24-bit. - /// If true, source and destination colors are swapped, that is, - /// each destination color is also mapped to the corresponding source color. - /// The total number of pixels changed. - /// - /// This function maps up to colors specified in - /// to these specified in . - /// Thereby, color srccolors[N], if found in the image, will be replaced by color - /// dstcolors[N]. If is true, additionally all colors - /// specified in are also mapped to these specified - /// in . For high color images, the actual image data will be - /// modified whereas, for palletized images only the palette will be changed. - /// - /// The function returns the number of pixels changed or zero, if no pixels were changed. - /// - /// Both arrays and are assumed - /// not to hold less than colors. - /// - /// For 16-bit images, all colors specified are transparently converted to their - /// proper 16-bit representation (either in RGB555 or RGB565 format, which is determined - /// by the image's red- green- and blue-mask). - /// - /// Note, that this behaviour is different from what does, - /// which modifies the actual image data on palletized images. - /// - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ApplyColorMapping")] - public static extern uint ApplyColorMapping(FIBITMAP dib, RGBQUAD[] srccolors, RGBQUAD[] dstcolors, uint count, bool ignore_alpha, bool swap); - - /// - /// Swaps two specified colors on a 1-, 4- or 8-bit palletized - /// or a 16-, 24- or 32-bit high color image. - /// - /// Handle to a FreeImage bitmap. - /// One of the two colors to be swapped. - /// The other of the two colors to be swapped. - /// If true, 32-bit images and colors are treated as 24-bit. - /// The total number of pixels changed. - /// - /// This function swaps the two specified colors and - /// on a palletized or high color image. - /// For high color images, the actual image data will be modified whereas, for palletized - /// images only the palette will be changed. - /// - /// Note, that this behaviour is different from what does, - /// which modifies the actual image data on palletized images. - /// - /// This is just a thin wrapper for and resolves to: - /// - /// - /// return ApplyColorMapping(dib, color_a, color_b, 1, ignore_alpha, true); - /// - /// - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SwapColors")] - public static extern uint SwapColors(FIBITMAP dib, ref RGBQUAD color_a, ref RGBQUAD color_b, bool ignore_alpha); - - /// - /// Applies palette index mapping for one or several indices - /// on a 1-, 4- or 8-bit palletized image. - /// - /// Handle to a FreeImage bitmap. - /// Array of palette indices to be used as the mapping source. - /// Array of palette indices to be used as the mapping destination. - /// The number of palette indices to be mapped. This is the size of both - /// srcindices and dstindices - /// If true, source and destination palette indices are swapped, that is, - /// each destination index is also mapped to the corresponding source index. - /// The total number of pixels changed. - /// - /// This function maps up to palette indices specified in - /// to these specified in . - /// Thereby, index srcindices[N], if present in the image, will be replaced by index - /// dstindices[N]. If is true, additionally all indices - /// specified in are also mapped to these specified in - /// . - /// - /// The function returns the number of pixels changed or zero, if no pixels were changed. - /// Both arrays and are assumed not to - /// hold less than indices. - /// - /// Note, that this behaviour is different from what does, which - /// modifies the actual image data on palletized images. - /// - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ApplyPaletteIndexMapping")] - public static extern uint ApplyPaletteIndexMapping(FIBITMAP dib, byte[] srcindices, byte[] dstindices, uint count, bool swap); - - /// - /// Swaps two specified palette indices on a 1-, 4- or 8-bit palletized image. - /// - /// Handle to a FreeImage bitmap. - /// One of the two palette indices to be swapped. - /// The other of the two palette indices to be swapped. - /// The total number of pixels changed. - /// - /// This function swaps the two specified palette indices index_a and - /// index_b on a palletized image. Therefore, not the palette, but the - /// actual image data will be modified. - /// - /// Note, that this behaviour is different from what does on palletized images, - /// which only swaps the colors in the palette. - /// - /// This is just a thin wrapper for and resolves to: - /// - /// - /// return ApplyPaletteIndexMapping(dib, index_a, index_b, 1, true); - /// - /// - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SwapPaletteIndices")] - public static extern uint SwapPaletteIndices(FIBITMAP dib, ref byte index_a, ref byte index_b); - - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_FillBackground")] - internal static extern bool FillBackground(FIBITMAP dib, IntPtr color, FREE_IMAGE_COLOR_OPTIONS options); - - #endregion - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/FreeImageWrapper.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/FreeImageWrapper.cs deleted file mode 100644 index 696d77a..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/FreeImageWrapper.cs +++ /dev/null @@ -1,5329 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.19 $ -// $Date: 2011/10/02 13:00:45 $ -// $Id: FreeImageWrapper.cs,v 1.19 2011/10/02 13:00:45 drolon Exp $ -// ========================================================== - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Drawing; -using System.Drawing.Imaging; -using System.IO; -using System.Reflection; -using System.Runtime.InteropServices; -using FreeImageAPI.IO; -using FreeImageAPI.Metadata; - -namespace FreeImageAPI -{ - /// - /// Static class importing functions from the FreeImage library - /// and providing additional functions. - /// - public static partial class FreeImage - { - #region Constants - - /// - /// Array containing all 'FREE_IMAGE_MDMODEL's. - /// - public static readonly FREE_IMAGE_MDMODEL[] FREE_IMAGE_MDMODELS = - (FREE_IMAGE_MDMODEL[])Enum.GetValues(typeof(FREE_IMAGE_MDMODEL)); - - /// - /// Stores handles used to read from streams. - /// - private static Dictionary streamHandles = - new Dictionary(); - - /// - /// Version of the wrapper library. - /// - private static Version WrapperVersion; - - private const int DIB_RGB_COLORS = 0; - private const int DIB_PAL_COLORS = 1; - private const int CBM_INIT = 0x4; - - /// - /// An uncompressed format. - /// - public const int BI_RGB = 0; - - /// - /// A run-length encoded (RLE) format for bitmaps with 8 bpp. The compression format is a 2-byte - /// format consisting of a count byte followed by a byte containing a color index. - /// - public const int BI_RLE8 = 1; - - /// - /// An RLE format for bitmaps with 4 bpp. The compression format is a 2-byte format consisting - /// of a count byte followed by two word-length color indexes. - /// - public const int BI_RLE4 = 2; - - /// - /// Specifies that the bitmap is not compressed and that the color table consists of three - /// DWORD color masks that specify the red, green, and blue components, respectively, - /// of each pixel. This is valid when used with 16- and 32-bpp bitmaps. - /// - public const int BI_BITFIELDS = 3; - - /// - /// Windows 98/Me, Windows 2000/XP: Indicates that the image is a JPEG image. - /// - public const int BI_JPEG = 4; - - /// - /// Windows 98/Me, Windows 2000/XP: Indicates that the image is a PNG image. - /// - public const int BI_PNG = 5; - - #endregion - - #region General functions - - /// - /// Returns the internal version of this FreeImage .NET wrapper. - /// - /// The internal version of this FreeImage .NET wrapper. - public static Version GetWrapperVersion() - { - if (WrapperVersion == null) - { - try - { - object[] attributes = Assembly.GetAssembly(typeof(FreeImage)) - .GetCustomAttributes(typeof(AssemblyFileVersionAttribute), false); - if ((attributes != null) && (attributes.Length != 0)) - { - AssemblyFileVersionAttribute attribute = - attributes[0] as AssemblyFileVersionAttribute; - if ((attribute != null) && (attribute.Version != null)) - { - return (WrapperVersion = new Version(attribute.Version)); - } - } - } - catch - { - - } - - WrapperVersion = new Version(); - } - - return WrapperVersion; - } - - /// - /// Returns the version of the native FreeImage library. - /// - /// The version of the native FreeImage library. - public static Version GetNativeVersion() - { - return new Version(GetVersion()); - } - - /// - /// Returns a value indicating if the FreeImage library is available or not. - /// See remarks for further details. - /// - /// false if the file is not available or out of date; - /// true, otherwise. - /// - /// The FreeImage.NET library is a wrapper for the native C++ library - /// (FreeImage.dll ... dont mix ist up with this library FreeImageNet.dll). - /// The native library must be either in the same folder as the program's - /// executable or in a folder contained in the envirent variable PATH - /// (for example %WINDIR%\System32). - /// Further more must both libraries, including the program itself, - /// be the same architecture (x86 or x64). - /// - public static bool IsAvailable() - { - try - { - // Call a static fast executing function - Version nativeVersion = new Version(GetVersion()); - Version wrapperVersion = GetWrapperVersion(); - // No exception thrown, the library seems to be present - return - (nativeVersion.Major > wrapperVersion.Major) || - ((nativeVersion.Major == wrapperVersion.Major) && (nativeVersion.Minor > wrapperVersion.Minor)) || - ((nativeVersion.Major == wrapperVersion.Major) && (nativeVersion.Minor == wrapperVersion.Minor) && (nativeVersion.Build >= wrapperVersion.Build)); - } - catch (DllNotFoundException) - { - return false; - } - catch (EntryPointNotFoundException) - { - return false; - } - catch (BadImageFormatException) - { - return false; - } - } - - #endregion - - #region Bitmap management functions - - /// - /// Creates a new bitmap in memory. - /// - /// Width of the new bitmap. - /// Height of the new bitmap. - /// Bit depth of the new Bitmap. - /// Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmap - /// Handle to a FreeImage bitmap. - public static FIBITMAP Allocate(int width, int height, int bpp) - { - return Allocate(width, height, bpp, 0, 0, 0); - } - - /// - /// Creates a new bitmap in memory. - /// - /// Type of the image. - /// Width of the new bitmap. - /// Height of the new bitmap. - /// Bit depth of the new Bitmap. - /// Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmap - /// Handle to a FreeImage bitmap. - public static FIBITMAP AllocateT(FREE_IMAGE_TYPE type, int width, int height, int bpp) - { - return AllocateT(type, width, height, bpp, 0, 0, 0); - } - - /// - /// Allocates a new image of the specified width, height and bit depth and optionally - /// fills it with the specified color. See remarks for further details. - /// - /// Width of the new bitmap. - /// Height of the new bitmap. - /// Bit depth of the new bitmap. - /// Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmaps. - /// The color to fill the bitmap with or null. - /// Options to enable or disable function-features. - /// The palette of the bitmap or null. - /// Handle to a FreeImage bitmap. - /// - /// This function is an extension to , which additionally supports - /// specifying a palette to be set for the newly create image, as well as specifying a - /// background color, the newly created image should initially be filled with. - /// - /// Basically, this function internally relies on function , followed by a - /// call to . This is why both parameters - /// and behave the same as it is - /// documented for function . - /// So, please refer to the documentation of to - /// learn more about parameters and . - /// - /// The palette specified through parameter is only copied to the - /// newly created image, if the desired bit depth is smaller than or equal to 8 bits per pixel. - /// In other words, the parameter is only taken into account for - /// palletized images. So, for an 8-bit image, the length is 256, for an 4-bit image it is 16 - /// and it is 2 for a 1-bit image. In other words, this function does not support partial palettes. - /// - /// However, specifying a palette is not necesarily needed, even for palletized images. This - /// function is capable of implicitly creating a palette, if is null. - /// If the specified background color is a greyscale value (red = green = blue) or if option - /// is specified, a greyscale palette - /// is created. For a 1-bit image, only if the specified background color is either black or white, - /// a monochrome palette, consisting of black and white only is created. In any case, the darker - /// colors are stored at the smaller palette indices. - /// - /// If the specified background color is not a greyscale value, or is neither black nor white - /// for a 1-bit image, solely this specified color is injected into the otherwise black-initialized - /// palette. For this operation, option - /// is implicit, so the specified is applied to the palette entry, - /// specified by the background color's field. - /// The image is then filled with this palette index. - /// - /// This function returns a newly created image as function does, if both - /// parameters and are null. - /// If only is null, the palette pointed to by - /// parameter is initially set for the new image, if a palletized - /// image of type is created. - /// However, in the latter case, this function returns an image, whose - /// pixels are all initialized with zeros so, the image will be filled with the color of the - /// first palette entry. - /// - public static FIBITMAP AllocateEx(int width, int height, int bpp, - RGBQUAD? color, FREE_IMAGE_COLOR_OPTIONS options, RGBQUAD[] palette) - { - return AllocateEx(width, height, bpp, color, options, palette, 0, 0, 0); - } - - /// - /// Allocates a new image of the specified width, height and bit depth and optionally - /// fills it with the specified color. See remarks for further details. - /// - /// Width of the new bitmap. - /// Height of the new bitmap. - /// Bit depth of the new bitmap. - /// Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmaps. - /// The color to fill the bitmap with or null. - /// Options to enable or disable function-features. - /// The palette of the bitmap or null. - /// Red part of the color layout. - /// eg: 0xFF0000 - /// Green part of the color layout. - /// eg: 0x00FF00 - /// Blue part of the color layout. - /// eg: 0x0000FF - /// Handle to a FreeImage bitmap. - /// - /// This function is an extension to , which additionally supports - /// specifying a palette to be set for the newly create image, as well as specifying a - /// background color, the newly created image should initially be filled with. - /// - /// Basically, this function internally relies on function , followed by a - /// call to . This is why both parameters - /// and behave the same as it is - /// documented for function . - /// So, please refer to the documentation of to - /// learn more about parameters and . - /// - /// The palette specified through parameter is only copied to the - /// newly created image, if the desired bit depth is smaller than or equal to 8 bits per pixel. - /// In other words, the parameter is only taken into account for - /// palletized images. So, for an 8-bit image, the length is 256, for an 4-bit image it is 16 - /// and it is 2 for a 1-bit image. In other words, this function does not support partial palettes. - /// - /// However, specifying a palette is not necesarily needed, even for palletized images. This - /// function is capable of implicitly creating a palette, if is null. - /// If the specified background color is a greyscale value (red = green = blue) or if option - /// is specified, a greyscale palette - /// is created. For a 1-bit image, only if the specified background color is either black or white, - /// a monochrome palette, consisting of black and white only is created. In any case, the darker - /// colors are stored at the smaller palette indices. - /// - /// If the specified background color is not a greyscale value, or is neither black nor white - /// for a 1-bit image, solely this specified color is injected into the otherwise black-initialized - /// palette. For this operation, option - /// is implicit, so the specified is applied to the palette entry, - /// specified by the background color's field. - /// The image is then filled with this palette index. - /// - /// This function returns a newly created image as function does, if both - /// parameters and are null. - /// If only is null, the palette pointed to by - /// parameter is initially set for the new image, if a palletized - /// image of type is created. - /// However, in the latter case, this function returns an image, whose - /// pixels are all initialized with zeros so, the image will be filled with the color of the - /// first palette entry. - /// - public static FIBITMAP AllocateEx(int width, int height, int bpp, - RGBQUAD? color, FREE_IMAGE_COLOR_OPTIONS options, RGBQUAD[] palette, - uint red_mask, uint green_mask, uint blue_mask) - { - if ((palette != null) && (bpp <= 8) && (palette.Length < (1 << bpp))) - return FIBITMAP.Zero; - - if (color.HasValue) - { - GCHandle handle = new GCHandle(); - try - { - RGBQUAD[] buffer = new RGBQUAD[] { color.Value }; - handle = GCHandle.Alloc(buffer, GCHandleType.Pinned); - return AllocateEx(width, height, bpp, handle.AddrOfPinnedObject(), - options, palette, red_mask, green_mask, blue_mask); - } - finally - { - if (handle.IsAllocated) - handle.Free(); - } - } - else - { - return AllocateEx(width, height, bpp, IntPtr.Zero, - options, palette, red_mask, green_mask, blue_mask); - } - } - - /// - /// Allocates a new image of the specified type, width, height and bit depth and optionally - /// fills it with the specified color. See remarks for further details. - /// - /// The type of the specified color. - /// Type of the image. - /// Width of the new bitmap. - /// Height of the new bitmap. - /// Bit depth of the new bitmap. - /// Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmap - /// The color to fill the bitmap with or null. - /// Options to enable or disable function-features. - /// The palette of the bitmap or null. - /// Handle to a FreeImage bitmap. - /// - /// This function is an extension to , which additionally supports - /// specifying a palette to be set for the newly create image, as well as specifying a - /// background color, the newly created image should initially be filled with. - /// - /// Basically, this function internally relies on function , followed by a - /// call to . This is why both parameters - /// and behave the same as it is - /// documented for function . So, please refer to the - /// documentation of to learn more about parameters color and options. - /// - /// The palette specified through parameter palette is only copied to the newly created - /// image, if its image type is and the desired bit - /// depth is smaller than or equal to 8 bits per pixel. In other words, the - /// palette is only taken into account for palletized images. However, if the preceding conditions - /// match and if is not null, the palette is assumed to be at - /// least as large as the size of a fully populated palette for the desired bit depth. - /// So, for an 8-bit image, this length is 256, for an 4-bit image it is 16 and it is - /// 2 for a 1-bit image. In other words, this function does not support partial palettes. - /// - /// However, specifying a palette is not necesarily needed, even for palletized images. This - /// function is capable of implicitly creating a palette, if is null. - /// If the specified background color is a greyscale value (red = green = blue) or if option - /// is specified, a greyscale palette - /// is created. For a 1-bit image, only if the specified background color is either black or white, - /// a monochrome palette, consisting of black and white only is created. In any case, the darker - /// colors are stored at the smaller palette indices. - /// - /// If the specified background color is not a greyscale value, or is neither black nor white - /// for a 1-bit image, solely this specified color is injected into the otherwise black-initialized - /// palette. For this operation, option - /// is implicit, so the specified color is applied to the palette entry, specified by the - /// background color's field. The image is then filled with - /// this palette index. - /// - /// This function returns a newly created image as function does, if both - /// parameters and are null. - /// If only is null, the palette pointed to by - /// parameter is initially set for the new image, if a palletized - /// image of type is created. - /// However, in the latter case, this function returns an image, whose - /// pixels are all initialized with zeros so, the image will be filled with the color of the - /// first palette entry. - /// - public static FIBITMAP AllocateExT(FREE_IMAGE_TYPE type, int width, int height, int bpp, - T? color, FREE_IMAGE_COLOR_OPTIONS options, RGBQUAD[] palette) where T : struct - { - return AllocateExT(type, width, height, bpp, color, options, palette, 0, 0, 0); - } - - /// - /// Allocates a new image of the specified type, width, height and bit depth and optionally - /// fills it with the specified color. See remarks for further details. - /// - /// The type of the specified color. - /// Type of the image. - /// Width of the new bitmap. - /// Height of the new bitmap. - /// Bit depth of the new bitmap. - /// Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmap - /// The color to fill the bitmap with or null. - /// Options to enable or disable function-features. - /// The palette of the bitmap or null. - /// Red part of the color layout. - /// eg: 0xFF0000 - /// Green part of the color layout. - /// eg: 0x00FF00 - /// Blue part of the color layout. - /// eg: 0x0000FF - /// Handle to a FreeImage bitmap. - /// - /// This function is an extension to , which additionally supports - /// specifying a palette to be set for the newly create image, as well as specifying a - /// background color, the newly created image should initially be filled with. - /// - /// Basically, this function internally relies on function , followed by a - /// call to . This is why both parameters - /// and behave the same as it is - /// documented for function . So, please refer to the - /// documentation of to learn more about parameters color and options. - /// - /// The palette specified through parameter palette is only copied to the newly created - /// image, if its image type is and the desired bit - /// depth is smaller than or equal to 8 bits per pixel. In other words, the - /// palette is only taken into account for palletized images. However, if the preceding conditions - /// match and if is not null, the palette is assumed to be at - /// least as large as the size of a fully populated palette for the desired bit depth. - /// So, for an 8-bit image, this length is 256, for an 4-bit image it is 16 and it is - /// 2 for a 1-bit image. In other words, this function does not support partial palettes. - /// - /// However, specifying a palette is not necesarily needed, even for palletized images. This - /// function is capable of implicitly creating a palette, if is null. - /// If the specified background color is a greyscale value (red = green = blue) or if option - /// is specified, a greyscale palette - /// is created. For a 1-bit image, only if the specified background color is either black or white, - /// a monochrome palette, consisting of black and white only is created. In any case, the darker - /// colors are stored at the smaller palette indices. - /// - /// If the specified background color is not a greyscale value, or is neither black nor white - /// for a 1-bit image, solely this specified color is injected into the otherwise black-initialized - /// palette. For this operation, option - /// is implicit, so the specified color is applied to the palette entry, specified by the - /// background color's field. The image is then filled with - /// this palette index. - /// - /// This function returns a newly created image as function does, if both - /// parameters and are null. - /// If only is null, the palette pointed to by - /// parameter is initially set for the new image, if a palletized - /// image of type is created. - /// However, in the latter case, this function returns an image, whose - /// pixels are all initialized with zeros so, the image will be filled with the color of the - /// first palette entry. - /// - public static FIBITMAP AllocateExT(FREE_IMAGE_TYPE type, int width, int height, int bpp, - T? color, FREE_IMAGE_COLOR_OPTIONS options, RGBQUAD[] palette, - uint red_mask, uint green_mask, uint blue_mask) where T : struct - { - if ((palette != null) && (bpp <= 8) && (palette.Length < (1 << bpp))) - return FIBITMAP.Zero; - - if (color.HasValue) - { - if (!CheckColorType(type, color.Value)) - return FIBITMAP.Zero; - - GCHandle handle = new GCHandle(); - try - { - T[] buffer = new T[] { color.Value }; - handle = GCHandle.Alloc(buffer, GCHandleType.Pinned); - return AllocateExT(type, width, height, bpp, handle.AddrOfPinnedObject(), - options, palette, red_mask, green_mask, blue_mask); - } - finally - { - if (handle.IsAllocated) - handle.Free(); - } - } - else - { - return AllocateExT(type, width, height, bpp, IntPtr.Zero, - options, palette, red_mask, green_mask, blue_mask); - } - } - - /// - /// Converts a FreeImage bitmap to a .NET . - /// - /// Handle to a FreeImage bitmap. - /// The converted .NET . - /// Copying metadata has been disabled until a proper way - /// of reading and storing metadata in a .NET bitmap is found. - /// - /// is null. - /// - /// The image type of is not FIT_BITMAP. - public static Bitmap GetBitmap(FIBITMAP dib) - { - return GetBitmap(dib, true); - } - - /// - /// Converts a FreeImage bitmap to a .NET . - /// - /// Handle to a FreeImage bitmap. - /// When true existing metadata will be copied. - /// The converted .NET . - /// Copying metadata has been disabled until a proper way - /// of reading and storing metadata in a .NET bitmap is found. - /// - /// is null. - /// - /// The image type of is not FIT_BITMAP. - internal static Bitmap GetBitmap(FIBITMAP dib, bool copyMetadata) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - if (GetImageType(dib) != FREE_IMAGE_TYPE.FIT_BITMAP) - { - throw new ArgumentException("Only bitmaps with type of FIT_BITMAP can be converted."); - } - - PixelFormat format = GetPixelFormat(dib); - - if ((format == PixelFormat.Undefined) && (GetBPP(dib) == 16u)) - { - throw new ArgumentException("Only 16bit 555 and 565 are supported."); - } - - int height = (int)GetHeight(dib); - int width = (int)GetWidth(dib); - int pitch = (int)GetPitch(dib); - - Bitmap result = new Bitmap(width, height, format); - BitmapData data; - // Locking the complete bitmap in writeonly mode - data = result.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, format); - // Writing the bitmap data directly into the new created .NET bitmap. - ConvertToRawBits(data.Scan0, dib, pitch, GetBPP(dib), - GetRedMask(dib), GetGreenMask(dib), GetBlueMask(dib), true); - // Unlock the bitmap - result.UnlockBits(data); - // Apply the bitmap resolution - if((GetResolutionX(dib) > 0) && (GetResolutionY(dib) > 0)) - { - // SetResolution will throw an exception when zero values are given on input - result.SetResolution(GetResolutionX(dib), GetResolutionY(dib)); - } - // Check whether the bitmap has a palette - if (GetPalette(dib) != IntPtr.Zero) - { - // Get the bitmaps palette to apply changes - ColorPalette palette = result.Palette; - // Get the orgininal palette - Color[] colorPalette = new Palette(dib).ColorData; - // Get the maximum number of palette entries to copy - int entriesToCopy = Math.Min(colorPalette.Length, palette.Entries.Length); - - // Check whether the bitmap is transparent - if (IsTransparent(dib)) - { - byte[] transTable = GetTransparencyTableEx(dib); - int i = 0; - int maxEntriesWithTrans = Math.Min(entriesToCopy, transTable.Length); - // Copy palette entries and include transparency - for (; i < maxEntriesWithTrans; i++) - { - palette.Entries[i] = Color.FromArgb(transTable[i], colorPalette[i]); - } - // Copy palette entries and that have no transparancy - for (; i < entriesToCopy; i++) - { - palette.Entries[i] = Color.FromArgb(0xFF, colorPalette[i]); - } - } - else - { - for (int i = 0; i < entriesToCopy; i++) - { - palette.Entries[i] = colorPalette[i]; - } - } - - // Set the bitmaps palette - result.Palette = palette; - } - // Copy metadata - if (copyMetadata) - { - try - { - List list = new List(); - // Get a list of all types - FITAG tag; - FIMETADATA mData; - foreach (FREE_IMAGE_MDMODEL model in FREE_IMAGE_MDMODELS) - { - // Get a unique search handle - mData = FindFirstMetadata(model, dib, out tag); - // Check if metadata exists for this type - if (mData.IsNull) continue; - do - { - PropertyItem propItem = CreatePropertyItem(); - propItem.Len = (int)GetTagLength(tag); - propItem.Id = (int)GetTagID(tag); - propItem.Type = (short)GetTagType(tag); - byte[] buffer = new byte[propItem.Len]; - - unsafe - { - byte* src = (byte*)GetTagValue(tag); - fixed (byte* dst = buffer) - { - CopyMemory(dst, src, (uint)propItem.Len); - } - } - - propItem.Value = buffer; - list.Add(propItem); - } - while (FindNextMetadata(mData, out tag)); - FindCloseMetadata(mData); - } - foreach (PropertyItem propItem in list) - { - result.SetPropertyItem(propItem); - } - } - catch - { - } - } - return result; - } - - /// - /// Converts an .NET into a FreeImage bitmap. - /// - /// The to convert. - /// Handle to a FreeImage bitmap. - /// Copying metadata has been disabled until a proper way - /// of reading and storing metadata in a .NET bitmap is found. - /// - /// is null. - /// - /// The bitmaps pixelformat is invalid. - public static FIBITMAP CreateFromBitmap(Bitmap bitmap) - { - return CreateFromBitmap(bitmap, false); - } - - /// - /// Converts an .NET into a FreeImage bitmap. - /// - /// The to convert. - /// When true existing metadata will be copied. - /// Handle to a FreeImage bitmap. - /// Copying metadata has been disabled until a proper way - /// of reading and storing metadata in a .NET bitmap is found. - /// - /// is null. - /// - /// The bitmaps pixelformat is invalid. - internal static FIBITMAP CreateFromBitmap(Bitmap bitmap, bool copyMetadata) - { - if (bitmap == null) - { - throw new ArgumentNullException("bitmap"); - } - uint bpp, red_mask, green_mask, blue_mask; - FREE_IMAGE_TYPE type; - if (!GetFormatParameters(bitmap.PixelFormat, out type, out bpp, out red_mask, out green_mask, out blue_mask)) - { - throw new ArgumentException("The bitmaps pixelformat is invalid."); - } - - // Locking the complete bitmap in readonly mode - BitmapData data = bitmap.LockBits( - new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadOnly, bitmap.PixelFormat); - // Copying the bitmap data directly from the .NET bitmap - FIBITMAP result = ConvertFromRawBits( - data.Scan0, - type, - data.Width, - data.Height, - data.Stride, - bpp, - red_mask, - green_mask, - blue_mask, - true); - bitmap.UnlockBits(data); - // Handle palette - if (GetPalette(result) != IntPtr.Zero) - { - Palette palette = new Palette(result); - Color[] colors = bitmap.Palette.Entries; - // Only copy available palette entries - int entriesToCopy = Math.Min(palette.Length, colors.Length); - byte[] transTable = new byte[entriesToCopy]; - for (int i = 0; i < entriesToCopy; i++) - { - RGBQUAD color = (RGBQUAD)colors[i]; - color.rgbReserved = 0x00; - palette[i] = color; - transTable[i] = colors[i].A; - } - if ((bitmap.Flags & (int)ImageFlags.HasAlpha) != 0) - { - FreeImage.SetTransparencyTable(result, transTable); - } - } - // Handle meta data - // Disabled - //if (copyMetadata) - //{ - // foreach (PropertyItem propItem in bitmap.PropertyItems) - // { - // FITAG tag = CreateTag(); - // SetTagLength(tag, (uint)propItem.Len); - // SetTagID(tag, (ushort)propItem.Id); - // SetTagType(tag, (FREE_IMAGE_MDTYPE)propItem.Type); - // SetTagValue(tag, propItem.Value); - // SetMetadata(FREE_IMAGE_MDMODEL.FIMD_EXIF_EXIF, result, "", tag); - // } - //} - return result; - } - - /// - /// Converts a raw bitmap to a FreeImage bitmap. - /// - /// Array of bytes containing the raw bitmap. - /// The type of the raw bitmap. - /// The width in pixels of the raw bitmap. - /// The height in pixels of the raw bitmap. - /// Defines the total width of a scanline in the raw bitmap, - /// including padding bytes. - /// The bit depth (bits per pixel) of the raw bitmap. - /// The bit mask describing the bits used to store a single - /// pixel's red component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// The bit mask describing the bits used to store a single - /// pixel's green component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// The bit mask describing the bits used to store a single - /// pixel's blue component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// If true, the raw bitmap is stored in top-down order (top-left pixel first) - /// and in bottom-up order (bottom-left pixel first) otherwise. - /// Handle to a FreeImage bitmap. - public static unsafe FIBITMAP ConvertFromRawBits( - byte[] bits, - FREE_IMAGE_TYPE type, - int width, - int height, - int pitch, - uint bpp, - uint red_mask, - uint green_mask, - uint blue_mask, - bool topdown) - { - fixed (byte* ptr = bits) - { - return ConvertFromRawBits( - (IntPtr)ptr, - type, - width, - height, - pitch, - bpp, - red_mask, - green_mask, - blue_mask, - topdown); - } - } - - /// - /// Converts a raw bitmap to a FreeImage bitmap. - /// - /// Pointer to the memory block containing the raw bitmap. - /// The type of the raw bitmap. - /// The width in pixels of the raw bitmap. - /// The height in pixels of the raw bitmap. - /// Defines the total width of a scanline in the raw bitmap, - /// including padding bytes. - /// The bit depth (bits per pixel) of the raw bitmap. - /// The bit mask describing the bits used to store a single - /// pixel's red component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// The bit mask describing the bits used to store a single - /// pixel's green component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// The bit mask describing the bits used to store a single - /// pixel's blue component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// If true, the raw bitmap is stored in top-down order (top-left pixel first) - /// and in bottom-up order (bottom-left pixel first) otherwise. - /// Handle to a FreeImage bitmap. - public static unsafe FIBITMAP ConvertFromRawBits( - IntPtr bits, - FREE_IMAGE_TYPE type, - int width, - int height, - int pitch, - uint bpp, - uint red_mask, - uint green_mask, - uint blue_mask, - bool topdown) - { - byte* addr = (byte*)bits; - if ((addr == null) || (width <= 0) || (height <= 0)) - { - return FIBITMAP.Zero; - } - - FIBITMAP dib = AllocateT(type, width, height, (int)bpp, red_mask, green_mask, blue_mask); - if (dib != FIBITMAP.Zero) - { - if (topdown) - { - for (int i = height - 1; i >= 0; --i) - { - CopyMemory((byte*)GetScanLine(dib, i), addr, (int)GetLine(dib)); - addr += pitch; - } - } - else - { - for (int i = 0; i < height; ++i) - { - CopyMemory((byte*)GetScanLine(dib, i), addr, (int)GetLine(dib)); - addr += pitch; - } - } - } - return dib; - } - - /// - /// Saves a .NET to a file. - /// - /// The .NET to save. - /// Name of the file to save to. - /// Returns true on success, false on failure. - /// - /// or is null. - /// - /// The bitmaps pixelformat is invalid. - public static bool SaveBitmap(Bitmap bitmap, string filename) - { - return SaveBitmap( - bitmap, - filename, - FREE_IMAGE_FORMAT.FIF_UNKNOWN, - FREE_IMAGE_SAVE_FLAGS.DEFAULT); - } - - /// - /// Saves a .NET to a file. - /// - /// The .NET to save. - /// Name of the file to save to. - /// Flags to enable or disable plugin-features. - /// Returns true on success, false on failure. - /// - /// or is null. - /// - /// The bitmaps pixelformat is invalid. - public static bool SaveBitmap(Bitmap bitmap, string filename, FREE_IMAGE_SAVE_FLAGS flags) - { - return SaveBitmap( - bitmap, - filename, - FREE_IMAGE_FORMAT.FIF_UNKNOWN, - flags); - } - - /// - /// Saves a .NET to a file. - /// - /// The .NET to save. - /// Name of the file to save to. - /// Format of the bitmap. If the format should be taken from the - /// filename use . - /// Flags to enable or disable plugin-features. - /// Returns true on success, false on failure. - /// - /// or is null. - /// - /// The bitmaps pixelformat is invalid. - public static bool SaveBitmap( - Bitmap bitmap, - string filename, - FREE_IMAGE_FORMAT format, - FREE_IMAGE_SAVE_FLAGS flags) - { - FIBITMAP dib = CreateFromBitmap(bitmap); - bool result = SaveEx(dib, filename, format, flags); - Unload(dib); - return result; - } - - /// - /// Loads a FreeImage bitmap. - /// The file will be loaded with default loading flags. - /// - /// The complete name of the file to load. - /// Handle to a FreeImage bitmap. - /// - /// does not exists. - public static FIBITMAP LoadEx(string filename) - { - FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_UNKNOWN; - return LoadEx(filename, FREE_IMAGE_LOAD_FLAGS.DEFAULT, ref format); - } - - /// - /// Loads a FreeImage bitmap. - /// Load flags can be provided by the flags parameter. - /// - /// The complete name of the file to load. - /// Flags to enable or disable plugin-features. - /// Handle to a FreeImage bitmap. - /// - /// does not exists. - public static FIBITMAP LoadEx(string filename, FREE_IMAGE_LOAD_FLAGS flags) - { - FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_UNKNOWN; - return LoadEx(filename, flags, ref format); - } - - /// - /// Loads a FreeImage bitmap. - /// In case the loading format is the files - /// real format is being analysed. If no plugin can read the file, format remains - /// and 0 is returned. - /// The file will be loaded with default loading flags. - /// - /// The complete name of the file to load. - /// Format of the image. If the format is unknown use - /// . - /// In case a suitable format was found by LoadEx it will be returned in format. - /// Handle to a FreeImage bitmap. - /// - /// does not exists. - public static FIBITMAP LoadEx(string filename, ref FREE_IMAGE_FORMAT format) - { - return LoadEx(filename, FREE_IMAGE_LOAD_FLAGS.DEFAULT, ref format); - } - - /// - /// Loads a FreeImage bitmap. - /// In case the loading format is the files - /// real format is being analysed. If no plugin can read the file, format remains - /// and 0 is returned. - /// Load flags can be provided by the flags parameter. - /// - /// The complete name of the file to load. - /// Flags to enable or disable plugin-features. - /// Format of the image. If the format is unknown use - /// . - /// In case a suitable format was found by LoadEx it will be returned in format. - /// - /// Handle to a FreeImage bitmap. - /// - /// does not exists. - public static FIBITMAP LoadEx(string filename, FREE_IMAGE_LOAD_FLAGS flags, ref FREE_IMAGE_FORMAT format) - { - // check if file exists - if (!File.Exists(filename)) - { - throw new FileNotFoundException(filename + " could not be found."); - } - FIBITMAP dib = new FIBITMAP(); - if (format == FREE_IMAGE_FORMAT.FIF_UNKNOWN) - { - // query all plugins to see if one can read the file - format = GetFileType(filename, 0); - } - // check if the plugin is capable of loading files - if (FIFSupportsReading(format)) - { - dib = Load(format, filename, flags); - } - return dib; - } - - /// - /// Loads a .NET from a file. - /// - /// Name of the file to be loaded. - /// Format of the image. If the format should be taken from the - /// filename use . - /// Flags to enable or disable plugin-features. - /// The loaded .NET . - /// - /// does not exists. - /// - /// The image type of the image is not . - public static Bitmap LoadBitmap(string filename, FREE_IMAGE_LOAD_FLAGS flags, ref FREE_IMAGE_FORMAT format) - { - FIBITMAP dib = LoadEx(filename, flags, ref format); - Bitmap result = GetBitmap(dib, true); - Unload(dib); - return result; - } - - /// - /// Deletes a previously loaded FreeImage bitmap from memory and resets the handle to 0. - /// - /// Handle to a FreeImage bitmap. - public static void UnloadEx(ref FIBITMAP dib) - { - if (!dib.IsNull) - { - Unload(dib); - dib.SetNull(); - } - } - - /// - /// Saves a previously loaded FreeImage bitmap to a file. - /// The format is taken off the filename. - /// If no suitable format was found false will be returned. - /// - /// Handle to a FreeImage bitmap. - /// The complete name of the file to save to. - /// The extension will be corrected if it is no valid extension for the - /// selected format or if no extension was specified. - /// Returns true on success, false on failure. - /// - /// or is null. - public static bool SaveEx(FIBITMAP dib, string filename) - { - return SaveEx( - ref dib, - filename, - FREE_IMAGE_FORMAT.FIF_UNKNOWN, - FREE_IMAGE_SAVE_FLAGS.DEFAULT, - FREE_IMAGE_COLOR_DEPTH.FICD_AUTO, - false); - } - - /// - /// Saves a previously loaded FreeImage bitmap to a file. - /// In case the loading format is - /// the format is taken off the filename. - /// If no suitable format was found false will be returned. - /// - /// Handle to a FreeImage bitmap. - /// The complete name of the file to save to. - /// The extension will be corrected if it is no valid extension for the - /// selected format or if no extension was specified. - /// Format of the image. If the format should be taken from the - /// filename use . - /// Returns true on success, false on failure. - /// - /// or is null. - public static bool SaveEx( - FIBITMAP dib, - string filename, - FREE_IMAGE_FORMAT format) - { - return SaveEx( - ref dib, - filename, - format, - FREE_IMAGE_SAVE_FLAGS.DEFAULT, - FREE_IMAGE_COLOR_DEPTH.FICD_AUTO, - false); - } - - /// - /// Saves a previously loaded FreeImage bitmap to a file. - /// The format is taken off the filename. - /// If no suitable format was found false will be returned. - /// - /// Handle to a FreeImage bitmap. - /// The complete name of the file to save to. - /// The extension will be corrected if it is no valid extension for the - /// selected format or if no extension was specified. - /// When true the structure will be unloaded on success. - /// If the function failed and returned false, the bitmap was not unloaded. - /// Returns true on success, false on failure. - /// - /// or is null. - public static bool SaveEx( - ref FIBITMAP dib, - string filename, - bool unloadSource) - { - return SaveEx( - ref dib, - filename, - FREE_IMAGE_FORMAT.FIF_UNKNOWN, - FREE_IMAGE_SAVE_FLAGS.DEFAULT, - FREE_IMAGE_COLOR_DEPTH.FICD_AUTO, - unloadSource); - } - - /// - /// Saves a previously loaded FreeImage bitmap to a file. - /// The format is taken off the filename. - /// If no suitable format was found false will be returned. - /// Save flags can be provided by the flags parameter. - /// - /// Handle to a FreeImage bitmap. - /// The complete name of the file to save to. - /// The extension will be corrected if it is no valid extension for the - /// selected format or if no extension was specified - /// Flags to enable or disable plugin-features. - /// Returns true on success, false on failure. - /// - /// or is null. - public static bool SaveEx( - FIBITMAP dib, - string filename, - FREE_IMAGE_SAVE_FLAGS flags) - { - return SaveEx( - ref dib, - filename, - FREE_IMAGE_FORMAT.FIF_UNKNOWN, - flags, - FREE_IMAGE_COLOR_DEPTH.FICD_AUTO, - false); - } - - /// - /// Saves a previously loaded FreeImage bitmap to a file. - /// The format is taken off the filename. - /// If no suitable format was found false will be returned. - /// Save flags can be provided by the flags parameter. - /// - /// Handle to a FreeImage bitmap. - /// The complete name of the file to save to. - /// The extension will be corrected if it is no valid extension for the - /// selected format or if no extension was specified. - /// Flags to enable or disable plugin-features. - /// When true the structure will be unloaded on success. - /// If the function failed and returned false, the bitmap was not unloaded. - /// Returns true on success, false on failure. - /// - /// or is null. - public static bool SaveEx( - ref FIBITMAP dib, - string filename, - FREE_IMAGE_SAVE_FLAGS flags, - bool unloadSource) - { - return SaveEx( - ref dib, - filename, - FREE_IMAGE_FORMAT.FIF_UNKNOWN, - flags, - FREE_IMAGE_COLOR_DEPTH.FICD_AUTO, - unloadSource); - } - - /// - /// Saves a previously loaded FreeImage bitmap to a file. - /// In case the loading format is - /// the format is taken off the filename. - /// If no suitable format was found false will be returned. - /// - /// Handle to a FreeImage bitmap. - /// The complete name of the file to save to. - /// The extension will be corrected if it is no valid extension for the - /// selected format or if no extension was specified. - /// Format of the image. If the format should be taken from the - /// filename use . - /// When true the structure will be unloaded on success. - /// If the function failed and returned false, the bitmap was not unloaded. - /// Returns true on success, false on failure. - /// - /// or is null. - public static bool SaveEx( - ref FIBITMAP dib, - string filename, - FREE_IMAGE_FORMAT format, - bool unloadSource) - { - return SaveEx( - ref dib, - filename, - format, - FREE_IMAGE_SAVE_FLAGS.DEFAULT, - FREE_IMAGE_COLOR_DEPTH.FICD_AUTO, - unloadSource); - } - - /// - /// Saves a previously loaded FreeImage bitmap to a file. - /// In case the loading format is - /// the format is taken off the filename. - /// If no suitable format was found false will be returned. - /// Save flags can be provided by the flags parameter. - /// - /// Handle to a FreeImage bitmap. - /// The complete name of the file to save to. - /// The extension will be corrected if it is no valid extension for the - /// selected format or if no extension was specified. - /// Format of the image. If the format should be taken from the - /// filename use . - /// Flags to enable or disable plugin-features. - /// Returns true on success, false on failure. - /// - /// or is null. - public static bool SaveEx( - FIBITMAP dib, - string filename, - FREE_IMAGE_FORMAT format, - FREE_IMAGE_SAVE_FLAGS flags) - { - return SaveEx( - ref dib, - filename, - format, - flags, - FREE_IMAGE_COLOR_DEPTH.FICD_AUTO, - false); - } - - /// - /// Saves a previously loaded FreeImage bitmap to a file. - /// In case the loading format is - /// the format is taken off the filename. - /// If no suitable format was found false will be returned. - /// Save flags can be provided by the flags parameter. - /// The bitmaps color depth can be set by 'colorDepth'. - /// If set to a suitable color depth - /// will be taken if available. - /// - /// Handle to a FreeImage bitmap. - /// The complete name of the file to save to. - /// The extension will be corrected if it is no valid extension for the - /// selected format or if no extension was specified. - /// Format of the image. If the format should be taken from the - /// filename use . - /// Flags to enable or disable plugin-features. - /// The new color depth of the bitmap. - /// Set to if Save should take the - /// best suitable color depth. - /// If a color depth is selected that the provided format cannot write an - /// error-message will be thrown. - /// When true the structure will be unloaded on success. - /// If the function failed and returned false, the bitmap was not unloaded. - /// Returns true on success, false on failure. - /// - /// A direct color conversion failed. - /// - /// or is null. - public static bool SaveEx( - ref FIBITMAP dib, - string filename, - FREE_IMAGE_FORMAT format, - FREE_IMAGE_SAVE_FLAGS flags, - FREE_IMAGE_COLOR_DEPTH colorDepth, - bool unloadSource) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - if (filename == null) - { - throw new ArgumentNullException("filename"); - } - bool result = false; - // Gets format from filename if the format is unknown - if (format == FREE_IMAGE_FORMAT.FIF_UNKNOWN) - { - format = GetFIFFromFilename(filename); - } - if (format != FREE_IMAGE_FORMAT.FIF_UNKNOWN) - { - // Checks writing support - if (FIFSupportsWriting(format) && FIFSupportsExportType(format, GetImageType(dib))) - { - // Check valid filename and correct it if needed - if (!IsFilenameValidForFIF(format, filename)) - { - string extension = GetPrimaryExtensionFromFIF(format); - filename = Path.ChangeExtension(filename, extension); - } - - FIBITMAP dibToSave = PrepareBitmapColorDepth(dib, format, colorDepth); - try - { - result = Save(format, dibToSave, filename, flags); - } - finally - { - // Always unload a temporary created bitmap. - if (dibToSave != dib) - { - UnloadEx(ref dibToSave); - } - // On success unload the bitmap - if (result && unloadSource) - { - UnloadEx(ref dib); - } - } - } - } - return result; - } - - /// - /// Loads a FreeImage bitmap. - /// The stream must be set to the correct position before calling LoadFromStream. - /// - /// The stream to read from. - /// Handle to a FreeImage bitmap. - /// - /// is null. - /// - /// is not capable of reading. - public static FIBITMAP LoadFromStream(Stream stream) - { - FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_UNKNOWN; - return LoadFromStream(stream, FREE_IMAGE_LOAD_FLAGS.DEFAULT, ref format); - } - - /// - /// Loads a FreeImage bitmap. - /// The stream must be set to the correct position before calling LoadFromStream. - /// - /// The stream to read from. - /// Flags to enable or disable plugin-features. - /// Handle to a FreeImage bitmap. - /// - /// is null. - /// - /// is not capable of reading. - public static FIBITMAP LoadFromStream(Stream stream, FREE_IMAGE_LOAD_FLAGS flags) - { - FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_UNKNOWN; - return LoadFromStream(stream, flags, ref format); - } - - /// - /// Loads a FreeImage bitmap. - /// In case the loading format is the - /// bitmaps real format is being analysed. - /// The stream must be set to the correct position before calling LoadFromStream. - /// - /// The stream to read from. - /// Format of the image. If the format is unknown use - /// . - /// In case a suitable format was found by LoadFromStream it will be returned in format. - /// Handle to a FreeImage bitmap. - /// - /// is null. - /// - /// is not capable of reading. - public static FIBITMAP LoadFromStream(Stream stream, ref FREE_IMAGE_FORMAT format) - { - return LoadFromStream(stream, FREE_IMAGE_LOAD_FLAGS.DEFAULT, ref format); - } - - /// - /// Loads a FreeImage bitmap. - /// In case the loading format is - /// the bitmaps real format is being analysed. - /// The stream must be set to the correct position before calling LoadFromStream. - /// - /// The stream to read from. - /// Flags to enable or disable plugin-features. - /// Format of the image. If the format is unknown use - /// . - /// In case a suitable format was found by LoadFromStream it will be returned in format. - /// Handle to a FreeImage bitmap. - /// - /// is null. - /// - /// is not capable of reading. - public static FIBITMAP LoadFromStream( - Stream stream, - FREE_IMAGE_LOAD_FLAGS flags, - ref FREE_IMAGE_FORMAT format) - { - if (stream == null) - { - throw new ArgumentNullException("stream"); - } - if (!stream.CanRead) - { - throw new ArgumentException("stream is not capable of reading."); - } - // Wrap the source stream if it is unable to seek (which is required by FreeImage) - stream = (stream.CanSeek) ? stream : new StreamWrapper(stream, true); - - stream.Position = 0L; - if (format == FREE_IMAGE_FORMAT.FIF_UNKNOWN) - { - // Get the format of the bitmap - format = GetFileTypeFromStream(stream); - // Restore the streams position - stream.Position = 0L; - } - if (!FIFSupportsReading(format)) - { - return FIBITMAP.Zero; - } - // Create a 'FreeImageIO' structure for calling 'LoadFromHandle' - // using the internal structure 'FreeImageStreamIO'. - FreeImageIO io = FreeImageStreamIO.io; - using (fi_handle handle = new fi_handle(stream)) - { - return LoadFromHandle(format, ref io, handle, flags); - } - } - - /// - /// Saves a previously loaded FreeImage bitmap to a stream. - /// The stream must be set to the correct position before calling SaveToStream. - /// - /// Handle to a FreeImage bitmap. - /// The stream to write to. - /// Format of the image. - /// Returns true on success, false on failure. - /// - /// or is null. - /// - /// cannot write. - public static bool SaveToStream( - FIBITMAP dib, - Stream stream, - FREE_IMAGE_FORMAT format) - { - return SaveToStream( - ref dib, - stream, - format, - FREE_IMAGE_SAVE_FLAGS.DEFAULT, - FREE_IMAGE_COLOR_DEPTH.FICD_AUTO, - false); - } - - /// - /// Saves a previously loaded FreeImage bitmap to a stream. - /// The stream must be set to the correct position before calling SaveToStream. - /// - /// Handle to a FreeImage bitmap. - /// The stream to write to. - /// Format of the image. - /// When true the structure will be unloaded on success. - /// Returns true on success, false on failure. - /// - /// or is null. - /// - /// cannot write. - public static bool SaveToStream( - ref FIBITMAP dib, - Stream stream, - FREE_IMAGE_FORMAT format, - bool unloadSource) - { - return SaveToStream( - ref dib, - stream, - format, - FREE_IMAGE_SAVE_FLAGS.DEFAULT, - FREE_IMAGE_COLOR_DEPTH.FICD_AUTO, - unloadSource); - } - - /// - /// Saves a previously loaded FreeImage bitmap to a stream. - /// The stream must be set to the correct position before calling SaveToStream. - /// - /// Handle to a FreeImage bitmap. - /// The stream to write to. - /// Format of the image. - /// Flags to enable or disable plugin-features. - /// Returns true on success, false on failure. - /// - /// or is null. - /// - /// cannot write. - public static bool SaveToStream( - FIBITMAP dib, - Stream stream, - FREE_IMAGE_FORMAT format, - FREE_IMAGE_SAVE_FLAGS flags) - { - return SaveToStream( - ref dib, - stream, - format, - flags, - FREE_IMAGE_COLOR_DEPTH.FICD_AUTO, - false); - } - - /// - /// Saves a previously loaded FreeImage bitmap to a stream. - /// The stream must be set to the correct position before calling SaveToStream. - /// - /// Handle to a FreeImage bitmap. - /// The stream to write to. - /// Format of the image. - /// Flags to enable or disable plugin-features. - /// When true the structure will be unloaded on success. - /// Returns true on success, false on failure. - /// - /// or is null. - /// - /// cannot write. - public static bool SaveToStream( - ref FIBITMAP dib, - Stream stream, - FREE_IMAGE_FORMAT format, - FREE_IMAGE_SAVE_FLAGS flags, - bool unloadSource) - { - return SaveToStream( - ref dib, stream, - format, - flags, - FREE_IMAGE_COLOR_DEPTH.FICD_AUTO, - unloadSource); - } - - /// - /// Saves a previously loaded FreeImage bitmap to a stream. - /// The stream must be set to the correct position before calling SaveToStream. - /// - /// Handle to a FreeImage bitmap. - /// The stream to write to. - /// Format of the image. - /// Flags to enable or disable plugin-features. - /// The new color depth of the bitmap. - /// Set to if SaveToStream should - /// take the best suitable color depth. - /// If a color depth is selected that the provided format cannot write an - /// error-message will be thrown. - /// Returns true on success, false on failure. - /// - /// or is null. - /// - /// cannot write. - public static bool SaveToStream( - FIBITMAP dib, - Stream stream, - FREE_IMAGE_FORMAT format, - FREE_IMAGE_SAVE_FLAGS flags, - FREE_IMAGE_COLOR_DEPTH colorDepth) - { - return SaveToStream( - ref dib, - stream, - format, - flags, - colorDepth, - false); - } - - /// - /// Saves a previously loaded FreeImage bitmap to a stream. - /// The stream must be set to the correct position before calling SaveToStream. - /// - /// Handle to a FreeImage bitmap. - /// The stream to write to. - /// Format of the image. - /// Flags to enable or disable plugin-features. - /// The new color depth of the bitmap. - /// Set to if SaveToStream should - /// take the best suitable color depth. - /// If a color depth is selected that the provided format cannot write an - /// error-message will be thrown. - /// When true the structure will be unloaded on success. - /// Returns true on success, false on failure. - /// - /// or is null. - /// - /// cannot write. - public static bool SaveToStream( - ref FIBITMAP dib, - Stream stream, - FREE_IMAGE_FORMAT format, - FREE_IMAGE_SAVE_FLAGS flags, - FREE_IMAGE_COLOR_DEPTH colorDepth, - bool unloadSource) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - if (stream == null) - { - throw new ArgumentNullException("stream"); - } - if (!stream.CanWrite) - { - throw new ArgumentException("stream is not capable of writing."); - } - if ((!FIFSupportsWriting(format)) || (!FIFSupportsExportType(format, GetImageType(dib)))) - { - return false; - } - - FIBITMAP dibToSave = PrepareBitmapColorDepth(dib, format, colorDepth); - bool result = false; - - try - { - // Create a 'FreeImageIO' structure for calling 'SaveToHandle' - FreeImageIO io = FreeImageStreamIO.io; - - using (fi_handle handle = new fi_handle(stream)) - { - result = SaveToHandle(format, dibToSave, ref io, handle, flags); - } - } - finally - { - // Always unload a temporary created bitmap. - if (dibToSave != dib) - { - UnloadEx(ref dibToSave); - } - // On success unload the bitmap - if (result && unloadSource) - { - UnloadEx(ref dib); - } - } - - return result; - } - - #endregion - - #region Plugin functions - - /// - /// Checks if an extension is valid for a certain format. - /// - /// The desired format. - /// The desired extension. - /// True if the extension is valid for the given format, false otherwise. - /// - /// is null. - public static bool IsExtensionValidForFIF(FREE_IMAGE_FORMAT fif, string extension) - { - return IsExtensionValidForFIF(fif, extension, StringComparison.CurrentCultureIgnoreCase); - } - - /// - /// Checks if an extension is valid for a certain format. - /// - /// The desired format. - /// The desired extension. - /// The string comparison type. - /// True if the extension is valid for the given format, false otherwise. - /// - /// is null. - public static bool IsExtensionValidForFIF(FREE_IMAGE_FORMAT fif, string extension, StringComparison comparisonType) - { - if (extension == null) - { - throw new ArgumentNullException("extension"); - } - bool result = false; - // Split up the string and compare each with the given extension - string tempList = GetFIFExtensionList(fif); - if (tempList != null) - { - string[] extensionList = tempList.Split(','); - foreach (string ext in extensionList) - { - if (extension.Equals(ext, comparisonType)) - { - result = true; - break; - } - } - } - return result; - } - - /// - /// Checks if a filename is valid for a certain format. - /// - /// The desired format. - /// The desired filename. - /// True if the filename is valid for the given format, false otherwise. - /// - /// is null. - public static bool IsFilenameValidForFIF(FREE_IMAGE_FORMAT fif, string filename) - { - return IsFilenameValidForFIF(fif, filename, StringComparison.CurrentCultureIgnoreCase); - } - - /// - /// Checks if a filename is valid for a certain format. - /// - /// The desired format. - /// The desired filename. - /// The string comparison type. - /// True if the filename is valid for the given format, false otherwise. - /// - /// is null. - public static bool IsFilenameValidForFIF(FREE_IMAGE_FORMAT fif, string filename, StringComparison comparisonType) - { - if (filename == null) - { - throw new ArgumentNullException("filename"); - } - bool result = false; - // Extract the filenames extension if it exists - string extension = Path.GetExtension(filename); - if (extension.Length != 0) - { - extension = extension.Remove(0, 1); - result = IsExtensionValidForFIF(fif, extension, comparisonType); - } - return result; - } - - /// - /// This function returns the primary (main or most commonly used?) extension of a certain - /// image format (fif). This is done by returning the first of all possible extensions - /// returned by GetFIFExtensionList(). - /// That assumes, that the plugin returns the extensions in ordered form. - /// The image format to obtain the primary extension for. - /// The primary extension of the specified image format. - public static string GetPrimaryExtensionFromFIF(FREE_IMAGE_FORMAT fif) - { - string result = null; - string extensions = GetFIFExtensionList(fif); - if (extensions != null) - { - int position = extensions.IndexOf(','); - if (position < 0) - { - result = extensions; - } - else - { - result = extensions.Substring(0, position); - } - } - return result; - } - - #endregion - - #region Multipage functions - - /// - /// Loads a FreeImage multi-paged bitmap. - /// - /// The complete name of the file to load. - /// Handle to a FreeImage multi-paged bitmap. - /// - /// does not exists while opening. - public static FIMULTIBITMAP OpenMultiBitmapEx(string filename) - { - FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_UNKNOWN; - return OpenMultiBitmapEx( - filename, - ref format, - FREE_IMAGE_LOAD_FLAGS.DEFAULT, - false, - false, - false); - } - - /// - /// Loads a FreeImage multi-paged bitmap. - /// - /// The complete name of the file to load. - /// When true performance is increased at the cost of memory. - /// Handle to a FreeImage multi-paged bitmap. - /// - /// does not exists while opening. - public static FIMULTIBITMAP OpenMultiBitmapEx(string filename, bool keep_cache_in_memory) - { - FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_UNKNOWN; - return OpenMultiBitmapEx( - filename, - ref format, - FREE_IMAGE_LOAD_FLAGS.DEFAULT, - false, - false, - keep_cache_in_memory); - } - - /// - /// Loads a FreeImage multi-paged bitmap. - /// - /// The complete name of the file to load. - /// When true the bitmap will be loaded read only. - /// When true performance is increased at the cost of memory. - /// Handle to a FreeImage multi-paged bitmap. - /// - /// does not exists while opening. - public static FIMULTIBITMAP OpenMultiBitmapEx( - string filename, - bool read_only, - bool keep_cache_in_memory) - { - FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_UNKNOWN; - return OpenMultiBitmapEx( - filename, - ref format, - FREE_IMAGE_LOAD_FLAGS.DEFAULT, - false, - read_only, - keep_cache_in_memory); - } - - /// - /// Loads a FreeImage multi-paged bitmap. - /// - /// The complete name of the file to load. - /// When true a new bitmap is created. - /// When true the bitmap will be loaded read only. - /// When true performance is increased at the cost of memory. - /// Handle to a FreeImage multi-paged bitmap. - /// - /// does not exists while opening. - public static FIMULTIBITMAP OpenMultiBitmapEx( - string filename, - bool create_new, - bool read_only, - bool keep_cache_in_memory) - { - FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_UNKNOWN; - return OpenMultiBitmapEx( - filename, - ref format, - FREE_IMAGE_LOAD_FLAGS.DEFAULT, - create_new, - read_only, - keep_cache_in_memory); - } - - /// - /// Loads a FreeImage multi-paged bitmap. - /// In case the loading format is the files real - /// format is being analysed. If no plugin can read the file, format remains - /// and 0 is returned. - /// - /// The complete name of the file to load. - /// Format of the image. If the format is unknown use - /// . - /// In case a suitable format was found by LoadEx it will be returned in format. - /// When true a new bitmap is created. - /// When true the bitmap will be loaded read only. - /// When true performance is increased at the cost of memory. - /// Handle to a FreeImage multi-paged bitmap. - /// - /// does not exists while opening. - public static FIMULTIBITMAP OpenMultiBitmapEx( - string filename, - ref FREE_IMAGE_FORMAT format, - bool create_new, - bool read_only, - bool keep_cache_in_memory) - { - return OpenMultiBitmapEx( - filename, - ref format, - FREE_IMAGE_LOAD_FLAGS.DEFAULT, - create_new, - read_only, - keep_cache_in_memory); - } - - /// - /// Loads a FreeImage multi-paged bitmap. - /// In case the loading format is the files - /// real format is being analysed. If no plugin can read the file, format remains - /// and 0 is returned. - /// Load flags can be provided by the flags parameter. - /// - /// The complete name of the file to load. - /// Format of the image. If the format is unknown use - /// . - /// In case a suitable format was found by LoadEx it will be returned in format. - /// Flags to enable or disable plugin-features. - /// When true a new bitmap is created. - /// When true the bitmap will be loaded read only. - /// When true performance is increased at the cost of memory. - /// Handle to a FreeImage multi-paged bitmap. - /// - /// does not exists while opening. - public static FIMULTIBITMAP OpenMultiBitmapEx( - string filename, - ref FREE_IMAGE_FORMAT format, - FREE_IMAGE_LOAD_FLAGS flags, - bool create_new, - bool read_only, - bool keep_cache_in_memory) - { - if (!File.Exists(filename) && !create_new) - { - throw new FileNotFoundException(filename + " could not be found."); - } - if (format == FREE_IMAGE_FORMAT.FIF_UNKNOWN) - { - // Check if a plugin can read the data - format = GetFileType(filename, 0); - } - FIMULTIBITMAP dib = new FIMULTIBITMAP(); - if (FIFSupportsReading(format)) - { - dib = OpenMultiBitmap(format, filename, create_new, read_only, keep_cache_in_memory, flags); - } - return dib; - } - - /// - /// Loads a FreeImage multi-paged bitmap. - /// - /// The stream to load the bitmap from. - /// Handle to a FreeImage multi-paged bitmap. - public static FIMULTIBITMAP OpenMultiBitmapFromStream(Stream stream) - { - FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_UNKNOWN; - return OpenMultiBitmapFromStream(stream, ref format, FREE_IMAGE_LOAD_FLAGS.DEFAULT); - } - - /// - /// Loads a FreeImage multi-paged bitmap. - /// In case the loading format is the files - /// real format is being analysed. If no plugin can read the file, format remains - /// and 0 is returned. - /// Load flags can be provided by the flags parameter. - /// - /// The stream to load the bitmap from. - /// Format of the image. If the format is unknown use - /// . - /// Flags to enable or disable plugin-features. - /// Handle to a FreeImage multi-paged bitmap. - public static FIMULTIBITMAP OpenMultiBitmapFromStream(Stream stream, ref FREE_IMAGE_FORMAT format, FREE_IMAGE_LOAD_FLAGS flags) - { - if (stream == null) - return FIMULTIBITMAP.Zero; - - if (!stream.CanSeek) - stream = new StreamWrapper(stream, true); - - FIMULTIBITMAP mdib = FIMULTIBITMAP.Zero; - FreeImageIO io = FreeImageStreamIO.io; - fi_handle handle = new fi_handle(stream); - - try - { - if (format == FREE_IMAGE_FORMAT.FIF_UNKNOWN) - { - format = GetFileTypeFromHandle(ref io, handle, checked((int)stream.Length)); - } - - mdib = OpenMultiBitmapFromHandle(format, ref io, handle, flags); - - if (mdib.IsNull) - { - handle.Dispose(); - } - else - { - lock (streamHandles) - { - streamHandles.Add(mdib, handle); - } - } - - return mdib; - } - catch - { - if (!mdib.IsNull) - CloseMultiBitmap(mdib, FREE_IMAGE_SAVE_FLAGS.DEFAULT); - - if (handle != null) - handle.Dispose(); - - throw; - } - } - - /// - /// Closes a previously opened multi-page bitmap and, when the bitmap was not opened read-only, applies any changes made to it. - /// - /// Handle to a FreeImage multi-paged bitmap. - /// Flags to enable or disable plugin-features. - /// Returns true on success, false on failure. - public static bool CloseMultiBitmap(FIMULTIBITMAP bitmap, FREE_IMAGE_SAVE_FLAGS flags) - { - if (CloseMultiBitmap_(bitmap, flags)) - { - fi_handle handle; - lock (streamHandles) - { - if (streamHandles.TryGetValue(bitmap, out handle)) - { - streamHandles.Remove(bitmap); - handle.Dispose(); - } - } - return true; - } - return false; - } - - /// - /// Closes a previously opened multi-page bitmap and, when the bitmap was not opened read-only, - /// applies any changes made to it. - /// On success the handle will be reset to null. - /// - /// Handle to a FreeImage multi-paged bitmap. - /// Returns true on success, false on failure. - public static bool CloseMultiBitmapEx(ref FIMULTIBITMAP bitmap) - { - return CloseMultiBitmapEx(ref bitmap, FREE_IMAGE_SAVE_FLAGS.DEFAULT); - } - - /// - /// Closes a previously opened multi-page bitmap and, when the bitmap was not opened read-only, - /// applies any changes made to it. - /// On success the handle will be reset to null. - /// - /// Handle to a FreeImage multi-paged bitmap. - /// Flags to enable or disable plugin-features. - /// Returns true on success, false on failure. - public static bool CloseMultiBitmapEx(ref FIMULTIBITMAP bitmap, FREE_IMAGE_SAVE_FLAGS flags) - { - bool result = false; - if (!bitmap.IsNull) - { - if (CloseMultiBitmap(bitmap, flags)) - { - bitmap.SetNull(); - result = true; - } - } - return result; - } - - /// - /// Retrieves the number of pages that are locked in a multi-paged bitmap. - /// - /// Handle to a FreeImage multi-paged bitmap. - /// Number of locked pages. - /// - /// is null. - public static int GetLockedPageCount(FIMULTIBITMAP dib) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - int result = 0; - GetLockedPageNumbers(dib, null, ref result); - return result; - } - - /// - /// Retrieves a list locked pages of a multi-paged bitmap. - /// - /// Handle to a FreeImage multi-paged bitmap. - /// List containing the indexes of the locked pages. - /// - /// is null. - public static int[] GetLockedPages(FIMULTIBITMAP dib) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - // Get the number of pages and create an array to save the information - int count = 0; - int[] result = null; - // Get count - if (GetLockedPageNumbers(dib, result, ref count)) - { - result = new int[count]; - // Fill array - if (!GetLockedPageNumbers(dib, result, ref count)) - { - result = null; - } - } - return result; - } - - /// - /// Loads a FreeImage multi-paged bitmap from a stream and returns the - /// FreeImage memory stream used as temporary buffer. - /// The bitmap can not be modified by calling - /// , - /// , - /// or - /// . - /// - /// The stream to read from. - /// Format of the image. - /// Flags to enable or disable plugin-features. - /// The temporary memory buffer used to load the bitmap. - /// Handle to a FreeImage multi-paged bitmap. - /// - /// is null. - /// - /// can not read. - public static FIMULTIBITMAP LoadMultiBitmapFromStream( - Stream stream, - FREE_IMAGE_FORMAT format, - FREE_IMAGE_LOAD_FLAGS flags, - out FIMEMORY memory) - { - if (stream == null) - { - throw new ArgumentNullException("stream"); - } - if (!stream.CanRead) - { - throw new ArgumentException("stream"); - } - const int blockSize = 1024; - int bytesRead; - byte[] buffer = new byte[blockSize]; - - stream = stream.CanSeek ? stream : new StreamWrapper(stream, true); - memory = OpenMemory(IntPtr.Zero, 0); - - do - { - bytesRead = stream.Read(buffer, 0, blockSize); - WriteMemory(buffer, (uint)blockSize, (uint)1, memory); - } - while (bytesRead == blockSize); - - return LoadMultiBitmapFromMemory(format, memory, flags); - } - - #endregion - - #region Filetype functions - - /// - /// Orders FreeImage to analyze the bitmap signature. - /// In case the stream is not seekable, the stream will have been used - /// and must be recreated for loading. - /// - /// Name of the stream to analyze. - /// Type of the bitmap. - /// - /// is null. - /// - /// can not read. - public static FREE_IMAGE_FORMAT GetFileTypeFromStream(Stream stream) - { - if (stream == null) - { - throw new ArgumentNullException("stream"); - } - if (!stream.CanRead) - { - throw new ArgumentException("stream is not capable of reading."); - } - // Wrap the stream if it cannot seek - stream = (stream.CanSeek) ? stream : new StreamWrapper(stream, true); - // Create a 'FreeImageIO' structure for the stream - FreeImageIO io = FreeImageStreamIO.io; - using (fi_handle handle = new fi_handle(stream)) - { - return GetFileTypeFromHandle(ref io, handle, 0); - } - } - - #endregion - - #region Pixel access functions - - /// - /// Retrieves an hBitmap for a FreeImage bitmap. - /// Call FreeHbitmap(IntPtr) to free the handle. - /// - /// Handle to a FreeImage bitmap. - /// A reference device context. - /// Use IntPtr.Zero if no reference is available. - /// When true dib will be unloaded if the function succeeded. - /// The hBitmap for the FreeImage bitmap. - /// - /// is null. - public static unsafe IntPtr GetHbitmap(FIBITMAP dib, IntPtr hdc, bool unload) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - IntPtr hBitmap = IntPtr.Zero; - bool release = false; - IntPtr ppvBits = IntPtr.Zero; - // Check if we have destination - if (release = (hdc == IntPtr.Zero)) - { - // We don't so request dc - hdc = GetDC(IntPtr.Zero); - } - if (hdc != IntPtr.Zero) - { - // Get pointer to the infoheader of the bitmap - IntPtr info = GetInfo(dib); - // Create a bitmap in the dc - hBitmap = CreateDIBSection(hdc, info, DIB_RGB_COLORS, out ppvBits, IntPtr.Zero, 0); - if (hBitmap != IntPtr.Zero && ppvBits != IntPtr.Zero) - { - // Copy the data into the dc - CopyMemory(ppvBits, GetBits(dib), (GetHeight(dib) * GetPitch(dib))); - // Success: we unload the bitmap - if (unload) - { - Unload(dib); - } - } - // We have to release the dc - if (release) - { - ReleaseDC(IntPtr.Zero, hdc); - } - } - return hBitmap; - } - - /// - /// Returns an HBITMAP created by the CreateDIBitmap() function which in turn - /// has always the same color depth as the reference DC, which may be provided - /// through . The desktop DC will be used, - /// if IntPtr.Zero DC is specified. - /// Call to free the handle. - /// - /// Handle to a FreeImage bitmap. - /// Handle to a device context. - /// When true the structure will be unloaded on success. - /// If the function failed and returned false, the bitmap was not unloaded. - /// If the function succeeds, the return value is a handle to the - /// compatible bitmap. If the function fails, the return value is . - /// - /// is null. - public static IntPtr GetBitmapForDevice(FIBITMAP dib, IntPtr hdc, bool unload) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - IntPtr hbitmap = IntPtr.Zero; - bool release = false; - if (release = (hdc == IntPtr.Zero)) - { - hdc = GetDC(IntPtr.Zero); - } - if (hdc != IntPtr.Zero) - { - hbitmap = CreateDIBitmap( - hdc, - GetInfoHeader(dib), - CBM_INIT, - GetBits(dib), - GetInfo(dib), - DIB_RGB_COLORS); - if (unload) - { - Unload(dib); - } - if (release) - { - ReleaseDC(IntPtr.Zero, hdc); - } - } - return hbitmap; - } - - /// - /// Creates a FreeImage DIB from a Device Context/Compatible Bitmap. - /// - /// Handle to the bitmap. - /// Handle to a device context. - /// Handle to a FreeImage bitmap. - /// - /// is null. - public unsafe static FIBITMAP CreateFromHbitmap(IntPtr hbitmap, IntPtr hdc) - { - if (hbitmap == IntPtr.Zero) - { - throw new ArgumentNullException("hbitmap"); - } - - FIBITMAP dib = new FIBITMAP(); - BITMAP bm; - uint colors; - bool release; - - if (GetObject(hbitmap, sizeof(BITMAP), (IntPtr)(&bm)) != 0) - { - dib = Allocate(bm.bmWidth, bm.bmHeight, bm.bmBitsPixel, 0, 0, 0); - if (!dib.IsNull) - { - colors = GetColorsUsed(dib); - if (release = (hdc == IntPtr.Zero)) - { - hdc = GetDC(IntPtr.Zero); - } - if (GetDIBits( - hdc, - hbitmap, - 0, - (uint)bm.bmHeight, - GetBits(dib), - GetInfo(dib), - DIB_RGB_COLORS) != 0) - { - if (colors != 0) - { - BITMAPINFOHEADER* bmih = (BITMAPINFOHEADER*)GetInfo(dib); - bmih[0].biClrImportant = bmih[0].biClrUsed = colors; - } - } - else - { - UnloadEx(ref dib); - } - if (release) - { - ReleaseDC(IntPtr.Zero, hdc); - } - } - } - - return dib; - } - - /// - /// Frees a bitmap handle. - /// - /// Handle to a bitmap. - /// True on success, false on failure. - public static bool FreeHbitmap(IntPtr hbitmap) - { - return DeleteObject(hbitmap); - } - - #endregion - - #region Bitmap information functions - - /// - /// Retrieves a DIB's resolution in X-direction measured in 'dots per inch' (DPI) and not in - /// 'dots per meter'. - /// - /// Handle to a FreeImage bitmap. - /// The resolution in 'dots per inch'. - /// - /// is null. - public static uint GetResolutionX(FIBITMAP dib) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - return (uint)(0.5d + 0.0254d * GetDotsPerMeterX(dib)); - } - - /// - /// Retrieves a DIB's resolution in Y-direction measured in 'dots per inch' (DPI) and not in - /// 'dots per meter'. - /// - /// Handle to a FreeImage bitmap. - /// The resolution in 'dots per inch'. - /// - /// is null. - public static uint GetResolutionY(FIBITMAP dib) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - return (uint)(0.5d + 0.0254d * GetDotsPerMeterY(dib)); - } - - /// - /// Sets a DIB's resolution in X-direction measured in 'dots per inch' (DPI) and not in - /// 'dots per meter'. - /// - /// Handle to a FreeImage bitmap. - /// The new resolution in 'dots per inch'. - /// - /// is null. - public static void SetResolutionX(FIBITMAP dib, uint res) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - SetDotsPerMeterX(dib, (uint)((double)res / 0.0254d + 0.5d)); - } - - /// - /// Sets a DIB's resolution in Y-direction measured in 'dots per inch' (DPI) and not in - /// 'dots per meter'. - /// - /// Handle to a FreeImage bitmap. - /// The new resolution in 'dots per inch'. - /// - /// is null. - public static void SetResolutionY(FIBITMAP dib, uint res) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - SetDotsPerMeterY(dib, (uint)((double)res / 0.0254d + 0.5d)); - } - - /// - /// Returns whether the image is a greyscale image or not. - /// The function scans all colors in the bitmaps palette for entries where - /// red, green and blue are not all the same (not a grey color). - /// Supports 1-, 4- and 8-bit bitmaps. - /// - /// Handle to a FreeImage bitmap. - /// True if the image is a greyscale image, else false. - /// - /// is null. - public static unsafe bool IsGreyscaleImage(FIBITMAP dib) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - bool result = true; - uint bpp = GetBPP(dib); - switch (bpp) - { - case 1: - case 4: - case 8: - RGBQUAD* palette = (RGBQUAD*)GetPalette(dib); - uint paletteLength = GetColorsUsed(dib); - for (int i = 0; i < paletteLength; i++) - { - if (palette[i].rgbRed != palette[i].rgbGreen || - palette[i].rgbRed != palette[i].rgbBlue) - { - result = false; - break; - } - } - break; - default: - result = false; - break; - } - return result; - } - - /// - /// Returns a structure that represents the palette of a FreeImage bitmap. - /// - /// Handle to a FreeImage bitmap. - /// A structure representing the bitmaps palette. - /// - /// is null. - public static Palette GetPaletteEx(FIBITMAP dib) - { - return new Palette(dib); - } - - /// - /// Returns the structure of a FreeImage bitmap. - /// The structure is a copy, so changes will have no effect on - /// the bitmap itself. - /// - /// Handle to a FreeImage bitmap. - /// structure of the bitmap. - /// - /// is null. - public static unsafe BITMAPINFOHEADER GetInfoHeaderEx(FIBITMAP dib) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - return *(BITMAPINFOHEADER*)GetInfoHeader(dib); - } - - /// - /// Returns the structure of a FreeImage bitmap. - /// The structure is a copy, so changes will have no effect on - /// the bitmap itself. - /// - /// Handle to a FreeImage bitmap. - /// structure of the bitmap. - /// - /// is null. - public static BITMAPINFO GetInfoEx(FIBITMAP dib) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - BITMAPINFO result = new BITMAPINFO(); - result.bmiHeader = GetInfoHeaderEx(dib); - IntPtr ptr = GetPalette(dib); - if (ptr == IntPtr.Zero) - { - result.bmiColors = new RGBQUAD[0]; - } - else - { - result.bmiColors = new MemoryArray(ptr, (int)result.bmiHeader.biClrUsed).Data; - } - return result; - } - - /// - /// Returns the pixelformat of the bitmap. - /// - /// Handle to a FreeImage bitmap. - /// of the bitmap. - /// - /// is null. - public static PixelFormat GetPixelFormat(FIBITMAP dib) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - - PixelFormat result = PixelFormat.Undefined; - - if (GetImageType(dib) == FREE_IMAGE_TYPE.FIT_BITMAP) - { - switch (GetBPP(dib)) - { - case 1: - result = PixelFormat.Format1bppIndexed; - break; - case 4: - result = PixelFormat.Format4bppIndexed; - break; - case 8: - result = PixelFormat.Format8bppIndexed; - break; - case 16: - if ((GetBlueMask(dib) == FI16_565_BLUE_MASK) && - (GetGreenMask(dib) == FI16_565_GREEN_MASK) && - (GetRedMask(dib) == FI16_565_RED_MASK)) - { - result = PixelFormat.Format16bppRgb565; - } - if ((GetBlueMask(dib) == FI16_555_BLUE_MASK) && - (GetGreenMask(dib) == FI16_555_GREEN_MASK) && - (GetRedMask(dib) == FI16_555_RED_MASK)) - { - result = PixelFormat.Format16bppRgb555; - } - break; - case 24: - result = PixelFormat.Format24bppRgb; - break; - case 32: - result = PixelFormat.Format32bppArgb; - break; - } - } - return result; - } - - /// - /// Retrieves all parameters needed to create a new FreeImage bitmap from - /// the format of a .NET . - /// - /// The - /// of the .NET . - /// Returns the type used for the new bitmap. - /// Returns the color depth for the new bitmap. - /// Returns the red_mask for the new bitmap. - /// Returns the green_mask for the new bitmap. - /// Returns the blue_mask for the new bitmap. - /// True in case a matching conversion exists; else false. - /// - public static bool GetFormatParameters( - PixelFormat format, - out FREE_IMAGE_TYPE type, - out uint bpp, - out uint red_mask, - out uint green_mask, - out uint blue_mask) - { - bool result = false; - type = FREE_IMAGE_TYPE.FIT_UNKNOWN; - bpp = 0; - red_mask = 0; - green_mask = 0; - blue_mask = 0; - switch (format) - { - case PixelFormat.Format1bppIndexed: - type = FREE_IMAGE_TYPE.FIT_BITMAP; - bpp = 1; - result = true; - break; - case PixelFormat.Format4bppIndexed: - type = FREE_IMAGE_TYPE.FIT_BITMAP; - bpp = 4; - result = true; - break; - case PixelFormat.Format8bppIndexed: - type = FREE_IMAGE_TYPE.FIT_BITMAP; - bpp = 8; - result = true; - break; - case PixelFormat.Format16bppRgb565: - type = FREE_IMAGE_TYPE.FIT_BITMAP; - bpp = 16; - red_mask = FI16_565_RED_MASK; - green_mask = FI16_565_GREEN_MASK; - blue_mask = FI16_565_BLUE_MASK; - result = true; - break; - case PixelFormat.Format16bppRgb555: - case PixelFormat.Format16bppArgb1555: - type = FREE_IMAGE_TYPE.FIT_BITMAP; - bpp = 16; - red_mask = FI16_555_RED_MASK; - green_mask = FI16_555_GREEN_MASK; - blue_mask = FI16_555_BLUE_MASK; - result = true; - break; - case PixelFormat.Format24bppRgb: - type = FREE_IMAGE_TYPE.FIT_BITMAP; - bpp = 24; - red_mask = FI_RGBA_RED_MASK; - green_mask = FI_RGBA_GREEN_MASK; - blue_mask = FI_RGBA_BLUE_MASK; - result = true; - break; - case PixelFormat.Format32bppRgb: - case PixelFormat.Format32bppArgb: - case PixelFormat.Format32bppPArgb: - type = FREE_IMAGE_TYPE.FIT_BITMAP; - bpp = 32; - red_mask = FI_RGBA_RED_MASK; - green_mask = FI_RGBA_GREEN_MASK; - blue_mask = FI_RGBA_BLUE_MASK; - result = true; - break; - case PixelFormat.Format16bppGrayScale: - type = FREE_IMAGE_TYPE.FIT_UINT16; - bpp = 16; - result = true; - break; - case PixelFormat.Format48bppRgb: - type = FREE_IMAGE_TYPE.FIT_RGB16; - bpp = 48; - result = true; - break; - case PixelFormat.Format64bppArgb: - case PixelFormat.Format64bppPArgb: - type = FREE_IMAGE_TYPE.FIT_RGBA16; - bpp = 64; - result = true; - break; - } - return result; - } - - /// - /// Returns the for the specified - /// . - /// - /// The - /// for which to return the corresponding . - /// The for the specified - /// - public static FREE_IMAGE_FORMAT GetFormat(ImageFormat imageFormat) - { - if (imageFormat != null) - { - if (imageFormat.Equals(ImageFormat.Bmp)) - return FREE_IMAGE_FORMAT.FIF_BMP; - if (imageFormat.Equals(ImageFormat.Gif)) - return FREE_IMAGE_FORMAT.FIF_GIF; - if (imageFormat.Equals(ImageFormat.Icon)) - return FREE_IMAGE_FORMAT.FIF_ICO; - if (imageFormat.Equals(ImageFormat.Jpeg)) - return FREE_IMAGE_FORMAT.FIF_JPEG; - if (imageFormat.Equals(ImageFormat.Png)) - return FREE_IMAGE_FORMAT.FIF_PNG; - if (imageFormat.Equals(ImageFormat.Tiff)) - return FREE_IMAGE_FORMAT.FIF_TIFF; - } - return FREE_IMAGE_FORMAT.FIF_UNKNOWN; - } - - /// - /// Retrieves all parameters needed to create a new FreeImage bitmap from - /// raw bits . - /// - /// The - /// of the data in memory. - /// The color depth for the data. - /// Returns the red_mask for the data. - /// Returns the green_mask for the data. - /// Returns the blue_mask for the data. - /// True in case a matching conversion exists; else false. - /// - public static bool GetTypeParameters( - FREE_IMAGE_TYPE type, - int bpp, - out uint red_mask, - out uint green_mask, - out uint blue_mask) - { - bool result = false; - red_mask = 0; - green_mask = 0; - blue_mask = 0; - switch (type) - { - case FREE_IMAGE_TYPE.FIT_BITMAP: - switch (bpp) - { - case 1: - case 4: - case 8: - result = true; - break; - case 16: - result = true; - red_mask = FI16_555_RED_MASK; - green_mask = FI16_555_GREEN_MASK; - blue_mask = FI16_555_BLUE_MASK; - break; - case 24: - case 32: - result = true; - red_mask = FI_RGBA_RED_MASK; - green_mask = FI_RGBA_GREEN_MASK; - blue_mask = FI_RGBA_BLUE_MASK; - break; - } - break; - case FREE_IMAGE_TYPE.FIT_UNKNOWN: - break; - default: - result = true; - break; - } - return result; - } - - /// - /// Compares two FreeImage bitmaps. - /// - /// The first bitmap to compare. - /// The second bitmap to compare. - /// Determines which components of the bitmaps will be compared. - /// True in case both bitmaps match the compare conditions, false otherwise. - public static bool Compare(FIBITMAP dib1, FIBITMAP dib2, FREE_IMAGE_COMPARE_FLAGS flags) - { - // Check whether one bitmap is null - if (dib1.IsNull ^ dib2.IsNull) - { - return false; - } - // Check whether both pointers are the same - if (dib1 == dib2) - { - return true; - } - if (((flags & FREE_IMAGE_COMPARE_FLAGS.HEADER) > 0) && (!CompareHeader(dib1, dib2))) - { - return false; - } - if (((flags & FREE_IMAGE_COMPARE_FLAGS.PALETTE) > 0) && (!ComparePalette(dib1, dib2))) - { - return false; - } - if (((flags & FREE_IMAGE_COMPARE_FLAGS.DATA) > 0) && (!CompareData(dib1, dib2))) - { - return false; - } - if (((flags & FREE_IMAGE_COMPARE_FLAGS.METADATA) > 0) && (!CompareMetadata(dib1, dib2))) - { - return false; - } - return true; - } - - private static unsafe bool CompareHeader(FIBITMAP dib1, FIBITMAP dib2) - { - IntPtr i1 = GetInfoHeader(dib1); - IntPtr i2 = GetInfoHeader(dib2); - return CompareMemory((void*)i1, (void*)i2, sizeof(BITMAPINFOHEADER)); - } - - private static unsafe bool ComparePalette(FIBITMAP dib1, FIBITMAP dib2) - { - IntPtr pal1 = GetPalette(dib1), pal2 = GetPalette(dib2); - bool hasPalette1 = pal1 != IntPtr.Zero; - bool hasPalette2 = pal2 != IntPtr.Zero; - if (hasPalette1 ^ hasPalette2) - { - return false; - } - if (!hasPalette1) - { - return true; - } - uint colors = GetColorsUsed(dib1); - if (colors != GetColorsUsed(dib2)) - { - return false; - } - return CompareMemory((void*)pal1, (void*)pal2, sizeof(RGBQUAD) * colors); - } - - private static unsafe bool CompareData(FIBITMAP dib1, FIBITMAP dib2) - { - uint width = GetWidth(dib1); - if (width != GetWidth(dib2)) - { - return false; - } - uint height = GetHeight(dib1); - if (height != GetHeight(dib2)) - { - return false; - } - uint bpp = GetBPP(dib1); - if (bpp != GetBPP(dib2)) - { - return false; - } - if (GetColorType(dib1) != GetColorType(dib2)) - { - return false; - } - FREE_IMAGE_TYPE type = GetImageType(dib1); - if (type != GetImageType(dib2)) - { - return false; - } - if (GetRedMask(dib1) != GetRedMask(dib2)) - { - return false; - } - if (GetGreenMask(dib1) != GetGreenMask(dib2)) - { - return false; - } - if (GetBlueMask(dib1) != GetBlueMask(dib2)) - { - return false; - } - - byte* ptr1, ptr2; - int fullBytes; - int shift; - uint line = GetLine(dib1); - - if (type == FREE_IMAGE_TYPE.FIT_BITMAP) - { - switch (bpp) - { - case 32: - for (int i = 0; i < height; i++) - { - ptr1 = (byte*)GetScanLine(dib1, i); - ptr2 = (byte*)GetScanLine(dib2, i); - if (!CompareMemory(ptr1, ptr2, line)) - { - return false; - } - } - break; - case 24: - for (int i = 0; i < height; i++) - { - ptr1 = (byte*)GetScanLine(dib1, i); - ptr2 = (byte*)GetScanLine(dib2, i); - if (!CompareMemory(ptr1, ptr2, line)) - { - return false; - } - } - break; - case 16: - short* sPtr1, sPtr2; - short mask = (short)(GetRedMask(dib1) | GetGreenMask(dib1) | GetBlueMask(dib1)); - if (mask == -1) - { - for (int i = 0; i < height; i++) - { - sPtr1 = (short*)GetScanLine(dib1, i); - sPtr2 = (short*)GetScanLine(dib2, i); - if (!CompareMemory(sPtr1, sPtr1, line)) - { - return false; - } - } - } - else - { - for (int i = 0; i < height; i++) - { - sPtr1 = (short*)GetScanLine(dib1, i); - sPtr2 = (short*)GetScanLine(dib2, i); - for (int x = 0; x < width; x++) - { - if ((sPtr1[x] & mask) != (sPtr2[x] & mask)) - { - return false; - } - } - } - } - break; - case 8: - for (int i = 0; i < height; i++) - { - ptr1 = (byte*)GetScanLine(dib1, i); - ptr2 = (byte*)GetScanLine(dib2, i); - if (!CompareMemory(ptr1, ptr2, line)) - { - return false; - } - } - break; - case 4: - fullBytes = (int)width / 2; - shift = (width % 2) == 0 ? 8 : 4; - for (int i = 0; i < height; i++) - { - ptr1 = (byte*)GetScanLine(dib1, i); - ptr2 = (byte*)GetScanLine(dib2, i); - if (fullBytes != 0) - { - if (!CompareMemory(ptr1, ptr2, fullBytes)) - { - return false; - } - ptr1 += fullBytes; - ptr2 += fullBytes; - } - if (shift != 8) - { - if ((ptr1[0] >> shift) != (ptr2[0] >> shift)) - { - return false; - } - } - } - break; - case 1: - fullBytes = (int)width / 8; - shift = 8 - ((int)width % 8); - for (int i = 0; i < height; i++) - { - ptr1 = (byte*)GetScanLine(dib1, i); - ptr2 = (byte*)GetScanLine(dib2, i); - if (fullBytes != 0) - { - if (!CompareMemory(ptr1, ptr2, fullBytes)) - { - return false; - } - ptr1 += fullBytes; - ptr2 += fullBytes; - } - if (shift != 8) - { - if ((ptr1[0] >> shift) != (ptr2[0] >> shift)) - { - return false; - } - } - } - break; - default: - throw new NotSupportedException("Only 1, 4, 8, 16, 24 and 32 bpp bitmaps are supported."); - } - } - else - { - for (int i = 0; i < height; i++) - { - ptr1 = (byte*)GetScanLine(dib1, i); - ptr2 = (byte*)GetScanLine(dib2, i); - if (!CompareMemory(ptr1, ptr2, line)) - { - return false; - } - } - } - return true; - } - - private static bool CompareMetadata(FIBITMAP dib1, FIBITMAP dib2) - { - MetadataTag tag1, tag2; - - foreach (FREE_IMAGE_MDMODEL metadataModel in FREE_IMAGE_MDMODELS) - { - if (GetMetadataCount(metadataModel, dib1) != - GetMetadataCount(metadataModel, dib2)) - { - return false; - } - if (GetMetadataCount(metadataModel, dib1) == 0) - { - continue; - } - - FIMETADATA mdHandle = FindFirstMetadata(metadataModel, dib1, out tag1); - if (mdHandle.IsNull) - { - continue; - } - do - { - if ((!GetMetadata(metadataModel, dib2, tag1.Key, out tag2)) || (tag1 != tag2)) - { - FindCloseMetadata(mdHandle); - return false; - } - } - while (FindNextMetadata(mdHandle, out tag1)); - FindCloseMetadata(mdHandle); - } - - return true; - } - - /// - /// Returns the FreeImage bitmap's transparency table. - /// The array is empty in case the bitmap has no transparency table. - /// - /// Handle to a FreeImage bitmap. - /// The FreeImage bitmap's transparency table. - /// - /// is null. - public static unsafe byte[] GetTransparencyTableEx(FIBITMAP dib) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - uint count = GetTransparencyCount(dib); - byte[] result = new byte[count]; - byte* ptr = (byte*)GetTransparencyTable(dib); - fixed (byte* dst = result) - { - CopyMemory(dst, ptr, count); - } - return result; - } - - /// - /// Set the FreeImage bitmap's transparency table. Only affects palletised bitmaps. - /// - /// Handle to a FreeImage bitmap. - /// The FreeImage bitmap's new transparency table. - /// - /// or is null. - public static void SetTransparencyTable(FIBITMAP dib, byte[] table) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - if (table == null) - { - throw new ArgumentNullException("table"); - } - SetTransparencyTable(dib, table, table.Length); - } - - /// - /// This function returns the number of unique colors actually used by the - /// specified 1-, 4-, 8-, 16-, 24- or 32-bit image. This might be different from - /// what function FreeImage_GetColorsUsed() returns, which actually returns the - /// palette size for palletised images. Works for - /// type images only. - /// - /// Handle to a FreeImage bitmap. - /// Returns the number of unique colors used by the image specified or - /// zero, if the image type cannot be handled. - /// - /// is null. - public static unsafe int GetUniqueColors(FIBITMAP dib) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - - int result = 0; - - if (GetImageType(dib) == FREE_IMAGE_TYPE.FIT_BITMAP) - { - BitArray bitArray; - int uniquePalEnts; - int hashcode; - byte[] lut; - int width = (int)GetWidth(dib); - int height = (int)GetHeight(dib); - - switch (GetBPP(dib)) - { - case 1: - - result = 1; - lut = CreateShrunkenPaletteLUT(dib, out uniquePalEnts); - if (uniquePalEnts == 1) - { - break; - } - - if ((*(byte*)GetScanLine(dib, 0) & 0x80) == 0) - { - for (int y = 0; y < height; y++) - { - byte* scanline = (byte*)GetScanLine(dib, y); - int mask = 0x80; - for (int x = 0; x < width; x++) - { - if ((scanline[x / 8] & mask) > 0) - { - return 2; - } - mask = (mask == 0x1) ? 0x80 : (mask >> 1); - } - } - } - else - { - for (int y = 0; y < height; y++) - { - byte* scanline = (byte*)GetScanLine(dib, y); - int mask = 0x80; - for (int x = 0; x < width; x++) - { - if ((scanline[x / 8] & mask) == 0) - { - return 2; - } - mask = (mask == 0x1) ? 0x80 : (mask >> 1); - } - } - } - break; - - case 4: - - bitArray = new BitArray(0x10); - lut = CreateShrunkenPaletteLUT(dib, out uniquePalEnts); - if (uniquePalEnts == 1) - { - result = 1; - break; - } - - for (int y = 0; (y < height) && (result < uniquePalEnts); y++) - { - byte* scanline = (byte*)GetScanLine(dib, y); - bool top = true; - for (int x = 0; (x < width) && (result < uniquePalEnts); x++) - { - if (top) - { - hashcode = lut[scanline[x / 2] >> 4]; - } - else - { - hashcode = lut[scanline[x / 2] & 0xF]; - } - top = !top; - if (!bitArray[hashcode]) - { - bitArray[hashcode] = true; - result++; - } - } - } - break; - - case 8: - - bitArray = new BitArray(0x100); - lut = CreateShrunkenPaletteLUT(dib, out uniquePalEnts); - if (uniquePalEnts == 1) - { - result = 1; - break; - } - - for (int y = 0; (y < height) && (result < uniquePalEnts); y++) - { - byte* scanline = (byte*)GetScanLine(dib, y); - for (int x = 0; (x < width) && (result < uniquePalEnts); x++) - { - hashcode = lut[scanline[x]]; - if (!bitArray[hashcode]) - { - bitArray[hashcode] = true; - result++; - } - } - } - break; - - case 16: - - bitArray = new BitArray(0x10000); - - for (int y = 0; y < height; y++) - { - short* scanline = (short*)GetScanLine(dib, y); - for (int x = 0; x < width; x++, scanline++) - { - hashcode = *scanline; - if (!bitArray[hashcode]) - { - bitArray[hashcode] = true; - result++; - } - } - } - break; - - case 24: - - bitArray = new BitArray(0x1000000); - - for (int y = 0; y < height; y++) - { - byte* scanline = (byte*)GetScanLine(dib, y); - for (int x = 0; x < width; x++, scanline += 3) - { - hashcode = *((int*)scanline) & 0x00FFFFFF; - if (!bitArray[hashcode]) - { - bitArray[hashcode] = true; - result++; - } - } - } - break; - - case 32: - - bitArray = new BitArray(0x1000000); - - for (int y = 0; y < height; y++) - { - int* scanline = (int*)GetScanLine(dib, y); - for (int x = 0; x < width; x++, scanline++) - { - hashcode = *scanline & 0x00FFFFFF; - if (!bitArray[hashcode]) - { - bitArray[hashcode] = true; - result++; - } - } - } - break; - } - } - return result; - } - - /// - /// Verifies whether the FreeImage bitmap is 16bit 555. - /// - /// The FreeImage bitmap to verify. - /// true if the bitmap is RGB16-555; otherwise false. - public static bool IsRGB555(FIBITMAP dib) - { - return ((GetRedMask(dib) == FI16_555_RED_MASK) && - (GetGreenMask(dib) == FI16_555_GREEN_MASK) && - (GetBlueMask(dib) == FI16_555_BLUE_MASK)); - } - - /// - /// Verifies whether the FreeImage bitmap is 16bit 565. - /// - /// The FreeImage bitmap to verify. - /// true if the bitmap is RGB16-565; otherwise false. - public static bool IsRGB565(FIBITMAP dib) - { - return ((GetRedMask(dib) == FI16_565_RED_MASK) && - (GetGreenMask(dib) == FI16_565_GREEN_MASK) && - (GetBlueMask(dib) == FI16_565_BLUE_MASK)); - } - - #endregion - - #region ICC profile functions - - /// - /// Creates a new ICC-Profile for a FreeImage bitmap. - /// - /// Handle to a FreeImage bitmap. - /// The data of the new ICC-Profile. - /// The new ICC-Profile of the bitmap. - /// - /// is null. - public static FIICCPROFILE CreateICCProfileEx(FIBITMAP dib, byte[] data) - { - return new FIICCPROFILE(dib, data); - } - - /// - /// Creates a new ICC-Profile for a FreeImage bitmap. - /// - /// Handle to a FreeImage bitmap. - /// The data of the new ICC-Profile. - /// The number of bytes of to use. - /// The new ICC-Profile of the FreeImage bitmap. - /// - /// is null. - public static FIICCPROFILE CreateICCProfileEx(FIBITMAP dib, byte[] data, int size) - { - return new FIICCPROFILE(dib, data, size); - } - - #endregion - - #region Conversion functions - - /// - /// Converts a FreeImage bitmap from one color depth to another. - /// If the conversion fails the original FreeImage bitmap is returned. - /// - /// Handle to a FreeImage bitmap. - /// The desired output format. - /// Handle to a FreeImage bitmap. - /// - /// is null. - public static FIBITMAP ConvertColorDepth( - FIBITMAP dib, - FREE_IMAGE_COLOR_DEPTH conversion) - { - return ConvertColorDepth( - dib, - conversion, - 128, - FREE_IMAGE_DITHER.FID_FS, - FREE_IMAGE_QUANTIZE.FIQ_WUQUANT, - false); - } - - /// - /// Converts a FreeImage bitmap from one color depth to another. - /// If the conversion fails the original FreeImage bitmap is returned. - /// - /// Handle to a FreeImage bitmap. - /// The desired output format. - /// When true the structure will be unloaded on success. - /// Handle to a FreeImage bitmap. - /// - /// is null. - public static FIBITMAP ConvertColorDepth( - FIBITMAP dib, - FREE_IMAGE_COLOR_DEPTH conversion, - bool unloadSource) - { - return ConvertColorDepth( - dib, - conversion, - 128, - FREE_IMAGE_DITHER.FID_FS, - FREE_IMAGE_QUANTIZE.FIQ_WUQUANT, - unloadSource); - } - - /// - /// Converts a FreeImage bitmap from one color depth to another. - /// If the conversion fails the original FreeImage bitmap is returned. - /// - /// Handle to a FreeImage bitmap. - /// The desired output format. - /// Threshold value when converting with - /// . - /// Handle to a FreeImage bitmap. - /// - /// is null. - public static FIBITMAP ConvertColorDepth( - FIBITMAP dib, - FREE_IMAGE_COLOR_DEPTH conversion, - byte threshold) - { - return ConvertColorDepth( - dib, - conversion, - threshold, - FREE_IMAGE_DITHER.FID_FS, - FREE_IMAGE_QUANTIZE.FIQ_WUQUANT, - false); - } - - /// - /// Converts a FreeImage bitmap from one color depth to another. - /// If the conversion fails the original FreeImage bitmap is returned. - /// - /// Handle to a FreeImage bitmap. - /// The desired output format. - /// Dither algorithm when converting - /// with . - /// Handle to a FreeImage bitmap. - /// - /// is null. - public static FIBITMAP ConvertColorDepth( - FIBITMAP dib, - FREE_IMAGE_COLOR_DEPTH conversion, - FREE_IMAGE_DITHER ditherMethod) - { - return ConvertColorDepth( - dib, - conversion, - 128, - ditherMethod, - FREE_IMAGE_QUANTIZE.FIQ_WUQUANT, - false); - } - - - /// - /// Converts a FreeImage bitmap from one color depth to another. - /// If the conversion fails the original FreeImage bitmap is returned. - /// - /// Handle to a FreeImage bitmap. - /// The desired output format. - /// The quantization algorithm for conversion to 8-bit color depth. - /// Handle to a FreeImage bitmap. - /// - /// is null. - public static FIBITMAP ConvertColorDepth( - FIBITMAP dib, - FREE_IMAGE_COLOR_DEPTH conversion, - FREE_IMAGE_QUANTIZE quantizationMethod) - { - return ConvertColorDepth( - dib, - conversion, - 128, - FREE_IMAGE_DITHER.FID_FS, - quantizationMethod, - false); - } - - /// - /// Converts a FreeImage bitmap from one color depth to another. - /// If the conversion fails the original FreeImage bitmap is returned. - /// - /// Handle to a FreeImage bitmap. - /// The desired output format. - /// Threshold value when converting with - /// . - /// When true the structure will be unloaded on success. - /// Handle to a FreeImage bitmap. - /// - /// is null. - public static FIBITMAP ConvertColorDepth( - FIBITMAP dib, - FREE_IMAGE_COLOR_DEPTH conversion, - byte threshold, - bool unloadSource) - { - return ConvertColorDepth( - dib, - conversion, - threshold, - FREE_IMAGE_DITHER.FID_FS, - FREE_IMAGE_QUANTIZE.FIQ_WUQUANT, - unloadSource); - } - - /// - /// Converts a FreeImage bitmap from one color depth to another. - /// If the conversion fails the original FreeImage bitmap is returned. - /// - /// Handle to a FreeImage bitmap. - /// The desired output format. - /// Dither algorithm when converting with - /// . - /// When true the structure will be unloaded on success. - /// Handle to a FreeImage bitmap. - /// - /// is null. - public static FIBITMAP ConvertColorDepth( - FIBITMAP dib, - FREE_IMAGE_COLOR_DEPTH conversion, - FREE_IMAGE_DITHER ditherMethod, - bool unloadSource) - { - return ConvertColorDepth( - dib, - conversion, - 128, - ditherMethod, - FREE_IMAGE_QUANTIZE.FIQ_WUQUANT, - unloadSource); - } - - - /// - /// Converts a FreeImage bitmap from one color depth to another. - /// If the conversion fails the original FreeImage bitmap is returned. - /// - /// Handle to a FreeImage bitmap. - /// The desired output format. - /// The quantization algorithm for conversion to 8-bit color depth. - /// When true the structure will be unloaded on success. - /// Handle to a FreeImage bitmap. - /// - /// is null. - public static FIBITMAP ConvertColorDepth( - FIBITMAP dib, - FREE_IMAGE_COLOR_DEPTH conversion, - FREE_IMAGE_QUANTIZE quantizationMethod, - bool unloadSource) - { - return ConvertColorDepth( - dib, - conversion, - 128, - FREE_IMAGE_DITHER.FID_FS, - quantizationMethod, - unloadSource); - } - - /// - /// Converts a FreeImage bitmap from one color depth to another. - /// If the conversion fails the original FreeImage bitmap is returned. - /// - /// Handle to a FreeImage bitmap. - /// The desired output format. - /// Threshold value when converting with - /// . - /// Dither algorithm when converting with - /// . - /// The quantization algorithm for conversion to 8-bit color depth. - /// When true the structure will be unloaded on success. - /// Handle to a FreeImage bitmap. - /// - /// is null. - internal static FIBITMAP ConvertColorDepth( - FIBITMAP dib, - FREE_IMAGE_COLOR_DEPTH conversion, - byte threshold, - FREE_IMAGE_DITHER ditherMethod, - FREE_IMAGE_QUANTIZE quantizationMethod, - bool unloadSource) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - - FIBITMAP result = new FIBITMAP(); - FIBITMAP dibTemp = new FIBITMAP(); - uint bpp = GetBPP(dib); - bool reorderPalette = ((conversion & FREE_IMAGE_COLOR_DEPTH.FICD_REORDER_PALETTE) > 0); - bool forceGreyscale = ((conversion & FREE_IMAGE_COLOR_DEPTH.FICD_FORCE_GREYSCALE) > 0); - - if (GetImageType(dib) == FREE_IMAGE_TYPE.FIT_BITMAP) - { - switch (conversion & (FREE_IMAGE_COLOR_DEPTH)0xFF) - { - case FREE_IMAGE_COLOR_DEPTH.FICD_01_BPP_THRESHOLD: - - if (bpp != 1) - { - if (forceGreyscale) - { - result = Threshold(dib, threshold); - } - else - { - dibTemp = ConvertTo24Bits(dib); - result = ColorQuantizeEx(dibTemp, quantizationMethod, 2, null, 1); - Unload(dibTemp); - } - } - else - { - bool isGreyscale = IsGreyscaleImage(dib); - if ((forceGreyscale && (!isGreyscale)) || - (reorderPalette && isGreyscale)) - { - result = Threshold(dib, threshold); - } - } - break; - - case FREE_IMAGE_COLOR_DEPTH.FICD_01_BPP_DITHER: - - if (bpp != 1) - { - if (forceGreyscale) - { - result = Dither(dib, ditherMethod); - } - else - { - dibTemp = ConvertTo24Bits(dib); - result = ColorQuantizeEx(dibTemp, quantizationMethod, 2, null, 1); - Unload(dibTemp); - } - } - else - { - bool isGreyscale = IsGreyscaleImage(dib); - if ((forceGreyscale && (!isGreyscale)) || - (reorderPalette && isGreyscale)) - { - result = Dither(dib, ditherMethod); - } - } - break; - - case FREE_IMAGE_COLOR_DEPTH.FICD_04_BPP: - - if (bpp != 4) - { - // Special case when 1bpp and FIC_PALETTE - if (forceGreyscale || - ((bpp == 1) && (GetColorType(dib) == FREE_IMAGE_COLOR_TYPE.FIC_PALETTE))) - { - dibTemp = ConvertToGreyscale(dib); - result = ConvertTo4Bits(dibTemp); - Unload(dibTemp); - } - else - { - dibTemp = ConvertTo24Bits(dib); - result = ColorQuantizeEx(dibTemp, quantizationMethod, 16, null, 4); - Unload(dibTemp); - } - } - else - { - bool isGreyscale = IsGreyscaleImage(dib); - if ((forceGreyscale && (!isGreyscale)) || - (reorderPalette && isGreyscale)) - { - dibTemp = ConvertToGreyscale(dib); - result = ConvertTo4Bits(dibTemp); - Unload(dibTemp); - } - } - - break; - - case FREE_IMAGE_COLOR_DEPTH.FICD_08_BPP: - - if (bpp != 8) - { - if (forceGreyscale) - { - result = ConvertToGreyscale(dib); - } - else - { - dibTemp = ConvertTo24Bits(dib); - result = ColorQuantize(dibTemp, quantizationMethod); - Unload(dibTemp); - } - } - else - { - bool isGreyscale = IsGreyscaleImage(dib); - if ((forceGreyscale && (!isGreyscale)) || (reorderPalette && isGreyscale)) - { - result = ConvertToGreyscale(dib); - } - } - break; - - case FREE_IMAGE_COLOR_DEPTH.FICD_16_BPP_555: - - if (forceGreyscale) - { - dibTemp = ConvertToGreyscale(dib); - result = ConvertTo16Bits555(dibTemp); - Unload(dibTemp); - } - else if (bpp != 16 || GetRedMask(dib) != FI16_555_RED_MASK || GetGreenMask(dib) != FI16_555_GREEN_MASK || GetBlueMask(dib) != FI16_555_BLUE_MASK) - { - result = ConvertTo16Bits555(dib); - } - break; - - case FREE_IMAGE_COLOR_DEPTH.FICD_16_BPP: - - if (forceGreyscale) - { - dibTemp = ConvertToGreyscale(dib); - result = ConvertTo16Bits565(dibTemp); - Unload(dibTemp); - } - else if (bpp != 16 || GetRedMask(dib) != FI16_565_RED_MASK || GetGreenMask(dib) != FI16_565_GREEN_MASK || GetBlueMask(dib) != FI16_565_BLUE_MASK) - { - result = ConvertTo16Bits565(dib); - } - break; - - case FREE_IMAGE_COLOR_DEPTH.FICD_24_BPP: - - if (forceGreyscale) - { - dibTemp = ConvertToGreyscale(dib); - result = ConvertTo24Bits(dibTemp); - Unload(dibTemp); - } - else if (bpp != 24) - { - result = ConvertTo24Bits(dib); - } - break; - - case FREE_IMAGE_COLOR_DEPTH.FICD_32_BPP: - - if (forceGreyscale) - { - dibTemp = ConvertToGreyscale(dib); - result = ConvertTo32Bits(dibTemp); - Unload(dibTemp); - } - else if (bpp != 32) - { - result = ConvertTo32Bits(dib); - } - break; - } - } - - if (result.IsNull) - { - return dib; - } - if (unloadSource) - { - Unload(dib); - } - - return result; - } - - /// - /// ColorQuantizeEx is an extension to the - /// method that provides additional options used to quantize a 24-bit image to any - /// number of colors (up to 256), as well as quantize a 24-bit image using a - /// provided palette. - /// - /// Handle to a FreeImage bitmap. - /// Specifies the color reduction algorithm to be used. - /// Size of the desired output palette. - /// The provided palette. - /// true to create a bitmap with the smallest possible - /// color depth for the specified . - /// Handle to a FreeImage bitmap. - public static FIBITMAP ColorQuantizeEx(FIBITMAP dib, FREE_IMAGE_QUANTIZE quantize, int PaletteSize, RGBQUAD[] ReservePalette, bool minColorDepth) - { - FIBITMAP result; - if (minColorDepth) - { - int bpp; - if (PaletteSize >= 256) - bpp = 8; - else if (PaletteSize > 2) - bpp = 4; - else - bpp = 1; - result = ColorQuantizeEx(dib, quantize, PaletteSize, ReservePalette, bpp); - } - else - { - result = ColorQuantizeEx(dib, quantize, PaletteSize, ReservePalette, 8); - } - return result; - } - - /// - /// ColorQuantizeEx is an extension to the - /// method that provides additional options used to quantize a 24-bit image to any - /// number of colors (up to 256), as well as quantize a 24-bit image using a - /// partial or full provided palette. - /// - /// Handle to a FreeImage bitmap. - /// Specifies the color reduction algorithm to be used. - /// Size of the desired output palette. - /// The provided palette. - /// The desired color depth of the created image. - /// Handle to a FreeImage bitmap. - public static FIBITMAP ColorQuantizeEx(FIBITMAP dib, FREE_IMAGE_QUANTIZE quantize, int PaletteSize, RGBQUAD[] ReservePalette, int bpp) - { - unsafe - { - FIBITMAP result = FIBITMAP.Zero; - FIBITMAP temp = FIBITMAP.Zero; - int reservedSize = (ReservePalette == null) ? 0 : ReservePalette.Length; - - if (bpp == 8) - { - result = ColorQuantizeEx(dib, quantize, PaletteSize, reservedSize, ReservePalette); - } - else if (bpp == 4) - { - temp = ColorQuantizeEx(dib, quantize, Math.Min(16, PaletteSize), reservedSize, ReservePalette); - if (!temp.IsNull) - { - result = Allocate((int)GetWidth(temp), (int)GetHeight(temp), 4, 0, 0, 0); - CloneMetadata(result, temp); - CopyMemory(GetPalette(result), GetPalette(temp), sizeof(RGBQUAD) * 16); - - for (int y = (int)GetHeight(temp) - 1; y >= 0; y--) - { - Scanline srcScanline = new Scanline(temp, y); - Scanline dstScanline = new Scanline(result, y); - - for (int x = (int)GetWidth(temp) - 1; x >= 0; x--) - { - dstScanline[x] = srcScanline[x]; - } - } - } - } - else if (bpp == 1) - { - temp = ColorQuantizeEx(dib, quantize, 2, reservedSize, ReservePalette); - if (!temp.IsNull) - { - result = Allocate((int)GetWidth(temp), (int)GetHeight(temp), 1, 0, 0, 0); - CloneMetadata(result, temp); - CopyMemory(GetPalette(result), GetPalette(temp), sizeof(RGBQUAD) * 2); - - for (int y = (int)GetHeight(temp) - 1; y >= 0; y--) - { - Scanline srcScanline = new Scanline(temp, y); - Scanline dstScanline = new Scanline(result, y); - - for (int x = (int)GetWidth(temp) - 1; x >= 0; x--) - { - dstScanline[x] = srcScanline[x]; - } - } - } - } - - UnloadEx(ref temp); - return result; - } - } - - #endregion - - #region Metadata - - /// - /// Copies metadata from one FreeImage bitmap to another. - /// - /// Source FreeImage bitmap containing the metadata. - /// FreeImage bitmap to copy the metadata to. - /// Flags to switch different copy modes. - /// Returns -1 on failure else the number of copied tags. - /// - /// or is null. - public static int CloneMetadataEx(FIBITMAP src, FIBITMAP dst, FREE_IMAGE_METADATA_COPY flags) - { - if (src.IsNull) - { - throw new ArgumentNullException("src"); - } - if (dst.IsNull) - { - throw new ArgumentNullException("dst"); - } - - FITAG tag = new FITAG(), tag2 = new FITAG(); - int copied = 0; - - // Clear all existing metadata - if ((flags & FREE_IMAGE_METADATA_COPY.CLEAR_EXISTING) > 0) - { - foreach (FREE_IMAGE_MDMODEL model in FREE_IMAGE_MDMODELS) - { - if (!SetMetadata(model, dst, null, tag)) - { - return -1; - } - } - } - - bool keep = !((flags & FREE_IMAGE_METADATA_COPY.REPLACE_EXISTING) > 0); - - foreach (FREE_IMAGE_MDMODEL model in FREE_IMAGE_MDMODELS) - { - FIMETADATA mData = FindFirstMetadata(model, src, out tag); - if (mData.IsNull) continue; - do - { - string key = GetTagKey(tag); - if (!(keep && GetMetadata(model, dst, key, out tag2))) - { - if (SetMetadata(model, dst, key, tag)) - { - copied++; - } - } - } - while (FindNextMetadata(mData, out tag)); - FindCloseMetadata(mData); - } - - return copied; - } - - /// - /// Returns the comment of a JPEG, PNG or GIF image. - /// - /// Handle to a FreeImage bitmap. - /// Comment of the FreeImage bitmp, or null in case no comment exists. - /// - /// is null. - public static string GetImageComment(FIBITMAP dib) - { - string result = null; - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - FITAG tag; - if (GetMetadata(FREE_IMAGE_MDMODEL.FIMD_COMMENTS, dib, "Comment", out tag)) - { - MetadataTag metadataTag = new MetadataTag(tag, FREE_IMAGE_MDMODEL.FIMD_COMMENTS); - result = metadataTag.Value as string; - } - return result; - } - - /// - /// Sets the comment of a JPEG, PNG or GIF image. - /// - /// Handle to a FreeImage bitmap. - /// New comment of the FreeImage bitmap. - /// Use null to remove the comment. - /// Returns true on success, false on failure. - /// - /// is null. - public static bool SetImageComment(FIBITMAP dib, string comment) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - bool result; - if (comment != null) - { - FITAG tag = CreateTag(); - MetadataTag metadataTag = new MetadataTag(tag, FREE_IMAGE_MDMODEL.FIMD_COMMENTS); - metadataTag.Value = comment; - result = SetMetadata(FREE_IMAGE_MDMODEL.FIMD_COMMENTS, dib, "Comment", tag); - DeleteTag(tag); - } - else - { - result = SetMetadata(FREE_IMAGE_MDMODEL.FIMD_COMMENTS, dib, "Comment", FITAG.Zero); - } - return result; - } - - /// - /// Retrieve a metadata attached to a FreeImage bitmap. - /// - /// The metadata model to look for. - /// Handle to a FreeImage bitmap. - /// The metadata field name. - /// A structure returned by the function. - /// Returns true on success, false on failure. - /// - /// is null. - public static bool GetMetadata( - FREE_IMAGE_MDMODEL model, - FIBITMAP dib, - string key, - out MetadataTag tag) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - - FITAG _tag; - bool result; - if (GetMetadata(model, dib, key, out _tag)) - { - tag = new MetadataTag(_tag, model); - result = true; - } - else - { - tag = null; - result = false; - } - return result; - } - - /// - /// Attach a new metadata tag to a FreeImage bitmap. - /// - /// The metadata model used to store the tag. - /// Handle to a FreeImage bitmap. - /// The tag field name. - /// The to be attached. - /// Returns true on success, false on failure. - /// - /// is null. - public static bool SetMetadata( - FREE_IMAGE_MDMODEL model, - FIBITMAP dib, - string key, - MetadataTag tag) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - return SetMetadata(model, dib, key, tag.tag); - } - - /// - /// Provides information about the first instance of a tag that matches the metadata model. - /// - /// The model to match. - /// Handle to a FreeImage bitmap. - /// Tag that matches the metadata model. - /// Unique search handle that can be used to call FindNextMetadata or FindCloseMetadata. - /// Null if the metadata model does not exist. - /// - /// is null. - public static FIMETADATA FindFirstMetadata( - FREE_IMAGE_MDMODEL model, - FIBITMAP dib, - out MetadataTag tag) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - FITAG _tag; - FIMETADATA result = FindFirstMetadata(model, dib, out _tag); - if (result.IsNull) - { - tag = null; - return result; - } - tag = new MetadataTag(_tag, model); - if (metaDataSearchHandler.ContainsKey(result)) - { - metaDataSearchHandler[result] = model; - } - else - { - metaDataSearchHandler.Add(result, model); - } - return result; - } - - /// - /// Find the next tag, if any, that matches the metadata model argument in a previous call - /// to FindFirstMetadata, and then alters the tag object contents accordingly. - /// - /// Unique search handle provided by FindFirstMetadata. - /// Tag that matches the metadata model. - /// Returns true on success, false on failure. - public static bool FindNextMetadata(FIMETADATA mdhandle, out MetadataTag tag) - { - FITAG _tag; - bool result; - if (FindNextMetadata(mdhandle, out _tag)) - { - tag = new MetadataTag(_tag, metaDataSearchHandler[mdhandle]); - result = true; - } - else - { - tag = null; - result = false; - } - return result; - } - - /// - /// Closes the specified metadata search handle and releases associated resources. - /// - /// The handle to close. - public static void FindCloseMetadata(FIMETADATA mdhandle) - { - if (metaDataSearchHandler.ContainsKey(mdhandle)) - { - metaDataSearchHandler.Remove(mdhandle); - } - FindCloseMetadata_(mdhandle); - } - - /// - /// This dictionary links FIMETADATA handles and FREE_IMAGE_MDMODEL models. - /// - private static Dictionary metaDataSearchHandler - = new Dictionary(1); - - #endregion - - #region Rotation and Flipping - - /// - /// This function rotates a 1-, 8-bit greyscale or a 24-, 32-bit color image by means of 3 shears. - /// 1-bit images rotation is limited to integer multiple of 90°. - /// null is returned for other values. - /// - /// Handle to a FreeImage bitmap. - /// The angle of rotation. - /// Handle to a FreeImage bitmap. - public static FIBITMAP Rotate(FIBITMAP dib, double angle) - { - return Rotate(dib, angle, IntPtr.Zero); - } - - /// - /// This function rotates a 1-, 8-bit greyscale or a 24-, 32-bit color image by means of 3 shears. - /// 1-bit images rotation is limited to integer multiple of 90°. - /// null is returned for other values. - /// - /// The type of the color to use as background. - /// Handle to a FreeImage bitmap. - /// The angle of rotation. - /// The color used used to fill the bitmap's background. - /// Handle to a FreeImage bitmap. - public static FIBITMAP Rotate(FIBITMAP dib, double angle, T? backgroundColor) where T : struct - { - if (backgroundColor.HasValue) - { - GCHandle handle = new GCHandle(); - try - { - T[] buffer = new T[] { backgroundColor.Value }; - handle = GCHandle.Alloc(buffer, GCHandleType.Pinned); - return Rotate(dib, angle, handle.AddrOfPinnedObject()); - } - finally - { - if (handle.IsAllocated) - handle.Free(); - } - } - else - { - return Rotate(dib, angle, IntPtr.Zero); - } - } - - /// - /// Rotates a 4-bit color FreeImage bitmap. - /// Allowed values for are 90, 180 and 270. - /// In case is 0 or 360 a clone is returned. - /// 0 is returned for other values or in case the rotation fails. - /// - /// Handle to a FreeImage bitmap. - /// The angle of rotation. - /// Handle to a FreeImage bitmap. - /// - /// This function is kind of temporary due to FreeImage's lack of - /// rotating 4-bit images. It's particularly used by 's - /// method RotateFlip. This function will be removed as soon as FreeImage - /// supports rotating 4-bit images. - /// - /// - /// is null. - public static unsafe FIBITMAP Rotate4bit(FIBITMAP dib, double angle) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - - FIBITMAP result = new FIBITMAP(); - int ang = (int)angle; - - if ((GetImageType(dib) == FREE_IMAGE_TYPE.FIT_BITMAP) && - (GetBPP(dib) == 4) && - ((ang % 90) == 0)) - { - int width, height, xOrg, yOrg; - Scanline[] src, dst; - width = (int)GetWidth(dib); - height = (int)GetHeight(dib); - byte index = 0; - switch (ang) - { - case 90: - result = Allocate(height, width, 4, 0, 0, 0); - if (result.IsNull) - { - break; - } - CopyPalette(dib, result); - src = Get04BitScanlines(dib); - dst = Get04BitScanlines(result); - for (int y = 0; y < width; y++) - { - yOrg = height - 1; - for (int x = 0; x < height; x++, yOrg--) - { - index = src[yOrg][y]; - dst[y][x] = index; - } - } - break; - case 180: - result = Allocate(width, height, 4, 0, 0, 0); - if (result.IsNull) - { - break; - } - CopyPalette(dib, result); - src = Get04BitScanlines(dib); - dst = Get04BitScanlines(result); - - yOrg = height - 1; - for (int y = 0; y < height; y++, yOrg--) - { - xOrg = width - 1; - for (int x = 0; x < width; x++, xOrg--) - { - index = src[yOrg][xOrg]; - dst[y][x] = index; - } - } - break; - case 270: - result = Allocate(height, width, 4, 0, 0, 0); - if (result.IsNull) - { - break; - } - CopyPalette(dib, result); - src = Get04BitScanlines(dib); - dst = Get04BitScanlines(result); - xOrg = width - 1; - for (int y = 0; y < width; y++, xOrg--) - { - for (int x = 0; x < height; x++) - { - index = src[x][xOrg]; - dst[y][x] = index; - } - } - break; - case 0: - case 360: - result = Clone(dib); - break; - } - } - return result; - } - - #endregion - - #region Upsampling / downsampling - - /// - /// Enlarges or shrinks the FreeImage bitmap selectively per side and fills newly added areas - /// with the specified background color. See remarks for further details. - /// - /// The type of the specified color. - /// Handle to a FreeImage bitmap. - /// The number of pixels, the image should be enlarged on its left side. - /// Negative values shrink the image on its left side. - /// The number of pixels, the image should be enlarged on its top side. - /// Negative values shrink the image on its top side. - /// The number of pixels, the image should be enlarged on its right side. - /// Negative values shrink the image on its right side. - /// The number of pixels, the image should be enlarged on its bottom side. - /// Negative values shrink the image on its bottom side. - /// The color, the enlarged sides of the image should be filled with. - /// Options that affect the color search process for palletized images. - /// Handle to a FreeImage bitmap. - /// - /// This function enlarges or shrinks an image selectively per side. - /// The main purpose of this function is to add borders to an image. - /// To add a border to any of the image's sides, a positive integer value must be passed in - /// any of the parameters , , - /// or . This value represents the border's - /// width in pixels. Newly created parts of the image (the border areas) are filled with the - /// specified . - /// Specifying a negative integer value for a certain side, will shrink or crop the image on - /// this side. Consequently, specifying zero for a certain side will not change the image's - /// extension on that side. - /// - /// So, calling this function with all parameters , , - /// and set to zero, is - /// effectively the same as calling function ; setting all parameters - /// , , and - /// to value equal to or smaller than zero, my easily be substituted - /// by a call to function . Both these cases produce a new image, which is - /// guaranteed not to be larger than the input image. Thus, since the specified - /// is not needed in these cases, - /// may be null. - /// - /// Both parameters and work according to - /// function . So, please refer to the documentation of - /// to learn more about parameters - /// and . For palletized images, the palette of the input image is - /// transparently copied to the newly created enlarged or shrunken image, so any color look-ups - /// are performed on this palette. - /// - /// - /// // create a white color
- /// RGBQUAD c;
- /// c.rgbRed = 0xFF;
- /// c.rgbGreen = 0xFF;
- /// c.rgbBlue = 0xFF;
- /// c.rgbReserved = 0x00;
- ///
- /// // add a white, symmetric 10 pixel wide border to the image
- /// dib2 = FreeImage_EnlargeCanvas(dib, 10, 10, 10, 10, c, FREE_IMAGE_COLOR_OPTIONS.FICO_RGB);
- ///
- /// // add white, 20 pixel wide stripes to the top and bottom side of the image
- /// dib3 = FreeImage_EnlargeCanvas(dib, 0, 20, 0, 20, c, FREE_IMAGE_COLOR_OPTIONS.FICO_RGB);
- ///
- /// // add white, 30 pixel wide stripes to the right side of the image and
- /// // cut off the 40 leftmost pixel columns
- /// dib3 = FreeImage_EnlargeCanvas(dib, -40, 0, 30, 0, c, FREE_IMAGE_COLOR_OPTIONS.FICO_RGB);
- ///
- public static FIBITMAP EnlargeCanvas(FIBITMAP dib, int left, int top, int right, int bottom, - T? color, FREE_IMAGE_COLOR_OPTIONS options) where T : struct - { - if (dib.IsNull) - return FIBITMAP.Zero; - - if (color.HasValue) - { - if (!CheckColorType(GetImageType(dib), color.Value)) - return FIBITMAP.Zero; - - GCHandle handle = new GCHandle(); - try - { - T[] buffer = new T[] { color.Value }; - handle = GCHandle.Alloc(buffer, GCHandleType.Pinned); - return EnlargeCanvas(dib, left, top, right, bottom, handle.AddrOfPinnedObject(), options); - } - finally - { - if (handle.IsAllocated) - handle.Free(); - } - } - else - { - return EnlargeCanvas(dib, left, top, right, bottom, IntPtr.Zero, options); - } - } - - #endregion - - #region Color - - /// - /// Sets all pixels of the specified image to the color provided through the - /// parameter. See remarks for further details. - /// - /// The type of the specified color. - /// Handle to a FreeImage bitmap. - /// The color to fill the bitmap with. See remarks for further details. - /// Options that affect the color search process for palletized images. - /// true on success, false on failure. - /// - /// This function sets all pixels of an image to the color provided through - /// the parameter. is used for standard type images. - /// For non standard type images the underlaying structure is used. - /// - /// So, must be of type , if the image to be filled is of type - /// and must be a structure if the - /// image is of type and so on. - /// - /// However, the fill color is always specified through a structure - /// for all images of type . - /// So, for 32- and 24-bit images, the red, green and blue members of the - /// structure are directly used for the image's red, green and blue channel respectively. - /// Although alpha transparent colors are - /// supported, the alpha channel of a 32-bit image never gets modified by this function. - /// A fill color with an alpha value smaller than 255 gets blended with the image's actual - /// background color, which is determined from the image's bottom-left pixel. - /// So, currently using alpha enabled colors, assumes the image to be unicolor before the - /// fill operation. However, the field is only taken into account, - /// if option has been specified. - /// - /// For 16-bit images, the red-, green- and blue components of the specified color are - /// transparently translated into either the 16-bit 555 or 565 representation. This depends - /// on the image's actual red- green- and blue masks. - /// - /// Special attention must be payed for palletized images. Generally, the RGB color specified - /// is looked up in the image's palette. The found palette index is then used to fill the image. - /// There are some option flags, that affect this lookup process: - /// - /// - /// Value - /// Meaning - /// - /// - /// - /// - /// Uses the color, that is nearest to the specified color. - /// This is the default behavior and should always find a - /// color in the palette. However, the visual result may - /// far from what was expected and mainly depends on the - /// image's palette. - /// - /// - /// - /// - /// - /// Searches the image's palette for the specified color - /// but only uses the returned palette index, if the specified - /// color exactly matches the palette entry. Of course, - /// depending on the image's actual palette entries, this - /// operation may fail. In this case, the function falls back - /// to option - /// and uses the RGBQUAD's rgbReserved member (or its low nibble for 4-bit images - /// or its least significant bit (LSB) for 1-bit images) as - /// the palette index used for the fill operation. - /// - /// - /// - /// - /// - /// Does not perform any color lookup from the palette, but - /// uses the RGBQUAD's alpha channel member rgbReserved as - /// the palette index to be used for the fill operation. - /// However, for 4-bit images, only the low nibble of the - /// rgbReserved member are used and for 1-bit images, only - /// the least significant bit (LSB) is used. - /// - /// - /// - /// - public static bool FillBackground(FIBITMAP dib, T color, FREE_IMAGE_COLOR_OPTIONS options) - where T : struct - { - if (dib.IsNull) - return false; - - if (!CheckColorType(GetImageType(dib), color)) - return false; - - GCHandle handle = new GCHandle(); - try - { - T[] buffer = new T[] { color }; - handle = GCHandle.Alloc(buffer, GCHandleType.Pinned); - return FillBackground(dib, handle.AddrOfPinnedObject(), options); - } - finally - { - if (handle.IsAllocated) - handle.Free(); - } - } - - #endregion - - #region Wrapper functions - - /// - /// Returns the next higher possible color depth. - /// - /// Color depth to increase. - /// The next higher color depth or 0 if there is no valid color depth. - internal static int GetNextColorDepth(int bpp) - { - int result = 0; - switch (bpp) - { - case 1: - result = 4; - break; - case 4: - result = 8; - break; - case 8: - result = 16; - break; - case 16: - result = 24; - break; - case 24: - result = 32; - break; - } - return result; - } - - /// - /// Returns the next lower possible color depth. - /// - /// Color depth to decrease. - /// The next lower color depth or 0 if there is no valid color depth. - internal static int GetPrevousColorDepth(int bpp) - { - int result = 0; - switch (bpp) - { - case 32: - result = 24; - break; - case 24: - result = 16; - break; - case 16: - result = 8; - break; - case 8: - result = 4; - break; - case 4: - result = 1; - break; - } - return result; - } - - /// - /// Reads a null-terminated c-string. - /// - /// Pointer to the first char of the string. - /// The converted string. - internal static unsafe string PtrToStr(byte* ptr) - { - string result = null; - if (ptr != null) - { - System.Text.StringBuilder sb = new System.Text.StringBuilder(); - - while (*ptr != 0) - { - sb.Append((char)(*(ptr++))); - } - result = sb.ToString(); - } - return result; - } - - internal static unsafe byte[] CreateShrunkenPaletteLUT(FIBITMAP dib, out int uniqueColors) - { - byte[] result = null; - uniqueColors = 0; - - if ((!dib.IsNull) && (GetImageType(dib) == FREE_IMAGE_TYPE.FIT_BITMAP) && (GetBPP(dib) <= 8)) - { - int size = (int)GetColorsUsed(dib); - List newPalette = new List(size); - List lut = new List(size); - RGBQUAD* palette = (RGBQUAD*)GetPalette(dib); - RGBQUAD color; - int index; - - for (int i = 0; i < size; i++) - { - color = palette[i]; - color.rgbReserved = 255; // ignore alpha - - index = newPalette.IndexOf(color); - if (index < 0) - { - newPalette.Add(color); - lut.Add((byte)(newPalette.Count - 1)); - } - else - { - lut.Add((byte)index); - } - } - result = lut.ToArray(); - uniqueColors = newPalette.Count; - } - return result; - } - - internal static PropertyItem CreatePropertyItem() - { - return (PropertyItem)Activator.CreateInstance(typeof(PropertyItem), true); - } - - private static unsafe void CopyPalette(FIBITMAP src, FIBITMAP dst) - { - RGBQUAD* orgPal = (RGBQUAD*)GetPalette(src); - RGBQUAD* newPal = (RGBQUAD*)GetPalette(dst); - uint size = (uint)(sizeof(RGBQUAD) * GetColorsUsed(src)); - CopyMemory(newPal, orgPal, size); - } - - private static unsafe Scanline[] Get04BitScanlines(FIBITMAP dib) - { - int height = (int)GetHeight(dib); - Scanline[] array = new Scanline[height]; - for (int i = 0; i < height; i++) - { - array[i] = new Scanline(dib, i); - } - return array; - } - - /// - /// Changes a bitmaps color depth. - /// Used by SaveEx and SaveToStream. - /// - private static FIBITMAP PrepareBitmapColorDepth(FIBITMAP dibToSave, FREE_IMAGE_FORMAT format, FREE_IMAGE_COLOR_DEPTH colorDepth) - { - FREE_IMAGE_TYPE type = GetImageType(dibToSave); - if (type == FREE_IMAGE_TYPE.FIT_BITMAP) - { - int bpp = (int)GetBPP(dibToSave); - int targetBpp = (int)(colorDepth & FREE_IMAGE_COLOR_DEPTH.FICD_COLOR_MASK); - - if (colorDepth != FREE_IMAGE_COLOR_DEPTH.FICD_AUTO) - { - // A fix colordepth was chosen - if (FIFSupportsExportBPP(format, targetBpp)) - { - dibToSave = ConvertColorDepth(dibToSave, colorDepth, false); - } - else - { - throw new ArgumentException("FreeImage\n\nFreeImage Library plugin " + - GetFormatFromFIF(format) + " is unable to write images with a color depth of " + - targetBpp + " bpp."); - } - } - else - { - // Auto selection was chosen - if (!FIFSupportsExportBPP(format, bpp)) - { - // The color depth is not supported - int bppUpper = bpp; - int bppLower = bpp; - // Check from the bitmaps current color depth in both directions - do - { - bppUpper = GetNextColorDepth(bppUpper); - if (FIFSupportsExportBPP(format, bppUpper)) - { - dibToSave = ConvertColorDepth(dibToSave, (FREE_IMAGE_COLOR_DEPTH)bppUpper, false); - break; - } - bppLower = GetPrevousColorDepth(bppLower); - if (FIFSupportsExportBPP(format, bppLower)) - { - dibToSave = ConvertColorDepth(dibToSave, (FREE_IMAGE_COLOR_DEPTH)bppLower, false); - break; - } - } while (!((bppLower == 0) && (bppUpper == 0))); - } - } - } - return dibToSave; - } - - /// - /// Compares blocks of memory. - /// - /// A pointer to a block of memory to compare. - /// A pointer to a block of memory to compare. - /// Specifies the number of bytes to be compared. - /// true, if all bytes compare as equal, false otherwise. - public static unsafe bool CompareMemory(void* buf1, void* buf2, uint length) - { - return (length == RtlCompareMemory(buf1, buf2, length)); - } - - /// - /// Compares blocks of memory. - /// - /// A pointer to a block of memory to compare. - /// A pointer to a block of memory to compare. - /// Specifies the number of bytes to be compared. - /// true, if all bytes compare as equal, false otherwise. - public static unsafe bool CompareMemory(void* buf1, void* buf2, long length) - { - return (length == RtlCompareMemory(buf1, buf2, checked((uint)length))); - } - - /// - /// Compares blocks of memory. - /// - /// A pointer to a block of memory to compare. - /// A pointer to a block of memory to compare. - /// Specifies the number of bytes to be compared. - /// true, if all bytes compare as equal, false otherwise. - public static unsafe bool CompareMemory(IntPtr buf1, IntPtr buf2, uint length) - { - return (length == RtlCompareMemory(buf1.ToPointer(), buf2.ToPointer(), length)); - } - - /// - /// Compares blocks of memory. - /// - /// A pointer to a block of memory to compare. - /// A pointer to a block of memory to compare. - /// Specifies the number of bytes to be compared. - /// true, if all bytes compare as equal, false otherwise. - public static unsafe bool CompareMemory(IntPtr buf1, IntPtr buf2, long length) - { - return (length == RtlCompareMemory(buf1.ToPointer(), buf2.ToPointer(), checked((uint)length))); - } - - /// - /// Moves a block of memory from one location to another. - /// - /// A pointer to the starting address of the move destination. - /// A pointer to the starting address of the block of memory to be moved. - /// The size of the block of memory to move, in bytes. - public static unsafe void MoveMemory(void* dst, void* src, long size) - { - MoveMemory(dst, src, checked((uint)size)); - } - - /// - /// Moves a block of memory from one location to another. - /// - /// A pointer to the starting address of the move destination. - /// A pointer to the starting address of the block of memory to be moved. - /// The size of the block of memory to move, in bytes. - public static unsafe void MoveMemory(IntPtr dst, IntPtr src, uint size) - { - MoveMemory(dst.ToPointer(), src.ToPointer(), size); - } - - /// - /// Moves a block of memory from one location to another. - /// - /// A pointer to the starting address of the move destination. - /// A pointer to the starting address of the block of memory to be moved. - /// The size of the block of memory to move, in bytes. - public static unsafe void MoveMemory(IntPtr dst, IntPtr src, long size) - { - MoveMemory(dst.ToPointer(), src.ToPointer(), checked((uint)size)); - } - - /// - /// Copies a block of memory from one location to another. - /// - /// A pointer to the starting address of the copied block's destination. - /// A pointer to the starting address of the block of memory to copy. - /// The size of the block of memory to copy, in bytes. - /// - /// CopyMemory runs faster than . - /// However, if both blocks overlap the result is undefined. - /// - public static unsafe void CopyMemory(byte* dest, byte* src, int len) - { - if (len >= 0x10) - { - do - { - *((int*)dest) = *((int*)src); - *((int*)(dest + 4)) = *((int*)(src + 4)); - *((int*)(dest + 8)) = *((int*)(src + 8)); - *((int*)(dest + 12)) = *((int*)(src + 12)); - dest += 0x10; - src += 0x10; - } - while ((len -= 0x10) >= 0x10); - } - if (len > 0) - { - if ((len & 8) != 0) - { - *((int*)dest) = *((int*)src); - *((int*)(dest + 4)) = *((int*)(src + 4)); - dest += 8; - src += 8; - } - if ((len & 4) != 0) - { - *((int*)dest) = *((int*)src); - dest += 4; - src += 4; - } - if ((len & 2) != 0) - { - *((short*)dest) = *((short*)src); - dest += 2; - src += 2; - } - if ((len & 1) != 0) - { - *dest = *src; - } - } - } - - /// - /// Copies a block of memory from one location to another. - /// - /// A pointer to the starting address of the copied block's destination. - /// A pointer to the starting address of the block of memory to copy. - /// The size of the block of memory to copy, in bytes. - /// - /// CopyMemory runs faster than . - /// However, if both blocks overlap the result is undefined. - /// - public static unsafe void CopyMemory(byte* dest, byte* src, long len) - { - CopyMemory(dest, src, checked((int)len)); - } - - /// - /// Copies a block of memory from one location to another. - /// - /// A pointer to the starting address of the copied block's destination. - /// A pointer to the starting address of the block of memory to copy. - /// The size of the block of memory to copy, in bytes. - /// - /// CopyMemory runs faster than . - /// However, if both blocks overlap the result is undefined. - /// - public static unsafe void CopyMemory(void* dest, void* src, long len) - { - CopyMemory((byte*)dest, (byte*)src, checked((int)len)); - } - - /// - /// Copies a block of memory from one location to another. - /// - /// A pointer to the starting address of the copied block's destination. - /// A pointer to the starting address of the block of memory to copy. - /// The size of the block of memory to copy, in bytes. - /// - /// CopyMemory runs faster than . - /// However, if both blocks overlap the result is undefined. - /// - public static unsafe void CopyMemory(void* dest, void* src, int len) - { - CopyMemory((byte*)dest, (byte*)src, len); - } - - /// - /// Copies a block of memory from one location to another. - /// - /// A pointer to the starting address of the copied block's destination. - /// A pointer to the starting address of the block of memory to copy. - /// The size of the block of memory to copy, in bytes. - /// - /// CopyMemory runs faster than . - /// However, if both blocks overlap the result is undefined. - /// - public static unsafe void CopyMemory(IntPtr dest, IntPtr src, int len) - { - CopyMemory((byte*)dest, (byte*)src, len); - } - - /// - /// Copies a block of memory from one location to another. - /// - /// A pointer to the starting address of the copied block's destination. - /// A pointer to the starting address of the block of memory to copy. - /// The size of the block of memory to copy, in bytes. - /// - /// CopyMemory runs faster than . - /// However, if both blocks overlap the result is undefined. - /// - public static unsafe void CopyMemory(IntPtr dest, IntPtr src, long len) - { - CopyMemory((byte*)dest, (byte*)src, checked((int)len)); - } - - /// - /// Copies a block of memory into an array. - /// - /// An array used as the destination of the copy process. - /// A pointer to the starting address of the block of memory to copy. - /// The size of the block of memory to copy, in bytes. - public static unsafe void CopyMemory(Array dest, void* src, int len) - { - GCHandle handle = GCHandle.Alloc(dest, GCHandleType.Pinned); - try - { - CopyMemory((byte*)handle.AddrOfPinnedObject(), (byte*)src, len); - } - finally - { - handle.Free(); - } - } - - /// - /// Copies a block of memory into an array. - /// - /// An array used as the destination of the copy process. - /// A pointer to the starting address of the block of memory to copy. - /// The size of the block of memory to copy, in bytes. - public static unsafe void CopyMemory(Array dest, void* src, long len) - { - CopyMemory(dest, (byte*)src, checked((int)len)); - } - - /// - /// Copies a block of memory into an array. - /// - /// An array used as the destination of the copy process. - /// A pointer to the starting address of the block of memory to copy. - /// The size of the block of memory to copy, in bytes. - public static unsafe void CopyMemory(Array dest, IntPtr src, int len) - { - CopyMemory(dest, (byte*)src, len); - } - - /// - /// Copies a block of memory into an array. - /// - /// An array used as the destination of the copy process. - /// A pointer to the starting address of the block of memory to copy. - /// The size of the block of memory to copy, in bytes. - public static unsafe void CopyMemory(Array dest, IntPtr src, long len) - { - CopyMemory(dest, (byte*)src, checked((int)len)); - } - - /// - /// Copies the content of an array to a memory location. - /// - /// A pointer to the starting address of the copied block's destination. - /// An array used as the source of the copy process. - /// The size of the block of memory to copy, in bytes. - public static unsafe void CopyMemory(void* dest, Array src, int len) - { - GCHandle handle = GCHandle.Alloc(src, GCHandleType.Pinned); - try - { - CopyMemory((byte*)dest, (byte*)handle.AddrOfPinnedObject(), len); - } - finally - { - handle.Free(); - } - } - - /// - /// Copies the content of an array to a memory location. - /// - /// A pointer to the starting address of the copied block's destination. - /// An array used as the source of the copy process. - /// The size of the block of memory to copy, in bytes. - public static unsafe void CopyMemory(void* dest, Array src, long len) - { - CopyMemory((byte*)dest, src, checked((int)len)); - } - - /// - /// Copies the content of an array to a memory location. - /// - /// A pointer to the starting address of the copied block's destination. - /// An array used as the source of the copy process. - /// The size of the block of memory to copy, in bytes. - public static unsafe void CopyMemory(IntPtr dest, Array src, int len) - { - CopyMemory((byte*)dest, src, len); - } - - /// - /// Copies the content of an array to a memory location. - /// - /// A pointer to the starting address of the copied block's destination. - /// An array used as the source of the copy process. - /// The size of the block of memory to copy, in bytes. - public static unsafe void CopyMemory(IntPtr dest, Array src, long len) - { - CopyMemory((byte*)dest, src, checked((int)len)); - } - - /// - /// Copies the content of one array into another array. - /// - /// An array used as the destination of the copy process. - /// An array used as the source of the copy process. - /// The size of the content to copy, in bytes. - public static unsafe void CopyMemory(Array dest, Array src, int len) - { - GCHandle dHandle = GCHandle.Alloc(dest, GCHandleType.Pinned); - try - { - GCHandle sHandle = GCHandle.Alloc(src, GCHandleType.Pinned); - try - { - CopyMemory((byte*)dHandle.AddrOfPinnedObject(), (byte*)sHandle.AddrOfPinnedObject(), len); - } - finally - { - sHandle.Free(); - } - } - finally - { - dHandle.Free(); - } - } - - /// - /// Copies the content of one array into another array. - /// - /// An array used as the destination of the copy process. - /// An array used as the source of the copy process. - /// The size of the content to copy, in bytes. - public static unsafe void CopyMemory(Array dest, Array src, long len) - { - CopyMemory(dest, src, checked((int)len)); - } - - internal static string ColorToString(Color color) - { - return string.Format( - System.Globalization.CultureInfo.CurrentCulture, - "{{Name={0}, ARGB=({1}, {2}, {3}, {4})}}", - new object[] { color.Name, color.A, color.R, color.G, color.B }); - } - - internal static void Resize(ref string str, int length) - { - if ((str != null) && (length >= 0) && (str.Length != length)) - { - char[] chars = str.ToCharArray(); - Array.Resize(ref chars, length); - str = new string(chars); - } - } - - internal static void Resize(ref string str, int min, int max) - { - if ((str != null) && (min >= 0) && (max >= 0) && (min <= max)) - { - if (str.Length < min) - { - char[] chars = str.ToCharArray(); - Array.Resize(ref chars, min); - str = new string(chars); - } - else if (str.Length > max) - { - char[] chars = str.ToCharArray(); - Array.Resize(ref chars, max); - str = new string(chars); - } - } - } - - internal static void Resize(ref T[] array, int length) - { - if ((array != null) && (length >= 0) && (array.Length != length)) - { - Array.Resize(ref array, length); - } - } - - internal static void Resize(ref T[] array, int min, int max) - { - if ((array != null) && (min >= 0) && (max >= 0) && (min <= max)) - { - if (array.Length < min) - { - Array.Resize(ref array, min); - } - else if (array.Length > max) - { - Array.Resize(ref array, max); - } - } - } - - internal static bool CheckColorType(FREE_IMAGE_TYPE imageType, T color) - { - Type type = typeof(T); - bool result; - switch (imageType) - { - case FREE_IMAGE_TYPE.FIT_BITMAP: - result = (type == typeof(RGBQUAD)); break; - case FREE_IMAGE_TYPE.FIT_COMPLEX: - result = (type == typeof(FICOMPLEX)); break; - case FREE_IMAGE_TYPE.FIT_DOUBLE: - result = (type == typeof(double)); break; - case FREE_IMAGE_TYPE.FIT_FLOAT: - result = (type == typeof(float)); break; - case FREE_IMAGE_TYPE.FIT_INT16: - result = (type == typeof(Int16)); break; - case FREE_IMAGE_TYPE.FIT_INT32: - result = (type == typeof(Int32)); break; - case FREE_IMAGE_TYPE.FIT_RGB16: - result = (type == typeof(FIRGB16)); break; - case FREE_IMAGE_TYPE.FIT_RGBA16: - result = (type == typeof(FIRGBA16)); break; - case FREE_IMAGE_TYPE.FIT_RGBAF: - result = (type == typeof(FIRGBAF)); break; - case FREE_IMAGE_TYPE.FIT_RGBF: - result = (type == typeof(FIRGBF)); break; - case FREE_IMAGE_TYPE.FIT_UINT16: - result = (type == typeof(UInt16)); break; - case FREE_IMAGE_TYPE.FIT_UINT32: - result = (type == typeof(UInt32)); break; - default: - result = false; break; - } - return result; - } - - #endregion - - #region Dll-Imports - - /// - /// Retrieves a handle to a display device context (DC) for the client area of a specified window - /// or for the entire screen. You can use the returned handle in subsequent GDI functions to draw in the DC. - /// - /// Handle to the window whose DC is to be retrieved. - /// If this value is IntPtr.Zero, GetDC retrieves the DC for the entire screen. - /// If the function succeeds, the return value is a handle to the DC for the specified window's client area. - /// If the function fails, the return value is NULL. - [DllImport("user32.dll")] - private static extern IntPtr GetDC(IntPtr hWnd); - - /// - /// Releases a device context (DC), freeing it for use by other applications. - /// The effect of the ReleaseDC function depends on the type of DC. It frees only common and window DCs. - /// It has no effect on class or private DCs. - /// - /// Handle to the window whose DC is to be released. - /// Handle to the DC to be released. - /// Returns true on success, false on failure. - [DllImport("user32.dll")] - private static extern bool ReleaseDC(IntPtr hWnd, IntPtr hDC); - - /// - /// Creates a DIB that applications can write to directly. - /// The function gives you a pointer to the location of the bitmap bit values. - /// You can supply a handle to a file-mapping object that the function will use to create the bitmap, - /// or you can let the system allocate the memory for the bitmap. - /// - /// Handle to a device context. - /// Pointer to a BITMAPINFO structure that specifies various attributes of the DIB, - /// including the bitmap dimensions and colors. - /// Specifies the type of data contained in the bmiColors array member of the BITMAPINFO structure - /// pointed to by pbmi (either logical palette indexes or literal RGB values). - /// Pointer to a variable that receives a pointer to the location of the DIB bit values. - /// Handle to a file-mapping object that the function will use to create the DIB. - /// This parameter can be NULL. - /// Specifies the offset from the beginning of the file-mapping object referenced by hSection - /// where storage for the bitmap bit values is to begin. This value is ignored if hSection is NULL. - /// If the function succeeds, the return value is a handle to the newly created DIB, - /// and *ppvBits points to the bitmap bit values. If the function fails, the return value is NULL, and *ppvBits is NULL. - [DllImport("gdi32.dll")] - private static extern IntPtr CreateDIBSection( - IntPtr hdc, - [In] IntPtr pbmi, - uint iUsage, - out IntPtr ppvBits, - IntPtr hSection, - uint dwOffset); - - /// - /// Deletes a logical pen, brush, font, bitmap, region, or palette, freeing all system resources associated with the object. - /// After the object is deleted, the specified handle is no longer valid. - /// - /// Handle to a logical pen, brush, font, bitmap, region, or palette. - /// Returns true on success, false on failure. - [DllImport("gdi32.dll")] - private static extern bool DeleteObject(IntPtr hObject); - - /// - /// Creates a compatible bitmap (DDB) from a DIB and, optionally, sets the bitmap bits. - /// - /// Handle to a device context. - /// Pointer to a bitmap information header structure. - /// Specifies how the system initializes the bitmap bits - (use 4). - /// Pointer to an array of bytes containing the initial bitmap data. - /// Pointer to a BITMAPINFO structure that describes the dimensions - /// and color format of the array pointed to by the lpbInit parameter. - /// Specifies whether the bmiColors member of the BITMAPINFO structure - /// was initialized - (use 0). - /// Handle to a DIB or null on failure. - [DllImport("gdi32.dll")] - private static extern IntPtr CreateDIBitmap( - IntPtr hdc, - IntPtr lpbmih, - uint fdwInit, - IntPtr lpbInit, - IntPtr lpbmi, - uint fuUsage); - - /// - /// Retrieves information for the specified graphics object. - /// - /// Handle to the graphics object of interest. - /// Specifies the number of bytes of information to - /// be written to the buffer. - /// Pointer to a buffer that receives the information - /// about the specified graphics object. - /// 0 on failure. - [DllImport("gdi32.dll")] - private static extern int GetObject(IntPtr hgdiobj, int cbBuffer, IntPtr lpvObject); - - /// - /// Retrieves the bits of the specified compatible bitmap and copies them into a buffer - /// as a DIB using the specified format. - /// - /// Handle to the device context. - /// Handle to the bitmap. This must be a compatible bitmap (DDB). - /// Specifies the first scan line to retrieve. - /// Specifies the number of scan lines to retrieve. - /// Pointer to a buffer to receive the bitmap data. - /// Pointer to a BITMAPINFO structure that specifies the desired - /// format for the DIB data. - /// Specifies the format of the bmiColors member of the - /// BITMAPINFO structure - (use 0). - /// 0 on failure. - [DllImport("gdi32.dll")] - private static extern unsafe int GetDIBits( - IntPtr hdc, - IntPtr hbmp, - uint uStartScan, - uint cScanLines, - IntPtr lpvBits, - IntPtr lpbmi, - uint uUsage); - - /// - /// Moves a block of memory from one location to another. - /// - /// Pointer to the starting address of the move destination. - /// Pointer to the starting address of the block of memory to be moved. - /// Size of the block of memory to move, in bytes. - [DllImport("Kernel32.dll", EntryPoint = "RtlMoveMemory", SetLastError = false)] - public static unsafe extern void MoveMemory(void* dst, void* src, uint size); - - /// - /// The RtlCompareMemory routine compares blocks of memory - /// and returns the number of bytes that are equivalent. - /// - /// A pointer to a block of memory to compare. - /// A pointer to a block of memory to compare. - /// Specifies the number of bytes to be compared. - /// RtlCompareMemory returns the number of bytes that compare as equal. - /// If all bytes compare as equal, the input Length is returned. - [DllImport("ntdll.dll", EntryPoint = "RtlCompareMemory", SetLastError = false)] - internal static unsafe extern uint RtlCompareMemory(void* buf1, void* buf2, uint count); - - #endregion - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Library.2005.csproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Library.2005.csproj deleted file mode 100644 index 1aa3345..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Library.2005.csproj +++ /dev/null @@ -1,190 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} - Library - Properties - FreeImageAPI - FreeImageNET - - - OnOutputUpdated - - - true - full - false - bin\Debug\ - DEBUG - none - 4 - 4194304 - 512 - true - 419 - false - bin\Debug\FreeImageNET.XML - true - - - none - true - bin\Release\ - - - none - 4 - 512 - 4194304 - true - false - 419 - bin\Release\FreeImageNET.XML - - - true - bin\Debug\ - DEBUG - true - bin\Debug\FreeImageNET.XML - false - 512 - full - x86 - false - none - - - bin\Release\ - true - bin\Release\FreeImageNET.XML - true - 512 - - - x86 - false - none - - - true - bin\Debug\ - DEBUG - true - bin\Debug\FreeImageNET.XML - false - 512 - full - x64 - false - none - - - bin\Release\ - true - bin\Release\FreeImageNET.XML - true - 512 - - - x64 - false - none - - - - - - - - - - - - - - - - - Code - - - - - - Code - - - - Code - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Library.csproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Library.csproj deleted file mode 100644 index 1d40089..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Library.csproj +++ /dev/null @@ -1,231 +0,0 @@ - - - Debug - AnyCPU - 9.0.21022 - 2.0 - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} - Library - Properties - FreeImageAPI - FreeImageNET - - - OnOutputUpdated - - - 2.0 - - - v3.5 - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - - - true - full - false - bin\Debug\ - DEBUG - none - 4 - 4194304 - 512 - true - 419 - false - bin\Debug\FreeImageNET.XML - true - - - none - true - bin\Release\ - - - none - 4 - 512 - 4194304 - true - false - 419 - bin\Release\FreeImageNET.XML - - - true - bin\Debug\ - DEBUG - true - bin\Debug\FreeImageNET.XML - true - 512 - full - x86 - false - none - - - bin\Release\ - true - bin\Release\FreeImageNET.XML - true - 512 - - - x86 - false - none - - - true - bin\Debug\ - DEBUG - true - bin\Debug\FreeImageNET.XML - true - 512 - full - x64 - false - none - - - bin\Release\ - true - bin\Release\FreeImageNET.XML - true - 512 - - - x64 - false - none - - - - - 3.5 - - - - - - - - - - - - - - - Code - - - - - - Code - - - - Code - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - False - .NET Framework 2.0 %28x86%29 - true - - - False - .NET Framework 3.0 %28x86%29 - false - - - False - .NET Framework 3.5 - false - - - - - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Properties/AssemblyInfo.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Properties/AssemblyInfo.cs deleted file mode 100644 index f6f8b84..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Resources; -// -[assembly: AssemblyTitle("FreeImage.NET")] -[assembly: AssemblyDescription(".NET wrapper for the FreeImage 3.15.1 Library")] -[assembly: AssemblyConfiguration("All")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("FreeImage.NET Wrapper")] -[assembly: AssemblyCopyright("Copyright 2003-2011, FreeImage, DataGis")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("3.15.1.0")] -[assembly: AssemblyDelaySign(false)] -[assembly: AssemblyKeyFile("")] -[assembly: AssemblyFileVersionAttribute("3.15.1.0")] -[assembly: ComVisibleAttribute(false)] -[assembly: NeutralResourcesLanguageAttribute("")] -[assembly: GuidAttribute("64a4c935-b757-499c-ab8c-6110316a9e51")] -// \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/BITMAP.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/BITMAP.cs deleted file mode 100644 index a4347c0..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/BITMAP.cs +++ /dev/null @@ -1,104 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.2 $ -// $Date: 2008/06/16 15:15:36 $ -// $Id: BITMAP.cs,v 1.2 2008/06/16 15:15:36 cklein05 Exp $ -// ========================================================== - -using System; -using System.Runtime.InteropServices; - -namespace FreeImageAPI -{ - /// - /// The BITMAP structure defines the type, width, height, color format, and bit values of a bitmap. - /// - /// - /// The bitmap formats currently used are monochrome and color. The monochrome bitmap uses a one-bit, - /// one-plane format. Each scan is a multiple of 32 bits. - /// - /// Scans are organized as follows for a monochrome bitmap of height n: - /// - /// - /// Scan 0 - /// Scan 1 - /// . - /// . - /// . - /// Scan n-2 - /// Scan n-1 - /// - /// - /// The pixels on a monochrome device are either black or white. If the corresponding bit in the - /// bitmap is 1, the pixel is set to the foreground color; if the corresponding bit in the bitmap - /// is zero, the pixel is set to the background color. - /// - /// All devices that have the RC_BITBLT device capability support bitmaps. For more information, - /// see GetDeviceCaps. - /// - /// Each device has a unique color format. To transfer a bitmap from one device to another, - /// use the GetDIBits and SetDIBits functions. - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct BITMAP - { - /// - /// Specifies the bitmap type. This member must be zero. - /// - public int bmType; - /// - /// Specifies the width, in pixels, of the bitmap. The width must be greater than zero. - /// - public int bmWidth; - /// - /// Specifies the height, in pixels, of the bitmap. The height must be greater than zero. - /// - public int bmHeight; - /// - /// Specifies the number of bytes in each scan line. This value must be divisible by 2, - /// because the system assumes that the bit values of a bitmap form an array that is word aligned. - /// - public int bmWidthBytes; - /// - /// Specifies the count of color planes. - /// - public ushort bmPlanes; - /// - /// Specifies the number of bits required to indicate the color of a pixel. - /// - public ushort bmBitsPixel; - /// - /// Pointer to the location of the bit values for the bitmap. - /// The bmBits member must be a long pointer to an array of character (1-byte) values. - /// - public IntPtr bmBits; - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/BITMAPINFO.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/BITMAPINFO.cs deleted file mode 100644 index 5b0a9f0..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/BITMAPINFO.cs +++ /dev/null @@ -1,203 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.3 $ -// $Date: 2008/06/16 15:16:07 $ -// $Id: BITMAPINFO.cs,v 1.3 2008/06/16 15:16:07 cklein05 Exp $ -// ========================================================== - -using System; -using System.Runtime.InteropServices; - -namespace FreeImageAPI -{ - /// - /// The BITMAPINFO structure defines the dimensions and color information for a DIB. - /// - /// - /// A DIB consists of two distinct parts: a BITMAPINFO structure describing the dimensions - /// and colors of the bitmap, and an array of bytes defining the pixels of the bitmap. The bits in - /// the array are packed together, but each scan line must be padded with zeroes to end on a - /// LONG data-type boundary. If the height of the bitmap is positive, the bitmap is a - /// bottom-up DIB and its origin is the lower-left corner. If the height is negative, the bitmap is - /// a top-down DIB and its origin is the upper left corner. - /// - /// A bitmap is packed when the bitmap array immediately follows the BITMAPINFO header. - /// Packed bitmaps are referenced by a single pointer. For packed bitmaps, the biClrUsed - /// member must be set to an even number when using the DIB_PAL_COLORS mode so that the DIB bitmap - /// array starts on a DWORD boundary. - /// - /// Note The bmiColors member should not contain palette indexes if the bitmap is to - /// be stored in a file or transferred to another application. - /// - /// Unless the application has exclusive use and control of the bitmap, the bitmap color table - /// should contain explicit RGB values. - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct BITMAPINFO : IEquatable - { - /// - /// Specifies a structure that contains information - /// about the dimensions of color format. - /// - public BITMAPINFOHEADER bmiHeader; - /// - /// The bmiColors member contains one of the following: - /// - /// - /// - /// - /// An array of . The elements of the array that make up the - /// color table. - /// - /// - /// - /// - /// - /// An array of 16-bit unsigned integers that specifies indexes into the currently realized - /// logical palette. This use of bmiColors is allowed for functions that use DIBs. - /// When bmiColors elements contain indexes to a realized logical palette, they must - /// also call the following bitmap functions: - /// - /// - /// - /// - /// CreateDIBitmap - /// - /// CreateDIBPatternBrush - /// - /// CreateDIBSection - /// - /// The iUsage parameter of CreateDIBSection must be set to DIB_PAL_COLORS. - /// - /// The number of entries in the array depends on the values of the biBitCount and - /// biClrUsed members of the structure. - /// - /// The colors in the bmiColors table appear in order of importance. For more information, - /// see the Remarks section. - /// - public RGBQUAD[] bmiColors; - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(BITMAPINFO left, BITMAPINFO right) - { - if (left.bmiHeader != right.bmiHeader) - { - return false; - } - if ((left.bmiColors == null) && (right.bmiColors == null)) - { - return true; - } - if ((left.bmiColors == null) || (right.bmiColors == null)) - { - return false; - } - if (left.bmiColors.Length != right.bmiColors.Length) - { - return false; - } - for (int i = 0; i < left.bmiColors.Length; i++) - { - if (left.bmiColors[i] != right.bmiColors[i]) - { - return false; - } - } - return true; - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(BITMAPINFO left, BITMAPINFO right) - { - return !(left == right); - } - - /// - /// Tests whether the specified structure is equivalent to this structure. - /// - /// A structure to compare to this instance. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public bool Equals(BITMAPINFO other) - { - return (this == other); - } - - /// - /// Tests whether the specified object is a structure - /// and is equivalent to this structure. - /// - /// The object to test. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is BITMAPINFO) && (this == ((BITMAPINFO)obj))); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - int hash = bmiHeader.GetHashCode(); - if (bmiColors != null) - { - for (int c = 0; c < bmiColors.Length; c++) - { - hash ^= bmiColors[c].GetHashCode(); - hash <<= 1; - } - hash <<= 1; - } - else - { - hash >>= 1; - } - return hash; - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/BITMAPINFOHEADER.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/BITMAPINFOHEADER.cs deleted file mode 100644 index 007870b..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/BITMAPINFOHEADER.cs +++ /dev/null @@ -1,352 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.4 $ -// $Date: 2008/06/16 15:17:37 $ -// $Id: BITMAPINFOHEADER.cs,v 1.4 2008/06/16 15:17:37 cklein05 Exp $ -// ========================================================== - -using System; -using System.Runtime.InteropServices; - -namespace FreeImageAPI -{ - /// - /// This structure contains information about the dimensions and color format - /// of a device-independent bitmap (DIB). - /// - /// - /// The structure combines the - /// BITMAPINFOHEADER structure and a color table to provide a complete - /// definition of the dimensions and colors of a DIB. - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct BITMAPINFOHEADER : IEquatable - { - /// - /// Specifies the size of the structure, in bytes. - /// - public uint biSize; - /// - /// Specifies the width of the bitmap, in pixels. - /// - /// Windows 98/Me, Windows 2000/XP: If biCompression is BI_JPEG or BI_PNG, - /// the biWidth member specifies the width of the decompressed JPEG or PNG image file, - /// respectively. - /// - public int biWidth; - /// - /// Specifies the height of the bitmap, in pixels. If biHeight is positive, the bitmap - /// is a bottom-up DIB and its origin is the lower-left corner. If biHeight is negative, - /// the bitmap is a top-down DIB and its origin is the upper-left corner. - /// - /// If biHeight is negative, indicating a top-down DIB, biCompression must be - /// either BI_RGB or BI_BITFIELDS. Top-down DIBs cannot be compressed. - /// - /// Windows 98/Me, Windows 2000/XP: If biCompression is BI_JPEG or BI_PNG, - /// the biHeight member specifies the height of the decompressed JPEG or PNG image file, - /// respectively. - /// - public int biHeight; - /// - /// Specifies the number of planes for the target device. This value must be set to 1. - /// - public ushort biPlanes; - /// - /// Specifies the number of bits per pixel.The biBitCount member of the BITMAPINFOHEADER - /// structure determines the number of bits that define each pixel and the maximum number of - /// colors in the bitmap. This member must be one of the following values. - /// - /// - /// - /// - /// Value - /// Meaning - /// - /// - /// - /// 0 - /// - /// Windows 98/Me, Windows 2000/XP: The number of bits-per-pixel is specified - /// or is implied by the JPEG or PNG format. - /// - /// - /// - /// - /// 1 - /// - /// The bitmap is monochrome, and the bmiColors member of - /// contains two entries. Each bit in the bitmap array represents a pixel. If the bit is clear, - /// the pixel is displayed with the color of the first entry in the bmiColors table; if the bit - /// is set, the pixel has the color of the second entry in the table. - /// - /// - /// - /// - /// 4 - /// - /// The bitmap has a maximum of 16 colors, and the bmiColors member of BITMAPINFO - /// contains up to 16 entries. Each pixel in the bitmap is represented by a 4-bit index into the - /// color table. For example, if the first byte in the bitmap is 0x1F, the byte represents two - /// pixels. The first pixel contains the color in the second table entry, and the second pixel - /// contains the color in the sixteenth table entry. - /// - /// - /// - /// 8 - /// - /// The bitmap has a maximum of 256 colors, and the bmiColors member of BITMAPINFO - /// contains up to 256 entries. In this case, each byte in the array represents a single pixel. - /// - /// - /// - /// - /// 16 - /// - /// The bitmap has a maximum of 2^16 colors. If the biCompression member of the - /// BITMAPINFOHEADER is BI_RGB, the bmiColors member of BITMAPINFO is NULL. - /// Each WORD in the bitmap array represents a single pixel. The relative intensities - /// of red, green, and blue are represented with five bits for each color component. - /// The value for blue is in the least significant five bits, followed by five bits each for - /// green and red. The most significant bit is not used. The bmiColors color table is used - /// for optimizing colors used on palette-based devices, and must contain the number of entries - /// specified by the biClrUsed member of the BITMAPINFOHEADER. - /// - /// If the biCompression member of the BITMAPINFOHEADER is BI_BITFIELDS, the - /// bmiColors member contains three DWORD color masks that specify the red, green, - /// and blue components, respectively, of each pixel. Each WORD in the bitmap array represents - /// a single pixel. - /// - /// Windows NT/Windows 2000/XP: When the biCompression member is BI_BITFIELDS, - /// bits set in each DWORD mask must be contiguous and should not overlap the bits - /// of another mask. All the bits in the pixel do not have to be used. - /// - /// Windows 95/98/Me: When the biCompression member is BI_BITFIELDS, the system - /// supports only the following 16bpp color masks: A 5-5-5 16-bit image, where the blue mask is - /// 0x001F, the green mask is 0x03E0, and the red mask is 0x7C00; and a 5-6-5 16-bit image, - /// where the blue mask is 0x001F, the green mask is 0x07E0, and the red mask is 0xF800. - /// - /// - /// - /// - /// 24 - /// - /// The bitmap has a maximum of 2^24 colors, and the bmiColors member of BITMAPINFO - /// is NULL. Each 3-byte triplet in the bitmap array represents the relative intensities of blue, - /// green, and red, respectively, for a pixel. The bmiColors color table is used for - /// optimizing colors used on palette-based devices, and must contain the number of entries - /// specified by the biClrUsed member of the BITMAPINFOHEADER. - /// - /// - /// - /// - /// 32 - /// - /// The bitmap has a maximum of 2^32 colors. If the biCompression member of the - /// BITMAPINFOHEADER is BI_RGB, the bmiColors member of BITMAPINFO is NULL. - /// Each DWORD in the bitmap array represents the relative intensities of blue, green, and red, - /// respectively, for a pixel. The high byte in each DWORD is not used. The bmiColors - /// color table is used for optimizing colors used on palette-based devices, and must contain the - /// number of entries specified by the biClrUsed member of the BITMAPINFOHEADER. - /// - /// If the biCompression member of the BITMAPINFOHEADER is BI_BITFIELDS, - /// the bmiColors member contains three DWORD color masks that specify the red, green, - /// and blue components, respectively, of each pixel. Each DWORD in the bitmap array represents - /// a single pixel. - /// - /// Windows NT/ 2000: When the biCompression member is BI_BITFIELDS, bits set in each - /// DWORD mask must be contiguous and should not overlap the bits of another mask. All the - /// bits in the pixel do not need to be used. - /// - /// Windows 95/98/Me: When the biCompression member is BI_BITFIELDS, the system - /// supports only the following 32-bpp color mask: The blue mask is 0x000000FF, the green mask is - /// 0x0000FF00, and the red mask is 0x00FF0000. - /// - /// - /// - /// - public ushort biBitCount; - /// - /// Specifies the type of compression for a compressed bottom-up bitmap (top-down DIBs cannot be - /// compressed). - /// - /// - /// Value - /// Meaning - /// - /// - /// - /// BI_RGB - /// An uncompressed format. - /// - /// - /// - /// BI_RLE8 - /// A run-length encoded (RLE) format for bitmaps with 8 bpp. The compression format - /// is a 2-byte format consisting of a count byte followed by a byte containing a color index. - /// - /// - /// - /// - /// BI_RLE4 - /// An RLE format for bitmaps with 4 bpp. The compression format is a 2-byte format - /// consisting of a count byte followed by two word-length color indexes. - /// - /// - /// - /// BI_BITFIELDS - /// Specifies that the bitmap is not compressed and that the color table consists - /// of three DWORD color masks that specify the red, green, and blue components, respectively, - /// of each pixel. This is valid when used with 16- and 32-bpp bitmaps. - /// - /// - /// - /// BI_JPEG - /// Windows 98/Me, Windows 2000/XP: Indicates that the image is a JPEG image. - /// - /// - /// - /// - /// BI_PNG - /// Windows 98/Me, Windows 2000/XP: Indicates that the image is a PNG image. - /// - /// - /// - /// - /// - public uint biCompression; - /// - /// Specifies the size, in bytes, of the image. This may be set to zero for BI_RGB bitmaps. - /// - /// Windows 98/Me, Windows 2000/XP: If biCompression is BI_JPEG or BI_PNG, - /// biSizeImage indicates the size of the JPEG or PNG image buffer, respectively. - /// - public uint biSizeImage; - /// - /// Specifies the horizontal resolution, in pixels-per-meter, of the target device for the bitmap. - /// An application can use this value to select a bitmap from a resource group that best matches - /// the characteristics of the current device. - /// - public int biXPelsPerMeter; - /// - /// Specifies the vertical resolution, in pixels-per-meter, of the target device for the bitmap. - /// - public int biYPelsPerMeter; - /// - /// Specifies the number of color indexes in the color table that are actually used by the bitmap. - /// If this value is zero, the bitmap uses the maximum number of colors corresponding to the value - /// of the biBitCount member for the compression mode specified by biCompression. - /// - /// If iClrUsed is nonzero and the biBitCount member is less than 16, the biClrUsed - /// member specifies the actual number of colors the graphics engine or device driver accesses. - /// If biBitCount is 16 or greater, the biClrUsed member specifies the size of the color - /// table used to optimize performance of the system color palettes. If biBitCount equals 16 or 32, - /// the optimal color palette starts immediately following the three DWORD masks. - /// - /// When the bitmap array immediately follows the structure, it is a packed bitmap. - /// Packed bitmaps are referenced by a single pointer. Packed bitmaps require that the - /// biClrUsed member must be either zero or the actual size of the color table. - /// - public uint biClrUsed; - /// - /// Specifies the number of color indexes that are required for displaying the bitmap. If this value - /// is zero, all colors are required. - /// - public uint biClrImportant; - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(BITMAPINFOHEADER left, BITMAPINFOHEADER right) - { - return ((left.biSize == right.biSize) && - (left.biWidth == right.biWidth) && - (left.biHeight == right.biHeight) && - (left.biPlanes == right.biPlanes) && - (left.biBitCount == right.biBitCount) && - (left.biCompression == right.biCompression) && - (left.biSizeImage == right.biSizeImage) && - (left.biXPelsPerMeter == right.biXPelsPerMeter) && - (left.biYPelsPerMeter == right.biYPelsPerMeter) && - (left.biClrUsed == right.biClrUsed) && - (left.biClrImportant == right.biClrImportant)); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(BITMAPINFOHEADER left, BITMAPINFOHEADER right) - { - return !(left == right); - } - - /// - /// Tests whether the specified structure is equivalent to this structure. - /// - /// A structure to compare to this instance. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public bool Equals(BITMAPINFOHEADER other) - { - return (this == other); - } - - /// - /// Tests whether the specified object is a structure - /// and is equivalent to this structure. - /// - /// The object to test. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is BITMAPINFOHEADER) && (this == (BITMAPINFOHEADER)obj)); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return base.GetHashCode(); - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FI16RGB555.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FI16RGB555.cs deleted file mode 100644 index 83adb5a..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FI16RGB555.cs +++ /dev/null @@ -1,277 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.3 $ -// $Date: 2009/02/20 07:41:08 $ -// $Id: FI16RGB555.cs,v 1.3 2009/02/20 07:41:08 cklein05 Exp $ -// ========================================================== - -using System; -using System.Drawing; -using System.Runtime.InteropServices; - -namespace FreeImageAPI -{ - /// - /// The FI16RGB555 structure describes a color consisting of relative - /// intensities of red, green, blue and alpha value. Each single color - /// component consumes 5 bits and so, takes values in the range from 0 to 31. - /// - /// - /// For easy integration of the underlying structure into the .NET framework, - /// the FI16RGB555 structure implements implicit conversion operators to - /// convert the represented color to and from the - /// type. This makes the type a real replacement - /// for the FI16RGB555 structure and my be used in all situations which require - /// an FI16RGB555 type. - /// - /// - /// - /// The following code example demonstrates the various conversions between the - /// FI16RGB555 structure and the structure. - /// - /// FI16RGB555 fi16rgb; - /// // Initialize the structure using a native .NET Color structure. - /// fi16rgb = new FI16RGB555(Color.Indigo); - /// // Initialize the structure using the implicit operator. - /// fi16rgb = Color.DarkSeaGreen; - /// // Convert the FI16RGB555 instance into a native .NET Color - /// // using its implicit operator. - /// Color color = fi16rgb; - /// // Using the structure's Color property for converting it - /// // into a native .NET Color. - /// Color another = fi16rgb.Color; - /// - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct FI16RGB555 : IComparable, IComparable, IEquatable - { - /// - /// The value of the color. - /// - private ushort value; - - /// - /// Initializes a new instance based on the specified . - /// - /// to initialize with. - public FI16RGB555(Color color) - { - value = (ushort)( - (((color.R * 31) / 255) << FreeImage.FI16_555_RED_SHIFT) + - (((color.G * 31) / 255) << FreeImage.FI16_555_GREEN_SHIFT) + - (((color.B * 31) / 255) << FreeImage.FI16_555_BLUE_SHIFT)); - } - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(FI16RGB555 left, FI16RGB555 right) - { - return (left.value == right.value); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(FI16RGB555 left, FI16RGB555 right) - { - return (!(left == right)); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator FI16RGB555(Color value) - { - return new FI16RGB555(value); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator Color(FI16RGB555 value) - { - return value.Color; - } - - /// - /// Gets or sets the of the structure. - /// - public Color Color - { - get - { - return Color.FromArgb( - ((value & FreeImage.FI16_555_RED_MASK) >> FreeImage.FI16_555_RED_SHIFT) * 255 / 31, - ((value & FreeImage.FI16_555_GREEN_MASK) >> FreeImage.FI16_555_GREEN_SHIFT) * 255 / 31, - ((value & FreeImage.FI16_555_BLUE_MASK) >> FreeImage.FI16_555_BLUE_SHIFT) * 255 / 31); - } - set - { - this.value = (ushort)( - (((value.R * 31) / 255) << FreeImage.FI16_555_RED_SHIFT) + - (((value.G * 31) / 255) << FreeImage.FI16_555_GREEN_SHIFT) + - (((value.B * 31) / 255) << FreeImage.FI16_555_BLUE_SHIFT)); - } - } - - /// - /// Gets or sets the red color component. - /// - public byte Red - { - get - { - return (byte)(((value & FreeImage.FI16_555_RED_MASK) >> FreeImage.FI16_555_RED_SHIFT) * 255 / 31); - } - set - { - this.value = (ushort)((this.value & (~FreeImage.FI16_555_RED_MASK)) | (((value * 31) / 255) << FreeImage.FI16_555_RED_SHIFT)); - } - } - - /// - /// Gets or sets the green color component. - /// - public byte Green - { - get - { - return (byte)(((value & FreeImage.FI16_555_GREEN_MASK) >> FreeImage.FI16_555_GREEN_SHIFT) * 255 / 31); - } - set - { - this.value = (ushort)((this.value & (~FreeImage.FI16_555_GREEN_MASK)) | (((value * 31) / 255) << FreeImage.FI16_555_GREEN_SHIFT)); - } - } - - /// - /// Gets or sets the blue color component. - /// - public byte Blue - { - get - { - return (byte)(((value & FreeImage.FI16_555_BLUE_MASK) >> FreeImage.FI16_555_BLUE_SHIFT) * 255 / 31); - } - set - { - this.value = (ushort)((this.value & (~FreeImage.FI16_555_BLUE_MASK)) | (((value * 31) / 255) << FreeImage.FI16_555_BLUE_SHIFT)); - } - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is FI16RGB555)) - { - throw new ArgumentException("obj"); - } - return CompareTo((FI16RGB555)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(FI16RGB555 other) - { - return this.Color.ToArgb().CompareTo(other.Color.ToArgb()); - } - - /// - /// Tests whether the specified object is a structure - /// and is equivalent to this structure. - /// - /// The object to test. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public override bool Equals(object obj) - { - return base.Equals(obj); - } - - /// - /// Tests whether the specified structure is equivalent to this structure. - /// - /// A structure to compare to this instance. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public bool Equals(FI16RGB555 other) - { - return (this == other); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return base.GetHashCode(); - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return FreeImage.ColorToString(Color); - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FI16RGB565.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FI16RGB565.cs deleted file mode 100644 index 26e59c3..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FI16RGB565.cs +++ /dev/null @@ -1,277 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.3 $ -// $Date: 2009/02/20 07:41:08 $ -// $Id: FI16RGB565.cs,v 1.3 2009/02/20 07:41:08 cklein05 Exp $ -// ========================================================== - -using System; -using System.Drawing; -using System.Runtime.InteropServices; - -namespace FreeImageAPI -{ - /// - /// The FI16RGB565 structure describes a color consisting of relative - /// intensities of red, green, blue and alpha value. Each single color - /// component consumes 5 bits and so, takes values in the range from 0 to 31. - /// - /// - /// For easy integration of the underlying structure into the .NET framework, - /// the FI16RGB565 structure implements implicit conversion operators to - /// convert the represented color to and from the - /// type. This makes the type a real replacement - /// for the FI16RGB565 structure and my be used in all situations which require - /// an FI16RGB565 type. - /// - /// - /// - /// The following code example demonstrates the various conversions between the - /// FI16RGB565 structure and the structure. - /// - /// FI16RGB565 fi16rgb; - /// // Initialize the structure using a native .NET Color structure. - /// fi16rgb = new FI16RGB565(Color.Indigo); - /// // Initialize the structure using the implicit operator. - /// fi16rgb = Color.DarkSeaGreen; - /// // Convert the FI16RGB565 instance into a native .NET Color - /// // using its implicit operator. - /// Color color = fi16rgb; - /// // Using the structure's Color property for converting it - /// // into a native .NET Color. - /// Color another = fi16rgb.Color; - /// - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct FI16RGB565 : IComparable, IComparable, IEquatable - { - /// - /// The value of the color. - /// - private ushort value; - - /// - /// Initializes a new instance based on the specified . - /// - /// to initialize with. - public FI16RGB565(Color color) - { - value = (ushort)( - (((color.R * 31) / 255) << FreeImage.FI16_565_RED_SHIFT) + - (((color.G * 63) / 255) << FreeImage.FI16_565_GREEN_SHIFT) + - (((color.B * 31) / 255) << FreeImage.FI16_565_BLUE_SHIFT)); - } - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(FI16RGB565 left, FI16RGB565 right) - { - return (left.value == right.value); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(FI16RGB565 left, FI16RGB565 right) - { - return (!(left == right)); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator FI16RGB565(Color value) - { - return new FI16RGB565(value); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator Color(FI16RGB565 value) - { - return value.Color; - } - - /// - /// Gets or sets the of the structure. - /// - public Color Color - { - get - { - return Color.FromArgb( - ((value & FreeImage.FI16_565_RED_MASK) >> FreeImage.FI16_565_RED_SHIFT) * 255 / 31, - ((value & FreeImage.FI16_565_GREEN_MASK) >> FreeImage.FI16_565_GREEN_SHIFT) * 255 / 63, - ((value & FreeImage.FI16_565_BLUE_MASK) >> FreeImage.FI16_565_BLUE_SHIFT) * 255 / 31); - } - set - { - this.value = (ushort)( - (((value.R * 31) / 255) << FreeImage.FI16_565_RED_SHIFT) + - (((value.G * 63) / 255) << FreeImage.FI16_565_GREEN_SHIFT) + - (((value.B * 31) / 255) << FreeImage.FI16_565_BLUE_SHIFT)); - } - } - - /// - /// Gets or sets the red color component. - /// - public byte Red - { - get - { - return (byte)(((value & FreeImage.FI16_565_RED_MASK) >> FreeImage.FI16_565_RED_SHIFT) * 255 / 31); - } - set - { - this.value = (ushort)((this.value & (~FreeImage.FI16_565_RED_MASK)) | (((value * 31) / 255) << FreeImage.FI16_565_RED_SHIFT)); - } - } - - /// - /// Gets or sets the green color component. - /// - public byte Green - { - get - { - return (byte)(((value & FreeImage.FI16_565_GREEN_MASK) >> FreeImage.FI16_565_GREEN_SHIFT) * 255 / 63); - } - set - { - this.value = (ushort)((this.value & (~FreeImage.FI16_565_GREEN_MASK)) | (((value * 63) / 255) << FreeImage.FI16_565_GREEN_SHIFT)); - } - } - - /// - /// Gets or sets the blue color component. - /// - public byte Blue - { - get - { - return (byte)(((value & FreeImage.FI16_565_BLUE_MASK) >> FreeImage.FI16_565_BLUE_SHIFT) * 255 / 31); - } - set - { - this.value = (ushort)((this.value & (~FreeImage.FI16_565_BLUE_MASK)) | (((value * 31) / 255) << FreeImage.FI16_565_BLUE_SHIFT)); - } - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is FI16RGB565)) - { - throw new ArgumentException("obj"); - } - return CompareTo((FI16RGB565)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(FI16RGB565 other) - { - return this.Color.ToArgb().CompareTo(other.Color.ToArgb()); - } - - /// - /// Tests whether the specified object is a structure - /// and is equivalent to this structure. - /// - /// The object to test. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public override bool Equals(object obj) - { - return base.Equals(obj); - } - - /// - /// Tests whether the specified structure is equivalent to this structure. - /// - /// A structure to compare to this instance. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public bool Equals(FI16RGB565 other) - { - return (this == other); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return base.GetHashCode(); - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return FreeImage.ColorToString(Color); - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FI1BIT.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FI1BIT.cs deleted file mode 100644 index 5712466..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FI1BIT.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; - -namespace FreeImageAPI -{ - /// - /// The FI1BIT structure represents a single bit. - /// It's value can be 0 or 1. - /// - [DebuggerDisplay("{value}"), - Serializable] - public struct FI1BIT - { - /// - /// Represents the largest possible value of . This field is constant. - /// - public const byte MaxValue = 0x01; - - /// - /// Represents the smallest possible value of . This field is constant. - /// - public const byte MinValue = 0x00; - - /// - /// The value of the structure. - /// - private byte value; - - /// - /// Initializes a new instance based on the specified value. - /// - /// The value to initialize with. - private FI1BIT(byte value) - { - this.value = (byte)(value & MaxValue); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator byte(FI1BIT value) - { - return value.value; - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator FI1BIT(byte value) - { - return new FI1BIT(value); - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return value.ToString(); - } - } -} diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FI4BIT.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FI4BIT.cs deleted file mode 100644 index a047a80..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FI4BIT.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; - -namespace FreeImageAPI -{ - /// - /// The FI4BIT structure represents the half of a . - /// It's valuerange is between 0 and 15. - /// - [DebuggerDisplay("{value}"), - Serializable] - public struct FI4BIT - { - /// - /// Represents the largest possible value of . This field is constant. - /// - public const byte MaxValue = 0x0F; - - /// - /// Represents the smallest possible value of . This field is constant. - /// - public const byte MinValue = 0x00; - - /// - /// The value of the structure. - /// - private byte value; - - /// - /// Initializes a new instance based on the specified value. - /// - /// The value to initialize with. - private FI4BIT(byte value) - { - this.value = (byte)(value & MaxValue); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator byte(FI4BIT value) - { - return value.value; - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator FI4BIT(byte value) - { - return new FI4BIT(value); - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return value.ToString(); - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIBITMAP.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIBITMAP.cs deleted file mode 100644 index 4403817..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIBITMAP.cs +++ /dev/null @@ -1,175 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.5 $ -// $Date: 2009/02/20 07:41:08 $ -// $Id: FIBITMAP.cs,v 1.5 2009/02/20 07:41:08 cklein05 Exp $ -// ========================================================== - -using System; -using System.Runtime.InteropServices; - -namespace FreeImageAPI -{ - /// - /// The FIBITMAP structure is a handle to a FreeImage bimtap. - /// - /// - /// The handle represented by a FIBITBAP structure provides - /// access to either a singlepage bitmap or exactly one page of - /// a multipage bitmap. - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct FIBITMAP : IComparable, IComparable, IEquatable - { - private IntPtr data; - - /// - /// A read-only field that represents a handle that has been initialized to zero. - /// - public static readonly FIBITMAP Zero; - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(FIBITMAP left, FIBITMAP right) - { - return (left.data == right.data); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(FIBITMAP left, FIBITMAP right) - { - return (left.data != right.data); - } - - /// - /// Gets whether the handle is a null or not. - /// - /// true if this handle is a null; - /// otherwise, false. - public bool IsNull - { - get - { - return (data == IntPtr.Zero); - } - } - - /// - /// Sets the handle to null. - /// - public void SetNull() - { - data = IntPtr.Zero; - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return data.ToString(); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return data.GetHashCode(); - } - - /// - /// Determines whether the specified is equal to the current . - /// - /// The to compare with the current . - /// true if the specified is equal to the current ; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is FIBITMAP) && (this == ((FIBITMAP)obj))); - } - - /// - /// Indicates whether the current object is equal to another object of the same type. - /// - /// An object to compare with this object. - /// true if the current object is equal to the other parameter; otherwise, false. - public bool Equals(FIBITMAP other) - { - return (this == other); - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is FIBITMAP)) - { - throw new ArgumentException("obj"); - } - return CompareTo((FIBITMAP)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(FIBITMAP other) - { - return this.data.ToInt64().CompareTo(other.data.ToInt64()); - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FICOMPLEX.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FICOMPLEX.cs deleted file mode 100644 index c3ea716..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FICOMPLEX.cs +++ /dev/null @@ -1,146 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.4 $ -// $Date: 2009/02/20 07:41:08 $ -// $Id: FICOMPLEX.cs,v 1.4 2009/02/20 07:41:08 cklein05 Exp $ -// ========================================================== - -using System; -using System.Runtime.InteropServices; - -namespace FreeImageAPI -{ - /// - /// The FICOMPLEX structure describes a color consisting of a real and an imaginary part. - /// Each part is using 4 bytes of data. - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct FICOMPLEX : IComparable, IComparable, IEquatable - { - /// - /// Real part of the color. - /// - public double real; - - /// - /// Imaginary part of the color. - /// - public double imag; - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(FICOMPLEX left, FICOMPLEX right) - { - return ((left.real == right.real) && (left.imag == right.imag)); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(FICOMPLEX left, FICOMPLEX right) - { - return ((left.real != right.real) || (left.imag == right.imag)); - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is FICOMPLEX)) - { - throw new ArgumentException("obj"); - } - return CompareTo((FICOMPLEX)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(FICOMPLEX other) - { - return base.GetHashCode(); - } - - /// - /// Tests whether the specified object is a structure - /// and is equivalent to this structure. - /// - /// The object to test. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is FICOMPLEX) && (this == ((FICOMPLEX)obj))); - } - - /// - /// Tests whether the specified structure is equivalent to this structure. - /// - /// A structure to compare to this instance. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public bool Equals(FICOMPLEX other) - { - return (this == other); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return base.GetHashCode(); - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIICCPROFILE.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIICCPROFILE.cs deleted file mode 100644 index 04f6b64..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIICCPROFILE.cs +++ /dev/null @@ -1,133 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.5 $ -// $Date: 2008/11/05 13:19:06 $ -// $Id: FIICCPROFILE.cs,v 1.5 2008/11/05 13:19:06 cklein05 Exp $ -// ========================================================== - -using System; -using System.Runtime.InteropServices; - -namespace FreeImageAPI -{ - /// - /// This Structure contains ICC-Profile data. - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct FIICCPROFILE - { - private ICC_FLAGS flags; - private uint size; - private IntPtr data; - - /// - /// Creates a new ICC-Profile for . - /// - /// Handle to a FreeImage bitmap. - /// The ICC-Profile data. - /// - /// is null. - public FIICCPROFILE(FIBITMAP dib, byte[] data) - : this(dib, data, (int)data.Length) - { - } - - /// - /// Creates a new ICC-Profile for . - /// - /// Handle to a FreeImage bitmap. - /// The ICC-Profile data. - /// Number of bytes to use from data. - /// - /// is null. - public unsafe FIICCPROFILE(FIBITMAP dib, byte[] data, int size) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - FIICCPROFILE prof; - size = Math.Min(size, (int)data.Length); - prof = *(FIICCPROFILE*)FreeImage.CreateICCProfile(dib, data, size); - this.flags = prof.flags; - this.size = prof.size; - this.data = prof.data; - } - - /// - /// Info flag of the profile. - /// - public ICC_FLAGS Flags - { - get { return flags; } - } - - /// - /// Profile's size measured in bytes. - /// - public uint Size - { - get { return size; } - } - - /// - /// Points to a block of contiguous memory containing the profile. - /// - public IntPtr DataPointer - { - get { return data; } - } - - /// - /// Copy of the ICC-Profiles data. - /// - public unsafe byte[] Data - { - get - { - byte[] result; - FreeImage.CopyMemory(result = new byte[size], data.ToPointer(), size); - return result; - } - } - - /// - /// Indicates whether the profile is CMYK. - /// - public bool IsCMYK - { - get - { - return ((flags & ICC_FLAGS.FIICC_COLOR_IS_CMYK) != 0); - } - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIMEMORY.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIMEMORY.cs deleted file mode 100644 index e190975..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIMEMORY.cs +++ /dev/null @@ -1,170 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.5 $ -// $Date: 2009/02/20 07:41:08 $ -// $Id: FIMEMORY.cs,v 1.5 2009/02/20 07:41:08 cklein05 Exp $ -// ========================================================== - -using System; -using System.Runtime.InteropServices; - -namespace FreeImageAPI -{ - /// - /// The FIMEMORY structure is a handle to an opened memory stream. - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct FIMEMORY : IComparable, IComparable, IEquatable - { - private IntPtr data; - - /// - /// A read-only field that represents a handle that has been initialized to zero. - /// - public static readonly FIMEMORY Zero; - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(FIMEMORY left, FIMEMORY right) - { - return (left.data == right.data); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(FIMEMORY left, FIMEMORY right) - { - return (left.data != right.data); - } - - /// - /// Gets whether the pointer is a null pointer or not. - /// - /// true if this is a null pointer; - /// otherwise, false. - public bool IsNull - { - get - { - return (data == IntPtr.Zero); - } - } - - /// - /// Sets the handle to null. - /// - public void SetNull() - { - data = IntPtr.Zero; - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return data.ToString(); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return data.GetHashCode(); - } - - /// - /// Determines whether the specified is equal to the current . - /// - /// The to compare with the current . - /// true if the specified is equal to the current ; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is FIMEMORY) && (this == ((FIMEMORY)obj))); - } - - /// - /// Indicates whether the current object is equal to another object of the same type. - /// - /// An object to compare with this object. - /// true if the current object is equal to the other parameter; otherwise, false. - public bool Equals(FIMEMORY other) - { - return (this == other); - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is FIMEMORY)) - { - throw new ArgumentException("obj"); - } - return CompareTo((FIMEMORY)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(FIMEMORY other) - { - return this.data.ToInt64().CompareTo(other.data.ToInt64()); - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIMETADATA.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIMETADATA.cs deleted file mode 100644 index 0fee77e..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIMETADATA.cs +++ /dev/null @@ -1,178 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.5 $ -// $Date: 2009/02/20 07:41:08 $ -// $Id: FIMETADATA.cs,v 1.5 2009/02/20 07:41:08 cklein05 Exp $ -// ========================================================== - -using System; -using System.Runtime.InteropServices; - -namespace FreeImageAPI -{ - /// - /// The FIMETADATA structure is an unique search handle for metadata search operations. - /// - /// - /// The FIMETADATA structure is usually returned by the - /// - /// function and then used on subsequent calls to - /// . - /// When the FIMETADATA handle is no longer used, it needs to be freed by the - /// function. - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct FIMETADATA : IComparable, IComparable, IEquatable - { - private IntPtr data; - - /// - /// A read-only field that represents a handle that has been initialized to zero. - /// - public static readonly FIMETADATA Zero; - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(FIMETADATA left, FIMETADATA right) - { - return (left.data == right.data); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(FIMETADATA left, FIMETADATA right) - { - return (left.data != right.data); - } - - /// - /// Gets whether the pointer is a null pointer or not. - /// - /// true if this is a null pointer; - /// otherwise, false. - public bool IsNull - { - get - { - return (data == IntPtr.Zero); - } - } - - /// - /// Sets the handle to null. - /// - public void SetNull() - { - data = IntPtr.Zero; - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return data.ToString(); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return data.GetHashCode(); - } - - /// - /// Determines whether the specified is equal to the current . - /// - /// The to compare with the current . - /// true if the specified is equal to the current ; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is FIMETADATA) && (this == ((FIMETADATA)obj))); - } - - /// - /// Indicates whether the current object is equal to another object of the same type. - /// - /// An object to compare with this object. - /// true if the current object is equal to the other parameter; otherwise, false. - public bool Equals(FIMETADATA other) - { - return (this == other); - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is FIMETADATA)) - { - throw new ArgumentException("obj"); - } - return CompareTo((FIMETADATA)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(FIMETADATA other) - { - return this.data.ToInt64().CompareTo(other.data.ToInt64()); - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIMULTIBITMAP.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIMULTIBITMAP.cs deleted file mode 100644 index 931b911..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIMULTIBITMAP.cs +++ /dev/null @@ -1,170 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.5 $ -// $Date: 2009/02/20 07:41:08 $ -// $Id: FIMULTIBITMAP.cs,v 1.5 2009/02/20 07:41:08 cklein05 Exp $ -// ========================================================== - -using System; -using System.Runtime.InteropServices; - -namespace FreeImageAPI -{ - /// - /// The FIMULTIBITMAP structure is a handle to a FreeImage multipaged bimtap. - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct FIMULTIBITMAP : IComparable, IComparable, IEquatable - { - private IntPtr data; - - /// - /// A read-only field that represents a handle that has been initialized to zero. - /// - public static readonly FIMULTIBITMAP Zero; - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(FIMULTIBITMAP left, FIMULTIBITMAP right) - { - return (left.data == right.data); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(FIMULTIBITMAP left, FIMULTIBITMAP right) - { - return (left.data != right.data); - } - - /// - /// Gets whether the handle is a null or not. - /// - /// true if this handle is a null; - /// otherwise, false. - public bool IsNull - { - get - { - return (data == IntPtr.Zero); - } - } - - /// - /// Sets the handle to null. - /// - public void SetNull() - { - data = IntPtr.Zero; - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return data.ToString(); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return data.GetHashCode(); - } - - /// - /// Determines whether the specified is equal to the current . - /// - /// The to compare with the current . - /// true if the specified is equal to the current ; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is FIMULTIBITMAP) && (this == ((FIMULTIBITMAP)obj))); - } - - /// - /// Indicates whether the current object is equal to another object of the same type. - /// - /// An object to compare with this object. - /// true if the current object is equal to the other parameter; otherwise, false. - public bool Equals(FIMULTIBITMAP other) - { - return (this == other); - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is FIMULTIBITMAP)) - { - throw new ArgumentException("obj"); - } - return CompareTo((FIMULTIBITMAP)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(FIMULTIBITMAP other) - { - return this.data.ToInt64().CompareTo(other.data.ToInt64()); - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIRGB16.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIRGB16.cs deleted file mode 100644 index fbdf816..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIRGB16.cs +++ /dev/null @@ -1,267 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.3 $ -// $Date: 2009/02/20 07:41:08 $ -// $Id: FIRGB16.cs,v 1.3 2009/02/20 07:41:08 cklein05 Exp $ -// ========================================================== - -using System; -using System.Drawing; -using System.Runtime.InteropServices; - -namespace FreeImageAPI -{ - /// - /// The FIRGB16 structure describes a color consisting of relative - /// intensities of red, green, blue and alpha value. Each single color - /// component consumes 16 bits and so, takes values in the range from 0 to 65535. - /// - /// - /// - /// The FIRGB16 structure provides access to an underlying FreeImage FIRGB16 - /// structure. To determine the red, green or blue component of a color, - /// use the red, green or blue fields, respectively. - /// - /// For easy integration of the underlying structure into the .NET framework, - /// the FIRGB16 structure implements implicit conversion operators to - /// convert the represented color to and from the - /// type. This makes the type a real replacement - /// for the FIRGB16 structure and my be used in all situations which require - /// an FIRGB16 type. - /// - /// - /// Each color component red, green or blue of FIRGB16 is translated into - /// it's corresponding color component R, G or B of - /// by right shifting 8 bits and shifting left 8 bits for the reverse conversion. - /// When converting from into FIRGB16, the - /// color's alpha value is ignored and assumed to be 255 when converting from - /// FIRGB16 into , creating a fully - /// opaque color. - /// - /// - /// Conversion from System.Drawing.Color to FIRGB16 - /// - /// FIRGB16.component = Color.component << 8 - /// - /// Conversion from FIRGB16 to System.Drawing.Color - /// - /// Color.component = FIRGB16.component >> 8 - /// - /// The same conversion is also applied when the - /// property or the constructor - /// is invoked. - /// - /// - /// - /// The following code example demonstrates the various conversions between the - /// FIRGB16 structure and the structure. - /// - /// FIRGB16 firgb16; - /// // Initialize the structure using a native .NET Color structure. - /// firgb16 = new FIRGBA16(Color.Indigo); - /// // Initialize the structure using the implicit operator. - /// firgb16 = Color.DarkSeaGreen; - /// // Convert the FIRGB16 instance into a native .NET Color - /// // using its implicit operator. - /// Color color = firgb16; - /// // Using the structure's Color property for converting it - /// // into a native .NET Color. - /// Color another = firgb16.Color; - /// - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct FIRGB16 : IComparable, IComparable, IEquatable - { - /// - /// The red color component. - /// - public ushort red; - - /// - /// The green color component. - /// - public ushort green; - - /// - /// The blue color component. - /// - public ushort blue; - - /// - /// Initializes a new instance based on the specified . - /// - /// to initialize with. - public FIRGB16(Color color) - { - red = (ushort)(color.R << 8); - green = (ushort)(color.G << 8); - blue = (ushort)(color.B << 8); - } - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(FIRGB16 left, FIRGB16 right) - { - return - ((left.blue == right.blue) && - (left.green == right.green) && - (left.red == right.red)); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(FIRGB16 left, FIRGB16 right) - { - return !(left == right); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator FIRGB16(Color value) - { - return new FIRGB16(value); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator Color(FIRGB16 value) - { - return value.Color; - } - - /// - /// Gets or sets the of the structure. - /// - public Color Color - { - get - { - return Color.FromArgb((red >> 8), (green >> 8), (blue >> 8)); - } - set - { - red = (ushort)(value.R << 8); - green = (ushort)(value.G << 8); - blue = (ushort)(value.B << 8); - } - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is FIRGB16)) - { - throw new ArgumentException("obj"); - } - return CompareTo((FIRGB16)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(FIRGB16 other) - { - return this.Color.ToArgb().CompareTo(other.Color.ToArgb()); - } - - /// - /// Tests whether the specified object is a structure - /// and is equivalent to this structure. - /// - /// The object to test. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is FIRGB16) && (this == ((FIRGB16)obj))); - } - - /// - /// Tests whether the specified structure is equivalent to this structure. - /// - /// A structure to compare to this instance. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public bool Equals(FIRGB16 other) - { - return (this == other); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return base.GetHashCode(); - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return FreeImage.ColorToString(Color); - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIRGBA16.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIRGBA16.cs deleted file mode 100644 index d63698d..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIRGBA16.cs +++ /dev/null @@ -1,271 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.3 $ -// $Date: 2009/02/20 07:41:08 $ -// $Id: FIRGBA16.cs,v 1.3 2009/02/20 07:41:08 cklein05 Exp $ -// ========================================================== - -using System; -using System.Drawing; -using System.Runtime.InteropServices; - -namespace FreeImageAPI -{ - /// - /// The FIRGBA16 structure describes a color consisting of relative - /// intensities of red, green, blue and alpha value. Each single color - /// component consumes 16 bits and so, takes values in the range from 0 to 65535. - /// - /// - /// - /// The FIRGBA16 structure provides access to an underlying FreeImage FIRGBA16 - /// structure. To determine the alpha, red, green or blue component of a color, - /// use the alpha, red, green or blue fields, respectively. - /// - /// For easy integration of the underlying structure into the .NET framework, - /// the FIRGBA16 structure implements implicit conversion operators to - /// convert the represented color to and from the - /// type. This makes the type a real replacement - /// for the FIRGBA16 structure and my be used in all situations which require - /// an FIRGBA16 type. - /// - /// - /// Each color component alpha, red, green or blue of FIRGBA16 - /// is translated into it's corresponding color component A, R, G or B of - /// by an 8 bit right shift and vice versa. - /// - /// - /// Conversion from System.Drawing.Color to FIRGBA16 - /// - /// FIRGBA16.component = Color.component << 8 - /// - /// Conversion from FIRGBA16 to System.Drawing.Color - /// - /// Color.component = FIRGBA16.component >> 8 - /// - /// The same conversion is also applied when the - /// property or the constructor - /// is invoked. - /// - /// - /// - /// The following code example demonstrates the various conversions between the - /// FIRGBA16 structure and the structure. - /// - /// FIRGBA16 firgba16; - /// // Initialize the structure using a native .NET Color structure. - /// firgba16 = new FIRGBA16(Color.Indigo); - /// // Initialize the structure using the implicit operator. - /// firgba16 = Color.DarkSeaGreen; - /// // Convert the FIRGBA16 instance into a native .NET Color - /// // using its implicit operator. - /// Color color = firgba16; - /// // Using the structure's Color property for converting it - /// // into a native .NET Color. - /// Color another = firgba16.Color; - /// - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct FIRGBA16 : IComparable, IComparable, IEquatable - { - /// - /// The red color component. - /// - public ushort red; - - /// - /// The green color component. - /// - public ushort green; - - /// - /// The blue color component. - /// - public ushort blue; - - /// - /// The alpha color component. - /// - public ushort alpha; - - /// - /// Initializes a new instance based on the specified . - /// - /// to initialize with. - public FIRGBA16(Color color) - { - red = (ushort)(color.R << 8); - green = (ushort)(color.G << 8); - blue = (ushort)(color.B << 8); - alpha = (ushort)(color.A << 8); - } - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(FIRGBA16 left, FIRGBA16 right) - { - return - ((left.alpha == right.alpha) && - (left.blue == right.blue) && - (left.green == right.green) && - (left.red == right.red)); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(FIRGBA16 left, FIRGBA16 right) - { - return !(left == right); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator FIRGBA16(Color value) - { - return new FIRGBA16(value); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator Color(FIRGBA16 value) - { - return value.Color; - } - - /// - /// Gets or sets the of the structure. - /// - public Color Color - { - get - { - return Color.FromArgb((alpha >> 8), (red >> 8), (green >> 8), (blue >> 8)); - } - set - { - red = (ushort)(value.R << 8); - green = (ushort)(value.G << 8); - blue = (ushort)(value.B << 8); - alpha = (ushort)(value.A << 8); - } - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is FIRGBA16)) - { - throw new ArgumentException("obj"); - } - return CompareTo((FIRGBA16)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(FIRGBA16 other) - { - return this.Color.ToArgb().CompareTo(other.Color.ToArgb()); - } - - /// - /// Tests whether the specified object is a structure - /// and is equivalent to this structure. - /// - /// The object to test. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is FIRGBA16) && (this == ((FIRGBA16)obj))); - } - - /// - /// Tests whether the specified structure is equivalent to this structure. - /// - /// A structure to compare to this instance. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public bool Equals(FIRGBA16 other) - { - return (this == other); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return base.GetHashCode(); - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return FreeImage.ColorToString(Color); - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIRGBAF.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIRGBAF.cs deleted file mode 100644 index aa515a0..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIRGBAF.cs +++ /dev/null @@ -1,276 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.3 $ -// $Date: 2009/02/20 07:41:08 $ -// $Id: FIRGBAF.cs,v 1.3 2009/02/20 07:41:08 cklein05 Exp $ -// ========================================================== - -using System; -using System.Drawing; -using System.Runtime.InteropServices; - -namespace FreeImageAPI -{ - /// - /// The FIRGBAF structure describes a color consisting of relative - /// intensities of red, green, blue and alpha value. Each single color - /// component consumes 32 bits and takes values in the range from 0 to 1. - /// - /// - /// - /// The FIRGBAF structure provides access to an underlying FreeImage FIRGBAF - /// structure. To determine the alpha, red, green or blue component of a color, - /// use the alpha, red, green or blue fields, respectively. - /// - /// For easy integration of the underlying structure into the .NET framework, - /// the FIRGBAF structure implements implicit conversion operators to - /// convert the represented color to and from the - /// type. This makes the type a real replacement - /// for the FIRGBAF structure and my be used in all situations which require - /// an FIRGBAF type. - /// - /// - /// Each color component alpha, red, green or blue of FIRGBAF is translated - /// into it's corresponding color component A, R, G or B of - /// by linearly mapping the values of one range - /// into the other range and vice versa. - /// - /// - /// Conversion from System.Drawing.Color to FIRGBAF - /// - /// FIRGBAF.component = (float)Color.component / 255f - /// - /// Conversion from FIRGBAF to System.Drawing.Color - /// - /// Color.component = (int)(FIRGBAF.component * 255f) - /// - /// The same conversion is also applied when the - /// property or the constructor - /// is invoked. - /// - /// - /// - /// The following code example demonstrates the various conversions between the - /// FIRGBAF structure and the structure. - /// - /// FIRGBAF firgbaf; - /// // Initialize the structure using a native .NET Color structure. - /// firgbaf = new FIRGBAF(Color.Indigo); - /// // Initialize the structure using the implicit operator. - /// firgbaf = Color.DarkSeaGreen; - /// // Convert the FIRGBAF instance into a native .NET Color - /// // using its implicit operator. - /// Color color = firgbaf; - /// // Using the structure's Color property for converting it - /// // into a native .NET Color. - /// Color another = firgbaf.Color; - /// - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct FIRGBAF : IComparable, IComparable, IEquatable - { - /// - /// The red color component. - /// - public float red; - - /// - /// The green color component. - /// - public float green; - - /// - /// The blue color component. - /// - public float blue; - - /// - /// The alpha color component. - /// - public float alpha; - - /// - /// Initializes a new instance based on the specified . - /// - /// to initialize with. - public FIRGBAF(Color color) - { - red = (float)color.R / 255f; - green = (float)color.G / 255f; - blue = (float)color.B / 255f; - alpha = (float)color.A / 255f; - } - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(FIRGBAF left, FIRGBAF right) - { - return - ((left.alpha == right.alpha) && - (left.blue == right.blue) && - (left.green == right.green) && - (left.red == right.red)); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(FIRGBAF left, FIRGBAF right) - { - return !(left == right); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator FIRGBAF(Color value) - { - return new FIRGBAF(value); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator Color(FIRGBAF value) - { - return value.Color; - } - - /// - /// Gets or sets the of the structure. - /// - public Color Color - { - get - { - return Color.FromArgb( - (int)(alpha * 255f), - (int)(red * 255f), - (int)(green * 255f), - (int)(blue * 255f)); - } - set - { - red = (float)value.R / 255f; - green = (float)value.G / 255f; - blue = (float)value.B / 255f; - alpha = (float)value.A / 255f; - } - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is FIRGBAF)) - { - throw new ArgumentException("obj"); - } - return CompareTo((FIRGBAF)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(FIRGBAF other) - { - return this.Color.ToArgb().CompareTo(other.Color.ToArgb()); - } - - /// - /// Tests whether the specified object is a structure - /// and is equivalent to this structure. - /// - /// The object to test. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is FIRGBAF) && (this == ((FIRGBAF)obj))); - } - - /// - /// Tests whether the specified structure is equivalent to this structure. - /// - /// A structure to compare to this instance. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public bool Equals(FIRGBAF other) - { - return (this == other); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return base.GetHashCode(); - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return FreeImage.ColorToString(Color); - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIRGBF.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIRGBF.cs deleted file mode 100644 index 0fce242..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIRGBF.cs +++ /dev/null @@ -1,272 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.3 $ -// $Date: 2009/02/20 07:41:08 $ -// $Id: FIRGBF.cs,v 1.3 2009/02/20 07:41:08 cklein05 Exp $ -// ========================================================== - -using System; -using System.Drawing; -using System.Runtime.InteropServices; - -namespace FreeImageAPI -{ - /// - /// The FIRGBF structure describes a color consisting of relative - /// intensities of red, green, blue and alpha value. Each single color - /// component consumes 32 bits and takes values in the range from 0 to 1. - /// - /// - /// - /// The FIRGBF structure provides access to an underlying FreeImage FIRGBF - /// structure. To determine the red, green or blue component of a color, use the - /// red, green or blue fields, respectively. - /// - /// For easy integration of the underlying structure into the .NET framework, - /// the FIRGBF structure implements implicit conversion operators to - /// convert the represented color to and from the - /// type. This makes the type a real replacement - /// for the FIRGBF structure and my be used in all situations which require - /// an FIRGBF type. - /// - /// - /// Each color component alpha, red, green or blue of FIRGBF is translated - /// into it's corresponding color component A, R, G or B of - /// by linearly mapping the values of one range - /// into the other range and vice versa. - /// When converting from into FIRGBF, the - /// color's alpha value is ignored and assumed to be 255 when converting from - /// FIRGBF into , creating a fully - /// opaque color. - /// - /// - /// Conversion from System.Drawing.Color to FIRGBF - /// - /// FIRGBF.component = (float)Color.component / 255f - /// - /// Conversion from FIRGBF to System.Drawing.Color - /// - /// Color.component = (int)(FIRGBF.component * 255f) - /// - /// The same conversion is also applied when the - /// property or the constructor - /// is invoked. - /// - /// - /// - /// The following code example demonstrates the various conversions between the - /// FIRGBF structure and the structure. - /// - /// FIRGBF firgbf; - /// // Initialize the structure using a native .NET Color structure. - /// firgbf = new FIRGBF(Color.Indigo); - /// // Initialize the structure using the implicit operator. - /// firgbf = Color.DarkSeaGreen; - /// // Convert the FIRGBF instance into a native .NET Color - /// // using its implicit operator. - /// Color color = firgbf; - /// // Using the structure's Color property for converting it - /// // into a native .NET Color. - /// Color another = firgbf.Color; - /// - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct FIRGBF : IComparable, IComparable, IEquatable - { - /// - /// The red color component. - /// - public float red; - - /// - /// The green color component. - /// - public float green; - - /// - /// The blue color component. - /// - public float blue; - - /// - /// Initializes a new instance based on the specified . - /// - /// to initialize with. - public FIRGBF(Color color) - { - red = (float)color.R / 255f; - green = (float)color.G / 255f; - blue = (float)color.B / 255f; - } - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(FIRGBF left, FIRGBF right) - { - return - ((left.blue == right.blue) && - (left.green == right.green) && - (left.red == right.red)); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(FIRGBF left, FIRGBF right) - { - return !(left == right); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator FIRGBF(Color value) - { - return new FIRGBF(value); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator Color(FIRGBF value) - { - return value.Color; - } - - /// - /// Gets or sets the of the structure. - /// - public Color Color - { - get - { - return Color.FromArgb( - (int)(red * 255f), - (int)(green * 255f), - (int)(blue * 255f)); - } - set - { - red = (float)value.R / 255f; - green = (float)value.G / 255f; - blue = (float)value.B / 255f; - } - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is FIRGBF)) - { - throw new ArgumentException("obj"); - } - return CompareTo((FIRGBF)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(FIRGBF other) - { - return this.Color.ToArgb().CompareTo(other.Color.ToArgb()); - } - - /// - /// Tests whether the specified object is a structure - /// and is equivalent to this structure. - /// - /// The object to test. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is FIRGBF) && (this == ((FIRGBF)obj))); - } - - /// - /// Tests whether the specified structure is equivalent to this structure. - /// - /// A structure to compare to this instance. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public bool Equals(FIRGBF other) - { - return (this == other); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return base.GetHashCode(); - } - - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return FreeImage.ColorToString(Color); - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIRational.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIRational.cs deleted file mode 100644 index 4788a0b..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIRational.cs +++ /dev/null @@ -1,1011 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.5 $ -// $Date: 2009/02/27 16:36:23 $ -// $Id: FIRational.cs,v 1.5 2009/02/27 16:36:23 cklein05 Exp $ -// ========================================================== - -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Diagnostics; - -namespace FreeImageAPI -{ - /// - /// The FIRational structure represents a fraction via two - /// instances which are interpreted as numerator and denominator. - /// - /// - /// The structure tries to approximate the value of - /// when creating a new instance by using a better algorithm than FreeImage does. - /// - /// The structure implements the following operators: - /// +, -, ++, --, ==, != , >, >==, <, <== and ~ (which switches nominator and denomiator). - /// - /// The structure can be converted into all .NET standard types either implicit or - /// explicit. - /// - [Serializable, StructLayout(LayoutKind.Sequential), ComVisible(true)] - public struct FIRational : IConvertible, IComparable, IFormattable, IComparable, IEquatable - { - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private int numerator; - - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private int denominator; - - /// - /// Represents the largest possible value of . This field is constant. - /// - public static readonly FIRational MaxValue = new FIRational(Int32.MaxValue, 1); - - /// - /// Represents the smallest possible value of . This field is constant. - /// - public static readonly FIRational MinValue = new FIRational(Int32.MinValue, 1); - - /// - /// Represents the smallest positive value greater than zero. This field is constant. - /// - public static readonly FIRational Epsilon = new FIRational(1, Int32.MaxValue); - - /// - /// Initializes a new instance based on the specified parameters. - /// - /// The numerator. - /// The denominator. - public FIRational(int n, int d) - { - numerator = n; - denominator = d; - Normalize(); - } - - /// - /// Initializes a new instance based on the specified parameters. - /// - /// The tag to read the data from. - public unsafe FIRational(FITAG tag) - { - switch (FreeImage.GetTagType(tag)) - { - case FREE_IMAGE_MDTYPE.FIDT_SRATIONAL: - int* value = (int*)FreeImage.GetTagValue(tag); - numerator = (int)value[0]; - denominator = (int)value[1]; - Normalize(); - return; - default: - throw new ArgumentException("tag"); - } - } - - /// - /// Initializes a new instance based on the specified parameters. - /// - /// The value to convert into a fraction. - /// - /// cannot be converted into a fraction - /// represented by two integer values. - public FIRational(decimal value) - { - try - { - int sign = value < 0 ? -1 : 1; - value = Math.Abs(value); - try - { - int[] contFract = CreateContinuedFraction(value); - CreateFraction(contFract, out numerator, out denominator); - Normalize(); - } - catch - { - numerator = 0; - denominator = 1; - } - if (Math.Abs(((decimal)numerator / (decimal)denominator) - value) > 0.0001m) - { - int maxDen = (Int32.MaxValue / (int)value) - 2; - maxDen = maxDen < 10000 ? maxDen : 10000; - ApproximateFraction(value, maxDen, out numerator, out denominator); - Normalize(); - if (Math.Abs(((decimal)numerator / (decimal)denominator) - value) > 0.0001m) - { - throw new OverflowException("Unable to convert value into a fraction"); - } - } - numerator *= sign; - Normalize(); - } - catch (Exception ex) - { - throw new OverflowException("Unable to calculate fraction.", ex); - } - } - - /// - /// The numerator of the fraction. - /// - public int Numerator - { - get { return numerator; } - } - - /// - /// The denominator of the fraction. - /// - public int Denominator - { - get { return denominator; } - } - - /// - /// Returns the truncated value of the fraction. - /// - /// - public int Truncate() - { - return denominator > 0 ? (int)(numerator / denominator) : 0; - } - - /// - /// Returns whether the fraction is representing an integer value. - /// - public bool IsInteger - { - get - { - return (denominator == 1 || - (denominator != 0 && (numerator % denominator == 0)) || - (denominator == 0 && numerator == 0)); - } - } - - /// - /// Calculated the greatest common divisor of 'a' and 'b'. - /// - private static long Gcd(long a, long b) - { - a = Math.Abs(a); - b = Math.Abs(b); - long r; - while (b > 0) - { - r = a % b; - a = b; - b = r; - } - return a; - } - - /// - /// Calculated the smallest common multiple of 'a' and 'b'. - /// - private static long Scm(int n, int m) - { - return Math.Abs((long)n * (long)m) / Gcd(n, m); - } - - /// - /// Normalizes the fraction. - /// - private void Normalize() - { - if (denominator == 0) - { - numerator = 0; - denominator = 1; - return; - } - - if (numerator != 1 && denominator != 1) - { - int common = (int)Gcd(numerator, denominator); - if (common != 1 && common != 0) - { - numerator /= common; - denominator /= common; - } - } - - if (denominator < 0) - { - numerator *= -1; - denominator *= -1; - } - } - - /// - /// Normalizes a fraction. - /// - private static void Normalize(ref long numerator, ref long denominator) - { - if (denominator == 0) - { - numerator = 0; - denominator = 1; - } - else if (numerator != 1 && denominator != 1) - { - long common = Gcd(numerator, denominator); - if (common != 1) - { - numerator /= common; - denominator /= common; - } - } - if (denominator < 0) - { - numerator *= -1; - denominator *= -1; - } - } - - /// - /// Returns the digits after the point. - /// - private static int GetDigits(decimal value) - { - int result = 0; - value -= decimal.Truncate(value); - while (value != 0) - { - value *= 10; - value -= decimal.Truncate(value); - result++; - } - return result; - } - - /// - /// Creates a continued fraction of a decimal value. - /// - private static int[] CreateContinuedFraction(decimal value) - { - int precision = GetDigits(value); - decimal epsilon = 0.0000001m; - List list = new List(); - value = Math.Abs(value); - - byte b = 0; - - list.Add((int)value); - value -= ((int)value); - - while (value != 0m) - { - if (++b == byte.MaxValue || value < epsilon) - { - break; - } - value = 1m / value; - if (Math.Abs((Math.Round(value, precision - 1) - value)) < epsilon) - { - value = Math.Round(value, precision - 1); - } - list.Add((int)value); - value -= ((int)value); - } - return list.ToArray(); - } - - /// - /// Creates a fraction from a continued fraction. - /// - private static void CreateFraction(int[] continuedFraction, out int numerator, out int denominator) - { - numerator = 1; - denominator = 0; - int temp; - - for (int i = continuedFraction.Length - 1; i > -1; i--) - { - temp = numerator; - numerator = continuedFraction[i] * numerator + denominator; - denominator = temp; - } - } - - /// - /// Tries 'brute force' to approximate with a fraction. - /// - private static void ApproximateFraction(decimal value, int maxDen, out int num, out int den) - { - num = 0; - den = 0; - decimal bestDifference = 1m; - decimal currentDifference = -1m; - int digits = GetDigits(value); - - if (digits <= 9) - { - int mul = 1; - for (int i = 1; i <= digits; i++) - { - mul *= 10; - } - if (mul <= maxDen) - { - num = (int)(value * mul); - den = mul; - return; - } - } - - for (int i = 1; i <= maxDen; i++) - { - int numerator = (int)Math.Floor(value * (decimal)i + 0.5m); - currentDifference = Math.Abs(value - (decimal)numerator / (decimal)i); - if (currentDifference < bestDifference) - { - num = numerator; - den = i; - bestDifference = currentDifference; - } - } - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return ((IConvertible)this).ToDouble(null).ToString(); - } - - /// - /// Tests whether the specified object is a structure - /// and is equivalent to this structure. - /// - /// The object to test. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is FIRational) && (this == ((FIRational)obj))); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return base.GetHashCode(); - } - - #region Operators - - /// - /// Standard implementation of the operator. - /// - public static FIRational operator +(FIRational r1) - { - return r1; - } - - /// - /// Standard implementation of the operator. - /// - public static FIRational operator -(FIRational r1) - { - r1.numerator *= -1; - return r1; - } - - /// - /// Returns the reciprocal value of this instance. - /// - public static FIRational operator ~(FIRational r1) - { - int temp = r1.denominator; - r1.denominator = r1.numerator; - r1.numerator = temp; - r1.Normalize(); - return r1; - } - - /// - /// Standard implementation of the operator. - /// - public static FIRational operator ++(FIRational r1) - { - checked - { - r1.numerator += r1.denominator; - } - return r1; - } - - /// - /// Standard implementation of the operator. - /// - public static FIRational operator --(FIRational r1) - { - checked - { - r1.numerator -= r1.denominator; - } - return r1; - } - - /// - /// Standard implementation of the operator. - /// - public static FIRational operator +(FIRational r1, FIRational r2) - { - long numerator = 0; - long denominator = Scm(r1.denominator, r2.denominator); - numerator = (r1.numerator * (denominator / r1.denominator)) + (r2.numerator * (denominator / r2.denominator)); - Normalize(ref numerator, ref denominator); - checked - { - return new FIRational((int)numerator, (int)denominator); - } - } - - /// - /// Standard implementation of the operator. - /// - public static FIRational operator -(FIRational r1, FIRational r2) - { - return r1 + (-r2); - } - - /// - /// Standard implementation of the operator. - /// - public static FIRational operator *(FIRational r1, FIRational r2) - { - long numerator = r1.numerator * r2.numerator; - long denominator = r1.denominator * r2.denominator; - Normalize(ref numerator, ref denominator); - checked - { - return new FIRational((int)numerator, (int)denominator); - } - } - - /// - /// Standard implementation of the operator. - /// - public static FIRational operator /(FIRational r1, FIRational r2) - { - int temp = r2.denominator; - r2.denominator = r2.numerator; - r2.numerator = temp; - return r1 * r2; - } - - /// - /// Standard implementation of the operator. - /// - public static FIRational operator %(FIRational r1, FIRational r2) - { - r2.Normalize(); - if (Math.Abs(r2.numerator) < r2.denominator) - return new FIRational(0, 0); - int div = (int)(r1 / r2); - return r1 - (r2 * div); - } - - /// - /// Standard implementation of the operator. - /// - public static bool operator ==(FIRational r1, FIRational r2) - { - r1.Normalize(); - r2.Normalize(); - return (r1.numerator == r2.numerator) && (r1.denominator == r2.denominator); - } - - /// - /// Standard implementation of the operator. - /// - public static bool operator !=(FIRational r1, FIRational r2) - { - return !(r1 == r2); - } - - /// - /// Standard implementation of the operator. - /// - public static bool operator >(FIRational r1, FIRational r2) - { - long denominator = Scm(r1.denominator, r2.denominator); - return (r1.numerator * (denominator / r1.denominator)) > (r2.numerator * (denominator / r2.denominator)); - } - - /// - /// Standard implementation of the operator. - /// - public static bool operator <(FIRational r1, FIRational r2) - { - long denominator = Scm(r1.denominator, r2.denominator); - return (r1.numerator * (denominator / r1.denominator)) < (r2.numerator * (denominator / r2.denominator)); - } - - /// - /// Standard implementation of the operator. - /// - public static bool operator >=(FIRational r1, FIRational r2) - { - long denominator = Scm(r1.denominator, r2.denominator); - return (r1.numerator * (denominator / r1.denominator)) >= (r2.numerator * (denominator / r2.denominator)); - } - - /// - /// Standard implementation of the operator. - /// - public static bool operator <=(FIRational r1, FIRational r2) - { - long denominator = Scm(r1.denominator, r2.denominator); - return (r1.numerator * (denominator / r1.denominator)) <= (r2.numerator * (denominator / r2.denominator)); - } - - #endregion - - #region Conversions - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator bool(FIRational value) - { - return (value.numerator != 0); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator byte(FIRational value) - { - return (byte)(double)value; - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator char(FIRational value) - { - return (char)(double)value; - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator decimal(FIRational value) - { - return value.denominator == 0 ? 0m : (decimal)value.numerator / (decimal)value.denominator; - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator double(FIRational value) - { - return value.denominator == 0 ? 0d : (double)value.numerator / (double)value.denominator; - } - - /// - /// Converts the value of a structure to an structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator short(FIRational value) - { - return (short)(double)value; - } - - /// - /// Converts the value of a structure to an structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator int(FIRational value) - { - return (int)(double)value; - } - - /// - /// Converts the value of a structure to an structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator long(FIRational value) - { - return (byte)(double)value; - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator float(FIRational value) - { - return value.denominator == 0 ? 0f : (float)value.numerator / (float)value.denominator; - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator sbyte(FIRational value) - { - return (sbyte)(double)value; - } - - /// - /// Converts the value of a structure to an structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator ushort(FIRational value) - { - return (ushort)(double)value; - } - - /// - /// Converts the value of a structure to an structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator uint(FIRational value) - { - return (uint)(double)value; - } - - /// - /// Converts the value of a structure to an structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator ulong(FIRational value) - { - return (ulong)(double)value; - } - - // - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator FIRational(bool value) - { - return new FIRational(value ? 1 : 0, 1); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator FIRational(byte value) - { - return new FIRational(value, 1); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator FIRational(char value) - { - return new FIRational(value, 1); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator FIRational(decimal value) - { - return new FIRational(value); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator FIRational(double value) - { - return new FIRational((decimal)value); - } - - /// - /// Converts the value of an structure to a structure. - /// - /// An structure. - /// A new instance of initialized to . - public static implicit operator FIRational(short value) - { - return new FIRational(value, 1); - } - - /// - /// Converts the value of an structure to a structure. - /// - /// An structure. - /// A new instance of initialized to . - public static implicit operator FIRational(int value) - { - return new FIRational(value, 1); - } - - /// - /// Converts the value of an structure to a structure. - /// - /// An structure. - /// A new instance of initialized to . - public static explicit operator FIRational(long value) - { - return new FIRational((int)value, 1); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator FIRational(sbyte value) - { - return new FIRational(value, 1); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator FIRational(float value) - { - return new FIRational((decimal)value); - } - - /// - /// Converts the value of an structure to a structure. - /// - /// An structure. - /// A new instance of initialized to . - public static implicit operator FIRational(ushort value) - { - return new FIRational(value, 1); - } - - /// - /// Converts the value of an structure to a structure. - /// - /// An structure. - /// A new instance of initialized to . - public static explicit operator FIRational(uint value) - { - return new FIRational((int)value, 1); - } - - /// - /// Converts the value of an structure to a structure. - /// - /// An structure. - /// A new instance of initialized to . - public static explicit operator FIRational(ulong value) - { - return new FIRational((int)value, 1); - } - - #endregion - - #region IConvertible Member - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Double; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - return (bool)this; - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return (byte)this; - } - - char IConvertible.ToChar(IFormatProvider provider) - { - return (char)this; - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - return Convert.ToDateTime(((IConvertible)this).ToDouble(provider)); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return this; - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return this; - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return (short)this; - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return (int)this; - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return (long)this; - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return (sbyte)this; - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return this; - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(((double)this).ToString(), provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - return Convert.ChangeType(((IConvertible)this).ToDouble(provider), conversionType, provider); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return (ushort)this; - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return (uint)this; - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return (ulong)this; - } - - #endregion - - #region IComparable Member - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is FIRational)) - { - throw new ArgumentException(); - } - return CompareTo((FIRational)obj); - } - - #endregion - - #region IFormattable Member - - /// - /// Formats the value of the current instance using the specified format. - /// - /// The String specifying the format to use. - /// The IFormatProvider to use to format the value. - /// A String containing the value of the current instance in the specified format. - public string ToString(string format, IFormatProvider formatProvider) - { - if (format == null) - { - format = ""; - } - return String.Format(formatProvider, format, ((IConvertible)this).ToDouble(formatProvider)); - } - - #endregion - - #region IEquatable Member - - /// - /// Tests whether the specified structure is equivalent to this structure. - /// - /// A structure to compare to this instance. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public bool Equals(FIRational other) - { - return (this == other); - } - - #endregion - - #region IComparable Member - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(FIRational other) - { - FIRational difference = this - other; - difference.Normalize(); - if (difference.numerator > 0) return 1; - if (difference.numerator < 0) return -1; - else return 0; - } - - #endregion - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FITAG.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FITAG.cs deleted file mode 100644 index a439bb9..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FITAG.cs +++ /dev/null @@ -1,170 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.5 $ -// $Date: 2009/02/20 07:41:08 $ -// $Id: FITAG.cs,v 1.5 2009/02/20 07:41:08 cklein05 Exp $ -// ========================================================== - -using System; -using System.Runtime.InteropServices; - -namespace FreeImageAPI -{ - /// - /// The FITAG structure is a handle to a FreeImage metadata tag. - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct FITAG : IComparable, IComparable, IEquatable - { - private IntPtr data; - - /// - /// A read-only field that represents a handle that has been initialized to zero. - /// - public static readonly FITAG Zero; - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(FITAG left, FITAG right) - { - return (left.data == right.data); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(FITAG left, FITAG right) - { - return (left.data != right.data); - } - - /// - /// Gets whether the pointer is a null pointer or not. - /// - /// true if this is a null pointer; - /// otherwise, false. - public bool IsNull - { - get - { - return (data == IntPtr.Zero); - } - } - - /// - /// Sets the handle to null. - /// - public void SetNull() - { - data = IntPtr.Zero; - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return data.ToString(); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return data.GetHashCode(); - } - - /// - /// Determines whether the specified is equal to the current . - /// - /// The to compare with the current . - /// true if the specified is equal to the current ; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is FITAG) && (this == ((FITAG)obj))); - } - - /// - /// Indicates whether the current object is equal to another object of the same type. - /// - /// An object to compare with this object. - /// true if the current object is equal to the other parameter; otherwise, false. - public bool Equals(FITAG other) - { - return (this == other); - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is FITAG)) - { - throw new ArgumentException("obj"); - } - return CompareTo((FITAG)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(FITAG other) - { - return this.data.ToInt64().CompareTo(other.data.ToInt64()); - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIURational.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIURational.cs deleted file mode 100644 index 4c2f24d..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FIURational.cs +++ /dev/null @@ -1,1010 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.5 $ -// $Date: 2009/02/27 16:36:23 $ -// $Id: FIURational.cs,v 1.5 2009/02/27 16:36:23 cklein05 Exp $ -// ========================================================== - -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Diagnostics; - -namespace FreeImageAPI -{ - /// - /// The FIURational structure represents a fraction via two - /// instances which are interpreted as numerator and denominator. - /// - /// - /// The structure tries to approximate the value of - /// when creating a new instance by using a better algorithm than FreeImage does. - /// - /// The structure implements the following operators: - /// +, ++, --, ==, != , >, >==, <, <== and ~ (which switches nominator and denomiator). - /// - /// The structure can be converted into all .NET standard types either implicit or - /// explicit. - /// - [Serializable, StructLayout(LayoutKind.Sequential), ComVisible(true)] - public struct FIURational : IConvertible, IComparable, IFormattable, IComparable, IEquatable - { - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private uint numerator; - - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private uint denominator; - - /// - /// Represents the largest possible value of . This field is constant. - /// - public static readonly FIURational MaxValue = new FIURational(UInt32.MaxValue, 1u); - - /// - /// Represents the smallest possible value of . This field is constant. - /// - public static readonly FIURational MinValue = new FIURational(0u, 1u); - - /// - /// Represents the smallest positive value greater than zero. This field is constant. - /// - public static readonly FIURational Epsilon = new FIURational(1u, UInt32.MaxValue); - - /// - /// Initializes a new instance based on the specified parameters. - /// - /// The numerator. - /// The denominator. - public FIURational(uint n, uint d) - { - numerator = n; - denominator = d; - Normalize(); - } - - /// - /// Initializes a new instance based on the specified parameters. - /// - /// The tag to read the data from. - public unsafe FIURational(FITAG tag) - { - switch (FreeImage.GetTagType(tag)) - { - case FREE_IMAGE_MDTYPE.FIDT_RATIONAL: - uint* pvalue = (uint*)FreeImage.GetTagValue(tag); - numerator = pvalue[0]; - denominator = pvalue[1]; - Normalize(); - return; - default: - throw new ArgumentException("tag"); - } - } - - /// - ///Initializes a new instance based on the specified parameters. - /// - /// The value to convert into a fraction. - /// - /// cannot be converted into a fraction - /// represented by two unsigned integer values. - public FIURational(decimal value) - { - try - { - if (value < 0) - { - throw new OverflowException("value"); - } - try - { - int[] contFract = CreateContinuedFraction(value); - CreateFraction(contFract, out numerator, out denominator); - Normalize(); - } - catch - { - numerator = 0; - denominator = 1; - } - if (Math.Abs(((decimal)numerator / (decimal)denominator) - value) > 0.0001m) - { - int maxDen = (Int32.MaxValue / (int)value) - 2; - maxDen = maxDen < 10000 ? maxDen : 10000; - ApproximateFraction(value, maxDen, out numerator, out denominator); - Normalize(); - if (Math.Abs(((decimal)numerator / (decimal)denominator) - value) > 0.0001m) - { - throw new OverflowException("Unable to convert value into a fraction"); - } - } - Normalize(); - } - catch (Exception ex) - { - throw new OverflowException("Unable to calculate fraction.", ex); - } - } - - /// - /// The numerator of the fraction. - /// - public uint Numerator - { - get { return numerator; } - } - - /// - /// The denominator of the fraction. - /// - public uint Denominator - { - get { return denominator; } - } - - /// - /// Returns the truncated value of the fraction. - /// - /// - public int Truncate() - { - return denominator > 0 ? (int)(numerator / denominator) : 0; - } - - /// - /// Returns whether the fraction is representing an integer value. - /// - public bool IsInteger - { - get - { - return (denominator == 1 || - (denominator != 0 && (numerator % denominator == 0)) || - (denominator == 0 && numerator == 0)); - } - } - - /// - /// Calculated the greatest common divisor of 'a' and 'b'. - /// - private static ulong Gcd(ulong a, ulong b) - { - ulong r; - while (b > 0) - { - r = a % b; - a = b; - b = r; - } - return a; - } - - /// - /// Calculated the smallest common multiple of 'a' and 'b'. - /// - private static ulong Scm(uint n, uint m) - { - return (ulong)n * (ulong)m / Gcd(n, m); - } - - /// - /// Normalizes the fraction. - /// - private void Normalize() - { - if (denominator == 0) - { - numerator = 0; - denominator = 1; - return; - } - - if (numerator != 1 && denominator != 1) - { - uint common = (uint)Gcd(numerator, denominator); - if (common != 1 && common != 0) - { - numerator /= common; - denominator /= common; - } - } - } - - /// - /// Normalizes a fraction. - /// - private static void Normalize(ref ulong numerator, ref ulong denominator) - { - if (denominator == 0) - { - numerator = 0; - denominator = 1; - } - else if (numerator != 1 && denominator != 1) - { - ulong common = Gcd(numerator, denominator); - if (common != 1) - { - numerator /= common; - denominator /= common; - } - } - } - - /// - /// Returns the digits after the point. - /// - private static int GetDigits(decimal value) - { - int result = 0; - value -= decimal.Truncate(value); - while (value != 0) - { - value *= 10; - value -= decimal.Truncate(value); - result++; - } - return result; - } - - /// - /// Creates a continued fraction of a decimal value. - /// - private static int[] CreateContinuedFraction(decimal value) - { - int precision = GetDigits(value); - decimal epsilon = 0.0000001m; - List list = new List(); - value = Math.Abs(value); - - byte b = 0; - - list.Add((int)value); - value -= ((int)value); - - while (value != 0m) - { - if (++b == byte.MaxValue || value < epsilon) - { - break; - } - value = 1m / value; - if (Math.Abs((Math.Round(value, precision - 1) - value)) < epsilon) - { - value = Math.Round(value, precision - 1); - } - list.Add((int)value); - value -= ((int)value); - } - return list.ToArray(); - } - - /// - /// Creates a fraction from a continued fraction. - /// - private static void CreateFraction(int[] continuedFraction, out uint numerator, out uint denominator) - { - numerator = 1; - denominator = 0; - uint temp; - - for (int i = continuedFraction.Length - 1; i > -1; i--) - { - temp = numerator; - numerator = (uint)(continuedFraction[i] * numerator + denominator); - denominator = temp; - } - } - - /// - /// Tries 'brute force' to approximate with a fraction. - /// - private static void ApproximateFraction(decimal value, int maxDen, out uint num, out uint den) - { - num = 0; - den = 0; - decimal bestDifference = 1m; - decimal currentDifference = -1m; - int digits = GetDigits(value); - - if (digits <= 9) - { - uint mul = 1; - for (int i = 1; i <= digits; i++) - { - mul *= 10; - } - if (mul <= maxDen) - { - num = (uint)(value * mul); - den = mul; - return; - } - } - - for (uint u = 1; u <= maxDen; u++) - { - uint numerator = (uint)Math.Floor(value * (decimal)u + 0.5m); - currentDifference = Math.Abs(value - (decimal)numerator / (decimal)u); - if (currentDifference < bestDifference) - { - num = numerator; - den = u; - bestDifference = currentDifference; - } - } - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return ((IConvertible)this).ToDouble(null).ToString(); - } - - /// - /// Tests whether the specified object is a structure - /// and is equivalent to this structure. - /// - /// The object to test. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is FIURational) && (this == ((FIURational)obj))); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return base.GetHashCode(); - } - - #region Operators - - /// - /// Standard implementation of the operator. - /// - public static FIURational operator +(FIURational value) - { - return value; - } - - /// - /// Returns the reciprocal value of this instance. - /// - public static FIURational operator ~(FIURational value) - { - uint temp = value.denominator; - value.denominator = value.numerator; - value.numerator = temp; - value.Normalize(); - return value; - } - - /// - /// Standard implementation of the operator. - /// - public static FIURational operator ++(FIURational value) - { - checked - { - value.numerator += value.denominator; - } - return value; - } - - /// - /// Standard implementation of the operator. - /// - public static FIURational operator --(FIURational value) - { - checked - { - value.numerator -= value.denominator; - } - return value; - } - - /// - /// Standard implementation of the operator. - /// - public static FIURational operator +(FIURational left, FIURational right) - { - ulong numerator = 0; - ulong denominator = Scm(left.denominator, right.denominator); - numerator = (left.numerator * (denominator / left.denominator)) + - (right.numerator * (denominator / right.denominator)); - Normalize(ref numerator, ref denominator); - checked - { - return new FIURational((uint)numerator, (uint)denominator); - } - } - - /// - /// Standard implementation of the operator. - /// - public static FIURational operator -(FIURational left, FIURational right) - { - checked - { - if (left.denominator != right.denominator) - { - uint denom = left.denominator; - left.numerator *= right.denominator; - left.denominator *= right.denominator; - right.numerator *= denom; - right.denominator *= denom; - } - left.numerator -= right.numerator; - left.Normalize(); - return left; - } - } - - /// - /// Standard implementation of the operator. - /// - public static FIURational operator *(FIURational left, FIURational r2) - { - ulong numerator = left.numerator * r2.numerator; - ulong denominator = left.denominator * r2.denominator; - Normalize(ref numerator, ref denominator); - checked - { - return new FIURational((uint)numerator, (uint)denominator); - } - } - - /// - /// Standard implementation of the operator. - /// - public static FIURational operator /(FIURational left, FIURational right) - { - uint temp = right.denominator; - right.denominator = right.numerator; - right.numerator = temp; - return left * right; - } - - /// - /// Standard implementation of the operator. - /// - public static FIURational operator %(FIURational left, FIURational right) - { - right.Normalize(); - if (Math.Abs(right.numerator) < right.denominator) - return new FIURational(0, 0); - int div = (int)(left / right); - return left - (right * div); - } - - /// - /// Standard implementation of the operator. - /// - public static bool operator ==(FIURational left, FIURational right) - { - left.Normalize(); - right.Normalize(); - return (left.numerator == right.numerator) && (left.denominator == right.denominator); - } - - /// - /// Standard implementation of the operator. - /// - public static bool operator !=(FIURational left, FIURational right) - { - left.Normalize(); - right.Normalize(); - return (left.numerator != right.numerator) || (left.denominator != right.denominator); - } - - /// - /// Standard implementation of the operator. - /// - public static bool operator >(FIURational left, FIURational right) - { - ulong denominator = Scm(left.denominator, right.denominator); - return (left.numerator * (denominator / left.denominator)) > - (right.numerator * (denominator / right.denominator)); - } - - /// - /// Standard implementation of the operator. - /// - public static bool operator <(FIURational left, FIURational right) - { - ulong denominator = Scm(left.denominator, right.denominator); - return (left.numerator * (denominator / left.denominator)) < - (right.numerator * (denominator / right.denominator)); - } - - /// - /// Standard implementation of the operator. - /// - public static bool operator >=(FIURational left, FIURational right) - { - ulong denominator = Scm(left.denominator, right.denominator); - return (left.numerator * (denominator / left.denominator)) >= - (right.numerator * (denominator / right.denominator)); - } - - /// - /// Standard implementation of the operator. - /// - public static bool operator <=(FIURational left, FIURational right) - { - ulong denominator = Scm(left.denominator, right.denominator); - return (left.numerator * (denominator / left.denominator)) <= - (right.numerator * (denominator / right.denominator)); - } - - #endregion - - #region Conversions - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator bool(FIURational value) - { - return (value.numerator != 0); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator byte(FIURational value) - { - return (byte)(double)value; - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator char(FIURational value) - { - return (char)(double)value; - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator decimal(FIURational value) - { - return value.denominator == 0 ? 0m : (decimal)value.numerator / (decimal)value.denominator; - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator double(FIURational value) - { - return value.denominator == 0 ? 0d : (double)value.numerator / (double)value.denominator; - } - - /// - /// Converts the value of a structure to an structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator short(FIURational value) - { - return (short)(double)value; - } - - /// - /// Converts the value of a structure to an structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator int(FIURational value) - { - return (int)(double)value; - } - - /// - /// Converts the value of a structure to an structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator long(FIURational value) - { - return (byte)(double)value; - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator float(FIURational value) - { - return value.denominator == 0 ? 0f : (float)value.numerator / (float)value.denominator; - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator sbyte(FIURational value) - { - return (sbyte)(double)value; - } - - /// - /// Converts the value of a structure to an structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator ushort(FIURational value) - { - return (ushort)(double)value; - } - - /// - /// Converts the value of a structure to an structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator uint(FIURational value) - { - return (uint)(double)value; - } - - /// - /// Converts the value of a structure to an structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator ulong(FIURational value) - { - return (ulong)(double)value; - } - - // - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator FIURational(bool value) - { - return new FIURational(value ? 1u : 0u, 1u); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator FIURational(byte value) - { - return new FIURational(value, 1); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator FIURational(char value) - { - return new FIURational(value, 1); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator FIURational(decimal value) - { - return new FIURational(value); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator FIURational(double value) - { - return new FIURational((decimal)value); - } - - /// - /// Converts the value of an structure to a structure. - /// - /// An structure. - /// A new instance of initialized to . - public static implicit operator FIURational(short value) - { - return new FIURational((uint)value, 1u); - } - - /// - /// Converts the value of an structure to a structure. - /// - /// An structure. - /// A new instance of initialized to . - public static implicit operator FIURational(int value) - { - return new FIURational((uint)value, 1u); - } - - /// - /// Converts the value of an structure to a structure. - /// - /// An structure. - /// A new instance of initialized to . - public static explicit operator FIURational(long value) - { - return new FIURational((uint)value, 1u); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator FIURational(sbyte value) - { - return new FIURational((uint)value, 1u); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator FIURational(float value) - { - return new FIURational((decimal)value); - } - - /// - /// Converts the value of an structure to a structure. - /// - /// An structure. - /// A new instance of initialized to . - public static implicit operator FIURational(ushort value) - { - return new FIURational(value, 1); - } - - /// - /// Converts the value of an structure to a structure. - /// - /// An structure. - /// A new instance of initialized to . - public static explicit operator FIURational(uint value) - { - return new FIURational(value, 1u); - } - - /// - /// Converts the value of an structure to a structure. - /// - /// An structure. - /// A new instance of initialized to . - public static explicit operator FIURational(ulong value) - { - return new FIURational((uint)value, 1u); - } - - #endregion - - #region IConvertible Member - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Double; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - return (bool)this; - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return (byte)this; - } - - char IConvertible.ToChar(IFormatProvider provider) - { - return (char)this; - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - return Convert.ToDateTime(((IConvertible)this).ToDouble(provider)); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return this; - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return this; - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return (short)this; - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return (int)this; - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return (long)this; - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return (sbyte)this; - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return this; - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(((double)this).ToString(), provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - return Convert.ChangeType(((IConvertible)this).ToDouble(provider), conversionType, provider); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return (ushort)this; - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return (uint)this; - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return (ulong)this; - } - - #endregion - - #region IComparable Member - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is FIURational)) - { - throw new ArgumentException(); - } - return CompareTo((FIURational)obj); - } - - #endregion - - #region IFormattable Member - - /// - /// Formats the value of the current instance using the specified format. - /// - /// The String specifying the format to use. - /// The IFormatProvider to use to format the value. - /// A String containing the value of the current instance in the specified format. - public string ToString(string format, IFormatProvider formatProvider) - { - if (format == null) - { - format = ""; - } - return String.Format(formatProvider, format, ((IConvertible)this).ToDouble(formatProvider)); - } - - #endregion - - #region IEquatable Member - - /// - /// Tests whether the specified structure is equivalent to this structure. - /// - /// A structure to compare to this instance. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public bool Equals(FIURational other) - { - return (this == other); - } - - #endregion - - #region IComparable Member - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(FIURational other) - { - FIURational difference = this - other; - difference.Normalize(); - if (difference.numerator > 0) return 1; - if (difference.numerator < 0) return -1; - else return 0; - } - - #endregion - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FreeImageIO.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FreeImageIO.cs deleted file mode 100644 index af464d0..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/FreeImageIO.cs +++ /dev/null @@ -1,66 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.3 $ -// $Date: 2008/06/17 13:49:23 $ -// $Id: FreeImageIO.cs,v 1.3 2008/06/17 13:49:23 cklein05 Exp $ -// ========================================================== - -using System.Runtime.InteropServices; - -namespace FreeImageAPI.IO -{ - /// - /// Structure for implementing access to custom handles. - /// - [StructLayout(LayoutKind.Sequential)] - public struct FreeImageIO - { - /// - /// Delegate to the C++ function fread. - /// - public ReadProc readProc; - - /// - /// Delegate to the C++ function fwrite. - /// - public WriteProc writeProc; - - /// - /// Delegate to the C++ function fseek. - /// - public SeekProc seekProc; - - /// - /// Delegate to the C++ function ftell. - /// - public TellProc tellProc; - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/Plugin.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/Plugin.cs deleted file mode 100644 index 0148c45..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/Plugin.cs +++ /dev/null @@ -1,132 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.3 $ -// $Date: 2008/06/17 13:48:22 $ -// $Id: Plugin.cs,v 1.3 2008/06/17 13:48:22 cklein05 Exp $ -// ========================================================== - -using System; -using System.Runtime.InteropServices; -using FreeImageAPI.Plugins; - -namespace FreeImageAPI.Plugins -{ - /// - /// The structure contains functionpointers that make up a FreeImage plugin. - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct Plugin - { - /// - /// Delegate to a function that returns a string which describes - /// the plugins format. - /// - public FormatProc formatProc; - - /// - /// Delegate to a function that returns a string which contains - /// a more detailed description. - /// - public DescriptionProc descriptionProc; - - /// - /// Delegate to a function that returns a comma seperated list - /// of file extensions the plugin can read or write. - /// - public ExtensionListProc extensionListProc; - - /// - /// Delegate to a function that returns a regular expression that - /// can be used to idientify whether a file can be handled by the plugin. - /// - public RegExprProc regExprProc; - - /// - /// Delegate to a function that opens a file. - /// - public OpenProc openProc; - - /// - /// Delegate to a function that closes a previosly opened file. - /// - public CloseProc closeProc; - - /// - /// Delegate to a function that returns the number of pages of a multipage - /// bitmap if the plugin is capable of handling multipage bitmaps. - /// - public PageCountProc pageCountProc; - - /// - /// UNKNOWN - /// - public PageCapabilityProc pageCapabilityProc; - - /// - /// Delegate to a function that loads and decodes a bitmap into memory. - /// - public LoadProc loadProc; - - /// - /// Delegate to a function that saves a bitmap. - /// - public SaveProc saveProc; - - /// - /// Delegate to a function that determines whether the source is a valid image. - /// - public ValidateProc validateProc; - - /// - /// Delegate to a function that returns a string which contains - /// the plugin's mime type. - /// - public MimeProc mimeProc; - - /// - /// Delegate to a function that returns whether the plugin can handle the - /// specified color depth. - /// - public SupportsExportBPPProc supportsExportBPPProc; - - /// - /// Delegate to a function that returns whether the plugin can handle the - /// specified image type. - /// - public SupportsExportTypeProc supportsExportTypeProc; - - /// - /// Delegate to a function that returns whether the plugin can handle - /// ICC-Profiles. - /// - public SupportsICCProfilesProc supportsICCProfilesProc; - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/RGBQUAD.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/RGBQUAD.cs deleted file mode 100644 index fce303e..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/RGBQUAD.cs +++ /dev/null @@ -1,342 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.4 $ -// $Date: 2009/02/20 07:40:53 $ -// $Id: RGBQUAD.cs,v 1.4 2009/02/20 07:40:53 cklein05 Exp $ -// ========================================================== - -using System; -using System.Drawing; -using System.Runtime.InteropServices; - -namespace FreeImageAPI -{ - /// - /// The RGBQUAD structure describes a color consisting of relative - /// intensities of red, green, blue and alpha value. Each single color - /// component consumes 8 bits and so, takes values in the range from 0 to 255. - /// - /// - /// - /// The RGBQUAD structure provides access to an underlying Win32 RGBQUAD - /// structure. To determine the alpha, red, green or blue component of a color, - /// use the rgbReserved, rgbRed, rgbGreen or rgbBlue fields, respectively. - /// - /// For easy integration of the underlying structure into the .NET framework, - /// the RGBQUAD structure implements implicit conversion operators to - /// convert the represented color to and from the - /// type. This makes the type a real replacement - /// for the RGBQUAD structure and my be used in all situations which require - /// an RGBQUAD type. - /// - /// - /// Each color component rgbReserved, rgbRed, rgbGreen or rgbBlue of RGBQUAD - /// is translated into it's corresponding color component A, R, G or B of - /// by an one-to-one manner and vice versa. - /// - /// - /// Conversion from System.Drawing.Color to RGBQUAD - /// - /// RGBQUAD.component = Color.component - /// - /// Conversion from RGBQUAD to System.Drawing.Color - /// - /// Color.component = RGBQUAD.component - /// - /// The same conversion is also applied when the - /// property or the constructor - /// is invoked. - /// - /// - /// - /// The following code example demonstrates the various conversions between the - /// RGBQUAD structure and the structure. - /// - /// RGBQUAD rgbq; - /// // Initialize the structure using a native .NET Color structure. - /// rgbq = new RGBQUAD(Color.Indigo); - /// // Initialize the structure using the implicit operator. - /// rgbq = Color.DarkSeaGreen; - /// // Convert the RGBQUAD instance into a native .NET Color - /// // using its implicit operator. - /// Color color = rgbq; - /// // Using the structure's Color property for converting it - /// // into a native .NET Color. - /// Color another = rgbq.Color; - /// - /// - [Serializable, StructLayout(LayoutKind.Explicit)] - public struct RGBQUAD : IComparable, IComparable, IEquatable - { - /// - /// The blue color component. - /// - [FieldOffset(0)] - public byte rgbBlue; - - /// - /// The green color component. - /// - [FieldOffset(1)] - public byte rgbGreen; - - /// - /// The red color component. - /// - [FieldOffset(2)] - public byte rgbRed; - - /// - /// The alpha color component. - /// - [FieldOffset(3)] - public byte rgbReserved; - - /// - /// The color's value. - /// - [FieldOffset(0)] - public uint uintValue; - - /// - /// Initializes a new instance based on the specified . - /// - /// to initialize with. - public RGBQUAD(Color color) - { - uintValue = 0u; - rgbBlue = color.B; - rgbGreen = color.G; - rgbRed = color.R; - rgbReserved = color.A; - } - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(RGBQUAD left, RGBQUAD right) - { - return (left.uintValue == right.uintValue); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(RGBQUAD left, RGBQUAD right) - { - return (left.uintValue != right.uintValue); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator RGBQUAD(Color value) - { - return new RGBQUAD(value); - } - - /// - /// Converts the value of a structure to a Color structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator Color(RGBQUAD value) - { - return value.Color; - } - - /// - /// Converts the value of an structure to a structure. - /// - /// An structure. - /// A new instance of initialized to . - public static implicit operator RGBQUAD(uint value) - { - RGBQUAD result = new RGBQUAD(); - result.uintValue = value; - return result; - } - - /// - /// Converts the value of a structure to an structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator uint(RGBQUAD value) - { - return value.uintValue; - } - - /// - /// Gets or sets the of the structure. - /// - public Color Color - { - get - { - return Color.FromArgb( - rgbReserved, - rgbRed, - rgbGreen, - rgbBlue); - } - set - { - rgbRed = value.R; - rgbGreen = value.G; - rgbBlue = value.B; - rgbReserved = value.A; - } - } - - /// - /// Converts an array of into an array of - /// . - /// - /// The array to convert. - /// An array of . - public static RGBQUAD[] ToRGBQUAD(Color[] array) - { - if (array == null) - return null; - - RGBQUAD[] result = new RGBQUAD[array.Length]; - for (int i = 0; i < array.Length; i++) - { - result[i] = array[i]; - } - return result; - } - - /// - /// Converts an array of into an array of - /// . - /// - /// The array to convert. - /// An array of . - public static Color[] ToColor(RGBQUAD[] array) - { - if (array == null) - return null; - - Color[] result = new Color[array.Length]; - for (int i = 0; i < array.Length; i++) - { - result[i] = array[i].Color; - } - return result; - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is RGBQUAD)) - { - throw new ArgumentException("obj"); - } - return CompareTo((RGBQUAD)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(RGBQUAD other) - { - return this.Color.ToArgb().CompareTo(other.Color.ToArgb()); - } - - /// - /// Tests whether the specified object is a structure - /// and is equivalent to this structure. - /// - /// The object to test. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is RGBQUAD) && (this == ((RGBQUAD)obj))); - } - - /// - /// Tests whether the specified structure is equivalent to this structure. - /// - /// A structure to compare to this instance. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public bool Equals(RGBQUAD other) - { - return (this == other); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return base.GetHashCode(); - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return FreeImage.ColorToString(Color); - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/RGBTRIPLE.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/RGBTRIPLE.cs deleted file mode 100644 index feddcbf..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/RGBTRIPLE.cs +++ /dev/null @@ -1,295 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.3 $ -// $Date: 2009/02/20 07:41:08 $ -// $Id: RGBTRIPLE.cs,v 1.3 2009/02/20 07:41:08 cklein05 Exp $ -// ========================================================== - -using System; -using System.Drawing; -using System.Runtime.InteropServices; - -namespace FreeImageAPI -{ - /// - /// The RGBTRIPLE structure describes a color consisting of relative - /// intensities of red, green and blue value. Each single color component - /// consumes 8 bits and so, takes values in the range from 0 to 255. - /// - /// - /// - /// The RGBTRIPLE structure provides access to an underlying Win32 RGBTRIPLE - /// structure. To determine the red, green or blue component of a color, use the - /// rgbtRed, rgbtGreen or rgbtBlue fields, respectively. - /// - /// For easy integration of the underlying structure into the .NET framework, - /// the RGBTRIPLE structure implements implicit conversion operators to - /// convert the represented color to and from the - /// type. This makes the type a real replacement - /// for the RGBTRIPLE structure and my be used in all situations which require - /// an RGBTRIPLE type. - /// - /// - /// Each of the color components rgbtRed, rgbtGreen or rgbtBlue of RGBTRIPLE is - /// translated into it's corresponding color component R, G or B of - /// by an one-to-one manner and vice versa. - /// When converting from into RGBTRIPLE, the - /// color's alpha value is ignored and assumed to be 255 when converting from - /// RGBTRIPLE into , creating a fully - /// opaque color. - /// - /// - /// Conversion from System.Drawing.Color to RGBTRIPLE - /// - /// RGBTRIPLE.component = Color.component - /// - /// Conversion from RGBTRIPLE to System.Drawing.Color - /// - /// Color.component = RGBTRIPLE.component - /// - /// The same conversion is also applied when the - /// property or the constructor - /// is invoked. - /// - /// - /// - /// The following code example demonstrates the various conversions between the - /// RGBTRIPLE structure and the structure. - /// - /// RGBTRIPLE rgbt; - /// // Initialize the structure using a native .NET Color structure. - /// rgbt = new RGBTRIPLE(Color.Indigo); - /// // Initialize the structure using the implicit operator. - /// rgbt = Color.DarkSeaGreen; - /// // Convert the RGBTRIPLE instance into a native .NET Color - /// // using its implicit operator. - /// Color color = rgbt; - /// // Using the structure's Color property for converting it - /// // into a native .NET Color. - /// Color another = rgbt.Color; - /// - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct RGBTRIPLE : IComparable, IComparable, IEquatable - { - /// - /// The blue color component. - /// - public byte rgbtBlue; - - /// - /// The green color component. - /// - public byte rgbtGreen; - - /// - /// The red color component. - /// - public byte rgbtRed; - - /// - /// Initializes a new instance based on the specified . - /// - /// to initialize with. - public RGBTRIPLE(Color color) - { - rgbtBlue = color.B; - rgbtGreen = color.G; - rgbtRed = color.R; - } - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(RGBTRIPLE left, RGBTRIPLE right) - { - return - left.rgbtBlue == right.rgbtBlue && - left.rgbtGreen == right.rgbtGreen && - left.rgbtRed == right.rgbtRed; - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(RGBTRIPLE left, RGBTRIPLE right) - { - return !(left == right); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator RGBTRIPLE(Color value) - { - return new RGBTRIPLE(value); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator Color(RGBTRIPLE value) - { - return value.Color; - } - - /// - /// Converts the value of an structure to a structure. - /// - /// An structure. - /// A new instance of initialized to . - public static implicit operator RGBTRIPLE(uint value) - { - RGBTRIPLE result = new RGBTRIPLE(); - result.rgbtBlue = (byte)(value & 0xFF); - result.rgbtGreen = (byte)((value >> 8) & 0xFF); - result.rgbtRed = (byte)((value >> 16) & 0xFF); - return result; - } - - /// - /// Converts the value of a structure to an structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator uint(RGBTRIPLE value) - { - return (uint)((value.rgbtRed << 16) | (value.rgbtGreen << 8) | (value.rgbtBlue)); - } - - /// - /// Gets or sets the of the structure. - /// - public Color Color - { - get - { - return Color.FromArgb( - rgbtRed, - rgbtGreen, - rgbtBlue); - } - set - { - rgbtBlue = value.B; - rgbtGreen = value.G; - rgbtRed = value.R; - } - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is RGBTRIPLE)) - { - throw new ArgumentException("obj"); - } - return CompareTo((RGBTRIPLE)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(RGBTRIPLE other) - { - return this.Color.ToArgb().CompareTo(other.Color.ToArgb()); - } - - /// - /// Tests whether the specified object is a structure - /// and is equivalent to this structure. - /// - /// The object to test. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is RGBTRIPLE) && (this == ((RGBTRIPLE)obj))); - } - - /// - /// Tests whether the specified structure is equivalent to this - /// structure. - /// - /// A structure to compare to this instance. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public bool Equals(RGBTRIPLE other) - { - return (this == other); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return base.GetHashCode(); - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return FreeImage.ColorToString(Color); - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/fi_handle.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/fi_handle.cs deleted file mode 100644 index 7547d78..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/Structs/fi_handle.cs +++ /dev/null @@ -1,256 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// CVS -// $Revision: 1.7 $ -// $Date: 2009/02/20 07:41:08 $ -// $Id: fi_handle.cs,v 1.7 2009/02/20 07:41:08 cklein05 Exp $ -// ========================================================== - -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; - -namespace FreeImageAPI.IO -{ - /// - /// Wrapper for a custom handle. - /// - /// - /// The fi_handle of FreeImage in C++ is a simple pointer, but in .NET - /// it's not that simple. This wrapper uses fi_handle in two different ways. - /// - /// We implement a new plugin and FreeImage gives us a handle (pointer) that - /// we can simply pass through to the given functions in a 'FreeImageIO' - /// structure. - /// But when we want to use LoadFromhandle or SaveToHandle we need - /// a fi_handle (that we receive again in our own functions). - /// This handle is for example a stream (see LoadFromStream / SaveToStream) - /// that we want to work with. To know which stream a read/write is meant for - /// we could use a hash value that the wrapper itself handles or we can - /// go the unmanaged way of using a handle. - /// Therefor we use a to receive a unique pointer that we can - /// convert back into a .NET object. - /// When the fi_handle instance is no longer needed the instance must be disposed - /// by the creater manually! It is recommended to use the using statement to - /// be sure the instance is always disposed: - /// - /// - /// using (fi_handle handle = new fi_handle(object)) - /// { - /// callSomeFunctions(handle); - /// } - /// - /// - /// What does that mean? - /// If we get a fi_handle from unmanaged code we get a pointer to unmanaged - /// memory that we do not have to care about, and just pass ist back to FreeImage. - /// If we have to create a handle our own we use the standard constructur - /// that fills the with an pointer that represents the given object. - /// With calling the is used to retrieve the original - /// object we passed through the constructor. - /// - /// This way we can implement a fi_handle that works with managed an unmanaged - /// code. - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct fi_handle : IComparable, IComparable, IEquatable, IDisposable - { - /// - /// The handle to wrap. - /// - public IntPtr handle; - - /// - /// Initializes a new instance wrapping a managed object. - /// - /// The object to wrap. - /// - /// is null. - public fi_handle(object obj) - { - if (obj == null) - { - throw new ArgumentNullException("obj"); - } - GCHandle gch = GCHandle.Alloc(obj, GCHandleType.Normal); - handle = GCHandle.ToIntPtr(gch); - } - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(fi_handle left, fi_handle right) - { - return (left.handle == right.handle); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(fi_handle left, fi_handle right) - { - return (left.handle != right.handle); - } - - /// - /// Gets whether the pointer is a null pointer. - /// - public bool IsNull - { - get - { - return (handle == IntPtr.Zero); - } - } - - /// - /// Returns the object assigned to the handle in case this instance - /// was created by managed code. - /// - /// assigned to this handle or null on failure. - internal object GetObject() - { - object result = null; - if (handle != IntPtr.Zero) - { - try - { - result = GCHandle.FromIntPtr(handle).Target; - } - catch - { - } - } - return result; - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return handle.ToString(); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return handle.GetHashCode(); - } - - /// - /// Tests whether the specified object is a structure - /// and is equivalent to this structure. - /// - /// The object to test. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is fi_handle) && (this == ((fi_handle)obj))); - } - - /// - /// Indicates whether the current object is equal to another object of the same type. - /// - /// An object to compare with this object. - /// True if the current object is equal to the other parameter; otherwise, false. - public bool Equals(fi_handle other) - { - return (this == other); - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is fi_handle)) - { - throw new ArgumentException("obj"); - } - return CompareTo((fi_handle)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(fi_handle other) - { - return handle.ToInt64().CompareTo(other.handle.ToInt64()); - } - - /// - /// Releases all resources used by the instance. - /// - public void Dispose() - { - if (this.handle != IntPtr.Zero) - { - try - { - GCHandle.FromIntPtr(handle).Free(); - } - catch - { - } - finally - { - this.handle = IntPtr.Zero; - } - } - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/build.bat b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/build.bat deleted file mode 100644 index 8c9f4db..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Library/build.bat +++ /dev/null @@ -1,7 +0,0 @@ -@ECHO OFF -IF NOT EXIST bin MD bin -IF NOT EXIST bin\Release MD bin\Release -csc.exe /out:bin\Release\FreeImageNET.dll /target:library /doc:bin\Release\FreeImageNET.XML /debug- /o /nowarn:419 /unsafe+ /filealign:512 /recurse:*.cs -IF EXIST ..\Bin copy bin\Release\FreeImageNET.dll ..\Bin > NUL -IF EXIST ..\Bin copy bin\Release\FreeImageNET.XML ..\Bin > NUL -pause \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 01 - Loading and saving/Program.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 01 - Loading and saving/Program.cs deleted file mode 100644 index 4ca025f..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 01 - Loading and saving/Program.cs +++ /dev/null @@ -1,179 +0,0 @@ -using System; -using System.IO; -using FreeImageAPI; -using System.Collections.Generic; -using System.Runtime.Serialization.Formatters.Binary; -using System.Drawing; -using System.Drawing.Imaging; -using System.Runtime.InteropServices; - -namespace Sample01 -{ - class Program - { - static void Main(string[] args) - { - // Check if FreeImage.dll is available (can be in %path%). - if (!FreeImage.IsAvailable()) - { - Console.WriteLine("FreeImage.dll seems to be missing. Aborting."); - return; - } - - Sample sample = new Sample(); - // This example shows the basic loading and saving operations offered by FreeImage. - sample.Example01(); - - // This example shows a more comfortable way offered by the .NET Wrapper. - sample.Example02(); - - // This example shows the FreeImage-Errormessage-Callback - sample.Example03(); - } - } - - public class Sample - { - const string fileName = @"Sample.jpg"; - const string outFileName = @"Sample.tif"; - FIBITMAP dib = new FIBITMAP(); - string message = null; - - public void Example01() - { - if (!File.Exists(fileName)) - { - Console.WriteLine(fileName + " does not exist. Aborting."); - return; - } - - // Try to unload the bitmap handle (in case it is not null). - // Always assert that a handle (like dib) is unloaded before it is reused, because - // on unmanaged side there is no garbage collector that will clean up unreferenced - // objects. - // The following code will produce a memory leak (in case the bitmap is loaded - // successfully) because the handle to the first bitmap is lost: - // dib = FreeImage.Load(FREE_IMAGE_FORMAT.FIF_JPEG, fileName, FREE_IMAGE_LOAD_FLAGS.JPEG_ACCURATE); - // dib = FreeImage.Load(FREE_IMAGE_FORMAT.FIF_JPEG, fileName, FREE_IMAGE_LOAD_FLAGS.JPEG_ACCURATE); - if (!dib.IsNull) - FreeImage.Unload(dib); - - // Loading a sample bitmap. In this case it's a .jpg file. 'Load' requires the file - // format or the loading process will fail. An additional flag (the default value is - // 'DEFAULT') can be set to enable special loading options. - dib = FreeImage.Load(FREE_IMAGE_FORMAT.FIF_JPEG, fileName, FREE_IMAGE_LOAD_FLAGS.JPEG_ACCURATE); - - // Check if the handle is null which means the bitmap could not be loaded. - if (dib.IsNull) - { - Console.WriteLine("Loading bitmap failed. Aborting."); - // Check whether there was an error message. - return; - } - - // Try flipping the bitmap. - if (!FreeImage.FlipHorizontal(dib)) - { - Console.WriteLine("Unable to flip bitmap."); - // Check whether there was an error message. - } - - // Store the bitmap back to disk. Again the desired format is needed. In this case the format is 'TIFF'. - // An output filename has to be chosen (which will be overwritten without a warning). - // A flag can be provided to enable pluginfunctions (compression is this case). - FreeImage.Save(FREE_IMAGE_FORMAT.FIF_TIFF, dib, outFileName, FREE_IMAGE_SAVE_FLAGS.TIFF_DEFLATE); - - // The bitmap was saved to disk but is still allocated in memory, so the handle has to be freed. - if (!dib.IsNull) - FreeImage.Unload(dib); - - // Make sure to set the handle to null so that it is clear that the handle is not pointing to a bitmap. - dib.SetNull(); - } - - public void Example02() - { - // 'UnloadEx' is a comfortable way of unloading a bitmap. The coder can call 'UnloadEx' even - // when the handle is pointing to null (in this case nothing will happen). In case the handle - // is valid (valid means that it is NOT pointing to null) the bitmap will be unloaded and the - // handle will be set to null manually. - FreeImage.UnloadEx(ref dib); - - // 'LoadEx' is a comfortable way of loading a bitmap. 'LoadEx' tries to find out the format of - // the file and will use this to load it. It will use DEFAULT loading values. - dib = FreeImage.LoadEx(fileName); - - // Check if the handle is null which means the bitmap could not be loaded. - if (dib.IsNull) - { - Console.WriteLine("Loading bitmap failed. Aborting."); - return; - } - - // 'SaveEx' (like 'LoadEx') will try to save the bitmap with default values. - // Before saving the bitmap, 'SaveEx' checks whether the extension is valid for the file type - // and if the plugin can use the colordepth of the bitmap. If not it will automatically convert - // the bitmap into the next best colordepth and save it. - if (!FreeImage.SaveEx(ref dib, @"Sample.gif", false)) - { - Console.WriteLine("Saving bitmap failed."); - } - - // The handle is still valid. - if (!FreeImage.SaveEx( - ref dib, - @"Sample", // No extension was selected so let 'SaveEx' decide. - FREE_IMAGE_FORMAT.FIF_PNG, // A format is needed this time. - FREE_IMAGE_SAVE_FLAGS.DEFAULT, // PNG has no options so use default. - FREE_IMAGE_COLOR_DEPTH.FICD_04_BPP, // 4bpp as result color depth. - true)) // We're done so unload - { - // SaveEx will not unload the bitmap in case saving failed. - // This way possible operations done to the bitmaps aren't lost. - FreeImage.UnloadEx(ref dib); - } - } - - public void Example03() - { - // Safely unload to prevent memory leak. - FreeImage.UnloadEx(ref dib); - - // Load the example bitmap. - dib = FreeImage.LoadEx(fileName); - - // Check whether loading succeeded. - if (dib.IsNull) - { - return; - } - - // Add this class to the callback event. - FreeImageEngine.Message += new OutputMessageFunction(FreeImage_Message); - - // Try to save the bitmap as a gif - if (!FreeImage.Save(FREE_IMAGE_FORMAT.FIF_GIF, dib, @"Sample_fail.gif", FREE_IMAGE_SAVE_FLAGS.DEFAULT)) - { - // Saving failed - // Check whether there was an error callback - if (message != null) - { - // Print the message and delete it. - Console.WriteLine("Error message recieved: {0}", message); - message = null; - } - } - - // Unload bitmap. - FreeImage.UnloadEx(ref dib); - - // Remove this class from the callback event. - FreeImageEngine.Message -= new OutputMessageFunction(FreeImage_Message); - } - - void FreeImage_Message(FREE_IMAGE_FORMAT fif, string message) - { - this.message = message; - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 01 - Loading and saving/Properties/AssemblyInfo.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 01 - Loading and saving/Properties/AssemblyInfo.cs deleted file mode 100644 index 0a5e51f..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 01 - Loading and saving/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("ac0569fe-c021-4f40-bfe9-275baf0fd21a")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 01 - Loading and saving/Sample 01 - Loading and saving.2005.csproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 01 - Loading and saving/Sample 01 - Loading and saving.2005.csproj deleted file mode 100644 index 451beb7..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 01 - Loading and saving/Sample 01 - Loading and saving.2005.csproj +++ /dev/null @@ -1,105 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {0D294AB6-FAD4-4364-AAB6-43C1796116A9} - Exe - Properties - Sample01 - Sample01 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - true - - - none - true - bin\Release\ - TRACE - prompt - 4 - false - true - - - true - bin\Debug\ - DEBUG;TRACE - true - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - true - - - x86 - false - prompt - - - true - bin\Debug\ - DEBUG;TRACE - true - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - true - - - x64 - false - prompt - - - - - - - - - - - - Always - - - - - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} - Library - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 01 - Loading and saving/Sample 01 - Loading and saving.csproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 01 - Loading and saving/Sample 01 - Loading and saving.csproj deleted file mode 100644 index b26a3cb..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 01 - Loading and saving/Sample 01 - Loading and saving.csproj +++ /dev/null @@ -1,110 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {0D294AB6-FAD4-4364-AAB6-43C1796116A9} - Exe - Properties - Sample01 - Sample01 - - - - - 2.0 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - true - - - none - true - bin\Release\ - TRACE - prompt - 4 - false - true - - - true - bin\Debug\ - DEBUG;TRACE - true - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - true - - - x86 - false - prompt - - - true - bin\Debug\ - DEBUG;TRACE - true - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - true - - - x64 - false - prompt - - - - - - - - - - - - Always - - - - - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} - Library - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 01 - Loading and saving/Sample.jpg b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 01 - Loading and saving/Sample.jpg deleted file mode 100644 index b537c00..0000000 Binary files a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 01 - Loading and saving/Sample.jpg and /dev/null differ diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 02 - Multipaged bitmaps/Program.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 02 - Multipaged bitmaps/Program.cs deleted file mode 100644 index 306cce0..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 02 - Multipaged bitmaps/Program.cs +++ /dev/null @@ -1,140 +0,0 @@ -using System; -using System.IO; -using FreeImageAPI; - -namespace Sample02 -{ - class Program - { - static void Main(string[] args) - { - // Check if FreeImage.dll is available (can be in %path%). - if (!FreeImage.IsAvailable()) - { - Console.WriteLine("FreeImage.dll seems to be missing. Aborting."); - return; - } - - Sample sample = new Sample(); - sample.Example(); - } - } - - public class Sample - { - const string fileName = @"multipaged.tif"; - FIMULTIBITMAP dib = new FIMULTIBITMAP(); - Random rand = new Random(); - - public void Example() - { - if (!File.Exists(fileName)) - { - Console.WriteLine("File not found. Aborting."); - return; - } - - // Load the multipaged bitmap. - // 'OpenMultiBitmapEx' tries to find the correct file format, loads the bitmap - // with default options, with write support and does not use caching. - dib = FreeImage.OpenMultiBitmapEx(fileName); - - // Check whether loading succeeded. - if (dib.IsNull) - { - Console.WriteLine("File could not be loaded. Aborting."); - return; - } - - // Get the number of bitmaps the multipaged bitmap contains. - int count = FreeImage.GetPageCount(dib); - - // Multipaged bitmaps consist of multiple single FIBITMAPs - FIBITMAP page = new FIBITMAP(); - - // There are bitmaps we can work with. - if (count > 0) - { - // Lock a random bitmap to work with. - page = FreeImage.LockPage(dib, rand.Next(0, count)); - } - - // Check whether locking succeeded. - if (page.IsNull) - { - // Locking failed. Unload the bitmap and return. - FreeImage.CloseMultiBitmapEx(ref dib); - return; - } - - // Get a list of locked pages. This can be usefull to check whether a page has already been locked. - int[] lockedPages = FreeImage.GetLockedPages(dib); - - // Lets modify the page. - if (FreeImage.AdjustGamma(page, 2d)) - { - Console.WriteLine("Successfully changed gamma of page {0}.", lockedPages[0]); - } - else - { - Console.WriteLine("Failed to adjust gamma ..."); - } - - // Print out the list of locked pages - foreach (int i in lockedPages) - Console.WriteLine("Page {0} is locked.", i); - - // Use 'UnlockPage' instead of 'Unload' to free the page. Set the third parameter to 'true' - // so that FreeImage can store the changed page within the multipaged bitmap. - FreeImage.UnlockPage(dib, page, true); - - // Retieve the list again to see whether unlocking succeeded. - lockedPages = FreeImage.GetLockedPages(dib); - - // No output should be produced here. - foreach (int i in lockedPages) - Console.WriteLine("Page {0} is still locked.", i); - - // If there are more than one page we can swap them - if (count > 1) - { - if (!FreeImage.MovePage(dib, 1, 0)) - { - Console.WriteLine("Swapping pages failed."); - } - } - - if (count > 2) - { - // Lock page 2 - page = FreeImage.LockPage(dib, 2); - if (!page.IsNull) - { - // Clone the page for later appending - FIBITMAP temp = FreeImage.Clone(page); - - // Unlock the page again - FreeImage.UnlockPage(dib, page, false); - - // Delete the page form the multipaged bitmap - FreeImage.DeletePage(dib, 2); - - // Append the clone again - FreeImage.AppendPage(dib, temp); - - // Check whether the number of pages is still the same - Console.WriteLine("Pages before: {0}. Pages after: {1}", count, FreeImage.GetPageCount(dib)); - - // Unload clone to prevent memory leak - FreeImage.UnloadEx(ref temp); - } - } - - // We are done and close the multipaged bitmap. - if (!FreeImage.CloseMultiBitmapEx(ref dib)) - { - Console.WriteLine("Closing bitmap failed!"); - } - } - } -} diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 02 - Multipaged bitmaps/Properties/AssemblyInfo.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 02 - Multipaged bitmaps/Properties/AssemblyInfo.cs deleted file mode 100644 index fc97675..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 02 - Multipaged bitmaps/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("35960522-c01a-40d2-a86b-37b9839b131c")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 02 - Multipaged bitmaps/Sample 02 - Multipaged bitmaps.2005.csproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 02 - Multipaged bitmaps/Sample 02 - Multipaged bitmaps.2005.csproj deleted file mode 100644 index f0b7f29..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 02 - Multipaged bitmaps/Sample 02 - Multipaged bitmaps.2005.csproj +++ /dev/null @@ -1,97 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B} - Exe - Properties - Sample02 - Sample02 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - none - true - bin\Release\ - TRACE - prompt - 4 - false - - - true - bin\Debug\ - DEBUG;TRACE - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - - - x86 - false - prompt - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - - - x64 - false - prompt - - - - - - - - - - - - Always - - - - - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} - Library - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 02 - Multipaged bitmaps/Sample 02 - Multipaged bitmaps.csproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 02 - Multipaged bitmaps/Sample 02 - Multipaged bitmaps.csproj deleted file mode 100644 index 23255a3..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 02 - Multipaged bitmaps/Sample 02 - Multipaged bitmaps.csproj +++ /dev/null @@ -1,102 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B} - Exe - Properties - Sample02 - Sample02 - - - 2.0 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - none - true - bin\Release\ - TRACE - prompt - 4 - false - - - true - bin\Debug\ - DEBUG;TRACE - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - - - x86 - false - prompt - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - - - x64 - false - prompt - - - - - - - - - - - - Always - - - - - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} - Library - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 02 - Multipaged bitmaps/multipaged.tif b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 02 - Multipaged bitmaps/multipaged.tif deleted file mode 100644 index 886a7c9..0000000 Binary files a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 02 - Multipaged bitmaps/multipaged.tif and /dev/null differ diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 03 - Allocating/Program.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 03 - Allocating/Program.cs deleted file mode 100644 index 50d3cde..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 03 - Allocating/Program.cs +++ /dev/null @@ -1,74 +0,0 @@ -using System; -using System.IO; -using FreeImageAPI; - -namespace Sample03 -{ - class Program - { - static void Main(string[] args) - { - // Check if FreeImage.dll is available (can be in %path%). - if (!FreeImage.IsAvailable()) - { - Console.WriteLine("FreeImage.dll seems to be missing. Aborting."); - return; - } - - // Add this class to the message event - FreeImageEngine.Message += new OutputMessageFunction(FreeImage_Message); - - Sample sample = new Sample(); - sample.Example(); - - // Remove this class from the message event - FreeImageEngine.Message -= new OutputMessageFunction(FreeImage_Message); - } - - static void FreeImage_Message(FREE_IMAGE_FORMAT fif, string message) - { - Console.WriteLine("Error for {0}: {1}", fif.ToString(), message); - } - } - - public class Sample - { - FIBITMAP dib = new FIBITMAP(); - - public void Example() - { - // Allocating a new bitmap with 99x99 pixels, 16-bit color depth and an allocation of 5 bits for each color. - dib = FreeImage.Allocate(99, 99, 16, FreeImage.FI16_555_RED_MASK, FreeImage.FI16_555_GREEN_MASK, FreeImage.FI16_555_BLUE_MASK); - - // Saving bitmap. - if (!FreeImage.SaveEx(ref dib, "example01.bmp", true)) - { - Console.WriteLine("Saving 'example.bmp' failed."); - FreeImage.UnloadEx(ref dib); - } - - // Allocation a new bitmap with 71x33 pixels, 4-bit color depth. Bitmaps below 16-bit have paletts. - // Each pixel references an index within the palette wich contains the true color. - // Therefor no bit-masks are needed and can be set to 0. - dib = FreeImage.Allocate(71, 33, 4, 0, 0, 0); - - // Saving bitmap. - if (!FreeImage.SaveEx(ref dib, "example02.tif", true)) - { - Console.WriteLine("Saving 'example02.tif' failed."); - FreeImage.UnloadEx(ref dib); - } - - // Allocation a new bitmap. This time 'AllocateT' is used because 'Allocate' can only create standard bitmaps. - // In this case a RGBF bitmap is created. Red, green and blue are represented by a float-value so no bit-masks are needed. - dib = FreeImage.AllocateT(FREE_IMAGE_TYPE.FIT_RGBF, 50, 75, 9, 0, 0, 0); - - // Saving bitmap. - if (!FreeImage.SaveEx(ref dib, "example03.hdr", true)) - { - Console.WriteLine("Saving 'example03.hdr' failed."); - FreeImage.UnloadEx(ref dib); - } - } - } -} diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 03 - Allocating/Properties/AssemblyInfo.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 03 - Allocating/Properties/AssemblyInfo.cs deleted file mode 100644 index 96b32c1..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 03 - Allocating/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("7139f1dc-3312-4c76-aeb3-891f869409b3")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 03 - Allocating/Sample 03 - Allocating.2005.csproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 03 - Allocating/Sample 03 - Allocating.2005.csproj deleted file mode 100644 index a836a07..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 03 - Allocating/Sample 03 - Allocating.2005.csproj +++ /dev/null @@ -1,91 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {A7E452A1-1A43-47C4-8BF3-DA28E1402FB9} - Exe - Properties - Sample03 - Sample03 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - none - true - bin\Release\ - TRACE - prompt - 4 - false - - - true - bin\Debug\ - DEBUG;TRACE - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - - - x86 - false - prompt - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - - - x64 - false - prompt - - - - - - - - - - - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} - Library - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 03 - Allocating/Sample 03 - Allocating.csproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 03 - Allocating/Sample 03 - Allocating.csproj deleted file mode 100644 index ae8324c..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 03 - Allocating/Sample 03 - Allocating.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {A7E452A1-1A43-47C4-8BF3-DA28E1402FB9} - Exe - Properties - Sample03 - Sample03 - - - 2.0 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - none - true - bin\Release\ - TRACE - prompt - 4 - false - - - true - bin\Debug\ - DEBUG;TRACE - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - - - x86 - false - prompt - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - - - x64 - false - prompt - - - - - - - - - - - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} - Library - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/MainForm.Designer.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/MainForm.Designer.cs deleted file mode 100644 index 9ddcf38..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/MainForm.Designer.cs +++ /dev/null @@ -1,205 +0,0 @@ -namespace Sample04 -{ - partial class MainForm - { - /// - /// Erforderliche Designervariable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Verwendete Ressourcen bereinigen. - /// - /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Vom Windows Form-Designer generierter Code - - /// - /// Erforderliche Methode für die Designerunterstützung. - /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. - /// - private void InitializeComponent() - { - this.ofd = new System.Windows.Forms.OpenFileDialog(); - this.bOpenFile = new System.Windows.Forms.Button(); - this.lWidth = new System.Windows.Forms.Label(); - this.lHeight = new System.Windows.Forms.Label(); - this.lBPP = new System.Windows.Forms.Label(); - this.lRedMask = new System.Windows.Forms.Label(); - this.lGreenMask = new System.Windows.Forms.Label(); - this.lBlueMask = new System.Windows.Forms.Label(); - this.lImageType = new System.Windows.Forms.Label(); - this.lDPIY = new System.Windows.Forms.Label(); - this.lDPIX = new System.Windows.Forms.Label(); - this.lFormat = new System.Windows.Forms.Label(); - this.lHeader = new System.Windows.Forms.Label(); - this.SuspendLayout(); - // - // ofd - // - this.ofd.Filter = "All files (*.*)|*.*"; - // - // bOpenFile - // - this.bOpenFile.Location = new System.Drawing.Point(12, 358); - this.bOpenFile.Name = "bOpenFile"; - this.bOpenFile.Size = new System.Drawing.Size(75, 23); - this.bOpenFile.TabIndex = 4; - this.bOpenFile.Text = "Open file"; - this.bOpenFile.UseVisualStyleBackColor = true; - this.bOpenFile.Click += new System.EventHandler(this.bOpenFile_Click); - // - // lWidth - // - this.lWidth.AutoSize = true; - this.lWidth.Location = new System.Drawing.Point(9, 51); - this.lWidth.Name = "lWidth"; - this.lWidth.Size = new System.Drawing.Size(46, 16); - this.lWidth.TabIndex = 0; - this.lWidth.Text = "Width:"; - // - // lHeight - // - this.lHeight.AutoSize = true; - this.lHeight.Location = new System.Drawing.Point(9, 76); - this.lHeight.Name = "lHeight"; - this.lHeight.Size = new System.Drawing.Size(53, 16); - this.lHeight.TabIndex = 1; - this.lHeight.Text = "Height: "; - // - // lBPP - // - this.lBPP.AutoSize = true; - this.lBPP.Location = new System.Drawing.Point(9, 101); - this.lBPP.Name = "lBPP"; - this.lBPP.Size = new System.Drawing.Size(80, 16); - this.lBPP.TabIndex = 2; - this.lBPP.Text = "Color Depth:"; - // - // lRedMask - // - this.lRedMask.AutoSize = true; - this.lRedMask.Location = new System.Drawing.Point(9, 129); - this.lRedMask.Name = "lRedMask"; - this.lRedMask.Size = new System.Drawing.Size(68, 16); - this.lRedMask.TabIndex = 3; - this.lRedMask.Text = "Red Mask:"; - // - // lGreenMask - // - this.lGreenMask.AutoSize = true; - this.lGreenMask.Location = new System.Drawing.Point(9, 188); - this.lGreenMask.Name = "lGreenMask"; - this.lGreenMask.Size = new System.Drawing.Size(80, 16); - this.lGreenMask.TabIndex = 5; - this.lGreenMask.Text = "Green Mask:"; - // - // lBlueMask - // - this.lBlueMask.AutoSize = true; - this.lBlueMask.Location = new System.Drawing.Point(9, 158); - this.lBlueMask.Name = "lBlueMask"; - this.lBlueMask.Size = new System.Drawing.Size(70, 16); - this.lBlueMask.TabIndex = 6; - this.lBlueMask.Text = "Blue Mask:"; - // - // lImageType - // - this.lImageType.AutoSize = true; - this.lImageType.Location = new System.Drawing.Point(9, 215); - this.lImageType.Name = "lImageType"; - this.lImageType.Size = new System.Drawing.Size(81, 16); - this.lImageType.TabIndex = 7; - this.lImageType.Text = "Image Type:"; - // - // lDPIY - // - this.lDPIY.AutoSize = true; - this.lDPIY.Location = new System.Drawing.Point(9, 244); - this.lDPIY.Name = "lDPIY"; - this.lDPIY.Size = new System.Drawing.Size(43, 16); - this.lDPIY.TabIndex = 8; - this.lDPIY.Text = "DPI Y:"; - // - // lDPIX - // - this.lDPIX.AutoSize = true; - this.lDPIX.Location = new System.Drawing.Point(9, 273); - this.lDPIX.Name = "lDPIX"; - this.lDPIX.Size = new System.Drawing.Size(44, 16); - this.lDPIX.TabIndex = 9; - this.lDPIX.Text = "DPI X:"; - // - // lFormat - // - this.lFormat.AutoSize = true; - this.lFormat.Location = new System.Drawing.Point(9, 302); - this.lFormat.Name = "lFormat"; - this.lFormat.Size = new System.Drawing.Size(78, 16); - this.lFormat.TabIndex = 10; - this.lFormat.Text = "File Format:"; - // - // lHeader - // - this.lHeader.AutoSize = true; - this.lHeader.Location = new System.Drawing.Point(117, 19); - this.lHeader.Name = "lHeader"; - this.lHeader.Size = new System.Drawing.Size(162, 16); - this.lHeader.TabIndex = 11; - this.lHeader.Text = "Bitmap-Information Viewer"; - // - // MainForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(400, 393); - this.Controls.Add(this.lHeader); - this.Controls.Add(this.lFormat); - this.Controls.Add(this.lDPIX); - this.Controls.Add(this.lDPIY); - this.Controls.Add(this.lImageType); - this.Controls.Add(this.lBlueMask); - this.Controls.Add(this.lGreenMask); - this.Controls.Add(this.bOpenFile); - this.Controls.Add(this.lRedMask); - this.Controls.Add(this.lBPP); - this.Controls.Add(this.lHeight); - this.Controls.Add(this.lWidth); - this.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "MainForm"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Sample04"; - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.OpenFileDialog ofd; - private System.Windows.Forms.Button bOpenFile; - private System.Windows.Forms.Label lWidth; - private System.Windows.Forms.Label lHeight; - private System.Windows.Forms.Label lBPP; - private System.Windows.Forms.Label lRedMask; - private System.Windows.Forms.Label lGreenMask; - private System.Windows.Forms.Label lBlueMask; - private System.Windows.Forms.Label lImageType; - private System.Windows.Forms.Label lDPIY; - private System.Windows.Forms.Label lDPIX; - private System.Windows.Forms.Label lFormat; - private System.Windows.Forms.Label lHeader; - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/MainForm.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/MainForm.cs deleted file mode 100644 index 21e7342..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/MainForm.cs +++ /dev/null @@ -1,120 +0,0 @@ -using System; -using System.Windows.Forms; -using FreeImageAPI; - -namespace Sample04 -{ - public partial class MainForm : Form - { - string message = null; - - [STAThread] - static void Main() - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new MainForm()); - } - - public MainForm() - { - InitializeComponent(); - FreeImageEngine.Message += new OutputMessageFunction(FreeImage_Message); - } - - ~MainForm() - { - FreeImageEngine.Message -= new OutputMessageFunction(FreeImage_Message); - } - - void FreeImage_Message(FREE_IMAGE_FORMAT fif, string message) - { - if (this.message == null) - { - this.message = message; - } - else - { - this.message += "\n" + message; - } - } - - private void bOpenFile_Click(object sender, EventArgs e) - { - // Resetting filename - ofd.FileName = ""; - - // Was a file selected - if (ofd.ShowDialog() == DialogResult.OK) - { - // Format is stored in 'format' on successfull load. - FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_UNKNOWN; - - // Try loading the file - FIBITMAP dib = FreeImage.LoadEx(ofd.FileName, ref format); - - try - { - // Error handling - if (dib.IsNull) - { - // Chech whether FreeImage generated an error messe - if (message != null) - { - MessageBox.Show("File could not be loaded!\nError:{0}", message); - } - else - { - MessageBox.Show("File could not be loaded!", message); - } - return; - } - - // Read width - lWidth.Text = String.Format("Width: {0}", FreeImage.GetWidth(dib)); - - // Read height - lHeight.Text = String.Format("Height: {0}", FreeImage.GetHeight(dib)); - - // Read color depth - lBPP.Text = String.Format("Color Depth: {0}", FreeImage.GetBPP(dib)); - - // Read red bitmask (16 - 32 bpp) - lRedMask.Text = String.Format("Red Mask: 0x{0:X8}", FreeImage.GetRedMask(dib)); - - // Read green bitmask (16 - 32 bpp) - lBlueMask.Text = String.Format("Green Mask: 0x{0:X8}", FreeImage.GetGreenMask(dib)); - - // Read blue bitmask (16 - 32 bpp) - lGreenMask.Text = String.Format("Blue Mask: 0x{0:X8}", FreeImage.GetBlueMask(dib)); - - // Read image type (FI_BITMAP, FIT_RGB16, FIT_COMPLEX ect) - lImageType.Text = String.Format("Image Type: {0}", FreeImage.GetImageType(dib)); - - // Read x-axis dpi - lDPIX.Text = String.Format("DPI X: {0}", FreeImage.GetResolutionX(dib)); - - // Read y-axis dpi - lDPIY.Text = String.Format("DPI Y: {0}", FreeImage.GetResolutionY(dib)); - - // Read file format - lFormat.Text = String.Format("File Format: {0}", FreeImage.GetFormatFromFIF(format)); - } - catch - { - } - - // Always unload bitmap - FreeImage.UnloadEx(ref dib); - - // Reset the error massage buffer - message = null; - } - // No file was selected - else - { - MessageBox.Show("No file loaded.", "Error"); - } - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/MainForm.resx b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/MainForm.resx deleted file mode 100644 index 63f7f57..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/MainForm.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/Properties/AssemblyInfo.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/Properties/AssemblyInfo.cs deleted file mode 100644 index eafebc8..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("7c8fdc9a-a8f9-4996-99c8-9df47513edeb")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/Sample 04 - Getting bitmap informations.2005.csproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/Sample 04 - Getting bitmap informations.2005.csproj deleted file mode 100644 index dcd7f10..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/Sample 04 - Getting bitmap informations.2005.csproj +++ /dev/null @@ -1,104 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A} - WinExe - Properties - Sample04 - Sample04 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - none - true - bin\Release\ - TRACE - prompt - 4 - false - - - true - bin\Debug\ - DEBUG;TRACE - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - - - x86 - false - prompt - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - - - x64 - false - prompt - - - - - - - - - Form - - - MainForm.cs - - - - - - Designer - MainForm.cs - - - - - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} - Library - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/Sample 04 - Getting bitmap informations.csproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/Sample 04 - Getting bitmap informations.csproj deleted file mode 100644 index 009f830..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/Sample 04 - Getting bitmap informations.csproj +++ /dev/null @@ -1,109 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A} - WinExe - Properties - Sample04 - Sample04 - - - 2.0 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - none - true - bin\Release\ - TRACE - prompt - 4 - false - - - true - bin\Debug\ - DEBUG;TRACE - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - - - x86 - false - prompt - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - - - x64 - false - prompt - - - - - - - - - Form - - - MainForm.cs - - - - - - Designer - MainForm.cs - - - - - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} - Library - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Program.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Program.cs deleted file mode 100644 index de6819f..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Program.cs +++ /dev/null @@ -1,213 +0,0 @@ -using System; -using FreeImageAPI; -using System.Drawing; - -namespace Sample05 -{ - class Program - { - static void Main(string[] args) - { - // Check if FreeImage.dll is available (can be in %path%). - if (!FreeImage.IsAvailable()) - { - Console.WriteLine("FreeImage.dll seems to be missing. Aborting."); - return; - } - - Sample sample = new Sample(); - - // The example will flip the bitmap by manually accessing the - // bitmaps scanlines and swapping them - sample.Example01(); - - // The example will access each pixel of the bitmap manually - // and change its color intensity to 3/4 of the original value - // which will have a darker bitmap as result. - sample.Example02(); - - // The example will access and swap the bitmaps palette from - // 'FIC_MINISBLACK' to 'FIC_MINISWHITE'. Then it will swap each pixels - // palette index so that each pixel is assigned to the its old value - // so that the bitmaps "pixeldata" stays the same. - sample.Example03(); - } - } - - public class Sample - { - FIBITMAP dib = new FIBITMAP(); - - public void Example01() - { - // Load sample file - dib = FreeImage.LoadEx("Sample.jpg", FREE_IMAGE_LOAD_FLAGS.JPEG_ACCURATE); - - // Check whether loading succeeded - if (dib.IsNull) - { - Console.WriteLine("Sample.jpg could not be loaded. Aborting."); - return; - } - - // Check whether the bitmap has 24 bpp color depth to ensure - // using RGBTRIPPLE is correct. - if (FreeImage.GetBPP(dib) != 24) - { - Console.WriteLine("Sample.jpg is no 24 bpp bitmap. Aborting."); - FreeImage.UnloadEx(ref dib); - return; - } - - // Store height of the bitmap - int height = (int)FreeImage.GetHeight(dib); - - // Iterate over half of the bitmaps scanlines and swap - // line[1] with line[height], line[2] with line[height-1] etc which will - // flip the image. - for (int i = 0; i < (height / 2); i++) - { - // Get scanline from the bottom part of the bitmap - Scanline scanlineBottom = new Scanline(dib, i); - - // Get scanline from the top part of the bitmap - Scanline scanlineTop = new Scanline(dib, height - 1 - i); - - // Get arrays of RGBTRIPPLEs that contain the bitmaps real pixel data - // of the two scanlines. - RGBTRIPLE[] rgbtBottom = scanlineBottom.Data; - RGBTRIPLE[] rgbtTop = scanlineTop.Data; - - // Restore the scanline across to switch the bitmaps lines. - scanlineBottom.Data = rgbtTop; - scanlineTop.Data = rgbtBottom; - } - - // Store the bitmap to disk - if (!FreeImage.SaveEx(ref dib, "SampleOut01.jpg", FREE_IMAGE_SAVE_FLAGS.JPEG_QUALITYGOOD, true)) - { - Console.WriteLine("Error while saving 'SampleOut01.jpg'"); - FreeImage.UnloadEx(ref dib); - } - } - - public void Example02() - { - dib = FreeImage.LoadEx("Sample.jpg", FREE_IMAGE_LOAD_FLAGS.JPEG_ACCURATE); - - // Check whether loading succeeded - if (dib.IsNull) - { - Console.WriteLine("Sample.jpg could not be loaded. Aborting."); - return; - } - - // Check whether the bitmap has 24 bpp color depth to ensure - // using RGBTRIPPLE is correct. - if (FreeImage.GetBPP(dib) != 24) - { - Console.WriteLine("Sample.jpg is no 24 bpp bitmap. Aborting."); - FreeImage.UnloadEx(ref dib); - return; - } - - // Iterate over all scanlines - for (int i = 0; i < FreeImage.GetHeight(dib); i++) - { - // Get scanline - Scanline scanline = new Scanline(dib, i); - - // Get pixeldata from scanline - RGBTRIPLE[] rgbt = scanline.Data; - - // Iterate over each pixel reducing the colors intensity to 3/4 which - // will darken the bitmap. - for (int j = 0; j < rgbt.Length; j++) - { - rgbt[j].rgbtBlue = (byte)((int)rgbt[j].rgbtBlue * 3 / 4); - rgbt[j].rgbtGreen = (byte)((int)rgbt[j].rgbtGreen * 3 / 4); - rgbt[j].rgbtRed = (byte)((int)rgbt[j].rgbtRed * 3 / 4); - - // In case no direct access to the data is implemented - // the following way is equivalent: - // - // Color color = rgbt[j].color; - // rgbt[j].color = Color.FromArgb(color.R * 3 / 4, color.G * 3 / 4, color.B * 3 / 4); - } - - // Write the darkened scanline back to memory - scanline.Data = rgbt; - } - - // Store the bitmap to disk - if (!FreeImage.SaveEx(ref dib, "SampleOut02.jpg", FREE_IMAGE_SAVE_FLAGS.JPEG_QUALITYGOOD, true)) - { - Console.WriteLine("Error while saving 'SampleOut02.jpg'"); - FreeImage.UnloadEx(ref dib); - } - } - - public void Example03() - { - dib = FreeImage.LoadEx("Sample.tif"); - - // Check whether loading succeeded - if (dib.IsNull) - { - Console.WriteLine("Sample.tif could not be loaded. Aborting."); - return; - } - - // Check whether the bitmap has 4 bpp color depth to ensure - // using FI4B is correct. - if (FreeImage.GetBPP(dib) != 4) - { - Console.WriteLine("Sample.tif is no 4 bpp bitmap. Aborting."); - FreeImage.UnloadEx(ref dib); - return; - } - - // Get the bitmaps palette - Palette palette = FreeImage.GetPaletteEx(dib); - - int size = (int)palette.Length; - - // Check whether the palette has a color (is valid) - if (size == 0) - { - Console.WriteLine("Sample.tif has no valid palette. Aborting."); - FreeImage.UnloadEx(ref dib); - return; - } - - // Swapping the palette - for (int i = 0; i < size / 2; i++) - { - RGBQUAD temp = palette[i]; - palette[i] = palette[size - 1 - i]; - palette[size - 1 - i] = temp; - } - - // Iterate over each scanline - for (int i = 0; i < FreeImage.GetHeight(dib); i++) - { - // Get scanline - Scanline scanline = new Scanline(dib, i); - - // Iterate over all pixels swapping the palette index - // so that the color will stay the same - for (int j = 0; j < scanline.Length; j++) - { - scanline[j] = (byte)(size - 1 - scanline[j]); - } - } - - // Save the bitmap to disk - if (!FreeImage.SaveEx(ref dib, "SampleOut03.tif", FREE_IMAGE_SAVE_FLAGS.TIFF_LZW, true)) - { - Console.WriteLine("Error while saving 'SampleOut03.tif'"); - FreeImage.UnloadEx(ref dib); - } - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Properties/AssemblyInfo.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Properties/AssemblyInfo.cs deleted file mode 100644 index 7dd2e1a..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("fd43331d-5ea4-40f8-86d5-8f820d606912")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Sample 05 - Working with pixels.2005.csproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Sample 05 - Working with pixels.2005.csproj deleted file mode 100644 index 6483373..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Sample 05 - Working with pixels.2005.csproj +++ /dev/null @@ -1,100 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {A501F134-8FB6-460B-AFE9-884A696C1C07} - Exe - Properties - Sample05 - Sample05 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - none - true - bin\Release\ - TRACE - prompt - 4 - false - - - true - bin\Debug\ - DEBUG;TRACE - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - - - x86 - false - prompt - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - - - x64 - false - prompt - - - - - - - - - - - - Always - - - Always - - - - - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} - Library - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Sample 05 - Working with pixels.csproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Sample 05 - Working with pixels.csproj deleted file mode 100644 index b5a9d36..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Sample 05 - Working with pixels.csproj +++ /dev/null @@ -1,105 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {A501F134-8FB6-460B-AFE9-884A696C1C07} - Exe - Properties - Sample05 - Sample05 - - - 2.0 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - none - true - bin\Release\ - TRACE - prompt - 4 - false - - - true - bin\Debug\ - DEBUG;TRACE - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - - - x86 - false - prompt - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - - - x64 - false - prompt - - - - - - - - - - - - Always - - - Always - - - - - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} - Library - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Sample.jpg b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Sample.jpg deleted file mode 100644 index df1918c..0000000 Binary files a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Sample.jpg and /dev/null differ diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Sample.tif b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Sample.tif deleted file mode 100644 index 7b37c6b..0000000 Binary files a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Sample.tif and /dev/null differ diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/MainForm.Designer.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/MainForm.Designer.cs deleted file mode 100644 index fd131e6..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/MainForm.Designer.cs +++ /dev/null @@ -1,120 +0,0 @@ -namespace Sample06 -{ - partial class MainForm - { - /// - /// Erforderliche Designervariable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Verwendete Ressourcen bereinigen. - /// - /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Vom Windows Form-Designer generierter Code - - /// - /// Erforderliche Methode für die Designerunterstützung. - /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. - /// - private void InitializeComponent() - { - this.picBox = new System.Windows.Forms.PictureBox(); - this.bExample01 = new System.Windows.Forms.Button(); - this.bOriginal = new System.Windows.Forms.Button(); - this.bExample02 = new System.Windows.Forms.Button(); - this.bExample03 = new System.Windows.Forms.Button(); - ((System.ComponentModel.ISupportInitialize)(this.picBox)).BeginInit(); - this.SuspendLayout(); - // - // picBox - // - this.picBox.BackColor = System.Drawing.Color.White; - this.picBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.picBox.Location = new System.Drawing.Point(12, 12); - this.picBox.Name = "picBox"; - this.picBox.Size = new System.Drawing.Size(747, 465); - this.picBox.TabIndex = 0; - this.picBox.TabStop = false; - // - // bExample01 - // - this.bExample01.Location = new System.Drawing.Point(93, 483); - this.bExample01.Name = "bExample01"; - this.bExample01.Size = new System.Drawing.Size(88, 23); - this.bExample01.TabIndex = 1; - this.bExample01.Text = "Example 01"; - this.bExample01.UseVisualStyleBackColor = true; - this.bExample01.Click += new System.EventHandler(this.bExample01_Click); - // - // bOriginal - // - this.bOriginal.Location = new System.Drawing.Point(12, 483); - this.bOriginal.Name = "bOriginal"; - this.bOriginal.Size = new System.Drawing.Size(75, 23); - this.bOriginal.TabIndex = 2; - this.bOriginal.Text = "Original"; - this.bOriginal.UseVisualStyleBackColor = true; - this.bOriginal.Click += new System.EventHandler(this.bOriginal_Click); - // - // bExample02 - // - this.bExample02.Location = new System.Drawing.Point(187, 483); - this.bExample02.Name = "bExample02"; - this.bExample02.Size = new System.Drawing.Size(88, 23); - this.bExample02.TabIndex = 3; - this.bExample02.Text = "Example 02"; - this.bExample02.UseVisualStyleBackColor = true; - this.bExample02.Click += new System.EventHandler(this.bExample02_Click); - // - // bExample03 - // - this.bExample03.Location = new System.Drawing.Point(281, 483); - this.bExample03.Name = "bExample03"; - this.bExample03.Size = new System.Drawing.Size(88, 23); - this.bExample03.TabIndex = 4; - this.bExample03.Text = "Example 03"; - this.bExample03.UseVisualStyleBackColor = true; - this.bExample03.Click += new System.EventHandler(this.bExample03_Click); - // - // MainForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(771, 518); - this.Controls.Add(this.bExample03); - this.Controls.Add(this.bExample02); - this.Controls.Add(this.bOriginal); - this.Controls.Add(this.bExample01); - this.Controls.Add(this.picBox); - this.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "MainForm"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Sample06"; - ((System.ComponentModel.ISupportInitialize)(this.picBox)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.PictureBox picBox; - private System.Windows.Forms.Button bExample01; - private System.Windows.Forms.Button bOriginal; - private System.Windows.Forms.Button bExample02; - private System.Windows.Forms.Button bExample03; - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/MainForm.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/MainForm.cs deleted file mode 100644 index 125b9c3..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/MainForm.cs +++ /dev/null @@ -1,177 +0,0 @@ -using System; -using System.Drawing; -using System.Windows.Forms; -using FreeImageAPI; -using System.Drawing.Imaging; - -namespace Sample06 -{ - public partial class MainForm : Form - { - [STAThread] - static void Main() - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new MainForm()); - } - - public MainForm() - { - InitializeComponent(); - } - - private void bExample01_Click(object sender, EventArgs e) - { - // Load bitmap - FIBITMAP dib = FreeImage.LoadEx("Sample.jpg"); - - // Check success - if (dib.IsNull) - { - MessageBox.Show("Could not load Sample.jpg", "Error"); - return; - } - - // Check whether bitmap is 24-bit - if (FreeImage.GetBPP(dib) != 24) - { - MessageBox.Show("Sample.jpg is not 24-bit.", "Error"); - FreeImage.UnloadEx(ref dib); - return; - } - - // Convert the 24-bit bitmap to 8-bit and forcing the result will be greyscale - dib = FreeImage.ConvertColorDepth(dib, FREE_IMAGE_COLOR_DEPTH.FICD_08_BPP | FREE_IMAGE_COLOR_DEPTH.FICD_FORCE_GREYSCALE, true); - - if (FreeImage.GetBPP(dib) == 8) - { - // Convert the FreeImage-Bitmap into a .NET bitmap - Bitmap bitmap = FreeImage.GetBitmap(dib); - - // Dispose the bitmap of the pictureBox - if (picBox.Image != null) - { - picBox.Image.Dispose(); - } - - // Assign the bitmap to the picturebox - picBox.Image = bitmap; - } - - // Unload source bitmap - FreeImage.UnloadEx(ref dib); - } - - private void bOriginal_Click(object sender, EventArgs e) - { - // Load bitmap - FIBITMAP dib = FreeImage.LoadEx("Sample.jpg"); - - // Check success - if (dib.IsNull) - { - MessageBox.Show("Could not load Sample.jpg", "Error"); - return; - } - - // Convert the FreeImage-Bitmap into a .NET bitmap - Bitmap bitmap = FreeImage.GetBitmap(dib); - - // Check success - if (bitmap != null) - { - // Dispose old bitmap - if (picBox.Image != null) - { - picBox.Image.Dispose(); - } - - // Assign new bitmap - picBox.Image = bitmap; - } - - // Unload bitmap - FreeImage.UnloadEx(ref dib); - } - - private void bExample02_Click(object sender, EventArgs e) - { - FIBITMAP dib = FreeImage.LoadEx("Sample.jpg"); - - // Check success - if (dib.IsNull) - { - MessageBox.Show("Could not load Sample.jpg", "Error"); - return; - } - - // Convert bitmap to 8 bit - dib = FreeImage.ConvertColorDepth(dib, FREE_IMAGE_COLOR_DEPTH.FICD_08_BPP, true); - - // Check whether conversion succeeded - if (FreeImage.GetBPP(dib) != 8) - { - MessageBox.Show("Converting Sample.jpg to 8-bit failed.", "Error"); - FreeImage.UnloadEx(ref dib); - return; - } - - // Convert the FreeImage-Bitmap into a .NET bitmap - Bitmap bitmap = FreeImage.GetBitmap(dib); - - // Dispose old bitmap - if (picBox.Image != null) - { - picBox.Image.Dispose(); - } - - // Assign new bitmap - picBox.Image = bitmap; - - // Unload bitmap - FreeImage.UnloadEx(ref dib); - } - - private void bExample03_Click(object sender, EventArgs e) - { - // Load bitmap - Bitmap bitmap = (Bitmap)Bitmap.FromFile("Sample.jpg"); - - // Convert the .NET bitmap into a FreeImage-Bitmap - FIBITMAP dib = FreeImage.CreateFromBitmap(bitmap); - - // Unload bitmap - bitmap.Dispose(); - - // Rescale the bitmap - FIBITMAP temp = FreeImage.Rescale(dib, 300, 300, FREE_IMAGE_FILTER.FILTER_BICUBIC); - - // Unload bitmap - FreeImage.UnloadEx(ref dib); - - Random rand = new Random(); - - // Rotate the bitmap - dib = FreeImage.Rotate(temp, rand.NextDouble() * 360d); - - // Unload bitmap - FreeImage.UnloadEx(ref temp); - - // Convert the FreeImage-Bitmap into a .NET bitmap - bitmap = FreeImage.GetBitmap(dib); - - // Unload bitmap - FreeImage.UnloadEx(ref dib); - - // Unload bitmap - if (picBox.Image != null) - { - picBox.Image.Dispose(); - } - - // Assign new bitmap - picBox.Image = bitmap; - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/MainForm.resx b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/MainForm.resx deleted file mode 100644 index ff31a6d..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/MainForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/Properties/AssemblyInfo.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/Properties/AssemblyInfo.cs deleted file mode 100644 index 18e8904..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("69a8cbdd-43da-49e3-8d0b-2680c4ca2851")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/Sample 06 - Converting.2005.csproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/Sample 06 - Converting.2005.csproj deleted file mode 100644 index df1703b..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/Sample 06 - Converting.2005.csproj +++ /dev/null @@ -1,109 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {E2EA945D-E22C-47B3-9DD9-3A0B07FA3F81} - WinExe - Properties - Sample06 - Sample06 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - none - true - bin\Release\ - TRACE - prompt - 4 - false - - - true - bin\Debug\ - DEBUG;TRACE - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - - - x86 - false - prompt - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - - - x64 - false - prompt - - - - - - - - - Form - - - MainForm.cs - - - - - - Designer - MainForm.cs - - - - - Always - - - - - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} - Library - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/Sample 06 - Converting.csproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/Sample 06 - Converting.csproj deleted file mode 100644 index 1ff53b4..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/Sample 06 - Converting.csproj +++ /dev/null @@ -1,114 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {E2EA945D-E22C-47B3-9DD9-3A0B07FA3F81} - WinExe - Properties - Sample06 - Sample06 - - - 2.0 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - none - true - bin\Release\ - TRACE - prompt - 4 - false - - - true - bin\Debug\ - DEBUG;TRACE - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - - - x86 - false - prompt - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - - - x64 - false - prompt - - - - - - - - - Form - - - MainForm.cs - - - - - - Designer - MainForm.cs - - - - - Always - - - - - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} - Library - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/Sample.jpg b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/Sample.jpg deleted file mode 100644 index b537c00..0000000 Binary files a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/Sample.jpg and /dev/null differ diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 07 - ICC Profiles/Program.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 07 - ICC Profiles/Program.cs deleted file mode 100644 index 1b1732f..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 07 - ICC Profiles/Program.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System; -using System.Collections.Generic; -using FreeImageAPI; - -namespace Sample07 -{ - class Program - { - static void Main(string[] args) - { - // Check if FreeImage.dll is available (can be in %path%). - if (!FreeImage.IsAvailable()) - { - Console.WriteLine("FreeImage.dll seems to be missing. Aborting."); - return; - } - - Sample sample = new Sample(); - // This example shows how to work with ICC-Profiles. - sample.Example(); - } - } - - public class Sample - { - public void Example() - { - // Load the sample bitmap. - FIBITMAP dib = FreeImage.LoadEx("Sample.jpg"); - - // Check success - if (dib.IsNull) - { - Console.WriteLine("Sample.jpg could not be loaded. Aborting."); - return; - } - - // Get the bitmaps ICC-Profile. - FIICCPROFILE icc = FreeImage.GetICCProfileEx(dib); - - // Print the profiles address. - Console.WriteLine("The profiles memory-address is : 0x{0}", icc.DataPointer.ToString("X")); - - // Print the profiles size - Console.WriteLine("The profiles size is : {0} bytes", icc.Size); - - // Create data for a new profile. - byte[] data = new byte[256]; - for (int i = 0; i < data.Length; i++) - data[i] = (byte)i; - - // Create the new profile - icc = new FIICCPROFILE(dib, data); - - Console.WriteLine("The profiles memory-address is : 0x{0}", icc.DataPointer.ToString("X")); - Console.WriteLine("The profiles size is : {0} bytes", icc.Size); - - // Create the new profile but only use the first 64 bytes - icc = new FIICCPROFILE(dib, data, 64); - - Console.WriteLine("The profiles memory-address is : 0x{0}", icc.DataPointer.ToString("X")); - Console.WriteLine("The profiles size is : {0} bytes", icc.Size); - - // CreateICCProfileEx(...) does the same as above - icc = FreeImage.CreateICCProfileEx(dib, data, 16); - - Console.WriteLine("The profiles memory-address is : 0x{0}", icc.DataPointer.ToString("X")); - Console.WriteLine("The profiles size is : {0} bytes", icc.Size); - - FreeImage.UnloadEx(ref dib); - } - } -} diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 07 - ICC Profiles/Properties/AssemblyInfo.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 07 - ICC Profiles/Properties/AssemblyInfo.cs deleted file mode 100644 index d7f3a03..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 07 - ICC Profiles/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("c9991d1d-684a-4736-b088-369a216b35b6")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 07 - ICC Profiles/Sample 07 - ICC Profiles.2005.csproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 07 - ICC Profiles/Sample 07 - ICC Profiles.2005.csproj deleted file mode 100644 index ba97bbe..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 07 - ICC Profiles/Sample 07 - ICC Profiles.2005.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {3B1BB976-64A7-41FD-B7E2-59104161AF7E} - Exe - Properties - Sample07 - Sample07 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - none - true - bin\Release\ - TRACE - prompt - 4 - false - - - true - bin\Debug\ - DEBUG;TRACE - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - - - x86 - false - prompt - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - - - x64 - false - prompt - - - - - - - - - - - Always - - - - - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} - Library - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 07 - ICC Profiles/Sample 07 - ICC Profiles.csproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 07 - ICC Profiles/Sample 07 - ICC Profiles.csproj deleted file mode 100644 index 02a824f..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 07 - ICC Profiles/Sample 07 - ICC Profiles.csproj +++ /dev/null @@ -1,101 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {3B1BB976-64A7-41FD-B7E2-59104161AF7E} - Exe - Properties - Sample07 - Sample07 - - - 2.0 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - none - true - bin\Release\ - TRACE - prompt - 4 - false - - - true - bin\Debug\ - DEBUG;TRACE - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - - - x86 - false - prompt - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - - - x64 - false - prompt - - - - - - - - - - - Always - - - - - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} - Library - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 07 - ICC Profiles/Sample.jpg b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 07 - ICC Profiles/Sample.jpg deleted file mode 100644 index c9e425d..0000000 Binary files a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 07 - ICC Profiles/Sample.jpg and /dev/null differ diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/Properties/AssemblyInfo.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/Properties/AssemblyInfo.cs deleted file mode 100644 index 2db8f57..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("dc891ffc-ab5c-451f-97da-2c0d5d90edcc")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/Sample 08 - Creating a plugin.2005.csproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/Sample 08 - Creating a plugin.2005.csproj deleted file mode 100644 index 763a8e5..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/Sample 08 - Creating a plugin.2005.csproj +++ /dev/null @@ -1,110 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {491042DB-495B-420C-A3BE-5D13019707C5} - WinExe - Properties - Sample08 - Sample08 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - none - true - bin\Release\ - TRACE - prompt - 4 - false - - - true - bin\Debug\ - DEBUG;TRACE - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - - - x86 - false - prompt - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - - - x64 - false - prompt - - - - - - - - - - Form - - - SampleForm.cs - - - - - - Always - - - - - SampleForm.cs - Designer - - - - - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} - Library - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/Sample 08 - Creating a plugin.csproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/Sample 08 - Creating a plugin.csproj deleted file mode 100644 index 83039d4..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/Sample 08 - Creating a plugin.csproj +++ /dev/null @@ -1,115 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {491042DB-495B-420C-A3BE-5D13019707C5} - WinExe - Properties - Sample08 - Sample08 - - - 2.0 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - none - true - bin\Release\ - TRACE - prompt - 4 - false - - - true - bin\Debug\ - DEBUG;TRACE - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - - - x86 - false - prompt - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - - - x64 - false - prompt - - - - - - - - - - Form - - - SampleForm.cs - - - - - - Always - - - - - SampleForm.cs - Designer - - - - - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} - Library - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/Sample.jpg b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/Sample.jpg deleted file mode 100644 index b537c00..0000000 Binary files a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/Sample.jpg and /dev/null differ diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/SampleForm.Designer.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/SampleForm.Designer.cs deleted file mode 100644 index 4eafbae..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/SampleForm.Designer.cs +++ /dev/null @@ -1,119 +0,0 @@ -namespace Sample08 -{ - partial class SampleForm - { - /// - /// Erforderliche Designervariable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Verwendete Ressourcen bereinigen. - /// - /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Vom Windows Form-Designer generierter Code - - /// - /// Erforderliche Methode für die Designerunterstützung. - /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. - /// - private void InitializeComponent() - { - this.pictureBox = new System.Windows.Forms.PictureBox(); - this.bLoad = new System.Windows.Forms.Button(); - this.SaveToSer = new System.Windows.Forms.Button(); - this.LoadSerBitmap = new System.Windows.Forms.Button(); - this.bClearBitmap = new System.Windows.Forms.Button(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); - this.SuspendLayout(); - // - // pictureBox - // - this.pictureBox.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.pictureBox.Location = new System.Drawing.Point(12, 12); - this.pictureBox.Name = "pictureBox"; - this.pictureBox.Size = new System.Drawing.Size(600, 400); - this.pictureBox.TabIndex = 0; - this.pictureBox.TabStop = false; - // - // bLoad - // - this.bLoad.Location = new System.Drawing.Point(12, 418); - this.bLoad.Name = "bLoad"; - this.bLoad.Size = new System.Drawing.Size(98, 23); - this.bLoad.TabIndex = 1; - this.bLoad.Text = "Load any bitmap"; - this.bLoad.UseVisualStyleBackColor = true; - this.bLoad.Click += new System.EventHandler(this.bLoad_Click); - // - // SaveToSer - // - this.SaveToSer.Location = new System.Drawing.Point(324, 418); - this.SaveToSer.Name = "SaveToSer"; - this.SaveToSer.Size = new System.Drawing.Size(98, 23); - this.SaveToSer.TabIndex = 2; - this.SaveToSer.Text = "Save as .ser"; - this.SaveToSer.UseVisualStyleBackColor = true; - this.SaveToSer.Click += new System.EventHandler(this.SaveToSer_Click); - // - // LoadSerBitmap - // - this.LoadSerBitmap.Location = new System.Drawing.Point(220, 418); - this.LoadSerBitmap.Name = "LoadSerBitmap"; - this.LoadSerBitmap.Size = new System.Drawing.Size(98, 23); - this.LoadSerBitmap.TabIndex = 3; - this.LoadSerBitmap.Text = "Load .ser bitmap"; - this.LoadSerBitmap.UseVisualStyleBackColor = true; - this.LoadSerBitmap.Click += new System.EventHandler(this.LoadSerBitmap_Click); - // - // bClearBitmap - // - this.bClearBitmap.Location = new System.Drawing.Point(116, 418); - this.bClearBitmap.Name = "bClearBitmap"; - this.bClearBitmap.Size = new System.Drawing.Size(98, 23); - this.bClearBitmap.TabIndex = 4; - this.bClearBitmap.Text = "Clear screen"; - this.bClearBitmap.UseVisualStyleBackColor = true; - this.bClearBitmap.Click += new System.EventHandler(this.bClearBitmap_Click); - // - // SampleForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(627, 448); - this.Controls.Add(this.bClearBitmap); - this.Controls.Add(this.LoadSerBitmap); - this.Controls.Add(this.SaveToSer); - this.Controls.Add(this.bLoad); - this.Controls.Add(this.pictureBox); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "SampleForm"; - this.ShowIcon = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Sample 08"; - ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.PictureBox pictureBox; - private System.Windows.Forms.Button bLoad; - private System.Windows.Forms.Button SaveToSer; - private System.Windows.Forms.Button LoadSerBitmap; - private System.Windows.Forms.Button bClearBitmap; - } -} - diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/SampleForm.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/SampleForm.cs deleted file mode 100644 index 2551f0e..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/SampleForm.cs +++ /dev/null @@ -1,217 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Text; -using System.Windows.Forms; -using FreeImageAPI; -using System.Runtime.InteropServices; -using System.Security.Permissions; - -namespace Sample08 -{ - public partial class SampleForm : Form - { - SerializationPlugin serialPlugin; - - [STAThread] - static void Main() - { - // Check if FreeImage is available - if (!FreeImage.IsAvailable()) - { - throw new Exception("FreeImage is not available!"); - } - - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new SampleForm()); - } - - public SampleForm() - { - InitializeComponent(); - FreeImageEngine.Message += new OutputMessageFunction(FreeImage_Message); - - // Creating a new instance of the plugin will register it automatically. - serialPlugin = new SerializationPlugin(); - } - - void FreeImage_Message(FREE_IMAGE_FORMAT fif, string message) - { - // Show the message - MessageBox.Show(String.Format("Format: {0}\nMessage: {1}", fif, message), "FreeImage Message"); - } - - private void bLoad_Click(object sender, EventArgs e) - { - // Create a new dialog instance - OpenFileDialog ofd = new OpenFileDialog(); - try - { - // Apply settings - ofd.CheckPathExists = true; - ofd.CheckFileExists = true; - ofd.RestoreDirectory = true; - ofd.Filter = "All files (*.*)|*.*"; - - // Get filename - if (ofd.ShowDialog(this) == DialogResult.OK) - { - Bitmap bitmap = null; - try - { - // Try loading the selected file - // a ser-file will create an exception - bitmap = (Bitmap)Bitmap.FromFile(ofd.FileName); - } - catch - { - MessageBox.Show("Unable to load bitmap from file.", "Error"); - return; - } - - // Unload old bitmap - if (pictureBox.Image != null) - { - pictureBox.Image.Dispose(); - } - - // Set new bitmap - pictureBox.Image = bitmap; - MessageBox.Show("Bitmap loaded successfully", "Success"); - } - else - { - MessageBox.Show("Action aborted."); - } - } - finally - { - // Unload dialog - ofd.Dispose(); - } - } - - private void LoadSerBitmap_Click(object sender, EventArgs e) - { - // Creat a new dialog - OpenFileDialog ofd = new OpenFileDialog(); - - FIBITMAP dib = new FIBITMAP(); - try - { - // Apply settings - ofd.CheckPathExists = true; - ofd.CheckFileExists = true; - ofd.RestoreDirectory = true; - ofd.Filter = "Serialized bitmap (*.ser)|*.ser"; - - // Get filename - if (ofd.ShowDialog() == DialogResult.OK) - { - // Try loading the file forcing the new format - dib = FreeImage.Load(serialPlugin.Format, ofd.FileName, FREE_IMAGE_LOAD_FLAGS.DEFAULT); - if (dib.IsNull) - { - MessageBox.Show("Loading bitmap failed", "Error"); - return; - } - - // Convert the loaded bitmap into a .NET bitmap - Bitmap bitmap = FreeImage.GetBitmap(dib); - if (bitmap == null) - { - MessageBox.Show("Converting bitmap failed.", "Error"); - return; - } - - // Unload the picturebox - if (pictureBox.Image != null) - { - pictureBox.Image.Dispose(); - } - - // Apply the loaded bitmap - pictureBox.Image = bitmap; - MessageBox.Show("Bitmap loaded successfully", "Success"); - } - else - { - MessageBox.Show("Action aborted."); - } - } - finally - { - // Unload bitmap - FreeImage.UnloadEx(ref dib); - - // Unload dialog - ofd.Dispose(); - } - } - - private void SaveToSer_Click(object sender, EventArgs e) - { - // Create a new dialog - SaveFileDialog sfd = new SaveFileDialog(); - - FIBITMAP dib = new FIBITMAP(); - try - { - // Check if the picture box contains a bitmap that can be saved. - if (pictureBox.Image == null) - { - MessageBox.Show("No bitmap loaded.", "Error"); - return; - } - - // Convert the picture-boxes bitmap into a FreeImage bitmap. - dib = FreeImage.CreateFromBitmap((Bitmap)pictureBox.Image); - if (dib.IsNull) - { - MessageBox.Show("Unable to convert bitmap to FIBITMAP.", "Error"); - return; - } - - // Apply settings - sfd.Filter = "Serialized bitmap (*.ser)|*.ser"; - sfd.FileName = "Bitmap.ser"; - sfd.OverwritePrompt = true; - sfd.RestoreDirectory = true; - - // Get filename - if (sfd.ShowDialog() == DialogResult.OK) - { - // Save bitmap in the new format - if (FreeImage.SaveEx(dib, sfd.FileName, serialPlugin.Format)) - MessageBox.Show("Bitmap saved successfully.", "Success"); - else - MessageBox.Show("Saving bitmap failed.", "Failure"); - } - else - { - MessageBox.Show("Action aborted."); - } - } - finally - { - // Unload bitmap - FreeImage.UnloadEx(ref dib); - - // Unload dialog - sfd.Dispose(); - } - } - - private void bClearBitmap_Click(object sender, EventArgs e) - { - // Unload the picture-box - if (pictureBox.Image != null) - { - pictureBox.Image.Dispose(); - pictureBox.Image = null; - } - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/SampleForm.resx b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/SampleForm.resx deleted file mode 100644 index ff31a6d..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/SampleForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/SerializationPlugin.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/SerializationPlugin.cs deleted file mode 100644 index 96043e0..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/SerializationPlugin.cs +++ /dev/null @@ -1,222 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Runtime.InteropServices; -using System.Runtime.Serialization.Formatters.Binary; -using System.IO; -using System.IO.Compression; -using FreeImageAPI; -using FreeImageAPI.IO; -using FreeImageAPI.Plugins; - -namespace Sample08 -{ - public sealed class SerializationPlugin : LocalPlugin - { - // Header for the file - private byte[] header = new byte[] { 0xff, 0x12, 0x0f, 0xff, 0x01, 0x00 }; - - // Structure that will store all bitmap data. - [Serializable] - private struct SerialDib - { - public uint width; - public uint height; - public int pitch; - public uint bpp; - public uint red_mask; - public uint green_mask; - public uint blue_mask; - public byte[] data; - } - - // Implementation of 'GetImplementedMethods()' - // All implemented methods are listed. - protected override LocalPlugin.MethodFlags GetImplementedMethods() - { - return - MethodFlags.DescriptionProc | - MethodFlags.SupportsExportBPPProc | - MethodFlags.SupportsExportTypeProc | - MethodFlags.SupportsICCProfilesProc | - MethodFlags.LoadProc | - MethodFlags.SaveProc | - MethodFlags.ValidateProc | - MethodFlags.ExtensionListProc; - } - - // Returns a format string. - protected override string FormatProc() - { - return "Serialization"; - } - - // Returns a more specific description - protected override string DescriptionProc() - { - return "Serializes bitmaps for .NET"; - } - - // Returns whether a color depth is supported. - protected override bool SupportsExportBPPProc(int bpp) - { - return ((bpp == 1) || - (bpp == 4) || - (bpp == 8) || - (bpp == 16) || - (bpp == 24) || - (bpp == 32)); - } - - // This plugin can only export standard bitmaps - protected override bool SupportsExportTypeProc(FREE_IMAGE_TYPE type) - { - return (type == FREE_IMAGE_TYPE.FIT_BITMAP); - } - - // This plugin does not support icc profiles - protected override bool SupportsICCProfilesProc() - { - return false; - } - - // The function reads the first bytes of the file and compares it - // with the predefined header. - protected override bool ValidateProc(ref FreeImageIO io, fi_handle handle) - { - for (int i = 0; i < header.Length; i++) - if (ReadByte(io, handle) != header[i]) - return false; - return true; - } - - // Loading function - protected override FIBITMAP LoadProc(ref FreeImageIO io, fi_handle handle, int page, int flags, IntPtr data) - { - // Check if the data has the correct format - if (!ValidateProc(ref io, handle)) - { - // Create a free-image message - FreeImage.OutputMessageProc(format, "Invalid format."); - // return 0 (operation failed) - return FIBITMAP.Zero; - } - - SerialDib sdib; - int read = 0; - System.IO.MemoryStream stream = new System.IO.MemoryStream(); - byte[] buffer = new byte[1024]; - - do - { - // Use the helper function 'Read' to read from the source - read = Read(io, handle, 1, 1024, ref buffer); - - // Store the data in a temporary buffer - stream.Write(buffer, 0, read); - } - while (read != 0); - - // Set the memory stream back to the beginning. - stream.Position = 0; - - // Unzip the stream - GZipStream zipStream = new GZipStream(stream, CompressionMode.Decompress); - - // Create a serializer - BinaryFormatter formatter = new BinaryFormatter(); - - // Deserialize the stream - sdib = (SerialDib)formatter.Deserialize(zipStream); - - // Unload the stream - zipStream.Dispose(); - - // Use 'ConvertFromRawBits and the deserialized struct to recreate the bitmap - // In this case the marshaller is used to create the needed IntPtr to the data - // array. - FIBITMAP dib = FreeImage.ConvertFromRawBits( - Marshal.UnsafeAddrOfPinnedArrayElement(sdib.data, 0), - (int)sdib.width, (int)sdib.height, sdib.pitch, sdib.bpp, - sdib.red_mask, sdib.green_mask, sdib.blue_mask, - false); - - // Unload the temporary stream - stream.Dispose(); - - // Return the created bitmap - return dib; - } - - // Saving function - protected override bool SaveProc(ref FreeImageIO io, FIBITMAP dib, fi_handle handle, int page, int flags, IntPtr data) - { - SerialDib sdib; - uint size = FreeImage.GetDIBSize(dib); - - // Store all data needed to recreate the bitmap - sdib.width = FreeImage.GetWidth(dib); - sdib.height = FreeImage.GetHeight(dib); - sdib.pitch = (int)FreeImage.GetPitch(dib); - sdib.bpp = FreeImage.GetBPP(dib); - sdib.red_mask = FreeImage.GetRedMask(dib); - sdib.green_mask = FreeImage.GetGreenMask(dib); - sdib.blue_mask = FreeImage.GetBlueMask(dib); - sdib.data = new byte[size]; - - // Copy the bitmaps data into the structures byte-array - // The marshaller is used to create an IntPtr for using - // 'ConvertToRawBits'. - FreeImage.ConvertToRawBits(Marshal.UnsafeAddrOfPinnedArrayElement(sdib.data, 0), - dib, sdib.pitch, sdib.bpp, - sdib.red_mask, sdib.green_mask, sdib.blue_mask, - false); - - // Use the healper function to write the header to the destination - if (Write(io, handle, (uint)header.Length, 1, ref header) != 1) - return false; - - // Create a serializer - BinaryFormatter formatter = new BinaryFormatter(); - - // Create a temporary stream - MemoryStream stream = new MemoryStream(); - - // Create a compression stream - GZipStream zipStream = new GZipStream(stream, CompressionMode.Compress); - - // Serialize the structure into the compression stream - formatter.Serialize(zipStream, sdib); - - // Unload the compression stream - zipStream.Dispose(); - - // Get the result data - byte[] buffer = stream.GetBuffer(); - - // Use the healper function 'Write' to write the data to the destination - if (Write(io, handle, 1, (uint)buffer.Length, ref buffer) != buffer.Length) - { - // Unload the temporary stream - stream.Dispose(); - return false; - } - - // Unload the temporary stream - stream.Dispose(); - return true; - } - - // Return a list of supported file extensions (comma seperated) - protected override string ExtensionListProc() - { - return "ser"; - } - - // Implementation of 'ToString()' - public override string ToString() - { - return DescriptionProc(); - } - } -} diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/Properties/AssemblyInfo.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/Properties/AssemblyInfo.cs deleted file mode 100644 index 62165f0..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("7f29fbaa-d2b3-4011-b34f-5a109bc282af")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/Sample 09 - Working with streams.2005.csproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/Sample 09 - Working with streams.2005.csproj deleted file mode 100644 index 4674213..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/Sample 09 - Working with streams.2005.csproj +++ /dev/null @@ -1,105 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {92A454B2-67EF-4B70-99C9-F22B83B6FBFF} - WinExe - Properties - Sample09 - Sample09 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - none - true - bin\Release\ - TRACE - prompt - 4 - false - - - true - bin\Debug\ - DEBUG;TRACE - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - - - x86 - false - prompt - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - - - x64 - false - prompt - - - - - - - - - - - Form - - - SampleForm.cs - - - - - Designer - SampleForm.cs - - - - - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} - Library - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/Sample 09 - Working with streams.csproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/Sample 09 - Working with streams.csproj deleted file mode 100644 index a3cea35..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/Sample 09 - Working with streams.csproj +++ /dev/null @@ -1,110 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {92A454B2-67EF-4B70-99C9-F22B83B6FBFF} - WinExe - Properties - Sample09 - Sample09 - - - 2.0 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - none - true - bin\Release\ - TRACE - prompt - 4 - false - - - true - bin\Debug\ - DEBUG;TRACE - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - - - x86 - false - prompt - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - - - x64 - false - prompt - - - - - - - - - - - Form - - - SampleForm.cs - - - - - Designer - SampleForm.cs - - - - - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} - Library - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/SampleForm.Designer.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/SampleForm.Designer.cs deleted file mode 100644 index cf4489d..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/SampleForm.Designer.cs +++ /dev/null @@ -1,115 +0,0 @@ -namespace Sample09 -{ - partial class SampleForm - { - /// - /// Erforderliche Designervariable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Verwendete Ressourcen bereinigen. - /// - /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Vom Windows Form-Designer generierter Code - - /// - /// Erforderliche Methode für die Designerunterstützung. - /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. - /// - private void InitializeComponent() - { - this.picBox = new System.Windows.Forms.PictureBox(); - this.tbURL = new System.Windows.Forms.TextBox(); - this.lUrl = new System.Windows.Forms.Label(); - this.bLoadUrl = new System.Windows.Forms.Button(); - this.bSave = new System.Windows.Forms.Button(); - ((System.ComponentModel.ISupportInitialize)(this.picBox)).BeginInit(); - this.SuspendLayout(); - // - // picBox - // - this.picBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.picBox.Location = new System.Drawing.Point(12, 12); - this.picBox.Name = "picBox"; - this.picBox.Size = new System.Drawing.Size(536, 299); - this.picBox.TabIndex = 0; - this.picBox.TabStop = false; - // - // tbURL - // - this.tbURL.Location = new System.Drawing.Point(155, 317); - this.tbURL.Name = "tbURL"; - this.tbURL.Size = new System.Drawing.Size(393, 20); - this.tbURL.TabIndex = 1; - this.tbURL.Text = "http://freeimage.sourceforge.net/images/logo.jpg"; - // - // lUrl - // - this.lUrl.AutoSize = true; - this.lUrl.Location = new System.Drawing.Point(9, 320); - this.lUrl.Name = "lUrl"; - this.lUrl.Size = new System.Drawing.Size(137, 13); - this.lUrl.TabIndex = 2; - this.lUrl.Text = "Enter the URL of an Image:"; - // - // bLoadUrl - // - this.bLoadUrl.Location = new System.Drawing.Point(12, 344); - this.bLoadUrl.Name = "bLoadUrl"; - this.bLoadUrl.Size = new System.Drawing.Size(75, 23); - this.bLoadUrl.TabIndex = 3; - this.bLoadUrl.Text = "Load URL"; - this.bLoadUrl.UseVisualStyleBackColor = true; - this.bLoadUrl.Click += new System.EventHandler(this.bLoadUrl_Click); - // - // bSave - // - this.bSave.Location = new System.Drawing.Point(93, 344); - this.bSave.Name = "bSave"; - this.bSave.Size = new System.Drawing.Size(75, 23); - this.bSave.TabIndex = 4; - this.bSave.Text = "Save to disk"; - this.bSave.UseVisualStyleBackColor = true; - this.bSave.Click += new System.EventHandler(this.bSave_Click); - // - // SampleForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(560, 379); - this.Controls.Add(this.bSave); - this.Controls.Add(this.bLoadUrl); - this.Controls.Add(this.lUrl); - this.Controls.Add(this.tbURL); - this.Controls.Add(this.picBox); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "SampleForm"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Sample09"; - ((System.ComponentModel.ISupportInitialize)(this.picBox)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.PictureBox picBox; - private System.Windows.Forms.TextBox tbURL; - private System.Windows.Forms.Label lUrl; - private System.Windows.Forms.Button bLoadUrl; - private System.Windows.Forms.Button bSave; - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/SampleForm.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/SampleForm.cs deleted file mode 100644 index 72af7cf..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/SampleForm.cs +++ /dev/null @@ -1,147 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; -using FreeImageAPI; -using System.Net; -using System.IO; - -namespace Sample09 -{ - public partial class SampleForm : Form - { - [STAThread] - static void Main() - { - // Check if FreeImage is available - if (!FreeImage.IsAvailable()) - { - throw new Exception("FreeImage is not available!"); - } - - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new SampleForm()); - } - - public SampleForm() - { - InitializeComponent(); - } - - private void bLoadUrl_Click(object sender, EventArgs e) - { - // Verify url - if (String.IsNullOrEmpty(tbURL.Text)) - { - MessageBox.Show("Please enter a valid URL.", "Error"); - return; - } - FIBITMAP dib = new FIBITMAP(); - Stream sourceStream = null; - try - { - // Build a stream to read from - WebRequest request = (WebRequest)HttpWebRequest.Create(tbURL.Text); - WebResponse response = request.GetResponse(); - sourceStream = response.GetResponseStream(); - if (sourceStream == null) - { - throw new Exception(); - } - // Load the image from stream - dib = FreeImage.LoadFromStream(sourceStream); - // Check success - if (dib.IsNull) - { - throw new Exception(); - } - // Convert the bitmap into a .NET bitmap - Bitmap bitmap = FreeImage.GetBitmap(dib); - if (bitmap == null) - { - throw new Exception(); - } - // Show the bitmap - if (picBox.Image != null) - { - picBox.Image.Dispose(); - } - picBox.Image = bitmap; - } - catch - { - // Error handling - MessageBox.Show("Error loading URL.", "Error"); - } - finally - { - // Clean up memory - FreeImage.UnloadEx(ref dib); - if (sourceStream != null) sourceStream.Dispose(); - } - } - - private void bSave_Click(object sender, EventArgs e) - { - // Check if there is a loaded bitmap - if (picBox.Image == null) - { - MessageBox.Show("No image loaded.", "Error"); - return; - } - SaveFileDialog sfd = null; - FileStream fStream = null; - FIBITMAP dib = new FIBITMAP(); - try - { - sfd = new SaveFileDialog(); - sfd.CreatePrompt = false; - sfd.FileName = ""; - sfd.Filter = "TIF (*tif)|*.tif"; - sfd.OverwritePrompt = true; - sfd.RestoreDirectory = true; - if (sfd.ShowDialog() == DialogResult.OK) - { - // Convert the .NET bitmap into a FreeImage-Bitmap - dib = FreeImage.CreateFromBitmap((Bitmap)picBox.Image); - if (dib.IsNull) - { - throw new Exception(); - } - // Create a filestream to write to - fStream = new FileStream(sfd.FileName, FileMode.Create); - if (!FreeImage.SaveToStream( - ref dib, - fStream, - FREE_IMAGE_FORMAT.FIF_TIFF, - FREE_IMAGE_SAVE_FLAGS.TIFF_LZW, - FREE_IMAGE_COLOR_DEPTH.FICD_AUTO, - false)) - { - throw new Exception(); - } - MessageBox.Show("Image saved successfully.", "Success"); - } - else - { - MessageBox.Show("Operation aborted.", "Aborted"); - } - } - catch - { - MessageBox.Show("Error saving image.", "Error"); - } - finally - { - // Clean up - if (sfd != null) sfd.Dispose(); - if (fStream != null) fStream.Dispose(); - FreeImage.UnloadEx(ref dib); - } - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/SampleForm.resx b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/SampleForm.resx deleted file mode 100644 index ff31a6d..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/SampleForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/MainForm.Designer.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/MainForm.Designer.cs deleted file mode 100644 index b552724..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/MainForm.Designer.cs +++ /dev/null @@ -1,87 +0,0 @@ -namespace Sample10 -{ - partial class MainForm - { - /// - /// Erforderliche Designervariable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Verwendete Ressourcen bereinigen. - /// - /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Vom Windows Form-Designer generierter Code - - /// - /// Erforderliche Methode für die Designerunterstützung. - /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. - /// - private void InitializeComponent() - { - this.bLoad = new System.Windows.Forms.Button(); - this.bQuit = new System.Windows.Forms.Button(); - this.tvMetadata = new System.Windows.Forms.TreeView(); - this.SuspendLayout(); - // - // bLoad - // - this.bLoad.Location = new System.Drawing.Point(12, 336); - this.bLoad.Name = "bLoad"; - this.bLoad.Size = new System.Drawing.Size(75, 23); - this.bLoad.TabIndex = 0; - this.bLoad.Text = "Load Image"; - this.bLoad.UseVisualStyleBackColor = true; - this.bLoad.Click += new System.EventHandler(this.bLoad_Click); - // - // bQuit - // - this.bQuit.Location = new System.Drawing.Point(328, 336); - this.bQuit.Name = "bQuit"; - this.bQuit.Size = new System.Drawing.Size(75, 23); - this.bQuit.TabIndex = 1; - this.bQuit.Text = "Quit"; - this.bQuit.UseVisualStyleBackColor = true; - this.bQuit.Click += new System.EventHandler(this.bQuit_Click); - // - // tvMetadata - // - this.tvMetadata.Location = new System.Drawing.Point(12, 12); - this.tvMetadata.Name = "tvMetadata"; - this.tvMetadata.Size = new System.Drawing.Size(389, 318); - this.tvMetadata.TabIndex = 2; - // - // MainForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(415, 371); - this.Controls.Add(this.tvMetadata); - this.Controls.Add(this.bQuit); - this.Controls.Add(this.bLoad); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "MainForm"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "MainForm"; - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Button bLoad; - private System.Windows.Forms.Button bQuit; - private System.Windows.Forms.TreeView tvMetadata; - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/MainForm.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/MainForm.cs deleted file mode 100644 index 7ce6021..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/MainForm.cs +++ /dev/null @@ -1,105 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Windows.Forms; -using FreeImageAPI; -using FreeImageAPI.Metadata; - -namespace Sample10 -{ - public partial class MainForm : Form - { - [STAThread] - static void Main() - { - // Check if FreeImage.dll is available - if (!FreeImage.IsAvailable()) - { - MessageBox.Show("FreeImage is not available. Aborting.", "Error"); - } - - // Add this class to the FreeImage-Message-Callback - FreeImageEngine.Message += new OutputMessageFunction(FreeImage_Message); - - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new MainForm()); - } - - static void FreeImage_Message(FREE_IMAGE_FORMAT fif, string message) - { - // Display the data - MessageBox.Show( - String.Format("FreeImage-Message:\n{1}\nFormat:{0}", fif.ToString(), message), - "FreeImage-Message"); - } - - public MainForm() - { - InitializeComponent(); - } - - private void bQuit_Click(object sender, EventArgs e) - { - Application.Exit(); - } - - private void bLoad_Click(object sender, EventArgs e) - { - // Create variables - OpenFileDialog ofd = new OpenFileDialog(); - FIBITMAP dib = new FIBITMAP(); - try - { - // Apply settings - ofd.CheckFileExists = true; - ofd.CheckPathExists = true; - ofd.FileName = ""; - ofd.Filter = "All files (*.*)|*.*"; - ofd.Multiselect = false; - ofd.RestoreDirectory = true; - // Get image filename - if (ofd.ShowDialog() == DialogResult.OK) - { - // Load the image - dib = FreeImage.LoadEx(ofd.FileName); - // Check if image was loaded successfully - if (dib.IsNull) throw new Exception("Failed to load image."); - // Clear the treeview - tvMetadata.Nodes.Clear(); - // Create a wrapper for all metadata the image contains - ImageMetadata iMetadata = new ImageMetadata(dib); - // Get each metadata model - foreach (MetadataModel metadataModel in iMetadata) - { - // Create a new node for each model - TreeNode modelNode = tvMetadata.Nodes.Add(metadataModel.ToString()); - - // Get each metadata tag and create a subnode for it - foreach (MetadataTag metadataTag in metadataModel) - { - modelNode.Nodes.Add(metadataTag.Key + ": " + metadataTag.ToString()); - } - } - } - else - { - MessageBox.Show("Operation aborted.", "Aborted"); - } - } - // Display error message - catch (Exception ex) - { - while (ex.InnerException != null) - ex = ex.InnerException; - MessageBox.Show(ex.ToString(), "Exception caught"); - } - // Clean up - finally - { - ofd.Dispose(); - FreeImage.UnloadEx(ref dib); - } - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/MainForm.resx b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/MainForm.resx deleted file mode 100644 index ff31a6d..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/MainForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/Properties/AssemblyInfo.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/Properties/AssemblyInfo.cs deleted file mode 100644 index 67c1d7a..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("e8da4fa8-cc15-4b0e-8c57-d55ceb771559")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/Sample 10 - Metadata.2005.csproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/Sample 10 - Metadata.2005.csproj deleted file mode 100644 index c909e88..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/Sample 10 - Metadata.2005.csproj +++ /dev/null @@ -1,103 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {55DCC37A-E56C-44D9-9C44-8DAB10CD3003} - WinExe - Properties - Sample10 - Sample10 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - none - true - bin\Release\ - TRACE - prompt - 4 - - - true - bin\Debug\ - DEBUG;TRACE - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - - - x86 - prompt - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - - - x64 - prompt - - - - - - - - - - - Form - - - MainForm.cs - - - - - - Designer - MainForm.cs - - - - - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} - Library - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/Sample 10 - Metadata.csproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/Sample 10 - Metadata.csproj deleted file mode 100644 index bb218d6..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/Sample 10 - Metadata.csproj +++ /dev/null @@ -1,108 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {55DCC37A-E56C-44D9-9C44-8DAB10CD3003} - WinExe - Properties - Sample10 - Sample10 - - - 2.0 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - none - true - bin\Release\ - TRACE - prompt - 4 - - - true - bin\Debug\ - DEBUG;TRACE - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - - - x86 - prompt - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - - - x64 - prompt - - - - - - - - - - - Form - - - MainForm.cs - - - - - - Designer - MainForm.cs - - - - - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} - Library - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MainForm.Designer.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MainForm.Designer.cs deleted file mode 100644 index 9f2ffe2..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MainForm.Designer.cs +++ /dev/null @@ -1,382 +0,0 @@ -namespace Sample11 -{ - partial class MainForm - { - /// - /// Erforderliche Designervariable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Verwendete Ressourcen bereinigen. - /// - /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Vom Windows Form-Designer generierter Code - - /// - /// Erforderliche Methode für die Designerunterstützung. - /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. - /// - private void InitializeComponent() - { - this.pictureBox = new System.Windows.Forms.PictureBox(); - this.bLoadImage = new System.Windows.Forms.Button(); - this.bSaveImage = new System.Windows.Forms.Button(); - this.ofd = new System.Windows.Forms.OpenFileDialog(); - this.sfd = new System.Windows.Forms.SaveFileDialog(); - this.lWidth = new System.Windows.Forms.Label(); - this.lHeight = new System.Windows.Forms.Label(); - this.lBpp = new System.Windows.Forms.Label(); - this.lMetadataCount = new System.Windows.Forms.Label(); - this.bGreyscale = new System.Windows.Forms.Button(); - this.cbSelectFrame = new System.Windows.Forms.ComboBox(); - this.lComment = new System.Windows.Forms.Label(); - this.bAdjustGamma = new System.Windows.Forms.Button(); - this.vGamma = new System.Windows.Forms.NumericUpDown(); - this.bRedChannelOnly = new System.Windows.Forms.Button(); - this.bBlueChannel = new System.Windows.Forms.Button(); - this.bGreenChannel = new System.Windows.Forms.Button(); - this.bAllChannels = new System.Windows.Forms.Button(); - this.lSelectFrame = new System.Windows.Forms.Label(); - this.lImageFormat = new System.Windows.Forms.Label(); - this.bRotate = new System.Windows.Forms.Button(); - this.vRotate = new System.Windows.Forms.TrackBar(); - this.lRotate = new System.Windows.Forms.Label(); - this.lColors = new System.Windows.Forms.Label(); - this.nShowMetadata = new System.Windows.Forms.Button(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.vGamma)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.vRotate)).BeginInit(); - this.SuspendLayout(); - // - // pictureBox - // - this.pictureBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.pictureBox.Location = new System.Drawing.Point(14, 15); - this.pictureBox.Margin = new System.Windows.Forms.Padding(4); - this.pictureBox.Name = "pictureBox"; - this.pictureBox.Size = new System.Drawing.Size(542, 395); - this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.pictureBox.TabIndex = 0; - this.pictureBox.TabStop = false; - // - // bLoadImage - // - this.bLoadImage.Location = new System.Drawing.Point(564, 15); - this.bLoadImage.Margin = new System.Windows.Forms.Padding(4); - this.bLoadImage.Name = "bLoadImage"; - this.bLoadImage.Size = new System.Drawing.Size(125, 28); - this.bLoadImage.TabIndex = 1; - this.bLoadImage.Text = "Load image"; - this.bLoadImage.UseVisualStyleBackColor = true; - this.bLoadImage.Click += new System.EventHandler(this.bLoadImage_Click); - // - // bSaveImage - // - this.bSaveImage.Location = new System.Drawing.Point(564, 51); - this.bSaveImage.Margin = new System.Windows.Forms.Padding(4); - this.bSaveImage.Name = "bSaveImage"; - this.bSaveImage.Size = new System.Drawing.Size(125, 28); - this.bSaveImage.TabIndex = 2; - this.bSaveImage.Text = "Save image"; - this.bSaveImage.UseVisualStyleBackColor = true; - this.bSaveImage.Click += new System.EventHandler(this.bSaveImage_Click); - // - // ofd - // - this.ofd.AddExtension = false; - this.ofd.AutoUpgradeEnabled = false; - this.ofd.Filter = "All files|*.*"; - this.ofd.RestoreDirectory = true; - this.ofd.SupportMultiDottedExtensions = true; - // - // sfd - // - this.sfd.AddExtension = false; - this.sfd.Filter = "All files|*.*"; - this.sfd.RestoreDirectory = true; - this.sfd.SupportMultiDottedExtensions = true; - // - // lWidth - // - this.lWidth.AutoSize = true; - this.lWidth.Location = new System.Drawing.Point(563, 350); - this.lWidth.Name = "lWidth"; - this.lWidth.Size = new System.Drawing.Size(57, 16); - this.lWidth.TabIndex = 6; - this.lWidth.Text = "Width: 0"; - // - // lHeight - // - this.lHeight.AutoSize = true; - this.lHeight.Location = new System.Drawing.Point(649, 350); - this.lHeight.Name = "lHeight"; - this.lHeight.Size = new System.Drawing.Size(60, 16); - this.lHeight.TabIndex = 7; - this.lHeight.Text = "Height: 0"; - // - // lBpp - // - this.lBpp.AutoSize = true; - this.lBpp.Location = new System.Drawing.Point(740, 350); - this.lBpp.Name = "lBpp"; - this.lBpp.Size = new System.Drawing.Size(45, 16); - this.lBpp.TabIndex = 8; - this.lBpp.Text = "Bpp: 0"; - // - // lMetadataCount - // - this.lMetadataCount.AutoSize = true; - this.lMetadataCount.Location = new System.Drawing.Point(809, 350); - this.lMetadataCount.Name = "lMetadataCount"; - this.lMetadataCount.Size = new System.Drawing.Size(77, 16); - this.lMetadataCount.TabIndex = 9; - this.lMetadataCount.Text = "Metadata: 0"; - // - // bGreyscale - // - this.bGreyscale.Location = new System.Drawing.Point(564, 121); - this.bGreyscale.Name = "bGreyscale"; - this.bGreyscale.Size = new System.Drawing.Size(125, 28); - this.bGreyscale.TabIndex = 10; - this.bGreyscale.Text = "Conv to greyscale"; - this.bGreyscale.UseVisualStyleBackColor = true; - this.bGreyscale.Click += new System.EventHandler(this.bGreyscale_Click); - // - // cbSelectFrame - // - this.cbSelectFrame.FormattingEnabled = true; - this.cbSelectFrame.Location = new System.Drawing.Point(695, 156); - this.cbSelectFrame.Name = "cbSelectFrame"; - this.cbSelectFrame.Size = new System.Drawing.Size(121, 24); - this.cbSelectFrame.TabIndex = 11; - this.cbSelectFrame.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); - // - // lComment - // - this.lComment.AutoSize = true; - this.lComment.Location = new System.Drawing.Point(563, 373); - this.lComment.Name = "lComment"; - this.lComment.Size = new System.Drawing.Size(107, 16); - this.lComment.TabIndex = 12; - this.lComment.Text = "Image-comment:"; - // - // bAdjustGamma - // - this.bAdjustGamma.Location = new System.Drawing.Point(564, 185); - this.bAdjustGamma.Name = "bAdjustGamma"; - this.bAdjustGamma.Size = new System.Drawing.Size(125, 28); - this.bAdjustGamma.TabIndex = 13; - this.bAdjustGamma.Text = "Adjust gamma"; - this.bAdjustGamma.UseVisualStyleBackColor = true; - this.bAdjustGamma.Click += new System.EventHandler(this.bAdjustGamma_Click); - // - // vGamma - // - this.vGamma.DecimalPlaces = 2; - this.vGamma.Increment = new decimal(new int[] { - 0, - 0, - 0, - 0}); - this.vGamma.Location = new System.Drawing.Point(695, 189); - this.vGamma.Maximum = new decimal(new int[] { - 2, - 0, - 0, - 0}); - this.vGamma.Name = "vGamma"; - this.vGamma.Size = new System.Drawing.Size(121, 23); - this.vGamma.TabIndex = 14; - // - // bRedChannelOnly - // - this.bRedChannelOnly.Location = new System.Drawing.Point(564, 219); - this.bRedChannelOnly.Name = "bRedChannelOnly"; - this.bRedChannelOnly.Size = new System.Drawing.Size(125, 28); - this.bRedChannelOnly.TabIndex = 15; - this.bRedChannelOnly.Text = "Red channel"; - this.bRedChannelOnly.UseVisualStyleBackColor = true; - this.bRedChannelOnly.Click += new System.EventHandler(this.bRedChannelOnly_Click); - // - // bBlueChannel - // - this.bBlueChannel.Location = new System.Drawing.Point(564, 287); - this.bBlueChannel.Name = "bBlueChannel"; - this.bBlueChannel.Size = new System.Drawing.Size(125, 28); - this.bBlueChannel.TabIndex = 16; - this.bBlueChannel.Text = "Blue channel"; - this.bBlueChannel.UseVisualStyleBackColor = true; - this.bBlueChannel.Click += new System.EventHandler(this.bBlueChannel_Click); - // - // bGreenChannel - // - this.bGreenChannel.Location = new System.Drawing.Point(564, 253); - this.bGreenChannel.Name = "bGreenChannel"; - this.bGreenChannel.Size = new System.Drawing.Size(125, 28); - this.bGreenChannel.TabIndex = 17; - this.bGreenChannel.Text = "Green channel"; - this.bGreenChannel.UseVisualStyleBackColor = true; - this.bGreenChannel.Click += new System.EventHandler(this.bGreenChannel_Click); - // - // bAllChannels - // - this.bAllChannels.Location = new System.Drawing.Point(563, 321); - this.bAllChannels.Name = "bAllChannels"; - this.bAllChannels.Size = new System.Drawing.Size(126, 28); - this.bAllChannels.TabIndex = 18; - this.bAllChannels.Text = "All channels"; - this.bAllChannels.UseVisualStyleBackColor = true; - this.bAllChannels.Click += new System.EventHandler(this.bAllChannels_Click); - // - // lSelectFrame - // - this.lSelectFrame.AutoSize = true; - this.lSelectFrame.Location = new System.Drawing.Point(563, 159); - this.lSelectFrame.Name = "lSelectFrame"; - this.lSelectFrame.Size = new System.Drawing.Size(86, 16); - this.lSelectFrame.TabIndex = 19; - this.lSelectFrame.Text = "Select frame:"; - // - // lImageFormat - // - this.lImageFormat.AutoSize = true; - this.lImageFormat.Location = new System.Drawing.Point(563, 395); - this.lImageFormat.Name = "lImageFormat"; - this.lImageFormat.Size = new System.Drawing.Size(92, 16); - this.lImageFormat.TabIndex = 20; - this.lImageFormat.Text = "Image-format:"; - // - // bRotate - // - this.bRotate.Location = new System.Drawing.Point(564, 86); - this.bRotate.Name = "bRotate"; - this.bRotate.Size = new System.Drawing.Size(125, 28); - this.bRotate.TabIndex = 21; - this.bRotate.Text = "Rotate"; - this.bRotate.UseVisualStyleBackColor = true; - this.bRotate.Click += new System.EventHandler(this.bRotate_Click); - // - // vRotate - // - this.vRotate.Location = new System.Drawing.Point(695, 80); - this.vRotate.Maximum = 360; - this.vRotate.Name = "vRotate"; - this.vRotate.Size = new System.Drawing.Size(170, 45); - this.vRotate.TabIndex = 22; - this.vRotate.TickFrequency = 10; - this.vRotate.TickStyle = System.Windows.Forms.TickStyle.Both; - this.vRotate.Scroll += new System.EventHandler(this.vRotate_Scroll); - // - // lRotate - // - this.lRotate.AutoSize = true; - this.lRotate.Location = new System.Drawing.Point(871, 92); - this.lRotate.Name = "lRotate"; - this.lRotate.Size = new System.Drawing.Size(15, 16); - this.lRotate.TabIndex = 23; - this.lRotate.Text = "0"; - // - // lColors - // - this.lColors.AutoSize = true; - this.lColors.Location = new System.Drawing.Point(740, 394); - this.lColors.Name = "lColors"; - this.lColors.Size = new System.Drawing.Size(60, 16); - this.lColors.TabIndex = 24; - this.lColors.Text = "Colors: 0"; - // - // nShowMetadata - // - this.nShowMetadata.Location = new System.Drawing.Point(696, 15); - this.nShowMetadata.Name = "nShowMetadata"; - this.nShowMetadata.Size = new System.Drawing.Size(125, 28); - this.nShowMetadata.TabIndex = 25; - this.nShowMetadata.Text = "Show metadata"; - this.nShowMetadata.UseVisualStyleBackColor = true; - this.nShowMetadata.Click += new System.EventHandler(this.nShowMetadata_Click); - // - // MainForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(908, 423); - this.Controls.Add(this.nShowMetadata); - this.Controls.Add(this.lColors); - this.Controls.Add(this.lRotate); - this.Controls.Add(this.vRotate); - this.Controls.Add(this.bRotate); - this.Controls.Add(this.lImageFormat); - this.Controls.Add(this.lSelectFrame); - this.Controls.Add(this.bAllChannels); - this.Controls.Add(this.bGreenChannel); - this.Controls.Add(this.bBlueChannel); - this.Controls.Add(this.bRedChannelOnly); - this.Controls.Add(this.vGamma); - this.Controls.Add(this.bAdjustGamma); - this.Controls.Add(this.lComment); - this.Controls.Add(this.cbSelectFrame); - this.Controls.Add(this.bGreyscale); - this.Controls.Add(this.lMetadataCount); - this.Controls.Add(this.lBpp); - this.Controls.Add(this.lHeight); - this.Controls.Add(this.lWidth); - this.Controls.Add(this.bSaveImage); - this.Controls.Add(this.bLoadImage); - this.Controls.Add(this.pictureBox); - this.DoubleBuffered = true; - this.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.Margin = new System.Windows.Forms.Padding(4); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "MainForm"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Sample 11"; - ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.vGamma)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.vRotate)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.PictureBox pictureBox; - private System.Windows.Forms.Button bLoadImage; - private System.Windows.Forms.Button bSaveImage; - private System.Windows.Forms.OpenFileDialog ofd; - private System.Windows.Forms.SaveFileDialog sfd; - private System.Windows.Forms.Label lWidth; - private System.Windows.Forms.Label lHeight; - private System.Windows.Forms.Label lBpp; - private System.Windows.Forms.Label lMetadataCount; - private System.Windows.Forms.Button bGreyscale; - private System.Windows.Forms.ComboBox cbSelectFrame; - private System.Windows.Forms.Label lComment; - private System.Windows.Forms.Button bAdjustGamma; - private System.Windows.Forms.NumericUpDown vGamma; - private System.Windows.Forms.Button bRedChannelOnly; - private System.Windows.Forms.Button bBlueChannel; - private System.Windows.Forms.Button bGreenChannel; - private System.Windows.Forms.Button bAllChannels; - private System.Windows.Forms.Label lSelectFrame; - private System.Windows.Forms.Label lImageFormat; - private System.Windows.Forms.Button bRotate; - private System.Windows.Forms.TrackBar vRotate; - private System.Windows.Forms.Label lRotate; - private System.Windows.Forms.Label lColors; - private System.Windows.Forms.Button nShowMetadata; - } -} - diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MainForm.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MainForm.cs deleted file mode 100644 index 68a4702..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MainForm.cs +++ /dev/null @@ -1,412 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Windows.Forms; -using FreeImageAPI; -using FreeImageAPI.Metadata; -using FreeImageAPI.Plugins; - -namespace Sample11 -{ - public partial class MainForm : Form - { - public MainForm() - { - InitializeComponent(); - } - - [STAThread] - static void Main() - { - // Capture messages generated by FreeImage - FreeImageEngine.Message += new OutputMessageFunction(FreeImageEngine_Message); - - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new MainForm()); - } - - static void FreeImageEngine_Message(FREE_IMAGE_FORMAT fif, string message) - { - // Display the message - // FreeImage continues code executing when all - // addes subscribers of 'Message' finished returned. - MessageBox.Show(message, "FreeImage-Message", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - - // The FreeImageBitmap this sample will work with. - FreeImageBitmap bitmap = null; - - // Replaces the current bitmap with the given one. - private void ReplaceBitmap(FreeImageBitmap newBitmap) - { - // Checks whether the bitmap is usable - if (newBitmap == null || newBitmap.IsDisposed) - { - MessageBox.Show( - "Unexpected error.", - "Error", - MessageBoxButtons.OK, - MessageBoxIcon.Error); - } - - // Check whether the image type of the new bitmap is 'FIT_BITMAP'. - // If not convert to 'FIT_BITMAP'. - if (newBitmap.ImageType != FREE_IMAGE_TYPE.FIT_BITMAP) - { - if (!newBitmap.ConvertType(FREE_IMAGE_TYPE.FIT_BITMAP, true)) - { - MessageBox.Show( - "Error converting bitmap to standard type.", - "Error", - MessageBoxButtons.OK, - MessageBoxIcon.Error); - return; - } - } - - // Dispose the old bitmap only in case it exists and - // the old instance is another than the new one. - if ((bitmap != null) && !object.ReferenceEquals(bitmap, newBitmap)) - { - bitmap.Dispose(); - } - // Dispose the picturebox's bitmap in case it exists. - if (pictureBox.Image != null) - { - pictureBox.Image.Dispose(); - } - - // Set the new bitmap. - pictureBox.Image = (Bitmap)(bitmap = newBitmap); - - // Update gui. - UpdateBitmapInformations(); - UpdateFrameSelection(); - } - - // Get bitmap properties and display them in the gui. - private void UpdateBitmapInformations() - { - if (Bitmap) - { - // Get width - lWidth.Text = String.Format("Width: {0}", bitmap.Width); - // Get Height - lHeight.Text = String.Format("Height: {0}", bitmap.Height); - // Get color depth - lBpp.Text = String.Format("Bpp: {0}", bitmap.ColorDepth); - // Get number of metadata - ImageMetadata mData = bitmap.Metadata; - mData.HideEmptyModels = true; - int mCnt = 0; - foreach (MetadataModel model in mData.List) - { - mCnt += model.Count; - } - lMetadataCount.Text = String.Format("Metadata: {0}", mCnt); - // Get image comment - lComment.Text = String.Format("Image-comment: {0}", bitmap.Comment != null ? bitmap.Comment : String.Empty); - // Get the number of real colors in the image - lColors.Text = String.Format("Colors: {0}", bitmap.UniqueColors); - } - else - { - // Reset all values - lWidth.Text = String.Format("Width: {0}", 0); - lHeight.Text = String.Format("Height: {0}", 0); - lBpp.Text = String.Format("Bpp: {0}", 0); - lMetadataCount.Text = String.Format("Metadata: {0}", 0); - lComment.Text = String.Format("Image-comment: {0}", String.Empty); - lColors.Text = String.Format("Colors: {0}", 0); - } - } - - // Update combobox for frame selection. - private void UpdateFrameSelection() - { - cbSelectFrame.Items.Clear(); - if (Bitmap) - { - // Get number of frames in the bitmap - if (bitmap.FrameCount > 1) - { - // Add an entry for each frame to the combobox - for (int i = 0; i < bitmap.FrameCount; i++) - { - cbSelectFrame.Items.Add(String.Format("Frame {0}", i + 1)); - } - } - } - } - - // Returns true in case the variable 'bitmap' - // is set and not disposed. - private bool Bitmap - { - get { return ((bitmap != null) && (!bitmap.IsDisposed)); } - } - - private void bLoadImage_Click(object sender, EventArgs e) - { - if (ofd.ShowDialog() == DialogResult.OK) - { - try - { - // Load the file using autodetection - FreeImageBitmap fib = new FreeImageBitmap(ofd.FileName); - // Rescale the image so that it fits the picturebox - // Get the plugin that was used to load the bitmap - FreeImagePlugin plug = PluginRepository.Plugin(fib.ImageFormat); - lImageFormat.Text = String.Format("Image-format: {0}", plug.Format); - // Replace the existing bitmap with the new one - ReplaceBitmap(fib); - } - catch - { - } - } - } - - private void bSaveImage_Click(object sender, EventArgs e) - { - if (pictureBox.Image != null) - { - try - { - if (sfd.ShowDialog() == DialogResult.OK) - { - // Save the bitmap using autodetection - using (FreeImageBitmap temp = new FreeImageBitmap(pictureBox.Image)) - { - temp.Save(sfd.FileName); - } - } - } - catch - { - } - } - } - - private void bRotate_Click(object sender, EventArgs e) - { - if (Bitmap) - { - // Create a temporary rescaled bitmap - using (FreeImageBitmap temp = bitmap.GetScaledInstance( - pictureBox.DisplayRectangle.Width, pictureBox.DisplayRectangle.Height, - FREE_IMAGE_FILTER.FILTER_CATMULLROM)) - { - if (temp != null) - { - // Rotate the bitmap - temp.Rotate((double)vRotate.Value); - if (pictureBox.Image != null) - { - pictureBox.Image.Dispose(); - } - // Display the result - pictureBox.Image = (Bitmap)temp; - } - } - } - } - - private void bGreyscale_Click(object sender, EventArgs e) - { - if (Bitmap) - { - // Convert the bitmap to 8bpp and greyscale - ReplaceBitmap(bitmap.GetColorConvertedInstance( - FREE_IMAGE_COLOR_DEPTH.FICD_08_BPP | - FREE_IMAGE_COLOR_DEPTH.FICD_FORCE_GREYSCALE)); - } - } - - private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) - { - ComboBox cb = sender as ComboBox; - if ((cb != null) && (cb.Items.Count > 0)) - { - if (Bitmap) - { - try - { - // Switch the selected frame - bitmap.SelectActiveFrame(cb.SelectedIndex); - ReplaceBitmap(bitmap); - } - catch (ArgumentOutOfRangeException) - { - MessageBox.Show("Error changing frame.", "Error"); - } - } - } - } - - private void bAdjustGamma_Click(object sender, EventArgs e) - { - if (Bitmap) - { - // Adjust the gamma value - bitmap.AdjustGamma((double)vGamma.Value); - ReplaceBitmap(bitmap); - } - } - - private void bRedChannelOnly_Click(object sender, EventArgs e) - { - // Mask out green and blue - SetColorChannels(0xFF, 0x00, 0x00); - } - - private void bGreenChannel_Click(object sender, EventArgs e) - { - // Mask out red and blue - SetColorChannels(0x00, 0xFF, 0x00); - } - - private void bBlueChannel_Click(object sender, EventArgs e) - { - // Mask out red and green - SetColorChannels(0x00, 0x00, 0xFF); - } - - private void bAllChannels_Click(object sender, EventArgs e) - { - if (Bitmap) - { - // Restore the bitmap using the original - ReplaceBitmap(bitmap); - } - } - - private void SetColorChannels(int redmask, int greenmask, int bluemask) - { - if (Bitmap) - { - // Create a temporary clone. - using (FreeImageBitmap bitmap = (FreeImageBitmap)this.bitmap.Clone()) - { - if (bitmap != null) - { - // Check whether the bitmap has a palette - if (bitmap.HasPalette) - { - // Use the Palette class to handle the bitmap's - // palette. A palette always consist of RGBQUADs. - Palette palette = bitmap.Palette; - // Apply the new values for all three color components. - for (int i = 0; i < palette.Length; i++) - { - RGBQUAD rgbq = palette[i]; - - rgbq.rgbRed = (byte)(rgbq.rgbRed & redmask); - rgbq.rgbGreen = (byte)(rgbq.rgbGreen & greenmask); - rgbq.rgbBlue = (byte)(rgbq.rgbBlue & bluemask); - - palette[i] = rgbq; - } - } - // In case the bitmap has no palette it must have a color depth - // of 16, 24 or 32. Each color depth needs a different wrapping - // structure for the bitmaps data. These structures can be accessed - // by using the foreach clause. - else if (bitmap.ColorDepth == 16) - { - // Iterate over each scanline - // For 16bpp use either Scanline or Scanline - if (bitmap.IsRGB555) - { - foreach (Scanline scanline in bitmap) - { - for (int x = 0; x < scanline.Length; x++) - { - FI16RGB555 pixel = scanline[x]; - pixel.Red = (byte)(pixel.Red & redmask); - pixel.Green = (byte)(pixel.Green & greenmask); - pixel.Blue = (byte)(pixel.Blue & bluemask); - scanline[x] = pixel; - } - } - } - else if (bitmap.IsRGB565) - { - foreach (Scanline scanline in bitmap) - { - for (int x = 0; x < scanline.Length; x++) - { - FI16RGB565 pixel = scanline[x]; - pixel.Red = (byte)(pixel.Red & redmask); - pixel.Green = (byte)(pixel.Green & greenmask); - pixel.Blue = (byte)(pixel.Blue & bluemask); - scanline[x] = pixel; - } - } - } - } - else if (bitmap.ColorDepth == 24) - { - // Iterate over each scanline - // For 24bpp Scanline must be used - foreach (Scanline scanline in bitmap) - { - for (int x = 0; x < scanline.Length; x++) - { - RGBTRIPLE pixel = scanline[x]; - pixel.rgbtRed = (byte)(pixel.rgbtRed & redmask); - pixel.rgbtGreen = (byte)(pixel.rgbtGreen & greenmask); - pixel.rgbtBlue = (byte)(pixel.rgbtBlue & bluemask); - scanline[x] = pixel; - } - } - } - else if (bitmap.ColorDepth == 32) - { - // Iterate over each scanline - // For 32bpp Scanline must be used - foreach (Scanline scanline in bitmap) - { - for (int x = 0; x < scanline.Length; x++) - { - RGBQUAD pixel = scanline[x]; - pixel.rgbRed = (byte)(pixel.rgbRed & redmask); - pixel.rgbGreen = (byte)(pixel.rgbGreen & greenmask); - pixel.rgbBlue = (byte)(pixel.rgbBlue & bluemask); - scanline[x] = pixel; - } - } - } - // Dispose only the picturebox's bitmap - if (pictureBox.Image != null) - { - pictureBox.Image.Dispose(); - } - pictureBox.Image = (Bitmap)bitmap; - } - } - } - } - - private void vRotate_Scroll(object sender, EventArgs e) - { - TrackBar bar = sender as TrackBar; - if (bar != null) - { - lRotate.Text = bar.Value.ToString(); - } - } - - private void nShowMetadata_Click(object sender, EventArgs e) - { - if (Bitmap) - { - MetaDataFrame mFrame = new MetaDataFrame(); - mFrame.Tag = bitmap.Metadata; - mFrame.ShowDialog(this); - } - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MainForm.resx b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MainForm.resx deleted file mode 100644 index 5becef4..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MainForm.resx +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - 84, 17 - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MetaDataFrame.Designer.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MetaDataFrame.Designer.cs deleted file mode 100644 index 12c1031..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MetaDataFrame.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -namespace Sample11 -{ - partial class MetaDataFrame - { - /// - /// Erforderliche Designervariable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Verwendete Ressourcen bereinigen. - /// - /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Vom Windows Form-Designer generierter Code - - /// - /// Erforderliche Methode für die Designerunterstützung. - /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. - /// - private void InitializeComponent() - { - this.tvMetadata = new System.Windows.Forms.TreeView(); - this.SuspendLayout(); - // - // tvMetadata - // - this.tvMetadata.Location = new System.Drawing.Point(12, 12); - this.tvMetadata.Name = "tvMetadata"; - this.tvMetadata.Size = new System.Drawing.Size(389, 318); - this.tvMetadata.TabIndex = 3; - // - // MetaDataFrame - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(417, 349); - this.Controls.Add(this.tvMetadata); - this.DoubleBuffered = true; - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "MetaDataFrame"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Metadata"; - this.Load += new System.EventHandler(this.MetaDataFrame_Load); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.TreeView tvMetadata; - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MetaDataFrame.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MetaDataFrame.cs deleted file mode 100644 index 77e670b..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MetaDataFrame.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.ComponentModel; -using System.Windows.Forms; -using FreeImageAPI; -using FreeImageAPI.Metadata; - -namespace Sample11 -{ - public partial class MetaDataFrame : Form - { - public MetaDataFrame() - { - InitializeComponent(); - } - - private void MetaDataFrame_Load(object sender, EventArgs e) - { - ImageMetadata iMetadata = this.Tag as ImageMetadata; - if (iMetadata != null) - { - bool backup = iMetadata.HideEmptyModels; - iMetadata.HideEmptyModels = false; - try - { - // Get each metadata model - foreach (MetadataModel metadataModel in iMetadata) - { - // Create a new node for each model - TreeNode modelNode = tvMetadata.Nodes.Add(metadataModel.ToString()); - - // Get each metadata tag and create a subnode for it - foreach (MetadataTag metadataTag in metadataModel) - { - modelNode.Nodes.Add(metadataTag.Key + ": " + metadataTag.ToString()); - } - } - } - // Display error message - catch (Exception ex) - { - while (ex.InnerException != null) - ex = ex.InnerException; - MessageBox.Show(ex.ToString(), "Exception caught"); - } - iMetadata.HideEmptyModels = backup; - } - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MetaDataFrame.resx b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MetaDataFrame.resx deleted file mode 100644 index ff31a6d..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MetaDataFrame.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/Properties/AssemblyInfo.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/Properties/AssemblyInfo.cs deleted file mode 100644 index ce7c549..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("219019e1-9a57-46c7-b9d7-3928a9277fd6")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/Sample 11 - Using the FreeImageBitmap class.2005.csproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/Sample 11 - Using the FreeImageBitmap class.2005.csproj deleted file mode 100644 index 001e0d4..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/Sample 11 - Using the FreeImageBitmap class.2005.csproj +++ /dev/null @@ -1,115 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {996068CD-D07A-42E0-856F-ACC71E8565EF} - WinExe - Properties - Sample11 - Sample11 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - none - 4 - 512 - false - - - none - true - bin\Release\ - TRACE - none - 4 - 512 - - - true - bin\Debug\ - DEBUG;TRACE - 512 - full - x86 - false - none - - - bin\Release\ - TRACE - true - 512 - - - x86 - none - - - true - bin\Debug\ - DEBUG;TRACE - 512 - full - x64 - false - none - - - bin\Release\ - TRACE - true - 512 - - - x64 - none - - - - - - - - - Form - - - MainForm.cs - - - Form - - - MetaDataFrame.cs - - - - Designer - MainForm.cs - - - Designer - MetaDataFrame.cs - - - - - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} - Library - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/Sample 11 - Using the FreeImageBitmap class.csproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/Sample 11 - Using the FreeImageBitmap class.csproj deleted file mode 100644 index f8a87bd..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/Sample 11 - Using the FreeImageBitmap class.csproj +++ /dev/null @@ -1,120 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {996068CD-D07A-42E0-856F-ACC71E8565EF} - WinExe - Properties - Sample11 - Sample11 - - - 2.0 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - none - 4 - 512 - false - - - none - true - bin\Release\ - TRACE - none - 4 - 512 - - - true - bin\Debug\ - DEBUG;TRACE - 512 - full - x86 - false - none - - - bin\Release\ - TRACE - true - 512 - - - x86 - none - - - true - bin\Debug\ - DEBUG;TRACE - 512 - full - x64 - false - none - - - bin\Release\ - TRACE - true - 512 - - - x64 - none - - - - - - - - - Form - - - MainForm.cs - - - Form - - - MetaDataFrame.cs - - - - Designer - MainForm.cs - - - Designer - MetaDataFrame.cs - - - - - {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} - Library - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/SourceFileMerger/FreeImage.cs.template b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/SourceFileMerger/FreeImage.cs.template deleted file mode 100644 index f02974d..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/SourceFileMerger/FreeImage.cs.template +++ /dev/null @@ -1,219 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// To build the project without VS use the following commandline: -// "csc.exe /out:FreeImageNET.dll /target:library /doc:FreeImageNET.XML /debug- /o /unsafe+ /filealign:512 FreeImage.cs" -// ========================================================== - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Drawing; -using System.Drawing.Imaging; -using System.IO; -using System.Reflection; -using System.Resources; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using System.Xml; -using FreeImageAPI; -using FreeImageAPI.IO; -using FreeImageAPI.Metadata; -using FreeImageAPI.Plugins; - -///////////////////////////////////////////////////// -// // -// FreeImage.h import // -// // -///////////////////////////////////////////////////// - - #region Structs - -#include "Structs\BITMAP.cs" - -#include "Structs\BITMAPINFOHEADER.cs" - -#include "Structs\BITMAPINFO.cs" - -#include "Structs\FIBITMAP.cs" - -#include "Structs\FIMULTIBITMAP.cs" - -#include "Structs\FIMEMORY.cs" - -#include "Structs\FIMETADATA.cs" - -#include "Structs\FITAG.cs" - -#include "Structs\FreeImageIO.cs" - -#include "Structs\RGBQUAD.cs" - -#include "Structs\RGBTRIPLE.cs" - -#include "Structs\FIRGBA16.cs" - -#include "Structs\FIRGB16.cs" - -#include "Structs\FIRGBAF.cs" - -#include "Structs\FIRGBF.cs" - -#include "Structs\FICOMPLEX.cs" - -#include "Structs\FIICCPROFILE.cs" - -#include "Structs\Plugin.cs" - - #endregion - - #region Enums - -#include "Enumerations\DisposalMethodType.cs" - -#include "Enumerations\FREE_IMAGE_FORMAT.cs" - -#include "Enumerations\FREE_IMAGE_TYPE.cs" - -#include "Enumerations\FREE_IMAGE_COLOR_OPTIONS.cs" - -#include "Enumerations\FREE_IMAGE_COLOR_TYPE.cs" - -#include "Enumerations\FREE_IMAGE_QUANTIZE.cs" - -#include "Enumerations\FREE_IMAGE_DITHER.cs" - -#include "Enumerations\FREE_IMAGE_JPEG_OPERATION.cs" - -#include "Enumerations\FREE_IMAGE_TMO.cs" - -#include "Enumerations\FREE_IMAGE_FILTER.cs" - -#include "Enumerations\FREE_IMAGE_COLOR_CHANNEL.cs" - -#include "Enumerations\FREE_IMAGE_MDTYPE.cs" - -#include "Enumerations\FREE_IMAGE_MDMODEL.cs" - -#include "Enumerations\FREE_IMAGE_LOAD_FLAGS.cs" - -#include "Enumerations\FREE_IMAGE_SAVE_FLAGS.cs" - -#include "Enumerations\ICC_FLAGS.cs" - - #endregion - - #region Delegates - -#include "Delegates.cs" - - #endregion - -#include "FreeImageStaticImports.cs" - -///////////////////////////////////////////////////// -// // -// Wrapper functions // -// // -///////////////////////////////////////////////////// - - #region Structs - -#include "Structs\fi_handle.cs" - -#include "Structs\FI1BIT.cs" - -#include "Structs\FI4BIT.cs" - -#include "Structs\FI16RGB555.cs" - -#include "Structs\FI16RGB565.cs" - -#include "Structs\FIRational.cs" - -#include "Structs\FIURational.cs" - - #endregion - - #region Classes - -#include "Classes\FreeImageBitmap.cs" - -#include "Classes\FreeImageEngine.cs" - -#include "Classes\FreeImagePlugin.cs" - -#include "Classes\FreeImageStreamIO.cs" - -#include "Classes\GifInformation.cs" - -#include "Classes\ImageMetadata.cs" - -#include "Classes\LocalPlugin.cs" - -#include "Classes\MemoryArray.cs" - -#include "Classes\MetadataModel.cs" - - #region Metadata Models - - #include "Classes\MetadataModels.cs" - - #endregion - -#include "Classes\MetadataTag.cs" - -#include "Classes\Palette.cs" - -#include "Classes\PluginRepository.cs" - -#include "Classes\Scanline.cs" - -#include "Classes\StreamWrapper.cs" - - #endregion - - #region Enums - -#include "Enumerations\FREE_IMAGE_COLOR_DEPTH.cs" - -#include "Enumerations\FREE_IMAGE_COMPARE_FLAGS.cs" - -#include "Enumerations\FREE_IMAGE_METADATA_COPY.cs" - -#include "Enumerations\MD_SEARCH_FLAGS.cs" - - #endregion - -#include "FreeImageWrapper.cs" \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/SourceFileMerger/Program.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/SourceFileMerger/Program.cs deleted file mode 100644 index dd7ce7e..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/SourceFileMerger/Program.cs +++ /dev/null @@ -1,122 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; -using System.Text.RegularExpressions; - -namespace FreeImageNET_SFM -{ - class Program - { - static private Regex searchPattern = new Regex("#include[ \\t]*\"(.*)\"", RegexOptions.Compiled); - static private FileStream fStream = null; - static private TextWriter textOut = null; - private const string baseFolder = @"..\..\..\Library\"; - private const string templateName = @"FreeImage.cs.template"; - - static int Main(string[] args) - { - try - { - if (!File.Exists(templateName)) - { - Console.WriteLine(templateName + " not found."); return 1; - } - - try - { - fStream = new FileStream(@"FreeImage.cs", FileMode.Create); - } - catch - { - Console.WriteLine("Unable to create output file."); return 2; - } - - textOut = new StreamWriter(fStream); - - string[] content = File.ReadAllLines(templateName); - - for (int lineNumber = 0; lineNumber < content.Length; lineNumber++) - { - string line = content[lineNumber].Trim(); - Match match = searchPattern.Match(line); - - if (match.Success && match.Groups.Count == 2 && match.Groups[1].Value != null) - { - if (!File.Exists(baseFolder + match.Groups[1].Value)) - { - throw new FileNotFoundException(baseFolder + match.Groups[1].Value + " does not exist."); - } - - ParseFile(baseFolder + match.Groups[1].Value); - } - else - { - textOut.WriteLine(content[lineNumber]); - } - } - - return 0; - } - catch (Exception ex) - { - Console.WriteLine(ex.ToString()); - //Console.WriteLine("Error while parsing."); - return 3; - } - finally - { - if (textOut != null) - { - textOut.Flush(); - textOut.Close(); - } - } - } - - private static void ParseFile(string fileName) - { - int lineNumber = 0; - string line; - Match match; - string[] content = File.ReadAllLines(fileName); - - if (fileName.Contains("AssemblyInfo.cs")) - { - while (content[lineNumber].Trim().StartsWith("using") && lineNumber < content.Length) - { - lineNumber++; - } - lineNumber++; - } - else - { - while (!(content[lineNumber].Trim().StartsWith("namespace")) && lineNumber < content.Length) - { - lineNumber++; - } - //lineNumber += 2; - } - - for (; lineNumber < content.Length; lineNumber++) - { - line = content[lineNumber].Trim(); - match = searchPattern.Match(line); - - if (match.Success && match.Groups.Count == 2 && match.Groups[1].Value != null) - { - if (!File.Exists(baseFolder + match.Groups[1].Value)) - { - throw new FileNotFoundException(baseFolder + match.Groups[1].Value + " does not exist."); - } - - ParseFile(baseFolder + match.Groups[1].Value); - } - else - { - textOut.WriteLine(content[lineNumber]); - } - } - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/SourceFileMerger/Properties/AssemblyInfo.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/SourceFileMerger/Properties/AssemblyInfo.cs deleted file mode 100644 index 1634d6f..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/SourceFileMerger/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("4fcae9f3-1b12-4137-9c5b-047124da37e9")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/SourceFileMerger/SourceFileMerger.2005.csproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/SourceFileMerger/SourceFileMerger.2005.csproj deleted file mode 100644 index 6bc856b..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/SourceFileMerger/SourceFileMerger.2005.csproj +++ /dev/null @@ -1,97 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {2AD35641-C1EA-492C-B081-F4AA5AAE8FA1} - Exe - Properties - FreeImageNET_SFM - sourcefilemerger - - - true - full - false - bin\Debug\ - DEBUG;TRACE - none - 4 - false - 512 - - - none - true - bin\Release\ - TRACE - none - 4 - false - - - true - bin\Debug\ - DEBUG;TRACE - 512 - full - x86 - false - none - - - bin\Release\ - TRACE - true - - - x86 - false - none - - - true - bin\Debug\ - DEBUG;TRACE - 512 - full - x64 - false - none - - - bin\Release\ - TRACE - true - - - x64 - false - none - - - - - - - - - - - Always - - - - - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/SourceFileMerger/SourceFileMerger.csproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/SourceFileMerger/SourceFileMerger.csproj deleted file mode 100644 index 559e803..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/SourceFileMerger/SourceFileMerger.csproj +++ /dev/null @@ -1,102 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {2AD35641-C1EA-492C-B081-F4AA5AAE8FA1} - Exe - Properties - FreeImageNET_SFM - sourcefilemerger - - - 2.0 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - none - 4 - false - 512 - - - none - true - bin\Release\ - TRACE - none - 4 - false - - - true - bin\Debug\ - DEBUG;TRACE - 512 - full - x86 - false - none - - - bin\Release\ - TRACE - true - - - x86 - false - none - - - true - bin\Debug\ - DEBUG;TRACE - 512 - full - x64 - false - none - - - bin\Release\ - TRACE - true - - - x64 - false - none - - - - - - - - - - - Always - - - - - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/UnitTest/FreeImage.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/UnitTest/FreeImage.cs deleted file mode 100644 index 46cb386..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/UnitTest/FreeImage.cs +++ /dev/null @@ -1,30584 +0,0 @@ -// ========================================================== -// FreeImage 3 .NET wrapper -// Original FreeImage 3 functions and .NET compatible derived functions -// -// Design and implementation by -// - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) -// - Carsten Klein (cklein05@users.sourceforge.net) -// -// Contributors: -// - David Boland (davidboland@vodafone.ie) -// -// Main reference : MSDN Knowlede Base -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -// ========================================================== -// To build the project without VS use the following commandline: -// "csc.exe /out:FreeImageNET.dll /target:library /doc:FreeImageNET.XML /debug- /o /unsafe+ /filealign:512 FreeImage.cs" -// ========================================================== - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Drawing; -using System.Drawing.Imaging; -using System.IO; -using System.Reflection; -using System.Resources; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Text; -using System.Text.RegularExpressions; -using System.Xml; -using FreeImageAPI; -using FreeImageAPI.IO; -using FreeImageAPI.Metadata; -using FreeImageAPI.Plugins; - -///////////////////////////////////////////////////// -// // -// FreeImage.h import // -// // -///////////////////////////////////////////////////// - - #region Structs - -namespace FreeImageAPI -{ - /// - /// The BITMAP structure defines the type, width, height, color format, and bit values of a bitmap. - /// - /// - /// The bitmap formats currently used are monochrome and color. The monochrome bitmap uses a one-bit, - /// one-plane format. Each scan is a multiple of 32 bits. - /// - /// Scans are organized as follows for a monochrome bitmap of height n: - /// - /// - /// Scan 0 - /// Scan 1 - /// . - /// . - /// . - /// Scan n-2 - /// Scan n-1 - /// - /// - /// The pixels on a monochrome device are either black or white. If the corresponding bit in the - /// bitmap is 1, the pixel is set to the foreground color; if the corresponding bit in the bitmap - /// is zero, the pixel is set to the background color. - /// - /// All devices that have the RC_BITBLT device capability support bitmaps. For more information, - /// see GetDeviceCaps. - /// - /// Each device has a unique color format. To transfer a bitmap from one device to another, - /// use the GetDIBits and SetDIBits functions. - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct BITMAP - { - /// - /// Specifies the bitmap type. This member must be zero. - /// - public int bmType; - /// - /// Specifies the width, in pixels, of the bitmap. The width must be greater than zero. - /// - public int bmWidth; - /// - /// Specifies the height, in pixels, of the bitmap. The height must be greater than zero. - /// - public int bmHeight; - /// - /// Specifies the number of bytes in each scan line. This value must be divisible by 2, - /// because the system assumes that the bit values of a bitmap form an array that is word aligned. - /// - public int bmWidthBytes; - /// - /// Specifies the count of color planes. - /// - public ushort bmPlanes; - /// - /// Specifies the number of bits required to indicate the color of a pixel. - /// - public ushort bmBitsPixel; - /// - /// Pointer to the location of the bit values for the bitmap. - /// The bmBits member must be a long pointer to an array of character (1-byte) values. - /// - public IntPtr bmBits; - } -} - -namespace FreeImageAPI -{ - /// - /// This structure contains information about the dimensions and color format - /// of a device-independent bitmap (DIB). - /// - /// - /// The structure combines the - /// BITMAPINFOHEADER structure and a color table to provide a complete - /// definition of the dimensions and colors of a DIB. - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct BITMAPINFOHEADER : IEquatable - { - /// - /// Specifies the size of the structure, in bytes. - /// - public uint biSize; - /// - /// Specifies the width of the bitmap, in pixels. - /// - /// Windows 98/Me, Windows 2000/XP: If biCompression is BI_JPEG or BI_PNG, - /// the biWidth member specifies the width of the decompressed JPEG or PNG image file, - /// respectively. - /// - public int biWidth; - /// - /// Specifies the height of the bitmap, in pixels. If biHeight is positive, the bitmap - /// is a bottom-up DIB and its origin is the lower-left corner. If biHeight is negative, - /// the bitmap is a top-down DIB and its origin is the upper-left corner. - /// - /// If biHeight is negative, indicating a top-down DIB, biCompression must be - /// either BI_RGB or BI_BITFIELDS. Top-down DIBs cannot be compressed. - /// - /// Windows 98/Me, Windows 2000/XP: If biCompression is BI_JPEG or BI_PNG, - /// the biHeight member specifies the height of the decompressed JPEG or PNG image file, - /// respectively. - /// - public int biHeight; - /// - /// Specifies the number of planes for the target device. This value must be set to 1. - /// - public ushort biPlanes; - /// - /// Specifies the number of bits per pixel.The biBitCount member of the BITMAPINFOHEADER - /// structure determines the number of bits that define each pixel and the maximum number of - /// colors in the bitmap. This member must be one of the following values. - /// - /// - /// - /// - /// Value - /// Meaning - /// - /// - /// - /// 0 - /// - /// Windows 98/Me, Windows 2000/XP: The number of bits-per-pixel is specified - /// or is implied by the JPEG or PNG format. - /// - /// - /// - /// - /// 1 - /// - /// The bitmap is monochrome, and the bmiColors member of - /// contains two entries. Each bit in the bitmap array represents a pixel. If the bit is clear, - /// the pixel is displayed with the color of the first entry in the bmiColors table; if the bit - /// is set, the pixel has the color of the second entry in the table. - /// - /// - /// - /// - /// 4 - /// - /// The bitmap has a maximum of 16 colors, and the bmiColors member of BITMAPINFO - /// contains up to 16 entries. Each pixel in the bitmap is represented by a 4-bit index into the - /// color table. For example, if the first byte in the bitmap is 0x1F, the byte represents two - /// pixels. The first pixel contains the color in the second table entry, and the second pixel - /// contains the color in the sixteenth table entry. - /// - /// - /// - /// 8 - /// - /// The bitmap has a maximum of 256 colors, and the bmiColors member of BITMAPINFO - /// contains up to 256 entries. In this case, each byte in the array represents a single pixel. - /// - /// - /// - /// - /// 16 - /// - /// The bitmap has a maximum of 2^16 colors. If the biCompression member of the - /// BITMAPINFOHEADER is BI_RGB, the bmiColors member of BITMAPINFO is NULL. - /// Each WORD in the bitmap array represents a single pixel. The relative intensities - /// of red, green, and blue are represented with five bits for each color component. - /// The value for blue is in the least significant five bits, followed by five bits each for - /// green and red. The most significant bit is not used. The bmiColors color table is used - /// for optimizing colors used on palette-based devices, and must contain the number of entries - /// specified by the biClrUsed member of the BITMAPINFOHEADER. - /// - /// If the biCompression member of the BITMAPINFOHEADER is BI_BITFIELDS, the - /// bmiColors member contains three DWORD color masks that specify the red, green, - /// and blue components, respectively, of each pixel. Each WORD in the bitmap array represents - /// a single pixel. - /// - /// Windows NT/Windows 2000/XP: When the biCompression member is BI_BITFIELDS, - /// bits set in each DWORD mask must be contiguous and should not overlap the bits - /// of another mask. All the bits in the pixel do not have to be used. - /// - /// Windows 95/98/Me: When the biCompression member is BI_BITFIELDS, the system - /// supports only the following 16bpp color masks: A 5-5-5 16-bit image, where the blue mask is - /// 0x001F, the green mask is 0x03E0, and the red mask is 0x7C00; and a 5-6-5 16-bit image, - /// where the blue mask is 0x001F, the green mask is 0x07E0, and the red mask is 0xF800. - /// - /// - /// - /// - /// 24 - /// - /// The bitmap has a maximum of 2^24 colors, and the bmiColors member of BITMAPINFO - /// is NULL. Each 3-byte triplet in the bitmap array represents the relative intensities of blue, - /// green, and red, respectively, for a pixel. The bmiColors color table is used for - /// optimizing colors used on palette-based devices, and must contain the number of entries - /// specified by the biClrUsed member of the BITMAPINFOHEADER. - /// - /// - /// - /// - /// 32 - /// - /// The bitmap has a maximum of 2^32 colors. If the biCompression member of the - /// BITMAPINFOHEADER is BI_RGB, the bmiColors member of BITMAPINFO is NULL. - /// Each DWORD in the bitmap array represents the relative intensities of blue, green, and red, - /// respectively, for a pixel. The high byte in each DWORD is not used. The bmiColors - /// color table is used for optimizing colors used on palette-based devices, and must contain the - /// number of entries specified by the biClrUsed member of the BITMAPINFOHEADER. - /// - /// If the biCompression member of the BITMAPINFOHEADER is BI_BITFIELDS, - /// the bmiColors member contains three DWORD color masks that specify the red, green, - /// and blue components, respectively, of each pixel. Each DWORD in the bitmap array represents - /// a single pixel. - /// - /// Windows NT/ 2000: When the biCompression member is BI_BITFIELDS, bits set in each - /// DWORD mask must be contiguous and should not overlap the bits of another mask. All the - /// bits in the pixel do not need to be used. - /// - /// Windows 95/98/Me: When the biCompression member is BI_BITFIELDS, the system - /// supports only the following 32-bpp color mask: The blue mask is 0x000000FF, the green mask is - /// 0x0000FF00, and the red mask is 0x00FF0000. - /// - /// - /// - /// - public ushort biBitCount; - /// - /// Specifies the type of compression for a compressed bottom-up bitmap (top-down DIBs cannot be - /// compressed). - /// - /// - /// Value - /// Meaning - /// - /// - /// - /// BI_RGB - /// An uncompressed format. - /// - /// - /// - /// BI_RLE8 - /// A run-length encoded (RLE) format for bitmaps with 8 bpp. The compression format - /// is a 2-byte format consisting of a count byte followed by a byte containing a color index. - /// - /// - /// - /// - /// BI_RLE4 - /// An RLE format for bitmaps with 4 bpp. The compression format is a 2-byte format - /// consisting of a count byte followed by two word-length color indexes. - /// - /// - /// - /// BI_BITFIELDS - /// Specifies that the bitmap is not compressed and that the color table consists - /// of three DWORD color masks that specify the red, green, and blue components, respectively, - /// of each pixel. This is valid when used with 16- and 32-bpp bitmaps. - /// - /// - /// - /// BI_JPEG - /// Windows 98/Me, Windows 2000/XP: Indicates that the image is a JPEG image. - /// - /// - /// - /// - /// BI_PNG - /// Windows 98/Me, Windows 2000/XP: Indicates that the image is a PNG image. - /// - /// - /// - /// - /// - public uint biCompression; - /// - /// Specifies the size, in bytes, of the image. This may be set to zero for BI_RGB bitmaps. - /// - /// Windows 98/Me, Windows 2000/XP: If biCompression is BI_JPEG or BI_PNG, - /// biSizeImage indicates the size of the JPEG or PNG image buffer, respectively. - /// - public uint biSizeImage; - /// - /// Specifies the horizontal resolution, in pixels-per-meter, of the target device for the bitmap. - /// An application can use this value to select a bitmap from a resource group that best matches - /// the characteristics of the current device. - /// - public int biXPelsPerMeter; - /// - /// Specifies the vertical resolution, in pixels-per-meter, of the target device for the bitmap. - /// - public int biYPelsPerMeter; - /// - /// Specifies the number of color indexes in the color table that are actually used by the bitmap. - /// If this value is zero, the bitmap uses the maximum number of colors corresponding to the value - /// of the biBitCount member for the compression mode specified by biCompression. - /// - /// If iClrUsed is nonzero and the biBitCount member is less than 16, the biClrUsed - /// member specifies the actual number of colors the graphics engine or device driver accesses. - /// If biBitCount is 16 or greater, the biClrUsed member specifies the size of the color - /// table used to optimize performance of the system color palettes. If biBitCount equals 16 or 32, - /// the optimal color palette starts immediately following the three DWORD masks. - /// - /// When the bitmap array immediately follows the structure, it is a packed bitmap. - /// Packed bitmaps are referenced by a single pointer. Packed bitmaps require that the - /// biClrUsed member must be either zero or the actual size of the color table. - /// - public uint biClrUsed; - /// - /// Specifies the number of color indexes that are required for displaying the bitmap. If this value - /// is zero, all colors are required. - /// - public uint biClrImportant; - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(BITMAPINFOHEADER left, BITMAPINFOHEADER right) - { - return ((left.biSize == right.biSize) && - (left.biWidth == right.biWidth) && - (left.biHeight == right.biHeight) && - (left.biPlanes == right.biPlanes) && - (left.biBitCount == right.biBitCount) && - (left.biCompression == right.biCompression) && - (left.biSizeImage == right.biSizeImage) && - (left.biXPelsPerMeter == right.biXPelsPerMeter) && - (left.biYPelsPerMeter == right.biYPelsPerMeter) && - (left.biClrUsed == right.biClrUsed) && - (left.biClrImportant == right.biClrImportant)); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(BITMAPINFOHEADER left, BITMAPINFOHEADER right) - { - return !(left == right); - } - - /// - /// Tests whether the specified structure is equivalent to this structure. - /// - /// A structure to compare to this instance. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public bool Equals(BITMAPINFOHEADER other) - { - return (this == other); - } - - /// - /// Tests whether the specified object is a structure - /// and is equivalent to this structure. - /// - /// The object to test. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is BITMAPINFOHEADER) && (this == (BITMAPINFOHEADER)obj)); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return base.GetHashCode(); - } - } -} - -namespace FreeImageAPI -{ - /// - /// The BITMAPINFO structure defines the dimensions and color information for a DIB. - /// - /// - /// A DIB consists of two distinct parts: a BITMAPINFO structure describing the dimensions - /// and colors of the bitmap, and an array of bytes defining the pixels of the bitmap. The bits in - /// the array are packed together, but each scan line must be padded with zeroes to end on a - /// LONG data-type boundary. If the height of the bitmap is positive, the bitmap is a - /// bottom-up DIB and its origin is the lower-left corner. If the height is negative, the bitmap is - /// a top-down DIB and its origin is the upper left corner. - /// - /// A bitmap is packed when the bitmap array immediately follows the BITMAPINFO header. - /// Packed bitmaps are referenced by a single pointer. For packed bitmaps, the biClrUsed - /// member must be set to an even number when using the DIB_PAL_COLORS mode so that the DIB bitmap - /// array starts on a DWORD boundary. - /// - /// Note The bmiColors member should not contain palette indexes if the bitmap is to - /// be stored in a file or transferred to another application. - /// - /// Unless the application has exclusive use and control of the bitmap, the bitmap color table - /// should contain explicit RGB values. - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct BITMAPINFO : IEquatable - { - /// - /// Specifies a structure that contains information - /// about the dimensions of color format. - /// - public BITMAPINFOHEADER bmiHeader; - /// - /// The bmiColors member contains one of the following: - /// - /// - /// - /// - /// An array of . The elements of the array that make up the - /// color table. - /// - /// - /// - /// - /// - /// An array of 16-bit unsigned integers that specifies indexes into the currently realized - /// logical palette. This use of bmiColors is allowed for functions that use DIBs. - /// When bmiColors elements contain indexes to a realized logical palette, they must - /// also call the following bitmap functions: - /// - /// - /// - /// - /// CreateDIBitmap - /// - /// CreateDIBPatternBrush - /// - /// CreateDIBSection - /// - /// The iUsage parameter of CreateDIBSection must be set to DIB_PAL_COLORS. - /// - /// The number of entries in the array depends on the values of the biBitCount and - /// biClrUsed members of the structure. - /// - /// The colors in the bmiColors table appear in order of importance. For more information, - /// see the Remarks section. - /// - public RGBQUAD[] bmiColors; - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(BITMAPINFO left, BITMAPINFO right) - { - if (left.bmiHeader != right.bmiHeader) - { - return false; - } - if ((left.bmiColors == null) && (right.bmiColors == null)) - { - return true; - } - if ((left.bmiColors == null) || (right.bmiColors == null)) - { - return false; - } - if (left.bmiColors.Length != right.bmiColors.Length) - { - return false; - } - for (int i = 0; i < left.bmiColors.Length; i++) - { - if (left.bmiColors[i] != right.bmiColors[i]) - { - return false; - } - } - return true; - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(BITMAPINFO left, BITMAPINFO right) - { - return !(left == right); - } - - /// - /// Tests whether the specified structure is equivalent to this structure. - /// - /// A structure to compare to this instance. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public bool Equals(BITMAPINFO other) - { - return (this == other); - } - - /// - /// Tests whether the specified object is a structure - /// and is equivalent to this structure. - /// - /// The object to test. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is BITMAPINFO) && (this == ((BITMAPINFO)obj))); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - int hash = bmiHeader.GetHashCode(); - if (bmiColors != null) - { - for (int c = 0; c < bmiColors.Length; c++) - { - hash ^= bmiColors[c].GetHashCode(); - hash <<= 1; - } - hash <<= 1; - } - else - { - hash >>= 1; - } - return hash; - } - } -} - -namespace FreeImageAPI -{ - /// - /// The FIBITMAP structure is a handle to a FreeImage bimtap. - /// - /// - /// The handle represented by a FIBITBAP structure provides - /// access to either a singlepage bitmap or exactly one page of - /// a multipage bitmap. - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct FIBITMAP : IComparable, IComparable, IEquatable - { - private IntPtr data; - - /// - /// A read-only field that represents a handle that has been initialized to zero. - /// - public static readonly FIBITMAP Zero; - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(FIBITMAP left, FIBITMAP right) - { - return (left.data == right.data); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(FIBITMAP left, FIBITMAP right) - { - return (left.data != right.data); - } - - /// - /// Gets whether the handle is a null or not. - /// - /// true if this handle is a null; - /// otherwise, false. - public bool IsNull - { - get - { - return (data == IntPtr.Zero); - } - } - - /// - /// Sets the handle to null. - /// - public void SetNull() - { - data = IntPtr.Zero; - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return data.ToString(); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return data.GetHashCode(); - } - - /// - /// Determines whether the specified is equal to the current . - /// - /// The to compare with the current . - /// true if the specified is equal to the current ; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is FIBITMAP) && (this == ((FIBITMAP)obj))); - } - - /// - /// Indicates whether the current object is equal to another object of the same type. - /// - /// An object to compare with this object. - /// true if the current object is equal to the other parameter; otherwise, false. - public bool Equals(FIBITMAP other) - { - return (this == other); - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is FIBITMAP)) - { - throw new ArgumentException("obj"); - } - return CompareTo((FIBITMAP)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(FIBITMAP other) - { - return this.data.ToInt64().CompareTo(other.data.ToInt64()); - } - } -} - -namespace FreeImageAPI -{ - /// - /// The FIMULTIBITMAP structure is a handle to a FreeImage multipaged bimtap. - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct FIMULTIBITMAP : IComparable, IComparable, IEquatable - { - private IntPtr data; - - /// - /// A read-only field that represents a handle that has been initialized to zero. - /// - public static readonly FIMULTIBITMAP Zero; - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(FIMULTIBITMAP left, FIMULTIBITMAP right) - { - return (left.data == right.data); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(FIMULTIBITMAP left, FIMULTIBITMAP right) - { - return (left.data != right.data); - } - - /// - /// Gets whether the handle is a null or not. - /// - /// true if this handle is a null; - /// otherwise, false. - public bool IsNull - { - get - { - return (data == IntPtr.Zero); - } - } - - /// - /// Sets the handle to null. - /// - public void SetNull() - { - data = IntPtr.Zero; - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return data.ToString(); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return data.GetHashCode(); - } - - /// - /// Determines whether the specified is equal to the current . - /// - /// The to compare with the current . - /// true if the specified is equal to the current ; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is FIMULTIBITMAP) && (this == ((FIMULTIBITMAP)obj))); - } - - /// - /// Indicates whether the current object is equal to another object of the same type. - /// - /// An object to compare with this object. - /// true if the current object is equal to the other parameter; otherwise, false. - public bool Equals(FIMULTIBITMAP other) - { - return (this == other); - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is FIMULTIBITMAP)) - { - throw new ArgumentException("obj"); - } - return CompareTo((FIMULTIBITMAP)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(FIMULTIBITMAP other) - { - return this.data.ToInt64().CompareTo(other.data.ToInt64()); - } - } -} - -namespace FreeImageAPI -{ - /// - /// The FIMEMORY structure is a handle to an opened memory stream. - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct FIMEMORY : IComparable, IComparable, IEquatable - { - private IntPtr data; - - /// - /// A read-only field that represents a handle that has been initialized to zero. - /// - public static readonly FIMEMORY Zero; - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(FIMEMORY left, FIMEMORY right) - { - return (left.data == right.data); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(FIMEMORY left, FIMEMORY right) - { - return (left.data != right.data); - } - - /// - /// Gets whether the pointer is a null pointer or not. - /// - /// true if this is a null pointer; - /// otherwise, false. - public bool IsNull - { - get - { - return (data == IntPtr.Zero); - } - } - - /// - /// Sets the handle to null. - /// - public void SetNull() - { - data = IntPtr.Zero; - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return data.ToString(); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return data.GetHashCode(); - } - - /// - /// Determines whether the specified is equal to the current . - /// - /// The to compare with the current . - /// true if the specified is equal to the current ; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is FIMEMORY) && (this == ((FIMEMORY)obj))); - } - - /// - /// Indicates whether the current object is equal to another object of the same type. - /// - /// An object to compare with this object. - /// true if the current object is equal to the other parameter; otherwise, false. - public bool Equals(FIMEMORY other) - { - return (this == other); - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is FIMEMORY)) - { - throw new ArgumentException("obj"); - } - return CompareTo((FIMEMORY)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(FIMEMORY other) - { - return this.data.ToInt64().CompareTo(other.data.ToInt64()); - } - } -} - -namespace FreeImageAPI -{ - /// - /// The FIMETADATA structure is an unique search handle for metadata search operations. - /// - /// - /// The FIMETADATA structure is usually returned by the - /// - /// function and then used on subsequent calls to - /// . - /// When the FIMETADATA handle is no longer used, it needs to be freed by the - /// function. - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct FIMETADATA : IComparable, IComparable, IEquatable - { - private IntPtr data; - - /// - /// A read-only field that represents a handle that has been initialized to zero. - /// - public static readonly FIMETADATA Zero; - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(FIMETADATA left, FIMETADATA right) - { - return (left.data == right.data); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(FIMETADATA left, FIMETADATA right) - { - return (left.data != right.data); - } - - /// - /// Gets whether the pointer is a null pointer or not. - /// - /// true if this is a null pointer; - /// otherwise, false. - public bool IsNull - { - get - { - return (data == IntPtr.Zero); - } - } - - /// - /// Sets the handle to null. - /// - public void SetNull() - { - data = IntPtr.Zero; - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return data.ToString(); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return data.GetHashCode(); - } - - /// - /// Determines whether the specified is equal to the current . - /// - /// The to compare with the current . - /// true if the specified is equal to the current ; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is FIMETADATA) && (this == ((FIMETADATA)obj))); - } - - /// - /// Indicates whether the current object is equal to another object of the same type. - /// - /// An object to compare with this object. - /// true if the current object is equal to the other parameter; otherwise, false. - public bool Equals(FIMETADATA other) - { - return (this == other); - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is FIMETADATA)) - { - throw new ArgumentException("obj"); - } - return CompareTo((FIMETADATA)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(FIMETADATA other) - { - return this.data.ToInt64().CompareTo(other.data.ToInt64()); - } - } -} - -namespace FreeImageAPI -{ - /// - /// The FITAG structure is a handle to a FreeImage metadata tag. - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct FITAG : IComparable, IComparable, IEquatable - { - private IntPtr data; - - /// - /// A read-only field that represents a handle that has been initialized to zero. - /// - public static readonly FITAG Zero; - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(FITAG left, FITAG right) - { - return (left.data == right.data); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(FITAG left, FITAG right) - { - return (left.data != right.data); - } - - /// - /// Gets whether the pointer is a null pointer or not. - /// - /// true if this is a null pointer; - /// otherwise, false. - public bool IsNull - { - get - { - return (data == IntPtr.Zero); - } - } - - /// - /// Sets the handle to null. - /// - public void SetNull() - { - data = IntPtr.Zero; - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return data.ToString(); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return data.GetHashCode(); - } - - /// - /// Determines whether the specified is equal to the current . - /// - /// The to compare with the current . - /// true if the specified is equal to the current ; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is FITAG) && (this == ((FITAG)obj))); - } - - /// - /// Indicates whether the current object is equal to another object of the same type. - /// - /// An object to compare with this object. - /// true if the current object is equal to the other parameter; otherwise, false. - public bool Equals(FITAG other) - { - return (this == other); - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is FITAG)) - { - throw new ArgumentException("obj"); - } - return CompareTo((FITAG)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(FITAG other) - { - return this.data.ToInt64().CompareTo(other.data.ToInt64()); - } - } -} - -namespace FreeImageAPI.IO -{ - /// - /// Structure for implementing access to custom handles. - /// - [StructLayout(LayoutKind.Sequential)] - public struct FreeImageIO - { - /// - /// Delegate to the C++ function fread. - /// - public ReadProc readProc; - - /// - /// Delegate to the C++ function fwrite. - /// - public WriteProc writeProc; - - /// - /// Delegate to the C++ function fseek. - /// - public SeekProc seekProc; - - /// - /// Delegate to the C++ function ftell. - /// - public TellProc tellProc; - } -} - -namespace FreeImageAPI -{ - /// - /// The RGBQUAD structure describes a color consisting of relative - /// intensities of red, green, blue and alpha value. Each single color - /// component consumes 8 bits and so, takes values in the range from 0 to 255. - /// - /// - /// - /// The RGBQUAD structure provides access to an underlying Win32 RGBQUAD - /// structure. To determine the alpha, red, green or blue component of a color, - /// use the rgbReserved, rgbRed, rgbGreen or rgbBlue fields, respectively. - /// - /// For easy integration of the underlying structure into the .NET framework, - /// the RGBQUAD structure implements implicit conversion operators to - /// convert the represented color to and from the - /// type. This makes the type a real replacement - /// for the RGBQUAD structure and my be used in all situations which require - /// an RGBQUAD type. - /// - /// - /// Each color component rgbReserved, rgbRed, rgbGreen or rgbBlue of RGBQUAD - /// is translated into it's corresponding color component A, R, G or B of - /// by an one-to-one manner and vice versa. - /// - /// - /// Conversion from System.Drawing.Color to RGBQUAD - /// - /// RGBQUAD.component = Color.component - /// - /// Conversion from RGBQUAD to System.Drawing.Color - /// - /// Color.component = RGBQUAD.component - /// - /// The same conversion is also applied when the - /// property or the constructor - /// is invoked. - /// - /// - /// - /// The following code example demonstrates the various conversions between the - /// RGBQUAD structure and the structure. - /// - /// RGBQUAD rgbq; - /// // Initialize the structure using a native .NET Color structure. - /// rgbq = new RGBQUAD(Color.Indigo); - /// // Initialize the structure using the implicit operator. - /// rgbq = Color.DarkSeaGreen; - /// // Convert the RGBQUAD instance into a native .NET Color - /// // using its implicit operator. - /// Color color = rgbq; - /// // Using the structure's Color property for converting it - /// // into a native .NET Color. - /// Color another = rgbq.Color; - /// - /// - [Serializable, StructLayout(LayoutKind.Explicit)] - public struct RGBQUAD : IComparable, IComparable, IEquatable - { - /// - /// The blue color component. - /// - [FieldOffset(0)] - public byte rgbBlue; - - /// - /// The green color component. - /// - [FieldOffset(1)] - public byte rgbGreen; - - /// - /// The red color component. - /// - [FieldOffset(2)] - public byte rgbRed; - - /// - /// The alpha color component. - /// - [FieldOffset(3)] - public byte rgbReserved; - - /// - /// The color's value. - /// - [FieldOffset(0)] - public uint uintValue; - - /// - /// Initializes a new instance based on the specified . - /// - /// to initialize with. - public RGBQUAD(Color color) - { - uintValue = 0u; - rgbBlue = color.B; - rgbGreen = color.G; - rgbRed = color.R; - rgbReserved = color.A; - } - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(RGBQUAD left, RGBQUAD right) - { - return (left.uintValue == right.uintValue); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(RGBQUAD left, RGBQUAD right) - { - return (left.uintValue != right.uintValue); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator RGBQUAD(Color value) - { - return new RGBQUAD(value); - } - - /// - /// Converts the value of a structure to a Color structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator Color(RGBQUAD value) - { - return value.Color; - } - - /// - /// Converts the value of an structure to a structure. - /// - /// An structure. - /// A new instance of initialized to . - public static implicit operator RGBQUAD(uint value) - { - RGBQUAD result = new RGBQUAD(); - result.uintValue = value; - return result; - } - - /// - /// Converts the value of a structure to an structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator uint(RGBQUAD value) - { - return value.uintValue; - } - - /// - /// Gets or sets the of the structure. - /// - public Color Color - { - get - { - return Color.FromArgb( - rgbReserved, - rgbRed, - rgbGreen, - rgbBlue); - } - set - { - rgbRed = value.R; - rgbGreen = value.G; - rgbBlue = value.B; - rgbReserved = value.A; - } - } - - /// - /// Converts an array of into an array of - /// . - /// - /// The array to convert. - /// An array of . - public static RGBQUAD[] ToRGBQUAD(Color[] array) - { - if (array == null) - return null; - - RGBQUAD[] result = new RGBQUAD[array.Length]; - for (int i = 0; i < array.Length; i++) - { - result[i] = array[i]; - } - return result; - } - - /// - /// Converts an array of into an array of - /// . - /// - /// The array to convert. - /// An array of . - public static Color[] ToColor(RGBQUAD[] array) - { - if (array == null) - return null; - - Color[] result = new Color[array.Length]; - for (int i = 0; i < array.Length; i++) - { - result[i] = array[i].Color; - } - return result; - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is RGBQUAD)) - { - throw new ArgumentException("obj"); - } - return CompareTo((RGBQUAD)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(RGBQUAD other) - { - return this.Color.ToArgb().CompareTo(other.Color.ToArgb()); - } - - /// - /// Tests whether the specified object is a structure - /// and is equivalent to this structure. - /// - /// The object to test. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is RGBQUAD) && (this == ((RGBQUAD)obj))); - } - - /// - /// Tests whether the specified structure is equivalent to this structure. - /// - /// A structure to compare to this instance. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public bool Equals(RGBQUAD other) - { - return (this == other); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return base.GetHashCode(); - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return FreeImage.ColorToString(Color); - } - } -} - -namespace FreeImageAPI -{ - /// - /// The RGBTRIPLE structure describes a color consisting of relative - /// intensities of red, green and blue value. Each single color component - /// consumes 8 bits and so, takes values in the range from 0 to 255. - /// - /// - /// - /// The RGBTRIPLE structure provides access to an underlying Win32 RGBTRIPLE - /// structure. To determine the red, green or blue component of a color, use the - /// rgbtRed, rgbtGreen or rgbtBlue fields, respectively. - /// - /// For easy integration of the underlying structure into the .NET framework, - /// the RGBTRIPLE structure implements implicit conversion operators to - /// convert the represented color to and from the - /// type. This makes the type a real replacement - /// for the RGBTRIPLE structure and my be used in all situations which require - /// an RGBTRIPLE type. - /// - /// - /// Each of the color components rgbtRed, rgbtGreen or rgbtBlue of RGBTRIPLE is - /// translated into it's corresponding color component R, G or B of - /// by an one-to-one manner and vice versa. - /// When converting from into RGBTRIPLE, the - /// color's alpha value is ignored and assumed to be 255 when converting from - /// RGBTRIPLE into , creating a fully - /// opaque color. - /// - /// - /// Conversion from System.Drawing.Color to RGBTRIPLE - /// - /// RGBTRIPLE.component = Color.component - /// - /// Conversion from RGBTRIPLE to System.Drawing.Color - /// - /// Color.component = RGBTRIPLE.component - /// - /// The same conversion is also applied when the - /// property or the constructor - /// is invoked. - /// - /// - /// - /// The following code example demonstrates the various conversions between the - /// RGBTRIPLE structure and the structure. - /// - /// RGBTRIPLE rgbt; - /// // Initialize the structure using a native .NET Color structure. - /// rgbt = new RGBTRIPLE(Color.Indigo); - /// // Initialize the structure using the implicit operator. - /// rgbt = Color.DarkSeaGreen; - /// // Convert the RGBTRIPLE instance into a native .NET Color - /// // using its implicit operator. - /// Color color = rgbt; - /// // Using the structure's Color property for converting it - /// // into a native .NET Color. - /// Color another = rgbt.Color; - /// - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct RGBTRIPLE : IComparable, IComparable, IEquatable - { - /// - /// The blue color component. - /// - public byte rgbtBlue; - - /// - /// The green color component. - /// - public byte rgbtGreen; - - /// - /// The red color component. - /// - public byte rgbtRed; - - /// - /// Initializes a new instance based on the specified . - /// - /// to initialize with. - public RGBTRIPLE(Color color) - { - rgbtBlue = color.B; - rgbtGreen = color.G; - rgbtRed = color.R; - } - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(RGBTRIPLE left, RGBTRIPLE right) - { - return - left.rgbtBlue == right.rgbtBlue && - left.rgbtGreen == right.rgbtGreen && - left.rgbtRed == right.rgbtRed; - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(RGBTRIPLE left, RGBTRIPLE right) - { - return !(left == right); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator RGBTRIPLE(Color value) - { - return new RGBTRIPLE(value); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator Color(RGBTRIPLE value) - { - return value.Color; - } - - /// - /// Converts the value of an structure to a structure. - /// - /// An structure. - /// A new instance of initialized to . - public static implicit operator RGBTRIPLE(uint value) - { - RGBTRIPLE result = new RGBTRIPLE(); - result.rgbtBlue = (byte)(value & 0xFF); - result.rgbtGreen = (byte)((value >> 8) & 0xFF); - result.rgbtRed = (byte)((value >> 16) & 0xFF); - return result; - } - - /// - /// Converts the value of a structure to an structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator uint(RGBTRIPLE value) - { - return (uint)((value.rgbtRed << 16) | (value.rgbtGreen << 8) | (value.rgbtBlue)); - } - - /// - /// Gets or sets the of the structure. - /// - public Color Color - { - get - { - return Color.FromArgb( - rgbtRed, - rgbtGreen, - rgbtBlue); - } - set - { - rgbtBlue = value.B; - rgbtGreen = value.G; - rgbtRed = value.R; - } - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is RGBTRIPLE)) - { - throw new ArgumentException("obj"); - } - return CompareTo((RGBTRIPLE)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(RGBTRIPLE other) - { - return this.Color.ToArgb().CompareTo(other.Color.ToArgb()); - } - - /// - /// Tests whether the specified object is a structure - /// and is equivalent to this structure. - /// - /// The object to test. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is RGBTRIPLE) && (this == ((RGBTRIPLE)obj))); - } - - /// - /// Tests whether the specified structure is equivalent to this - /// structure. - /// - /// A structure to compare to this instance. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public bool Equals(RGBTRIPLE other) - { - return (this == other); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return base.GetHashCode(); - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return FreeImage.ColorToString(Color); - } - } -} - -namespace FreeImageAPI -{ - /// - /// The FIRGBA16 structure describes a color consisting of relative - /// intensities of red, green, blue and alpha value. Each single color - /// component consumes 16 bits and so, takes values in the range from 0 to 65535. - /// - /// - /// - /// The FIRGBA16 structure provides access to an underlying FreeImage FIRGBA16 - /// structure. To determine the alpha, red, green or blue component of a color, - /// use the alpha, red, green or blue fields, respectively. - /// - /// For easy integration of the underlying structure into the .NET framework, - /// the FIRGBA16 structure implements implicit conversion operators to - /// convert the represented color to and from the - /// type. This makes the type a real replacement - /// for the FIRGBA16 structure and my be used in all situations which require - /// an FIRGBA16 type. - /// - /// - /// Each color component alpha, red, green or blue of FIRGBA16 - /// is translated into it's corresponding color component A, R, G or B of - /// by an 8 bit right shift and vice versa. - /// - /// - /// Conversion from System.Drawing.Color to FIRGBA16 - /// - /// FIRGBA16.component = Color.component << 8 - /// - /// Conversion from FIRGBA16 to System.Drawing.Color - /// - /// Color.component = FIRGBA16.component >> 8 - /// - /// The same conversion is also applied when the - /// property or the constructor - /// is invoked. - /// - /// - /// - /// The following code example demonstrates the various conversions between the - /// FIRGBA16 structure and the structure. - /// - /// FIRGBA16 firgba16; - /// // Initialize the structure using a native .NET Color structure. - /// firgba16 = new FIRGBA16(Color.Indigo); - /// // Initialize the structure using the implicit operator. - /// firgba16 = Color.DarkSeaGreen; - /// // Convert the FIRGBA16 instance into a native .NET Color - /// // using its implicit operator. - /// Color color = firgba16; - /// // Using the structure's Color property for converting it - /// // into a native .NET Color. - /// Color another = firgba16.Color; - /// - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct FIRGBA16 : IComparable, IComparable, IEquatable - { - /// - /// The red color component. - /// - public ushort red; - - /// - /// The green color component. - /// - public ushort green; - - /// - /// The blue color component. - /// - public ushort blue; - - /// - /// The alpha color component. - /// - public ushort alpha; - - /// - /// Initializes a new instance based on the specified . - /// - /// to initialize with. - public FIRGBA16(Color color) - { - red = (ushort)(color.R << 8); - green = (ushort)(color.G << 8); - blue = (ushort)(color.B << 8); - alpha = (ushort)(color.A << 8); - } - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(FIRGBA16 left, FIRGBA16 right) - { - return - ((left.alpha == right.alpha) && - (left.blue == right.blue) && - (left.green == right.green) && - (left.red == right.red)); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(FIRGBA16 left, FIRGBA16 right) - { - return !(left == right); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator FIRGBA16(Color value) - { - return new FIRGBA16(value); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator Color(FIRGBA16 value) - { - return value.Color; - } - - /// - /// Gets or sets the of the structure. - /// - public Color Color - { - get - { - return Color.FromArgb((alpha >> 8), (red >> 8), (green >> 8), (blue >> 8)); - } - set - { - red = (ushort)(value.R << 8); - green = (ushort)(value.G << 8); - blue = (ushort)(value.B << 8); - alpha = (ushort)(value.A << 8); - } - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is FIRGBA16)) - { - throw new ArgumentException("obj"); - } - return CompareTo((FIRGBA16)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(FIRGBA16 other) - { - return this.Color.ToArgb().CompareTo(other.Color.ToArgb()); - } - - /// - /// Tests whether the specified object is a structure - /// and is equivalent to this structure. - /// - /// The object to test. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is FIRGBA16) && (this == ((FIRGBA16)obj))); - } - - /// - /// Tests whether the specified structure is equivalent to this structure. - /// - /// A structure to compare to this instance. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public bool Equals(FIRGBA16 other) - { - return (this == other); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return base.GetHashCode(); - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return FreeImage.ColorToString(Color); - } - } -} - -namespace FreeImageAPI -{ - /// - /// The FIRGB16 structure describes a color consisting of relative - /// intensities of red, green, blue and alpha value. Each single color - /// component consumes 16 bits and so, takes values in the range from 0 to 65535. - /// - /// - /// - /// The FIRGB16 structure provides access to an underlying FreeImage FIRGB16 - /// structure. To determine the red, green or blue component of a color, - /// use the red, green or blue fields, respectively. - /// - /// For easy integration of the underlying structure into the .NET framework, - /// the FIRGB16 structure implements implicit conversion operators to - /// convert the represented color to and from the - /// type. This makes the type a real replacement - /// for the FIRGB16 structure and my be used in all situations which require - /// an FIRGB16 type. - /// - /// - /// Each color component red, green or blue of FIRGB16 is translated into - /// it's corresponding color component R, G or B of - /// by right shifting 8 bits and shifting left 8 bits for the reverse conversion. - /// When converting from into FIRGB16, the - /// color's alpha value is ignored and assumed to be 255 when converting from - /// FIRGB16 into , creating a fully - /// opaque color. - /// - /// - /// Conversion from System.Drawing.Color to FIRGB16 - /// - /// FIRGB16.component = Color.component << 8 - /// - /// Conversion from FIRGB16 to System.Drawing.Color - /// - /// Color.component = FIRGB16.component >> 8 - /// - /// The same conversion is also applied when the - /// property or the constructor - /// is invoked. - /// - /// - /// - /// The following code example demonstrates the various conversions between the - /// FIRGB16 structure and the structure. - /// - /// FIRGB16 firgb16; - /// // Initialize the structure using a native .NET Color structure. - /// firgb16 = new FIRGBA16(Color.Indigo); - /// // Initialize the structure using the implicit operator. - /// firgb16 = Color.DarkSeaGreen; - /// // Convert the FIRGB16 instance into a native .NET Color - /// // using its implicit operator. - /// Color color = firgb16; - /// // Using the structure's Color property for converting it - /// // into a native .NET Color. - /// Color another = firgb16.Color; - /// - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct FIRGB16 : IComparable, IComparable, IEquatable - { - /// - /// The red color component. - /// - public ushort red; - - /// - /// The green color component. - /// - public ushort green; - - /// - /// The blue color component. - /// - public ushort blue; - - /// - /// Initializes a new instance based on the specified . - /// - /// to initialize with. - public FIRGB16(Color color) - { - red = (ushort)(color.R << 8); - green = (ushort)(color.G << 8); - blue = (ushort)(color.B << 8); - } - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(FIRGB16 left, FIRGB16 right) - { - return - ((left.blue == right.blue) && - (left.green == right.green) && - (left.red == right.red)); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(FIRGB16 left, FIRGB16 right) - { - return !(left == right); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator FIRGB16(Color value) - { - return new FIRGB16(value); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator Color(FIRGB16 value) - { - return value.Color; - } - - /// - /// Gets or sets the of the structure. - /// - public Color Color - { - get - { - return Color.FromArgb((red >> 8), (green >> 8), (blue >> 8)); - } - set - { - red = (ushort)(value.R << 8); - green = (ushort)(value.G << 8); - blue = (ushort)(value.B << 8); - } - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is FIRGB16)) - { - throw new ArgumentException("obj"); - } - return CompareTo((FIRGB16)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(FIRGB16 other) - { - return this.Color.ToArgb().CompareTo(other.Color.ToArgb()); - } - - /// - /// Tests whether the specified object is a structure - /// and is equivalent to this structure. - /// - /// The object to test. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is FIRGB16) && (this == ((FIRGB16)obj))); - } - - /// - /// Tests whether the specified structure is equivalent to this structure. - /// - /// A structure to compare to this instance. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public bool Equals(FIRGB16 other) - { - return (this == other); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return base.GetHashCode(); - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return FreeImage.ColorToString(Color); - } - } -} - -namespace FreeImageAPI -{ - /// - /// The FIRGBAF structure describes a color consisting of relative - /// intensities of red, green, blue and alpha value. Each single color - /// component consumes 32 bits and takes values in the range from 0 to 1. - /// - /// - /// - /// The FIRGBAF structure provides access to an underlying FreeImage FIRGBAF - /// structure. To determine the alpha, red, green or blue component of a color, - /// use the alpha, red, green or blue fields, respectively. - /// - /// For easy integration of the underlying structure into the .NET framework, - /// the FIRGBAF structure implements implicit conversion operators to - /// convert the represented color to and from the - /// type. This makes the type a real replacement - /// for the FIRGBAF structure and my be used in all situations which require - /// an FIRGBAF type. - /// - /// - /// Each color component alpha, red, green or blue of FIRGBAF is translated - /// into it's corresponding color component A, R, G or B of - /// by linearly mapping the values of one range - /// into the other range and vice versa. - /// - /// - /// Conversion from System.Drawing.Color to FIRGBAF - /// - /// FIRGBAF.component = (float)Color.component / 255f - /// - /// Conversion from FIRGBAF to System.Drawing.Color - /// - /// Color.component = (int)(FIRGBAF.component * 255f) - /// - /// The same conversion is also applied when the - /// property or the constructor - /// is invoked. - /// - /// - /// - /// The following code example demonstrates the various conversions between the - /// FIRGBAF structure and the structure. - /// - /// FIRGBAF firgbaf; - /// // Initialize the structure using a native .NET Color structure. - /// firgbaf = new FIRGBAF(Color.Indigo); - /// // Initialize the structure using the implicit operator. - /// firgbaf = Color.DarkSeaGreen; - /// // Convert the FIRGBAF instance into a native .NET Color - /// // using its implicit operator. - /// Color color = firgbaf; - /// // Using the structure's Color property for converting it - /// // into a native .NET Color. - /// Color another = firgbaf.Color; - /// - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct FIRGBAF : IComparable, IComparable, IEquatable - { - /// - /// The red color component. - /// - public float red; - - /// - /// The green color component. - /// - public float green; - - /// - /// The blue color component. - /// - public float blue; - - /// - /// The alpha color component. - /// - public float alpha; - - /// - /// Initializes a new instance based on the specified . - /// - /// to initialize with. - public FIRGBAF(Color color) - { - red = (float)color.R / 255f; - green = (float)color.G / 255f; - blue = (float)color.B / 255f; - alpha = (float)color.A / 255f; - } - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(FIRGBAF left, FIRGBAF right) - { - return - ((left.alpha == right.alpha) && - (left.blue == right.blue) && - (left.green == right.green) && - (left.red == right.red)); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(FIRGBAF left, FIRGBAF right) - { - return !(left == right); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator FIRGBAF(Color value) - { - return new FIRGBAF(value); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator Color(FIRGBAF value) - { - return value.Color; - } - - /// - /// Gets or sets the of the structure. - /// - public Color Color - { - get - { - return Color.FromArgb( - (int)(alpha * 255f), - (int)(red * 255f), - (int)(green * 255f), - (int)(blue * 255f)); - } - set - { - red = (float)value.R / 255f; - green = (float)value.G / 255f; - blue = (float)value.B / 255f; - alpha = (float)value.A / 255f; - } - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is FIRGBAF)) - { - throw new ArgumentException("obj"); - } - return CompareTo((FIRGBAF)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(FIRGBAF other) - { - return this.Color.ToArgb().CompareTo(other.Color.ToArgb()); - } - - /// - /// Tests whether the specified object is a structure - /// and is equivalent to this structure. - /// - /// The object to test. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is FIRGBAF) && (this == ((FIRGBAF)obj))); - } - - /// - /// Tests whether the specified structure is equivalent to this structure. - /// - /// A structure to compare to this instance. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public bool Equals(FIRGBAF other) - { - return (this == other); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return base.GetHashCode(); - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return FreeImage.ColorToString(Color); - } - } -} - -namespace FreeImageAPI -{ - /// - /// The FIRGBF structure describes a color consisting of relative - /// intensities of red, green, blue and alpha value. Each single color - /// component consumes 32 bits and takes values in the range from 0 to 1. - /// - /// - /// - /// The FIRGBF structure provides access to an underlying FreeImage FIRGBF - /// structure. To determine the red, green or blue component of a color, use the - /// red, green or blue fields, respectively. - /// - /// For easy integration of the underlying structure into the .NET framework, - /// the FIRGBF structure implements implicit conversion operators to - /// convert the represented color to and from the - /// type. This makes the type a real replacement - /// for the FIRGBF structure and my be used in all situations which require - /// an FIRGBF type. - /// - /// - /// Each color component alpha, red, green or blue of FIRGBF is translated - /// into it's corresponding color component A, R, G or B of - /// by linearly mapping the values of one range - /// into the other range and vice versa. - /// When converting from into FIRGBF, the - /// color's alpha value is ignored and assumed to be 255 when converting from - /// FIRGBF into , creating a fully - /// opaque color. - /// - /// - /// Conversion from System.Drawing.Color to FIRGBF - /// - /// FIRGBF.component = (float)Color.component / 255f - /// - /// Conversion from FIRGBF to System.Drawing.Color - /// - /// Color.component = (int)(FIRGBF.component * 255f) - /// - /// The same conversion is also applied when the - /// property or the constructor - /// is invoked. - /// - /// - /// - /// The following code example demonstrates the various conversions between the - /// FIRGBF structure and the structure. - /// - /// FIRGBF firgbf; - /// // Initialize the structure using a native .NET Color structure. - /// firgbf = new FIRGBF(Color.Indigo); - /// // Initialize the structure using the implicit operator. - /// firgbf = Color.DarkSeaGreen; - /// // Convert the FIRGBF instance into a native .NET Color - /// // using its implicit operator. - /// Color color = firgbf; - /// // Using the structure's Color property for converting it - /// // into a native .NET Color. - /// Color another = firgbf.Color; - /// - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct FIRGBF : IComparable, IComparable, IEquatable - { - /// - /// The red color component. - /// - public float red; - - /// - /// The green color component. - /// - public float green; - - /// - /// The blue color component. - /// - public float blue; - - /// - /// Initializes a new instance based on the specified . - /// - /// to initialize with. - public FIRGBF(Color color) - { - red = (float)color.R / 255f; - green = (float)color.G / 255f; - blue = (float)color.B / 255f; - } - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(FIRGBF left, FIRGBF right) - { - return - ((left.blue == right.blue) && - (left.green == right.green) && - (left.red == right.red)); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(FIRGBF left, FIRGBF right) - { - return !(left == right); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator FIRGBF(Color value) - { - return new FIRGBF(value); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator Color(FIRGBF value) - { - return value.Color; - } - - /// - /// Gets or sets the of the structure. - /// - public Color Color - { - get - { - return Color.FromArgb( - (int)(red * 255f), - (int)(green * 255f), - (int)(blue * 255f)); - } - set - { - red = (float)value.R / 255f; - green = (float)value.G / 255f; - blue = (float)value.B / 255f; - } - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is FIRGBF)) - { - throw new ArgumentException("obj"); - } - return CompareTo((FIRGBF)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(FIRGBF other) - { - return this.Color.ToArgb().CompareTo(other.Color.ToArgb()); - } - - /// - /// Tests whether the specified object is a structure - /// and is equivalent to this structure. - /// - /// The object to test. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is FIRGBF) && (this == ((FIRGBF)obj))); - } - - /// - /// Tests whether the specified structure is equivalent to this structure. - /// - /// A structure to compare to this instance. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public bool Equals(FIRGBF other) - { - return (this == other); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return base.GetHashCode(); - } - - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return FreeImage.ColorToString(Color); - } - } -} - -namespace FreeImageAPI -{ - /// - /// The FICOMPLEX structure describes a color consisting of a real and an imaginary part. - /// Each part is using 4 bytes of data. - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct FICOMPLEX : IComparable, IComparable, IEquatable - { - /// - /// Real part of the color. - /// - public double real; - - /// - /// Imaginary part of the color. - /// - public double imag; - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(FICOMPLEX left, FICOMPLEX right) - { - return ((left.real == right.real) && (left.imag == right.imag)); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(FICOMPLEX left, FICOMPLEX right) - { - return ((left.real != right.real) || (left.imag == right.imag)); - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is FICOMPLEX)) - { - throw new ArgumentException("obj"); - } - return CompareTo((FICOMPLEX)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(FICOMPLEX other) - { - return base.GetHashCode(); - } - - /// - /// Tests whether the specified object is a structure - /// and is equivalent to this structure. - /// - /// The object to test. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is FICOMPLEX) && (this == ((FICOMPLEX)obj))); - } - - /// - /// Tests whether the specified structure is equivalent to this structure. - /// - /// A structure to compare to this instance. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public bool Equals(FICOMPLEX other) - { - return (this == other); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return base.GetHashCode(); - } - } -} - -namespace FreeImageAPI -{ - /// - /// This Structure contains ICC-Profile data. - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct FIICCPROFILE - { - private ICC_FLAGS flags; - private uint size; - private IntPtr data; - - /// - /// Creates a new ICC-Profile for . - /// - /// Handle to a FreeImage bitmap. - /// The ICC-Profile data. - /// - /// is null. - public FIICCPROFILE(FIBITMAP dib, byte[] data) - : this(dib, data, (int)data.Length) - { - } - - /// - /// Creates a new ICC-Profile for . - /// - /// Handle to a FreeImage bitmap. - /// The ICC-Profile data. - /// Number of bytes to use from data. - /// - /// is null. - public unsafe FIICCPROFILE(FIBITMAP dib, byte[] data, int size) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - FIICCPROFILE prof; - size = Math.Min(size, (int)data.Length); - prof = *(FIICCPROFILE*)FreeImage.CreateICCProfile(dib, data, size); - this.flags = prof.flags; - this.size = prof.size; - this.data = prof.data; - } - - /// - /// Info flag of the profile. - /// - public ICC_FLAGS Flags - { - get { return flags; } - } - - /// - /// Profile's size measured in bytes. - /// - public uint Size - { - get { return size; } - } - - /// - /// Points to a block of contiguous memory containing the profile. - /// - public IntPtr DataPointer - { - get { return data; } - } - - /// - /// Copy of the ICC-Profiles data. - /// - public unsafe byte[] Data - { - get - { - byte[] result; - FreeImage.CopyMemory(result = new byte[size], data.ToPointer(), size); - return result; - } - } - - /// - /// Indicates whether the profile is CMYK. - /// - public bool IsCMYK - { - get - { - return ((flags & ICC_FLAGS.FIICC_COLOR_IS_CMYK) != 0); - } - } - } -} - -namespace FreeImageAPI.Plugins -{ - /// - /// The structure contains functionpointers that make up a FreeImage plugin. - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct Plugin - { - /// - /// Delegate to a function that returns a string which describes - /// the plugins format. - /// - public FormatProc formatProc; - - /// - /// Delegate to a function that returns a string which contains - /// a more detailed description. - /// - public DescriptionProc descriptionProc; - - /// - /// Delegate to a function that returns a comma seperated list - /// of file extensions the plugin can read or write. - /// - public ExtensionListProc extensionListProc; - - /// - /// Delegate to a function that returns a regular expression that - /// can be used to idientify whether a file can be handled by the plugin. - /// - public RegExprProc regExprProc; - - /// - /// Delegate to a function that opens a file. - /// - public OpenProc openProc; - - /// - /// Delegate to a function that closes a previosly opened file. - /// - public CloseProc closeProc; - - /// - /// Delegate to a function that returns the number of pages of a multipage - /// bitmap if the plugin is capable of handling multipage bitmaps. - /// - public PageCountProc pageCountProc; - - /// - /// UNKNOWN - /// - public PageCapabilityProc pageCapabilityProc; - - /// - /// Delegate to a function that loads and decodes a bitmap into memory. - /// - public LoadProc loadProc; - - /// - /// Delegate to a function that saves a bitmap. - /// - public SaveProc saveProc; - - /// - /// Delegate to a function that determines whether the source is a valid image. - /// - public ValidateProc validateProc; - - /// - /// Delegate to a function that returns a string which contains - /// the plugin's mime type. - /// - public MimeProc mimeProc; - - /// - /// Delegate to a function that returns whether the plugin can handle the - /// specified color depth. - /// - public SupportsExportBPPProc supportsExportBPPProc; - - /// - /// Delegate to a function that returns whether the plugin can handle the - /// specified image type. - /// - public SupportsExportTypeProc supportsExportTypeProc; - - /// - /// Delegate to a function that returns whether the plugin can handle - /// ICC-Profiles. - /// - public SupportsICCProfilesProc supportsICCProfilesProc; - } -} - - #endregion - - #region Enums - -namespace FreeImageAPI.Metadata -{ - /// - /// Specifies how a single frame will be handled after being displayed. - /// - public enum DisposalMethodType : byte - { - /// - /// Same behavior as but should not be used. - /// - Unspecified, - - /// - /// The image is left in place and will be overdrawn by the next image. - /// - Leave, - - /// - /// The area of the image will be blanked out by its background. - /// - Background, - - /// - /// Restores the the area of the image to the state it was before it - /// has been dawn. - /// - Previous, - } -} - -namespace FreeImageAPI -{ - /// - /// I/O image format identifiers. - /// - public enum FREE_IMAGE_FORMAT - { - /// - /// Unknown format (returned value only, never use it as input value) - /// - FIF_UNKNOWN = -1, - /// - /// Windows or OS/2 Bitmap File (*.BMP) - /// - FIF_BMP = 0, - /// - /// Windows Icon (*.ICO) - /// - FIF_ICO = 1, - /// - /// Independent JPEG Group (*.JPG, *.JIF, *.JPEG, *.JPE) - /// - FIF_JPEG = 2, - /// - /// JPEG Network Graphics (*.JNG) - /// - FIF_JNG = 3, - /// - /// Commodore 64 Koala format (*.KOA) - /// - FIF_KOALA = 4, - /// - /// Amiga IFF (*.IFF, *.LBM) - /// - FIF_LBM = 5, - /// - /// Amiga IFF (*.IFF, *.LBM) - /// - FIF_IFF = 5, - /// - /// Multiple Network Graphics (*.MNG) - /// - FIF_MNG = 6, - /// - /// Portable Bitmap (ASCII) (*.PBM) - /// - FIF_PBM = 7, - /// - /// Portable Bitmap (BINARY) (*.PBM) - /// - FIF_PBMRAW = 8, - /// - /// Kodak PhotoCD (*.PCD) - /// - FIF_PCD = 9, - /// - /// Zsoft Paintbrush PCX bitmap format (*.PCX) - /// - FIF_PCX = 10, - /// - /// Portable Graymap (ASCII) (*.PGM) - /// - FIF_PGM = 11, - /// - /// Portable Graymap (BINARY) (*.PGM) - /// - FIF_PGMRAW = 12, - /// - /// Portable Network Graphics (*.PNG) - /// - FIF_PNG = 13, - /// - /// Portable Pixelmap (ASCII) (*.PPM) - /// - FIF_PPM = 14, - /// - /// Portable Pixelmap (BINARY) (*.PPM) - /// - FIF_PPMRAW = 15, - /// - /// Sun Rasterfile (*.RAS) - /// - FIF_RAS = 16, - /// - /// truevision Targa files (*.TGA, *.TARGA) - /// - FIF_TARGA = 17, - /// - /// Tagged Image File Format (*.TIF, *.TIFF) - /// - FIF_TIFF = 18, - /// - /// Wireless Bitmap (*.WBMP) - /// - FIF_WBMP = 19, - /// - /// Adobe Photoshop (*.PSD) - /// - FIF_PSD = 20, - /// - /// Dr. Halo (*.CUT) - /// - FIF_CUT = 21, - /// - /// X11 Bitmap Format (*.XBM) - /// - FIF_XBM = 22, - /// - /// X11 Pixmap Format (*.XPM) - /// - FIF_XPM = 23, - /// - /// DirectDraw Surface (*.DDS) - /// - FIF_DDS = 24, - /// - /// Graphics Interchange Format (*.GIF) - /// - FIF_GIF = 25, - /// - /// High Dynamic Range (*.HDR) - /// - FIF_HDR = 26, - /// - /// Raw Fax format CCITT G3 (*.G3) - /// - FIF_FAXG3 = 27, - /// - /// Silicon Graphics SGI image format (*.SGI) - /// - FIF_SGI = 28, - /// - /// OpenEXR format (*.EXR) - /// - FIF_EXR = 29, - /// - /// JPEG-2000 format (*.J2K, *.J2C) - /// - FIF_J2K = 30, - /// - /// JPEG-2000 format (*.JP2) - /// - FIF_JP2 = 31, - /// - /// Portable FloatMap (*.PFM) - /// - FIF_PFM = 32, - /// - /// Macintosh PICT (*.PICT) - /// - FIF_PICT = 33, - /// - /// RAW camera image (*.*) - /// - FIF_RAW = 34, - } -} - -namespace FreeImageAPI -{ - /// - /// Image types used in FreeImage. - /// - public enum FREE_IMAGE_TYPE - { - /// - /// unknown type - /// - FIT_UNKNOWN = 0, - /// - /// standard image : 1-, 4-, 8-, 16-, 24-, 32-bit - /// - FIT_BITMAP = 1, - /// - /// array of unsigned short : unsigned 16-bit - /// - FIT_UINT16 = 2, - /// - /// array of short : signed 16-bit - /// - FIT_INT16 = 3, - /// - /// array of unsigned long : unsigned 32-bit - /// - FIT_UINT32 = 4, - /// - /// array of long : signed 32-bit - /// - FIT_INT32 = 5, - /// - /// array of float : 32-bit IEEE floating point - /// - FIT_FLOAT = 6, - /// - /// array of double : 64-bit IEEE floating point - /// - FIT_DOUBLE = 7, - /// - /// array of FICOMPLEX : 2 x 64-bit IEEE floating point - /// - FIT_COMPLEX = 8, - /// - /// 48-bit RGB image : 3 x 16-bit - /// - FIT_RGB16 = 9, - /// - /// 64-bit RGBA image : 4 x 16-bit - /// - FIT_RGBA16 = 10, - /// - /// 96-bit RGB float image : 3 x 32-bit IEEE floating point - /// - FIT_RGBF = 11, - /// - /// 128-bit RGBA float image : 4 x 32-bit IEEE floating point - /// - FIT_RGBAF = 12 - } -} - -namespace FreeImageAPI -{ - /// - /// Constants used in color filling routines. - /// - public enum FREE_IMAGE_COLOR_OPTIONS - { - /// - /// Default value. - /// - FICO_DEFAULT = 0x0, - /// - /// color is RGB color (contains no valid alpha channel). - /// - FICO_RGB = 0x0, - /// - /// color is RGBA color (contains a valid alpha channel). - /// - FICO_RGBA = 0x1, - /// - /// Lookup nearest RGB color from palette. - /// - FICO_NEAREST_COLOR = 0x0, - /// - /// Lookup equal RGB color from palette. - /// - FICO_EQUAL_COLOR = 0x2, - /// - /// contains the palette index to be used. - /// - FICO_ALPHA_IS_INDEX = 0x4, - } -} - -namespace FreeImageAPI -{ - /// - /// Image color types used in FreeImage. - /// - public enum FREE_IMAGE_COLOR_TYPE - { - /// - /// min value is white - /// - FIC_MINISWHITE = 0, - /// - /// min value is black - /// - FIC_MINISBLACK = 1, - /// - /// RGB color model - /// - FIC_RGB = 2, - /// - /// color map indexed - /// - FIC_PALETTE = 3, - /// - /// RGB color model with alpha channel - /// - FIC_RGBALPHA = 4, - /// - /// CMYK color model - /// - FIC_CMYK = 5 - } -} - -namespace FreeImageAPI -{ - /// - /// Color quantization algorithms. - /// Constants used in FreeImage_ColorQuantize. - /// - public enum FREE_IMAGE_QUANTIZE - { - /// - /// Xiaolin Wu color quantization algorithm - /// - FIQ_WUQUANT = 0, - /// - /// NeuQuant neural-net quantization algorithm by Anthony Dekker - /// - FIQ_NNQUANT = 1 - } -} - -namespace FreeImageAPI -{ - /// - /// Dithering algorithms. - /// Constants used in FreeImage_Dither. - /// - public enum FREE_IMAGE_DITHER - { - /// - /// Floyd and Steinberg error diffusion - /// - FID_FS = 0, - /// - /// Bayer ordered dispersed dot dithering (order 2 dithering matrix) - /// - FID_BAYER4x4 = 1, - /// - /// Bayer ordered dispersed dot dithering (order 3 dithering matrix) - /// - FID_BAYER8x8 = 2, - /// - /// Ordered clustered dot dithering (order 3 - 6x6 matrix) - /// - FID_CLUSTER6x6 = 3, - /// - /// Ordered clustered dot dithering (order 4 - 8x8 matrix) - /// - FID_CLUSTER8x8 = 4, - /// - /// Ordered clustered dot dithering (order 8 - 16x16 matrix) - /// - FID_CLUSTER16x16 = 5, - /// - /// Bayer ordered dispersed dot dithering (order 4 dithering matrix) - /// - FID_BAYER16x16 = 6 - } -} - -namespace FreeImageAPI -{ - /// - /// Lossless JPEG transformations constants used in FreeImage_JPEGTransform. - /// - public enum FREE_IMAGE_JPEG_OPERATION - { - /// - /// no transformation - /// - FIJPEG_OP_NONE = 0, - /// - /// horizontal flip - /// - FIJPEG_OP_FLIP_H = 1, - /// - /// vertical flip - /// - FIJPEG_OP_FLIP_V = 2, - /// - /// transpose across UL-to-LR axis - /// - FIJPEG_OP_TRANSPOSE = 3, - /// - /// transpose across UR-to-LL axis - /// - FIJPEG_OP_TRANSVERSE = 4, - /// - /// 90-degree clockwise rotation - /// - FIJPEG_OP_ROTATE_90 = 5, - /// - /// 180-degree rotation - /// - FIJPEG_OP_ROTATE_180 = 6, - /// - /// 270-degree clockwise (or 90 ccw) - /// - FIJPEG_OP_ROTATE_270 = 7 - } -} - -namespace FreeImageAPI -{ - /// - /// Tone mapping operators. Constants used in FreeImage_ToneMapping. - /// - public enum FREE_IMAGE_TMO - { - /// - /// Adaptive logarithmic mapping (F. Drago, 2003) - /// - FITMO_DRAGO03 = 0, - /// - /// Dynamic range reduction inspired by photoreceptor physiology (E. Reinhard, 2005) - /// - FITMO_REINHARD05 = 1, - /// - /// Gradient domain high dynamic range compression (R. Fattal, 2002) - /// - FITMO_FATTAL02 - } -} - -namespace FreeImageAPI -{ - /// - /// Upsampling / downsampling filters. Constants used in FreeImage_Rescale. - /// - public enum FREE_IMAGE_FILTER - { - /// - /// Box, pulse, Fourier window, 1st order (constant) b-spline - /// - FILTER_BOX = 0, - /// - /// Mitchell and Netravali's two-param cubic filter - /// - FILTER_BICUBIC = 1, - /// - /// Bilinear filter - /// - FILTER_BILINEAR = 2, - /// - /// 4th order (cubic) b-spline - /// - FILTER_BSPLINE = 3, - /// - /// Catmull-Rom spline, Overhauser spline - /// - FILTER_CATMULLROM = 4, - /// - /// Lanczos3 filter - /// - FILTER_LANCZOS3 = 5 - } -} - -namespace FreeImageAPI -{ - /// - /// Color channels. Constants used in color manipulation routines. - /// - public enum FREE_IMAGE_COLOR_CHANNEL - { - /// - /// Use red, green and blue channels - /// - FICC_RGB = 0, - /// - /// Use red channel - /// - FICC_RED = 1, - /// - /// Use green channel - /// - FICC_GREEN = 2, - /// - /// Use blue channel - /// - FICC_BLUE = 3, - /// - /// Use alpha channel - /// - FICC_ALPHA = 4, - /// - /// Use black channel - /// - FICC_BLACK = 5, - /// - /// Complex images: use real part - /// - FICC_REAL = 6, - /// - /// Complex images: use imaginary part - /// - FICC_IMAG = 7, - /// - /// Complex images: use magnitude - /// - FICC_MAG = 8, - /// - /// Complex images: use phase - /// - FICC_PHASE = 9 - } -} - -namespace FreeImageAPI -{ - /// - /// Tag data type information (based on TIFF specifications) - /// Note: RATIONALs are the ratio of two 32-bit integer values. - /// - public enum FREE_IMAGE_MDTYPE - { - /// - /// placeholder - /// - FIDT_NOTYPE = 0, - /// - /// 8-bit unsigned integer - /// - FIDT_BYTE = 1, - /// - /// 8-bit bytes w/ last byte null - /// - FIDT_ASCII = 2, - /// - /// 16-bit unsigned integer - /// - FIDT_SHORT = 3, - /// - /// 32-bit unsigned integer - /// - FIDT_LONG = 4, - /// - /// 64-bit unsigned fraction - /// - FIDT_RATIONAL = 5, - /// - /// 8-bit signed integer - /// - FIDT_SBYTE = 6, - /// - /// 8-bit untyped data - /// - FIDT_UNDEFINED = 7, - /// - /// 16-bit signed integer - /// - FIDT_SSHORT = 8, - /// - /// 32-bit signed integer - /// - FIDT_SLONG = 9, - /// - /// 64-bit signed fraction - /// - FIDT_SRATIONAL = 10, - /// - /// 32-bit IEEE floating point - /// - FIDT_FLOAT = 11, - /// - /// 64-bit IEEE floating point - /// - FIDT_DOUBLE = 12, - /// - /// 32-bit unsigned integer (offset) - /// - FIDT_IFD = 13, - /// - /// 32-bit RGBQUAD - /// - FIDT_PALETTE = 14 - } -} - -namespace FreeImageAPI -{ - /// - /// Metadata models supported by FreeImage. - /// - public enum FREE_IMAGE_MDMODEL - { - /// - /// No data - /// - FIMD_NODATA = -1, - /// - /// single comment or keywords - /// - FIMD_COMMENTS = 0, - /// - /// Exif-TIFF metadata - /// - FIMD_EXIF_MAIN = 1, - /// - /// Exif-specific metadata - /// - FIMD_EXIF_EXIF = 2, - /// - /// Exif GPS metadata - /// - FIMD_EXIF_GPS = 3, - /// - /// Exif maker note metadata - /// - FIMD_EXIF_MAKERNOTE = 4, - /// - /// Exif interoperability metadata - /// - FIMD_EXIF_INTEROP = 5, - /// - /// IPTC/NAA metadata - /// - FIMD_IPTC = 6, - /// - /// Abobe XMP metadata - /// - FIMD_XMP = 7, - /// - /// GeoTIFF metadata - /// - FIMD_GEOTIFF = 8, - /// - /// Animation metadata - /// - FIMD_ANIMATION = 9, - /// - /// Used to attach other metadata types to a dib - /// - FIMD_CUSTOM = 10 - } -} - -namespace FreeImageAPI -{ - /// - /// Flags used in load functions. - /// - [System.Flags] - public enum FREE_IMAGE_LOAD_FLAGS - { - /// - /// Default option for all types. - /// - DEFAULT = 0, - /// - /// Load the image as a 256 color image with ununsed palette entries, if it's 16 or 2 color. - /// - GIF_LOAD256 = 1, - /// - /// 'Play' the GIF to generate each frame (as 32bpp) instead of returning raw frame data when loading. - /// - GIF_PLAYBACK = 2, - /// - /// Convert to 32bpp and create an alpha channel from the AND-mask when loading. - /// - ICO_MAKEALPHA = 1, - /// - /// Load the file as fast as possible, sacrificing some quality. - /// - JPEG_FAST = 0x0001, - /// - /// Load the file with the best quality, sacrificing some speed. - /// - JPEG_ACCURATE = 0x0002, - /// - /// Load separated CMYK "as is" (use | to combine with other load flags). - /// - JPEG_CMYK = 0x0004, - /// - /// Load and rotate according to Exif 'Orientation' tag if available. - /// - JPEG_EXIFROTATE = 0x0008, - /// - /// Load the bitmap sized 768 x 512. - /// - PCD_BASE = 1, - /// - /// Load the bitmap sized 384 x 256. - /// - PCD_BASEDIV4 = 2, - /// - /// Load the bitmap sized 192 x 128. - /// - PCD_BASEDIV16 = 3, - /// - /// Avoid gamma correction. - /// - PNG_IGNOREGAMMA = 1, - /// - /// If set the loader converts RGB555 and ARGB8888 -> RGB888. - /// - TARGA_LOAD_RGB888 = 1, - /// - /// Reads tags for separated CMYK. - /// - TIFF_CMYK = 0x0001, - /// - /// Tries to load the JPEG preview image, embedded in - /// Exif Metadata or load the image as RGB 24-bit if no - /// preview image is available. - /// - RAW_PREVIEW = 0x1, - /// - /// Loads the image as RGB 24-bit. - /// - RAW_DISPLAY = 0x2, - } -} - -namespace FreeImageAPI -{ - /// - /// Flags used in save functions. - /// - [System.Flags] - public enum FREE_IMAGE_SAVE_FLAGS - { - /// - /// Default option for all types. - /// - DEFAULT = 0, - /// - /// Save with run length encoding. - /// - BMP_SAVE_RLE = 1, - /// - /// Save data as float instead of as half (not recommended). - /// - EXR_FLOAT = 0x0001, - /// - /// Save with no compression. - /// - EXR_NONE = 0x0002, - /// - /// Save with zlib compression, in blocks of 16 scan lines. - /// - EXR_ZIP = 0x0004, - /// - /// Save with piz-based wavelet compression. - /// - EXR_PIZ = 0x0008, - /// - /// Save with lossy 24-bit float compression. - /// - EXR_PXR24 = 0x0010, - /// - /// Save with lossy 44% float compression - goes to 22% when combined with EXR_LC. - /// - EXR_B44 = 0x0020, - /// - /// Save images with one luminance and two chroma channels, rather than as RGB (lossy compression). - /// - EXR_LC = 0x0040, - /// - /// Save with superb quality (100:1). - /// - JPEG_QUALITYSUPERB = 0x80, - /// - /// Save with good quality (75:1). - /// - JPEG_QUALITYGOOD = 0x0100, - /// - /// Save with normal quality (50:1). - /// - JPEG_QUALITYNORMAL = 0x0200, - /// - /// Save with average quality (25:1). - /// - JPEG_QUALITYAVERAGE = 0x0400, - /// - /// Save with bad quality (10:1). - /// - JPEG_QUALITYBAD = 0x0800, - /// - /// Save as a progressive-JPEG (use | to combine with other save flags). - /// - JPEG_PROGRESSIVE = 0x2000, - /// - /// Save with high 4x1 chroma subsampling (4:1:1). - /// - JPEG_SUBSAMPLING_411 = 0x1000, - /// - /// Save with medium 2x2 medium chroma (4:2:0). - /// - JPEG_SUBSAMPLING_420 = 0x4000, - /// - /// Save with low 2x1 chroma subsampling (4:2:2). - /// - JPEG_SUBSAMPLING_422 = 0x8000, - /// - /// Save with no chroma subsampling (4:4:4). - /// - JPEG_SUBSAMPLING_444 = 0x10000, - /// - /// Save using ZLib level 1 compression flag - /// (default value is ). - /// - PNG_Z_BEST_SPEED = 0x0001, - /// - /// Save using ZLib level 6 compression flag (default recommended value). - /// - PNG_Z_DEFAULT_COMPRESSION = 0x0006, - /// - /// save using ZLib level 9 compression flag - /// (default value is ). - /// - PNG_Z_BEST_COMPRESSION = 0x0009, - /// - /// Save without ZLib compression. - /// - PNG_Z_NO_COMPRESSION = 0x0100, - /// - /// Save using Adam7 interlacing (use | to combine with other save flags). - /// - PNG_INTERLACED = 0x0200, - /// - /// If set the writer saves in ASCII format (i.e. P1, P2 or P3). - /// - PNM_SAVE_ASCII = 1, - /// - /// Stores tags for separated CMYK (use | to combine with compression flags). - /// - TIFF_CMYK = 0x0001, - /// - /// Save using PACKBITS compression. - /// - TIFF_PACKBITS = 0x0100, - /// - /// Save using DEFLATE compression (a.k.a. ZLIB compression). - /// - TIFF_DEFLATE = 0x0200, - /// - /// Save using ADOBE DEFLATE compression. - /// - TIFF_ADOBE_DEFLATE = 0x0400, - /// - /// Save without any compression. - /// - TIFF_NONE = 0x0800, - /// - /// Save using CCITT Group 3 fax encoding. - /// - TIFF_CCITTFAX3 = 0x1000, - /// - /// Save using CCITT Group 4 fax encoding. - /// - TIFF_CCITTFAX4 = 0x2000, - /// - /// Save using LZW compression. - /// - TIFF_LZW = 0x4000, - /// - /// Save using JPEG compression. - /// - TIFF_JPEG = 0x8000 - } -} - -namespace FreeImageAPI -{ - /// - /// Flags for ICC profiles. - /// - [System.Flags] - public enum ICC_FLAGS : ushort - { - /// - /// Default value. - /// - FIICC_DEFAULT = 0x00, - /// - /// The color is CMYK. - /// - FIICC_COLOR_IS_CMYK = 0x01 - } -} - - #endregion - - #region Delegates - -namespace FreeImageAPI -{ - // Delegates used by the FreeImageIO structure - - /// - /// Delegate for capturing FreeImage error messages. - /// - /// The format of the image. - /// The errormessage. - // DLL_API is missing in the definition of the callbackfuntion. - [UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi, ThrowOnUnmappableChar = false)] - public delegate void OutputMessageFunction(FREE_IMAGE_FORMAT fif, string message); -} - -namespace FreeImageAPI.IO -{ - /// - /// Delegate to the C++ function fread. - /// - /// Pointer to read from. - /// Item size in bytes. - /// Maximum number of items to be read. - /// Handle/stream to read from. - /// Number of full items actually read, - /// which may be less than count if an error occurs or - /// if the end of the file is encountered before reaching count. - public delegate uint ReadProc(IntPtr buffer, uint size, uint count, fi_handle handle); - - /// - /// Delegate to the C++ function fwrite. - /// - /// Pointer to data to be written. - /// Item size in bytes. - /// Maximum number of items to be written. - /// Handle/stream to write to. - /// Number of full items actually written, - /// which may be less than count if an error occurs. - /// Also, if an error occurs, the file-position indicator cannot be determined. - public delegate uint WriteProc(IntPtr buffer, uint size, uint count, fi_handle handle); - - /// - /// Delegate to the C++ function fseek. - /// - /// Handle/stream to seek in. - /// Number of bytes from origin. - /// Initial position. - /// If successful 0 is returned; otherwise a nonzero value. - public delegate int SeekProc(fi_handle handle, int offset, SeekOrigin origin); - - /// - /// Delegate to the C++ function ftell. - /// - /// Handle/stream to retrieve its currents position from. - /// The current position. - public delegate int TellProc(fi_handle handle); - - // Delegates used by 'Plugin' structure -} - -namespace FreeImageAPI.Plugins -{ - /// - /// Delegate to a function that returns a string which describes - /// the plugins format. - /// - public delegate string FormatProc(); - - /// - /// Delegate to a function that returns a string which contains - /// a more detailed description. - /// - public delegate string DescriptionProc(); - - /// - /// Delegate to a function that returns a comma seperated list - /// of file extensions the plugin can read or write. - /// - public delegate string ExtensionListProc(); - - /// - /// Delegate to a function that returns a regular expression that - /// can be used to idientify whether a file can be handled by the plugin. - /// - public delegate string RegExprProc(); - - /// - /// Delegate to a function that opens a file. - /// - public delegate IntPtr OpenProc(ref FreeImageIO io, fi_handle handle, bool read); - - /// - /// Delegate to a function that closes a previosly opened file. - /// - public delegate void CloseProc(ref FreeImageIO io, fi_handle handle, IntPtr data); - - /// - /// Delegate to a function that returns the number of pages of a multipage - /// bitmap if the plugin is capable of handling multipage bitmaps. - /// - public delegate int PageCountProc(ref FreeImageIO io, fi_handle handle, IntPtr data); - - /// - /// UNKNOWN - /// - public delegate int PageCapabilityProc(ref FreeImageIO io, fi_handle handle, IntPtr data); - - /// - /// Delegate to a function that loads and decodes a bitmap into memory. - /// - public delegate FIBITMAP LoadProc(ref FreeImageIO io, fi_handle handle, int page, int flags, IntPtr data); - - /// - /// Delegate to a function that saves a bitmap. - /// - public delegate bool SaveProc(ref FreeImageIO io, FIBITMAP dib, fi_handle handle, int page, int flags, IntPtr data); - - /// - /// Delegate to a function that determines whether the source defined - /// by and is a valid image. - /// - public delegate bool ValidateProc(ref FreeImageIO io, fi_handle handle); - - /// - /// Delegate to a function that returns a string which contains - /// the plugin's mime type. - /// - public delegate string MimeProc(); - - /// - /// Delegate to a function that returns whether the plugin can handle the - /// specified color depth. - /// - public delegate bool SupportsExportBPPProc(int bpp); - - /// - /// Delegate to a function that returns whether the plugin can handle the - /// specified image type. - /// - public delegate bool SupportsExportTypeProc(FREE_IMAGE_TYPE type); - - /// - /// Delegate to a function that returns whether the plugin can handle - /// ICC-Profiles. - /// - public delegate bool SupportsICCProfilesProc(); - - /// - /// Callback function used by FreeImage to register plugins. - /// - public delegate void InitProc(ref Plugin plugin, int format_id); -} - - #endregion - -namespace FreeImageAPI -{ - public static partial class FreeImage - { - #region Constants - - /// - /// Filename of the FreeImage library. - /// - private const string FreeImageLibrary = "FreeImage"; - - /// - /// Number of bytes to shift left within a 4 byte block. - /// - public const int FI_RGBA_RED = 2; - - /// - /// Number of bytes to shift left within a 4 byte block. - /// - public const int FI_RGBA_GREEN = 1; - - /// - /// Number of bytes to shift left within a 4 byte block. - /// - public const int FI_RGBA_BLUE = 0; - - /// - /// Number of bytes to shift left within a 4 byte block. - /// - public const int FI_RGBA_ALPHA = 3; - - /// - /// Mask indicating the position of the given color. - /// - public const uint FI_RGBA_RED_MASK = 0x00FF0000; - - /// - /// Mask indicating the position of the given color. - /// - public const uint FI_RGBA_GREEN_MASK = 0x0000FF00; - - /// - /// Mask indicating the position of the given color. - /// - public const uint FI_RGBA_BLUE_MASK = 0x000000FF; - - /// - /// Mask indicating the position of the given color. - /// - public const uint FI_RGBA_ALPHA_MASK = 0xFF000000; - - /// - /// Number of bits to shift left within a 32 bit block. - /// - public const int FI_RGBA_RED_SHIFT = 16; - - /// - /// Number of bits to shift left within a 32 bit block. - /// - public const int FI_RGBA_GREEN_SHIFT = 8; - - /// - /// Number of bits to shift left within a 32 bit block. - /// - public const int FI_RGBA_BLUE_SHIFT = 0; - - /// - /// Number of bits to shift left within a 32 bit block. - /// - public const int FI_RGBA_ALPHA_SHIFT = 24; - - /// - /// Mask indicating the position of color components of a 32 bit color. - /// - public const uint FI_RGBA_RGB_MASK = (FI_RGBA_RED_MASK | FI_RGBA_GREEN_MASK | FI_RGBA_BLUE_MASK); - - /// - /// Mask indicating the position of the given color. - /// - public const int FI16_555_RED_MASK = 0x7C00; - - /// - /// Mask indicating the position of the given color. - /// - public const int FI16_555_GREEN_MASK = 0x03E0; - - /// - /// Mask indicating the position of the given color. - /// - public const int FI16_555_BLUE_MASK = 0x001F; - - /// - /// Number of bits to shift left within a 16 bit block. - /// - public const int FI16_555_RED_SHIFT = 10; - - /// - /// Number of bits to shift left within a 16 bit block. - /// - public const int FI16_555_GREEN_SHIFT = 5; - - /// - /// Number of bits to shift left within a 16 bit block. - /// - public const int FI16_555_BLUE_SHIFT = 0; - - /// - /// Mask indicating the position of the given color. - /// - public const int FI16_565_RED_MASK = 0xF800; - - /// - /// Mask indicating the position of the given color. - /// - public const int FI16_565_GREEN_MASK = 0x07E0; - - /// - /// Mask indicating the position of the given color. - /// - public const int FI16_565_BLUE_MASK = 0x001F; - - /// - /// Number of bits to shift left within a 16 bit block. - /// - public const int FI16_565_RED_SHIFT = 11; - - /// - /// Number of bits to shift left within a 16 bit block. - /// - public const int FI16_565_GREEN_SHIFT = 5; - - /// - /// Number of bits to shift left within a 16 bit block. - /// - public const int FI16_565_BLUE_SHIFT = 0; - - #endregion - - #region General functions - - /// - /// Initialises the library. - /// - /// - /// When the is true, FreeImage won't make use of external plugins. - /// - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_Initialise")] - private static extern void Initialise(bool load_local_plugins_only); - - /// - /// Deinitialises the library. - /// - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_DeInitialise")] - private static extern void DeInitialise(); - - /// - /// Returns a string containing the current version of the library. - /// - /// The current version of the library. - public static unsafe string GetVersion() { return PtrToStr(GetVersion_()); } - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_GetVersion")] - private static unsafe extern byte* GetVersion_(); - - /// - /// Returns a string containing a standard copyright message. - /// - /// A standard copyright message. - public static unsafe string GetCopyrightMessage() { return PtrToStr(GetCopyrightMessage_()); } - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_GetCopyrightMessage")] - private static unsafe extern byte* GetCopyrightMessage_(); - - /// - /// Calls the set error message function in FreeImage. - /// - /// Format of the bitmaps. - /// The error message. - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_OutputMessageProc")] - public static extern void OutputMessageProc(FREE_IMAGE_FORMAT fif, string message); - - /// - /// You use the function FreeImage_SetOutputMessage to capture the log string - /// so that you can show it to the user of the program. - /// The callback is implemented in the event of this class. - /// - /// The function is private because FreeImage can only have a single - /// callback function. To use the callback use the - /// event of this class. - /// Handler to the callback function. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetOutputMessage")] - internal static extern void SetOutputMessage(OutputMessageFunction omf); - - #endregion - - #region Bitmap management functions - - /// - /// Creates a new bitmap in memory. - /// - /// Width of the new bitmap. - /// Height of the new bitmap. - /// Bit depth of the new Bitmap. - /// Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmap - /// Red part of the color layout. - /// eg: 0xFF0000 - /// Green part of the color layout. - /// eg: 0x00FF00 - /// Blue part of the color layout. - /// eg: 0x0000FF - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_Allocate")] - public static extern FIBITMAP Allocate(int width, int height, int bpp, - uint red_mask, uint green_mask, uint blue_mask); - - /// - /// Creates a new bitmap in memory. - /// - /// Type of the image. - /// Width of the new bitmap. - /// Height of the new bitmap. - /// Bit depth of the new Bitmap. - /// Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmap - /// Red part of the color layout. - /// eg: 0xFF0000 - /// Green part of the color layout. - /// eg: 0x00FF00 - /// Blue part of the color layout. - /// eg: 0x0000FF - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_AllocateT")] - public static extern FIBITMAP AllocateT(FREE_IMAGE_TYPE type, int width, int height, int bpp, - uint red_mask, uint green_mask, uint blue_mask); - - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_AllocateEx")] - internal static extern FIBITMAP AllocateEx(int width, int height, int bpp, - IntPtr color, FREE_IMAGE_COLOR_OPTIONS options, RGBQUAD[] palette, - uint red_mask, uint green_mask, uint blue_mask); - - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_AllocateExT")] - internal static extern FIBITMAP AllocateExT(FREE_IMAGE_TYPE type, int width, int height, int bpp, - IntPtr color, FREE_IMAGE_COLOR_OPTIONS options, RGBQUAD[] palette, - uint red_mask, uint green_mask, uint blue_mask); - - /// - /// Makes an exact reproduction of an existing bitmap, including metadata and attached profile if any. - /// - /// Handle to a FreeImage bitmap. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_Clone")] - public static extern FIBITMAP Clone(FIBITMAP dib); - - /// - /// Deletes a previously loaded FIBITMAP from memory. - /// - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_Unload")] - public static extern void Unload(FIBITMAP dib); - - /// - /// Decodes a bitmap, allocates memory for it and returns it as a FIBITMAP. - /// - /// Type of the bitmap. - /// Name of the file to decode. - /// Flags to enable or disable plugin-features. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, CharSet = CharSet.Unicode, EntryPoint = "FreeImage_LoadU")] - public static extern FIBITMAP Load(FREE_IMAGE_FORMAT fif, string filename, FREE_IMAGE_LOAD_FLAGS flags); - - /// - /// Decodes a bitmap, allocates memory for it and returns it as a FIBITMAP. - /// The filename supports UNICODE. - /// - /// Type of the bitmap. - /// Name of the file to decode. - /// Flags to enable or disable plugin-features. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, CharSet = CharSet.Unicode, EntryPoint = "FreeImage_LoadU")] - private static extern FIBITMAP LoadU(FREE_IMAGE_FORMAT fif, string filename, FREE_IMAGE_LOAD_FLAGS flags); - - /// - /// Loads a bitmap from an arbitrary source. - /// - /// Type of the bitmap. - /// A FreeImageIO structure with functionpointers to handle the source. - /// A handle to the source. - /// Flags to enable or disable plugin-features. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_LoadFromHandle")] - public static extern FIBITMAP LoadFromHandle(FREE_IMAGE_FORMAT fif, ref FreeImageIO io, fi_handle handle, FREE_IMAGE_LOAD_FLAGS flags); - - /// - /// Saves a previosly loaded FIBITMAP to a file. - /// - /// Type of the bitmap. - /// Handle to a FreeImage bitmap. - /// Name of the file to save to. - /// Flags to enable or disable plugin-features. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, CharSet = CharSet.Unicode, EntryPoint = "FreeImage_SaveU")] - public static extern bool Save(FREE_IMAGE_FORMAT fif, FIBITMAP dib, string filename, FREE_IMAGE_SAVE_FLAGS flags); - - /// - /// Saves a previosly loaded FIBITMAP to a file. - /// The filename supports UNICODE. - /// - /// Type of the bitmap. - /// Handle to a FreeImage bitmap. - /// Name of the file to save to. - /// Flags to enable or disable plugin-features. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, CharSet = CharSet.Unicode, EntryPoint = "FreeImage_SaveU")] - private static extern bool SaveU(FREE_IMAGE_FORMAT fif, FIBITMAP dib, string filename, FREE_IMAGE_SAVE_FLAGS flags); - - /// - /// Saves a bitmap to an arbitrary source. - /// - /// Type of the bitmap. - /// Handle to a FreeImage bitmap. - /// A FreeImageIO structure with functionpointers to handle the source. - /// A handle to the source. - /// Flags to enable or disable plugin-features. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SaveToHandle")] - public static extern bool SaveToHandle(FREE_IMAGE_FORMAT fif, FIBITMAP dib, ref FreeImageIO io, fi_handle handle, - FREE_IMAGE_SAVE_FLAGS flags); - - #endregion - - #region Memory I/O streams - - /// - /// Open a memory stream. - /// - /// Pointer to the data in memory. - /// Length of the data in byte. - /// Handle to a memory stream. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_OpenMemory")] - public static extern FIMEMORY OpenMemory(IntPtr data, uint size_in_bytes); - - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_OpenMemory")] - internal static extern FIMEMORY OpenMemoryEx(byte[] data, uint size_in_bytes); - - /// - /// Close and free a memory stream. - /// - /// Handle to a memory stream. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_CloseMemory")] - public static extern void CloseMemory(FIMEMORY stream); - - /// - /// Decodes a bitmap from a stream, allocates memory for it and returns it as a FIBITMAP. - /// - /// Type of the bitmap. - /// Handle to a memory stream. - /// Flags to enable or disable plugin-features. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_LoadFromMemory")] - public static extern FIBITMAP LoadFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY stream, FREE_IMAGE_LOAD_FLAGS flags); - - /// - /// Saves a previosly loaded FIBITMAP to a stream. - /// - /// Type of the bitmap. - /// Handle to a FreeImage bitmap. - /// Handle to a memory stream. - /// Flags to enable or disable plugin-features. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SaveToMemory")] - public static extern bool SaveToMemory(FREE_IMAGE_FORMAT fif, FIBITMAP dib, FIMEMORY stream, FREE_IMAGE_SAVE_FLAGS flags); - - /// - /// Gets the current position of a memory handle. - /// - /// Handle to a memory stream. - /// The current file position if successful, -1 otherwise. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_TellMemory")] - public static extern int TellMemory(FIMEMORY stream); - - /// - /// Moves the memory handle to a specified location. - /// - /// Handle to a memory stream. - /// Number of bytes from origin. - /// Initial position. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SeekMemory")] - public static extern bool SeekMemory(FIMEMORY stream, int offset, System.IO.SeekOrigin origin); - - /// - /// Provides a direct buffer access to a memory stream. - /// - /// The target memory stream. - /// Pointer to the data in memory. - /// Size of the data in bytes. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_AcquireMemory")] - public static extern bool AcquireMemory(FIMEMORY stream, ref IntPtr data, ref uint size_in_bytes); - - /// - /// Reads data from a memory stream. - /// - /// The buffer to store the data in. - /// Size in bytes of the items. - /// Number of items to read. - /// The stream to read from. - /// The memory pointer associated with stream is increased by the number of bytes actually read. - /// The number of full items actually read. - /// May be less than count on error or stream-end. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ReadMemory")] - public static extern uint ReadMemory(byte[] buffer, uint size, uint count, FIMEMORY stream); - - /// - /// Writes data to a memory stream. - /// - /// The buffer to read the data from. - /// Size in bytes of the items. - /// Number of items to write. - /// The stream to write to. - /// The memory pointer associated with stream is increased by the number of bytes actually written. - /// The number of full items actually written. - /// May be less than count on error or stream-end. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_WriteMemory")] - public static extern uint WriteMemory(byte[] buffer, uint size, uint count, FIMEMORY stream); - - /// - /// Open a multi-page bitmap from a memory stream. - /// - /// Type of the bitmap. - /// The stream to decode. - /// Flags to enable or disable plugin-features. - /// Handle to a FreeImage multi-paged bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_LoadMultiBitmapFromMemory")] - public static extern FIMULTIBITMAP LoadMultiBitmapFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY stream, FREE_IMAGE_LOAD_FLAGS flags); - - #endregion - - #region Plugin functions - - /// - /// Registers a new plugin to be used in FreeImage. - /// - /// Pointer to the function that initialises the plugin. - /// A string describing the format of the plugin. - /// A string describing the plugin. - /// A string witha comma sperated list of extensions. f.e: "pl,pl2,pl4" - /// A regular expression used to identify the bitmap. - /// The format idientifier assigned by FreeImage. - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_RegisterLocalPlugin")] - public static extern FREE_IMAGE_FORMAT RegisterLocalPlugin(InitProc proc_address, - string format, string description, string extension, string regexpr); - - /// - /// Registers a new plugin to be used in FreeImage. The plugin is residing in a DLL. - /// The Init function must be called �Init� and must use the stdcall calling convention. - /// - /// Complete path to the dll file hosting the plugin. - /// A string describing the format of the plugin. - /// A string describing the plugin. - /// A string witha comma sperated list of extensions. f.e: "pl,pl2,pl4" - /// A regular expression used to identify the bitmap. - /// The format idientifier assigned by FreeImage. - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_RegisterExternalPlugin")] - public static extern FREE_IMAGE_FORMAT RegisterExternalPlugin(string path, - string format, string description, string extension, string regexpr); - - /// - /// Retrieves the number of FREE_IMAGE_FORMAT identifiers being currently registered. - /// - /// The number of registered formats. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetFIFCount")] - public static extern int GetFIFCount(); - - /// - /// Enables or disables a plugin. - /// - /// The plugin to enable or disable. - /// True: enable the plugin. false: disable the plugin. - /// The previous state of the plugin. - /// 1 - enabled. 0 - disables. -1 plugin does not exist. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetPluginEnabled")] - public static extern int SetPluginEnabled(FREE_IMAGE_FORMAT fif, bool enable); - - /// - /// Retrieves the state of a plugin. - /// - /// The plugin to check. - /// 1 - enabled. 0 - disables. -1 plugin does not exist. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_IsPluginEnabled")] - public static extern int IsPluginEnabled(FREE_IMAGE_FORMAT fif); - - /// - /// Returns a identifier from the format string that was used to register the FIF. - /// - /// The string that was used to register the plugin. - /// A identifier from the format. - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_GetFIFFromFormat")] - public static extern FREE_IMAGE_FORMAT GetFIFFromFormat(string format); - - /// - /// Returns a identifier from a MIME content type string - /// (MIME stands for Multipurpose Internet Mail Extension). - /// - /// A MIME content type. - /// A identifier from the MIME. - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_GetFIFFromMime")] - public static extern FREE_IMAGE_FORMAT GetFIFFromMime(string mime); - - /// - /// Returns the string that was used to register a plugin from the system assigned . - /// - /// The assigned . - /// The string that was used to register the plugin. - public static unsafe string GetFormatFromFIF(FREE_IMAGE_FORMAT fif) { return PtrToStr(GetFormatFromFIF_(fif)); } - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetFormatFromFIF")] - private static unsafe extern byte* GetFormatFromFIF_(FREE_IMAGE_FORMAT fif); - - /// - /// Returns a comma-delimited file extension list describing the bitmap formats the given plugin can read and/or write. - /// - /// The desired . - /// A comma-delimited file extension list. - public static unsafe string GetFIFExtensionList(FREE_IMAGE_FORMAT fif) { return PtrToStr(GetFIFExtensionList_(fif)); } - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetFIFExtensionList")] - private static unsafe extern byte* GetFIFExtensionList_(FREE_IMAGE_FORMAT fif); - - /// - /// Returns a descriptive string that describes the bitmap formats the given plugin can read and/or write. - /// - /// The desired . - /// A descriptive string that describes the bitmap formats. - public static unsafe string GetFIFDescription(FREE_IMAGE_FORMAT fif) { return PtrToStr(GetFIFDescription_(fif)); } - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetFIFDescription")] - private static unsafe extern byte* GetFIFDescription_(FREE_IMAGE_FORMAT fif); - - /// - /// Returns a regular expression string that can be used by a regular expression engine to identify the bitmap. - /// FreeImageQt makes use of this function. - /// - /// The desired . - /// A regular expression string. - public static unsafe string GetFIFRegExpr(FREE_IMAGE_FORMAT fif) { return PtrToStr(GetFIFRegExpr_(fif)); } - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetFIFRegExpr")] - private static unsafe extern byte* GetFIFRegExpr_(FREE_IMAGE_FORMAT fif); - - /// - /// Given a identifier, returns a MIME content type string (MIME stands for Multipurpose Internet Mail Extension). - /// - /// The desired . - /// A MIME content type string. - public static unsafe string GetFIFMimeType(FREE_IMAGE_FORMAT fif) { return PtrToStr(GetFIFMimeType_(fif)); } - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetFIFMimeType")] - private static unsafe extern byte* GetFIFMimeType_(FREE_IMAGE_FORMAT fif); - - /// - /// This function takes a filename or a file-extension and returns the plugin that can - /// read/write files with that extension in the form of a identifier. - /// - /// The filename or -extension. - /// The of the plugin. - [DllImport(FreeImageLibrary, CharSet = CharSet.Unicode, EntryPoint = "FreeImage_GetFIFFromFilenameU")] - public static extern FREE_IMAGE_FORMAT GetFIFFromFilename(string filename); - - /// - /// This function takes a filename or a file-extension and returns the plugin that can - /// read/write files with that extension in the form of a identifier. - /// Supports UNICODE filenames. - /// - /// The filename or -extension. - /// The of the plugin. - [DllImport(FreeImageLibrary, CharSet = CharSet.Unicode, EntryPoint = "FreeImage_GetFIFFromFilenameU")] - private static extern FREE_IMAGE_FORMAT GetFIFFromFilenameU(string filename); - - /// - /// Checks if a plugin can load bitmaps. - /// - /// The of the plugin. - /// True if the plugin can load bitmaps, else false. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_FIFSupportsReading")] - public static extern bool FIFSupportsReading(FREE_IMAGE_FORMAT fif); - - /// - /// Checks if a plugin can save bitmaps. - /// - /// The of the plugin. - /// True if the plugin can save bitmaps, else false. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_FIFSupportsWriting")] - public static extern bool FIFSupportsWriting(FREE_IMAGE_FORMAT fif); - - /// - /// Checks if a plugin can save bitmaps in the desired bit depth. - /// - /// The of the plugin. - /// The desired bit depth. - /// True if the plugin can save bitmaps in the desired bit depth, else false. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_FIFSupportsExportBPP")] - public static extern bool FIFSupportsExportBPP(FREE_IMAGE_FORMAT fif, int bpp); - - /// - /// Checks if a plugin can save a bitmap in the desired data type. - /// - /// The of the plugin. - /// The desired image type. - /// True if the plugin can save bitmaps as the desired type, else false. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_FIFSupportsExportType")] - public static extern bool FIFSupportsExportType(FREE_IMAGE_FORMAT fif, FREE_IMAGE_TYPE type); - - /// - /// Checks if a plugin can load or save an ICC profile. - /// - /// The of the plugin. - /// True if the plugin can load or save an ICC profile, else false. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_FIFSupportsICCProfiles")] - public static extern bool FIFSupportsICCProfiles(FREE_IMAGE_FORMAT fif); - - #endregion - - #region Multipage functions - - /// - /// Loads a FreeImage multi-paged bitmap. - /// Load flags can be provided by the flags parameter. - /// - /// Format of the image. - /// The complete name of the file to load. - /// When true a new bitmap is created. - /// When true the bitmap will be loaded read only. - /// When true performance is increased at the cost of memory. - /// Flags to enable or disable plugin-features. - /// Handle to a FreeImage multi-paged bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_OpenMultiBitmap")] - public static extern FIMULTIBITMAP OpenMultiBitmap(FREE_IMAGE_FORMAT fif, string filename, bool create_new, - bool read_only, bool keep_cache_in_memory, FREE_IMAGE_LOAD_FLAGS flags); - - /// - /// Loads a FreeImage multi-pages bitmap from the specified handle - /// using the specified functions. - /// Load flags can be provided by the flags parameter. - /// - /// Format of the image. - /// IO functions used to read from the specified handle. - /// The handle to load the bitmap from. - /// Flags to enable or disable plugin-features. - /// Handle to a FreeImage multi-paged bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_OpenMultiBitmapFromHandle")] - public static extern FIMULTIBITMAP OpenMultiBitmapFromHandle(FREE_IMAGE_FORMAT fif, ref FreeImageIO io, - fi_handle handle, FREE_IMAGE_LOAD_FLAGS flags); - - /// - /// Closes a previously opened multi-page bitmap and, when the bitmap was not opened read-only, applies any changes made to it. - /// - /// Handle to a FreeImage multi-paged bitmap. - /// Flags to enable or disable plugin-features. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_CloseMultiBitmap")] - private static extern bool CloseMultiBitmap_(FIMULTIBITMAP bitmap, FREE_IMAGE_SAVE_FLAGS flags); - - /// - /// Returns the number of pages currently available in the multi-paged bitmap. - /// - /// Handle to a FreeImage multi-paged bitmap. - /// Number of pages. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetPageCount")] - public static extern int GetPageCount(FIMULTIBITMAP bitmap); - - /// - /// Appends a new page to the end of the bitmap. - /// - /// Handle to a FreeImage multi-paged bitmap. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_AppendPage")] - public static extern void AppendPage(FIMULTIBITMAP bitmap, FIBITMAP data); - - /// - /// Inserts a new page before the given position in the bitmap. - /// - /// Handle to a FreeImage multi-paged bitmap. - /// Page has to be a number smaller than the current number of pages available in the bitmap. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_InsertPage")] - public static extern void InsertPage(FIMULTIBITMAP bitmap, int page, FIBITMAP data); - - /// - /// Deletes the page on the given position. - /// - /// Handle to a FreeImage multi-paged bitmap. - /// Number of the page to delete. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_DeletePage")] - public static extern void DeletePage(FIMULTIBITMAP bitmap, int page); - - /// - /// Locks a page in memory for editing. - /// - /// Handle to a FreeImage multi-paged bitmap. - /// Number of the page to lock. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_LockPage")] - public static extern FIBITMAP LockPage(FIMULTIBITMAP bitmap, int page); - - /// - /// Unlocks a previously locked page and gives it back to the multi-page engine. - /// - /// Handle to a FreeImage multi-paged bitmap. - /// Handle to a FreeImage bitmap. - /// If true, the page is applied to the multi-page bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_UnlockPage")] - public static extern void UnlockPage(FIMULTIBITMAP bitmap, FIBITMAP data, bool changed); - - /// - /// Moves the source page to the position of the target page. - /// - /// Handle to a FreeImage multi-paged bitmap. - /// New position of the page. - /// Old position of the page. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_MovePage")] - public static extern bool MovePage(FIMULTIBITMAP bitmap, int target, int source); - - /// - /// Returns an array of page-numbers that are currently locked in memory. - /// When the pages parameter is null, the size of the array is returned in the count variable. - /// - /// - /// - /// int[] lockedPages = null; - /// int count = 0; - /// GetLockedPageNumbers(dib, lockedPages, ref count); - /// lockedPages = new int[count]; - /// GetLockedPageNumbers(dib, lockedPages, ref count); - /// - /// - /// Handle to a FreeImage multi-paged bitmap. - /// The list of locked pages in the multi-pages bitmap. - /// If set to null, count will contain the number of pages. - /// If is set to null count will contain the number of locked pages. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetLockedPageNumbers")] - public static extern bool GetLockedPageNumbers(FIMULTIBITMAP bitmap, int[] pages, ref int count); - - #endregion - - #region Filetype functions - - /// - /// Orders FreeImage to analyze the bitmap signature. - /// - /// Name of the file to analyze. - /// Reserved parameter - use 0. - /// Type of the bitmap. - [DllImport(FreeImageLibrary, CharSet = CharSet.Unicode, EntryPoint = "FreeImage_GetFileTypeU")] - public static extern FREE_IMAGE_FORMAT GetFileType(string filename, int size); - - - /// - /// Orders FreeImage to analyze the bitmap signature. - /// Supports UNICODE filenames. - /// - /// Name of the file to analyze. - /// Reserved parameter - use 0. - /// Type of the bitmap. - [DllImport(FreeImageLibrary, CharSet = CharSet.Unicode, EntryPoint = "FreeImage_GetFileTypeU")] - private static extern FREE_IMAGE_FORMAT GetFileTypeU(string filename, int size); - - /// - /// Uses the structure as described in the topic bitmap management functions - /// to identify a bitmap type. - /// - /// A structure with functionpointers to handle the source. - /// A handle to the source. - /// Size in bytes of the source. - /// Type of the bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetFileTypeFromHandle")] - public static extern FREE_IMAGE_FORMAT GetFileTypeFromHandle(ref FreeImageIO io, fi_handle handle, int size); - - /// - /// Uses a memory handle to identify a bitmap type. - /// - /// Pointer to the stream. - /// Size in bytes of the source. - /// Type of the bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetFileTypeFromMemory")] - public static extern FREE_IMAGE_FORMAT GetFileTypeFromMemory(FIMEMORY stream, int size); - - #endregion - - #region Helper functions - - /// - /// Returns whether the platform is using Little Endian. - /// - /// Returns true if the platform is using Litte Endian, else false. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_IsLittleEndian")] - public static extern bool IsLittleEndian(); - - /// - /// Converts a X11 color name into a corresponding RGB value. - /// - /// Name of the color to convert. - /// Red component. - /// Green component. - /// Blue component. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_LookupX11Color")] - public static extern bool LookupX11Color(string szColor, out byte nRed, out byte nGreen, out byte nBlue); - - /// - /// Converts a SVG color name into a corresponding RGB value. - /// - /// Name of the color to convert. - /// Red component. - /// Green component. - /// Blue component. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_LookupSVGColor")] - public static extern bool LookupSVGColor(string szColor, out byte nRed, out byte nGreen, out byte nBlue); - - #endregion - - #region Pixel access functions - - /// - /// Returns a pointer to the data-bits of the bitmap. - /// - /// Handle to a FreeImage bitmap. - /// Pointer to the data-bits. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetBits")] - public static extern IntPtr GetBits(FIBITMAP dib); - - /// - /// Returns a pointer to the start of the given scanline in the bitmap's data-bits. - /// - /// Handle to a FreeImage bitmap. - /// Number of the scanline. - /// Pointer to the scanline. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetScanLine")] - public static extern IntPtr GetScanLine(FIBITMAP dib, int scanline); - - /// - /// Get the pixel index of a palettized image at position (x, y), including range check (slow access). - /// - /// Handle to a FreeImage bitmap. - /// Pixel position in horizontal direction. - /// Pixel position in vertical direction. - /// The pixel index. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetPixelIndex")] - public static extern bool GetPixelIndex(FIBITMAP dib, uint x, uint y, out byte value); - - /// - /// Get the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow access). - /// - /// Handle to a FreeImage bitmap. - /// Pixel position in horizontal direction. - /// Pixel position in vertical direction. - /// The pixel color. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetPixelColor")] - public static extern bool GetPixelColor(FIBITMAP dib, uint x, uint y, out RGBQUAD value); - - /// - /// Set the pixel index of a palettized image at position (x, y), including range check (slow access). - /// - /// Handle to a FreeImage bitmap. - /// Pixel position in horizontal direction. - /// Pixel position in vertical direction. - /// The new pixel index. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetPixelIndex")] - public static extern bool SetPixelIndex(FIBITMAP dib, uint x, uint y, ref byte value); - - /// - /// Set the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow access). - /// - /// Handle to a FreeImage bitmap. - /// Pixel position in horizontal direction. - /// Pixel position in vertical direction. - /// The new pixel color. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetPixelColor")] - public static extern bool SetPixelColor(FIBITMAP dib, uint x, uint y, ref RGBQUAD value); - - #endregion - - #region Bitmap information functions - - /// - /// Retrieves the type of the bitmap. - /// - /// Handle to a FreeImage bitmap. - /// Type of the bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetImageType")] - public static extern FREE_IMAGE_TYPE GetImageType(FIBITMAP dib); - - /// - /// Returns the number of colors used in a bitmap. - /// - /// Handle to a FreeImage bitmap. - /// Palette-size for palletised bitmaps, and 0 for high-colour bitmaps. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetColorsUsed")] - public static extern uint GetColorsUsed(FIBITMAP dib); - - /// - /// Returns the size of one pixel in the bitmap in bits. - /// - /// Handle to a FreeImage bitmap. - /// Size of one pixel in the bitmap in bits. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetBPP")] - public static extern uint GetBPP(FIBITMAP dib); - - /// - /// Returns the width of the bitmap in pixel units. - /// - /// Handle to a FreeImage bitmap. - /// With of the bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetWidth")] - public static extern uint GetWidth(FIBITMAP dib); - - /// - /// Returns the height of the bitmap in pixel units. - /// - /// Handle to a FreeImage bitmap. - /// Height of the bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetHeight")] - public static extern uint GetHeight(FIBITMAP dib); - - /// - /// Returns the width of the bitmap in bytes. - /// - /// Handle to a FreeImage bitmap. - /// With of the bitmap in bytes. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetLine")] - public static extern uint GetLine(FIBITMAP dib); - - /// - /// Returns the width of the bitmap in bytes, rounded to the next 32-bit boundary, - /// also known as pitch or stride or scan width. - /// - /// Handle to a FreeImage bitmap. - /// With of the bitmap in bytes. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetPitch")] - public static extern uint GetPitch(FIBITMAP dib); - - /// - /// Returns the size of the DIB-element of a FIBITMAP in memory. - /// - /// Handle to a FreeImage bitmap. - /// Size of the DIB-element - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetDIBSize")] - public static extern uint GetDIBSize(FIBITMAP dib); - - /// - /// Returns a pointer to the bitmap's palette. - /// - /// Handle to a FreeImage bitmap. - /// Pointer to the bitmap's palette. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetPalette")] - public static extern IntPtr GetPalette(FIBITMAP dib); - - /// - /// Returns the horizontal resolution, in pixels-per-meter, of the target device for the bitmap. - /// - /// Handle to a FreeImage bitmap. - /// The horizontal resolution, in pixels-per-meter. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetDotsPerMeterX")] - public static extern uint GetDotsPerMeterX(FIBITMAP dib); - - /// - /// Returns the vertical resolution, in pixels-per-meter, of the target device for the bitmap. - /// - /// Handle to a FreeImage bitmap. - /// The vertical resolution, in pixels-per-meter. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetDotsPerMeterY")] - public static extern uint GetDotsPerMeterY(FIBITMAP dib); - - /// - /// Set the horizontal resolution, in pixels-per-meter, of the target device for the bitmap. - /// - /// Handle to a FreeImage bitmap. - /// The new horizontal resolution. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetDotsPerMeterX")] - public static extern void SetDotsPerMeterX(FIBITMAP dib, uint res); - - /// - /// Set the vertical resolution, in pixels-per-meter, of the target device for the bitmap. - /// - /// Handle to a FreeImage bitmap. - /// The new vertical resolution. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetDotsPerMeterY")] - public static extern void SetDotsPerMeterY(FIBITMAP dib, uint res); - - /// - /// Returns a pointer to the of the DIB-element in a FIBITMAP. - /// - /// Handle to a FreeImage bitmap. - /// Poiter to the header of the bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetInfoHeader")] - public static extern IntPtr GetInfoHeader(FIBITMAP dib); - - /// - /// Alias for FreeImage_GetInfoHeader that returns a pointer to a - /// rather than to a . - /// - /// Handle to a FreeImage bitmap. - /// Pointer to the structure for the bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetInfo")] - public static extern IntPtr GetInfo(FIBITMAP dib); - - /// - /// Investigates the color type of the bitmap by reading the bitmap's pixel bits and analysing them. - /// - /// Handle to a FreeImage bitmap. - /// The color type of the bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetColorType")] - public static extern FREE_IMAGE_COLOR_TYPE GetColorType(FIBITMAP dib); - - /// - /// Returns a bit pattern describing the red color component of a pixel in a FreeImage bitmap. - /// - /// Handle to a FreeImage bitmap. - /// The bit pattern for RED. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetRedMask")] - public static extern uint GetRedMask(FIBITMAP dib); - - /// - /// Returns a bit pattern describing the green color component of a pixel in a FreeImage bitmap. - /// - /// Handle to a FreeImage bitmap. - /// The bit pattern for green. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetGreenMask")] - public static extern uint GetGreenMask(FIBITMAP dib); - - /// - /// Returns a bit pattern describing the blue color component of a pixel in a FreeImage bitmap. - /// - /// Handle to a FreeImage bitmap. - /// The bit pattern for blue. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetBlueMask")] - public static extern uint GetBlueMask(FIBITMAP dib); - - /// - /// Returns the number of transparent colors in a palletised bitmap. - /// - /// Handle to a FreeImage bitmap. - /// The number of transparent colors in a palletised bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetTransparencyCount")] - public static extern uint GetTransparencyCount(FIBITMAP dib); - - /// - /// Returns a pointer to the bitmap's transparency table. - /// - /// Handle to a FreeImage bitmap. - /// Pointer to the bitmap's transparency table. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetTransparencyTable")] - public static extern IntPtr GetTransparencyTable(FIBITMAP dib); - - /// - /// Tells FreeImage if it should make use of the transparency table - /// or the alpha channel that may accompany a bitmap. - /// - /// Handle to a FreeImage bitmap. - /// True to enable the transparency, false to disable. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetTransparent")] - public static extern void SetTransparent(FIBITMAP dib, bool enabled); - - /// - /// Set the bitmap's transparency table. Only affects palletised bitmaps. - /// - /// Handle to a FreeImage bitmap. - /// Pointer to the bitmap's new transparency table. - /// The number of transparent colors in the new transparency table. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetTransparencyTable")] - internal static extern void SetTransparencyTable(FIBITMAP dib, byte[] table, int count); - - /// - /// Returns whether the transparency table is enabled. - /// - /// Handle to a FreeImage bitmap. - /// Returns true when the transparency table is enabled (1-, 4- or 8-bit images) - /// or when the input dib contains alpha values (32-bit images). Returns false otherwise. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_IsTransparent")] - public static extern bool IsTransparent(FIBITMAP dib); - - /// - /// Returns whether the bitmap has a file background color. - /// - /// Handle to a FreeImage bitmap. - /// Returns true when the image has a file background color, false otherwise. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_HasBackgroundColor")] - public static extern bool HasBackgroundColor(FIBITMAP dib); - - /// - /// Returns the file background color of an image. - /// For 8-bit images, the color index in the palette is returned in the - /// rgbReserved member of the bkcolor parameter. - /// - /// Handle to a FreeImage bitmap. - /// The background color. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetBackgroundColor")] - public static extern bool GetBackgroundColor(FIBITMAP dib, out RGBQUAD bkcolor); - - /// - /// Set the file background color of an image. - /// When saving an image to PNG, this background color is transparently saved to the PNG file. - /// - /// Handle to a FreeImage bitmap. - /// The new background color. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetBackgroundColor")] - public static unsafe extern bool SetBackgroundColor(FIBITMAP dib, ref RGBQUAD bkcolor); - - /// - /// Set the file background color of an image. - /// When saving an image to PNG, this background color is transparently saved to the PNG file. - /// When the bkcolor parameter is null, the background color is removed from the image. - /// - /// This overloaded version of the function with an array parameter is provided to allow - /// passing null in the parameter. This is similar to the - /// original C/C++ function. Passing null as parameter will - /// unset the dib's previously set background color. - /// - /// - /// Handle to a FreeImage bitmap. - /// The new background color. - /// The first entry in the array is used. - /// Returns true on success, false on failure. - /// - /// - /// // create a RGBQUAD color - /// RGBQUAD color = new RGBQUAD(Color.Green); - /// - /// // set the dib's background color (using the other version of the function) - /// FreeImage.SetBackgroundColor(dib, ref color); - /// - /// // remove it again (this only works due to the array parameter RGBQUAD[]) - /// FreeImage.SetBackgroundColor(dib, null); - /// - /// - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetBackgroundColor")] - public static unsafe extern bool SetBackgroundColor(FIBITMAP dib, RGBQUAD[] bkcolor); - - /// - /// Sets the index of the palette entry to be used as transparent color - /// for the image specified. Does nothing on high color images. - /// - /// Handle to a FreeImage bitmap. - /// The index of the palette entry to be set as transparent color. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetTransparentIndex")] - public static extern void SetTransparentIndex(FIBITMAP dib, int index); - - /// - /// Returns the palette entry used as transparent color for the image specified. - /// Works for palletised images only and returns -1 for high color - /// images or if the image has no color set to be transparent. - /// - /// Handle to a FreeImage bitmap. - /// the index of the palette entry used as transparent color for - /// the image specified or -1 if there is no transparent color found - /// (e.g. the image is a high color image). - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetTransparentIndex")] - public static extern int GetTransparentIndex(FIBITMAP dib); - - #endregion - - #region ICC profile functions - - /// - /// Retrieves the data of the bitmap. - /// This function can also be called safely, when the original format does not support profiles. - /// - /// Handle to a FreeImage bitmap. - /// The data of the bitmap. - public static FIICCPROFILE GetICCProfileEx(FIBITMAP dib) { unsafe { return *(FIICCPROFILE*)FreeImage.GetICCProfile(dib); } } - - /// - /// Retrieves a pointer to the data of the bitmap. - /// This function can also be called safely, when the original format does not support profiles. - /// - /// Handle to a FreeImage bitmap. - /// Pointer to the data of the bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetICCProfile")] - public static extern IntPtr GetICCProfile(FIBITMAP dib); - - /// - /// Creates a new block from ICC profile data previously read from a file - /// or built by a color management system. The profile data is attached to the bitmap. - /// - /// Handle to a FreeImage bitmap. - /// Pointer to the new data. - /// Size of the data. - /// Pointer to the created structure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_CreateICCProfile")] - public static extern IntPtr CreateICCProfile(FIBITMAP dib, byte[] data, int size); - - /// - /// This function destroys an previously created by . - /// After this call the bitmap will contain no profile information. - /// This function should be called to ensure that a stored bitmap will not contain any profile information. - /// - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_DestroyICCProfile")] - public static extern void DestroyICCProfile(FIBITMAP dib); - - #endregion - - #region Conversion functions - - /// - /// Converts a bitmap to 4 bits. - /// If the bitmap was a high-color bitmap (16, 24 or 32-bit) or if it was a - /// monochrome or greyscale bitmap (1 or 8-bit), the end result will be a - /// greyscale bitmap, otherwise (1-bit palletised bitmaps) it will be a palletised bitmap. - /// - /// Handle to a FreeImage bitmap. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ConvertTo4Bits")] - public static extern FIBITMAP ConvertTo4Bits(FIBITMAP dib); - - /// - /// Converts a bitmap to 8 bits. If the bitmap was a high-color bitmap (16, 24 or 32-bit) - /// or if it was a monochrome or greyscale bitmap (1 or 4-bit), the end result will be a - /// greyscale bitmap, otherwise (1 or 4-bit palletised bitmaps) it will be a palletised bitmap. - /// - /// Handle to a FreeImage bitmap. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ConvertTo8Bits")] - public static extern FIBITMAP ConvertTo8Bits(FIBITMAP dib); - - /// - /// Converts a bitmap to a 8-bit greyscale image with a linear ramp. - /// - /// Handle to a FreeImage bitmap. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ConvertToGreyscale")] - public static extern FIBITMAP ConvertToGreyscale(FIBITMAP dib); - - /// - /// Converts a bitmap to 16 bits, where each pixel has a color pattern of - /// 5 bits red, 5 bits green and 5 bits blue. One bit in each pixel is unused. - /// - /// Handle to a FreeImage bitmap. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ConvertTo16Bits555")] - public static extern FIBITMAP ConvertTo16Bits555(FIBITMAP dib); - - /// - /// Converts a bitmap to 16 bits, where each pixel has a color pattern of - /// 5 bits red, 6 bits green and 5 bits blue. - /// - /// Handle to a FreeImage bitmap. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ConvertTo16Bits565")] - public static extern FIBITMAP ConvertTo16Bits565(FIBITMAP dib); - - /// - /// Converts a bitmap to 24 bits. A clone of the input bitmap is returned for 24-bit bitmaps. - /// - /// Handle to a FreeImage bitmap. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ConvertTo24Bits")] - public static extern FIBITMAP ConvertTo24Bits(FIBITMAP dib); - - /// - /// Converts a bitmap to 32 bits. A clone of the input bitmap is returned for 32-bit bitmaps. - /// - /// Handle to a FreeImage bitmap. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ConvertTo32Bits")] - public static extern FIBITMAP ConvertTo32Bits(FIBITMAP dib); - - /// - /// Quantizes a high-color 24-bit bitmap to an 8-bit palette color bitmap. - /// - /// Handle to a FreeImage bitmap. - /// Specifies the color reduction algorithm to be used. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ColorQuantize")] - public static extern FIBITMAP ColorQuantize(FIBITMAP dib, FREE_IMAGE_QUANTIZE quantize); - - /// - /// ColorQuantizeEx is an extension to the method that - /// provides additional options used to quantize a 24-bit image to any - /// number of colors (up to 256), as well as quantize a 24-bit image using a - /// partial or full provided palette. - /// - /// Handle to a FreeImage bitmap. - /// Specifies the color reduction algorithm to be used. - /// Size of the desired output palette. - /// Size of the provided palette of ReservePalette. - /// The provided palette. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ColorQuantizeEx")] - public static extern FIBITMAP ColorQuantizeEx(FIBITMAP dib, FREE_IMAGE_QUANTIZE quantize, int PaletteSize, int ReserveSize, RGBQUAD[] ReservePalette); - - /// - /// Converts a bitmap to 1-bit monochrome bitmap using a threshold T between [0..255]. - /// The function first converts the bitmap to a 8-bit greyscale bitmap. - /// Then, any brightness level that is less than T is set to zero, otherwise to 1. - /// For 1-bit input bitmaps, the function clones the input bitmap and builds a monochrome palette. - /// - /// Handle to a FreeImage bitmap. - /// The threshold. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_Threshold")] - public static extern FIBITMAP Threshold(FIBITMAP dib, byte t); - - /// - /// Converts a bitmap to 1-bit monochrome bitmap using a dithering algorithm. - /// For 1-bit input bitmaps, the function clones the input bitmap and builds a monochrome palette. - /// - /// Handle to a FreeImage bitmap. - /// The dithering algorithm to use. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_Dither")] - public static extern FIBITMAP Dither(FIBITMAP dib, FREE_IMAGE_DITHER algorithm); - - /// - /// Converts a raw bitmap to a FreeImage bitmap. - /// - /// Pointer to the memory block containing the raw bitmap. - /// The width in pixels of the raw bitmap. - /// The height in pixels of the raw bitmap. - /// Defines the total width of a scanline in the raw bitmap, - /// including padding bytes. - /// The bit depth (bits per pixel) of the raw bitmap. - /// The bit mask describing the bits used to store a single - /// pixel's red component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// The bit mask describing the bits used to store a single - /// pixel's green component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// The bit mask describing the bits used to store a single - /// pixel's blue component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// If true, the raw bitmap is stored in top-down order (top-left pixel first) - /// and in bottom-up order (bottom-left pixel first) otherwise. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ConvertFromRawBits")] - public static extern FIBITMAP ConvertFromRawBits(IntPtr bits, int width, int height, int pitch, - uint bpp, uint red_mask, uint green_mask, uint blue_mask, bool topdown); - - /// - /// Converts a raw bitmap to a FreeImage bitmap. - /// - /// Array of bytes containing the raw bitmap. - /// The width in pixels of the raw bitmap. - /// The height in pixels of the raw bitmap. - /// Defines the total width of a scanline in the raw bitmap, - /// including padding bytes. - /// The bit depth (bits per pixel) of the raw bitmap. - /// The bit mask describing the bits used to store a single - /// pixel's red component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// The bit mask describing the bits used to store a single - /// pixel's green component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// The bit mask describing the bits used to store a single - /// pixel's blue component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// If true, the raw bitmap is stored in top-down order (top-left pixel first) - /// and in bottom-up order (bottom-left pixel first) otherwise. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ConvertFromRawBits")] - public static extern FIBITMAP ConvertFromRawBits(byte[] bits, int width, int height, int pitch, - uint bpp, uint red_mask, uint green_mask, uint blue_mask, bool topdown); - - /// - /// Converts a FreeImage bitmap to a raw bitmap, that is a raw piece of memory. - /// - /// Pointer to the memory block receiving the raw bitmap. - /// Handle to a FreeImage bitmap. - /// The desired total width in bytes of a scanline in the raw bitmap, - /// including any padding bytes. - /// The desired bit depth (bits per pixel) of the raw bitmap. - /// The desired bit mask describing the bits used to store a single - /// pixel's red component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// The desired bit mask describing the bits used to store a single - /// pixel's green component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// The desired bit mask describing the bits used to store a single - /// pixel's blue component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// If true, the raw bitmap will be stored in top-down order (top-left pixel first) - /// and in bottom-up order (bottom-left pixel first) otherwise. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ConvertToRawBits")] - public static extern void ConvertToRawBits(IntPtr bits, FIBITMAP dib, int pitch, uint bpp, - uint red_mask, uint green_mask, uint blue_mask, bool topdown); - - /// - /// Converts a FreeImage bitmap to a raw bitmap, that is a raw piece of memory. - /// - /// Array of bytes receiving the raw bitmap. - /// Handle to a FreeImage bitmap. - /// The desired total width in bytes of a scanline in the raw bitmap, - /// including any padding bytes. - /// The desired bit depth (bits per pixel) of the raw bitmap. - /// The desired bit mask describing the bits used to store a single - /// pixel's red component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// The desired bit mask describing the bits used to store a single - /// pixel's green component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// The desired bit mask describing the bits used to store a single - /// pixel's blue component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// If true, the raw bitmap will be stored in top-down order (top-left pixel first) - /// and in bottom-up order (bottom-left pixel first) otherwise. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ConvertToRawBits")] - public static extern void ConvertToRawBits(byte[] bits, FIBITMAP dib, int pitch, uint bpp, - uint red_mask, uint green_mask, uint blue_mask, bool topdown); - - /// - /// Converts a 24- or 32-bit RGB(A) standard image or a 48-bit RGB image to a FIT_RGBF type image. - /// - /// Handle to a FreeImage bitmap. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ConvertToRGBF")] - public static extern FIBITMAP ConvertToRGBF(FIBITMAP dib); - - /// - /// Converts a non standard image whose color type is FIC_MINISBLACK - /// to a standard 8-bit greyscale image. - /// - /// Handle to a FreeImage bitmap. - /// When true the conversion is done by scaling linearly - /// each pixel value from [min, max] to an integer value between [0..255], - /// where min and max are the minimum and maximum pixel values in the image. - /// When false the conversion is done by rounding each pixel value to an integer between [0..255]. - /// - /// Rounding is done using the following formula: - /// - /// dst_pixel = (BYTE) MIN(255, MAX(0, q)) where int q = int(src_pixel + 0.5); - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ConvertToStandardType")] - public static extern FIBITMAP ConvertToStandardType(FIBITMAP src, bool scale_linear); - - /// - /// Converts an image of any type to type dst_type. - /// - /// Handle to a FreeImage bitmap. - /// Destination type. - /// True to scale linear, else false. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ConvertToType")] - public static extern FIBITMAP ConvertToType(FIBITMAP src, FREE_IMAGE_TYPE dst_type, bool scale_linear); - - #endregion - - #region Tone mapping operators - - /// - /// Converts a High Dynamic Range image (48-bit RGB or 96-bit RGBF) to a 24-bit RGB image, suitable for display. - /// - /// Handle to a FreeImage bitmap. - /// The tone mapping operator to be used. - /// Parmeter depending on the used algorithm - /// Parmeter depending on the used algorithm - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ToneMapping")] - public static extern FIBITMAP ToneMapping(FIBITMAP dib, FREE_IMAGE_TMO tmo, double first_param, double second_param); - - /// - /// Converts a High Dynamic Range image to a 24-bit RGB image using a global - /// operator based on logarithmic compression of luminance values, imitating the human response to light. - /// - /// Handle to a FreeImage bitmap. - /// A gamma correction that is applied after the tone mapping. - /// A value of 1 means no correction. - /// Scale factor allowing to adjust the brightness of the output image. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_TmoDrago03")] - public static extern FIBITMAP TmoDrago03(FIBITMAP src, double gamma, double exposure); - - /// - /// Converts a High Dynamic Range image to a 24-bit RGB image using a global operator inspired - /// by photoreceptor physiology of the human visual system. - /// - /// Handle to a FreeImage bitmap. - /// Controls the overall image intensity in the range [-8, 8]. - /// Controls the overall image contrast in the range [0.3, 1.0[. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_TmoReinhard05")] - public static extern FIBITMAP TmoReinhard05(FIBITMAP src, double intensity, double contrast); - - /// - /// Apply the Gradient Domain High Dynamic Range Compression to a RGBF image and convert to 24-bit RGB. - /// - /// Handle to a FreeImage bitmap. - /// Color saturation (s parameter in the paper) in [0.4..0.6] - /// Atenuation factor (beta parameter in the paper) in [0.8..0.9] - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_TmoFattal02")] - public static extern FIBITMAP TmoFattal02(FIBITMAP src, double color_saturation, double attenuation); - - #endregion - - #region Compression functions - - /// - /// Compresses a source buffer into a target buffer, using the ZLib library. - /// - /// Pointer to the target buffer. - /// Size of the target buffer. - /// Must be at least 0.1% larger than source_size plus 12 bytes. - /// Pointer to the source buffer. - /// Size of the source buffer. - /// The actual size of the compressed buffer, or 0 if an error occurred. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ZLibCompress")] - public static extern uint ZLibCompress(byte[] target, uint target_size, byte[] source, uint source_size); - - /// - /// Decompresses a source buffer into a target buffer, using the ZLib library. - /// - /// Pointer to the target buffer. - /// Size of the target buffer. - /// Must have been saved outlide of zlib. - /// Pointer to the source buffer. - /// Size of the source buffer. - /// The actual size of the uncompressed buffer, or 0 if an error occurred. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ZLibUncompress")] - public static extern uint ZLibUncompress(byte[] target, uint target_size, byte[] source, uint source_size); - - /// - /// Compresses a source buffer into a target buffer, using the ZLib library. - /// - /// Pointer to the target buffer. - /// Size of the target buffer. - /// Must be at least 0.1% larger than source_size plus 24 bytes. - /// Pointer to the source buffer. - /// Size of the source buffer. - /// The actual size of the compressed buffer, or 0 if an error occurred. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ZLibGZip")] - public static extern uint ZLibGZip(byte[] target, uint target_size, byte[] source, uint source_size); - - /// - /// Decompresses a source buffer into a target buffer, using the ZLib library. - /// - /// Pointer to the target buffer. - /// Size of the target buffer. - /// Must have been saved outlide of zlib. - /// Pointer to the source buffer. - /// Size of the source buffer. - /// The actual size of the uncompressed buffer, or 0 if an error occurred. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ZLibGUnzip")] - public static extern uint ZLibGUnzip(byte[] target, uint target_size, byte[] source, uint source_size); - - /// - /// Generates a CRC32 checksum. - /// - /// The CRC32 checksum to begin with. - /// Pointer to the source buffer. - /// If the value is 0, the function returns the required initial value for the crc. - /// Size of the source buffer. - /// - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ZLibCRC32")] - public static extern uint ZLibCRC32(uint crc, byte[] source, uint source_size); - - #endregion - - #region Tag creation and destruction - - /// - /// Allocates a new object. - /// This object must be destroyed with a call to - /// when no longer in use. - /// - /// The new . - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_CreateTag")] - public static extern FITAG CreateTag(); - - /// - /// Delete a previously allocated object. - /// - /// The to destroy. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_DeleteTag")] - public static extern void DeleteTag(FITAG tag); - - /// - /// Creates and returns a copy of a object. - /// - /// The to clone. - /// The new . - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_CloneTag")] - public static extern FITAG CloneTag(FITAG tag); - - #endregion - - #region Tag accessors - - /// - /// Returns the tag field name (unique inside a metadata model). - /// - /// The tag field. - /// The field name. - public static unsafe string GetTagKey(FITAG tag) { return PtrToStr(GetTagKey_(tag)); } - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_GetTagKey")] - private static unsafe extern byte* GetTagKey_(FITAG tag); - - /// - /// Returns the tag description. - /// - /// The tag field. - /// The description or NULL if unavailable. - public static unsafe string GetTagDescription(FITAG tag) { return PtrToStr(GetTagDescription_(tag)); } - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_GetTagDescription")] - private static unsafe extern byte* GetTagDescription_(FITAG tag); - - /// - /// Returns the tag ID. - /// - /// The tag field. - /// The ID or 0 if unavailable. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetTagID")] - public static extern ushort GetTagID(FITAG tag); - - /// - /// Returns the tag data type. - /// - /// The tag field. - /// The tag type. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetTagType")] - public static extern FREE_IMAGE_MDTYPE GetTagType(FITAG tag); - - /// - /// Returns the number of components in the tag (in tag type units). - /// - /// The tag field. - /// The number of components. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetTagCount")] - public static extern uint GetTagCount(FITAG tag); - - /// - /// Returns the length of the tag value in bytes. - /// - /// The tag field. - /// The length of the tag value. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetTagLength")] - public static extern uint GetTagLength(FITAG tag); - - /// - /// Returns the tag value. - /// It is up to the programmer to interpret the returned pointer correctly, - /// according to the results of GetTagType and GetTagCount. - /// - /// The tag field. - /// Pointer to the value. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetTagValue")] - public static extern IntPtr GetTagValue(FITAG tag); - - /// - /// Sets the tag field name. - /// - /// The tag field. - /// The new name. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_SetTagKey")] - public static extern bool SetTagKey(FITAG tag, string key); - - /// - /// Sets the tag description. - /// - /// The tag field. - /// The new description. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_SetTagDescription")] - public static extern bool SetTagDescription(FITAG tag, string description); - - /// - /// Sets the tag ID. - /// - /// The tag field. - /// The new ID. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetTagID")] - public static extern bool SetTagID(FITAG tag, ushort id); - - /// - /// Sets the tag data type. - /// - /// The tag field. - /// The new type. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetTagType")] - public static extern bool SetTagType(FITAG tag, FREE_IMAGE_MDTYPE type); - - /// - /// Sets the number of data in the tag. - /// - /// The tag field. - /// New number of data. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetTagCount")] - public static extern bool SetTagCount(FITAG tag, uint count); - - /// - /// Sets the length of the tag value in bytes. - /// - /// The tag field. - /// The new length. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetTagLength")] - public static extern bool SetTagLength(FITAG tag, uint length); - - /// - /// Sets the tag value. - /// - /// The tag field. - /// Pointer to the new value. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetTagValue")] - public static extern bool SetTagValue(FITAG tag, byte[] value); - - #endregion - - #region Metadata iterator - - /// - /// Provides information about the first instance of a tag that matches the metadata model. - /// - /// The model to match. - /// Handle to a FreeImage bitmap. - /// Tag that matches the metadata model. - /// Unique search handle that can be used to call FindNextMetadata or FindCloseMetadata. - /// Null if the metadata model does not exist. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_FindFirstMetadata")] - public static extern FIMETADATA FindFirstMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP dib, out FITAG tag); - - /// - /// Find the next tag, if any, that matches the metadata model argument in a previous call - /// to FindFirstMetadata, and then alters the tag object contents accordingly. - /// - /// Unique search handle provided by FindFirstMetadata. - /// Tag that matches the metadata model. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_FindNextMetadata")] - public static extern bool FindNextMetadata(FIMETADATA mdhandle, out FITAG tag); - - /// - /// Closes the specified metadata search handle and releases associated resources. - /// - /// The handle to close. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_FindCloseMetadata")] - private static extern void FindCloseMetadata_(FIMETADATA mdhandle); - - #endregion - - #region Metadata setter and getter - - /// - /// Retrieve a metadata attached to a dib. - /// - /// The metadata model to look for. - /// Handle to a FreeImage bitmap. - /// The metadata field name. - /// A FITAG structure returned by the function. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_GetMetadata")] - public static extern bool GetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP dib, string key, out FITAG tag); - - /// - /// Attach a new FreeImage tag to a dib. - /// - /// The metadata model used to store the tag. - /// Handle to a FreeImage bitmap. - /// The tag field name. - /// The FreeImage tag to be attached. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_SetMetadata")] - public static extern bool SetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP dib, string key, FITAG tag); - - #endregion - - #region Metadata helper functions - - /// - /// Returns the number of tags contained in the model metadata model attached to the input dib. - /// - /// The metadata model. - /// Handle to a FreeImage bitmap. - /// Number of tags contained in the metadata model. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetMetadataCount")] - public static extern uint GetMetadataCount(FREE_IMAGE_MDMODEL model, FIBITMAP dib); - - /// - /// Copies the metadata of FreeImage bitmap to another. - /// - /// The FreeImage bitmap to copy the metadata to. - /// The FreeImage bitmap to copy the metadata from. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_CloneMetadata")] - public static extern bool CloneMetadata(FIBITMAP dst, FIBITMAP src); - - /// - /// Converts a FreeImage tag structure to a string that represents the interpreted tag value. - /// The function is not thread safe. - /// - /// The metadata model. - /// The interpreted tag value. - /// Reserved. - /// The representing string. - public static unsafe string TagToString(FREE_IMAGE_MDMODEL model, FITAG tag, uint Make) { return PtrToStr(TagToString_(model, tag, Make)); } - [DllImport(FreeImageLibrary, CharSet = CharSet.Ansi, EntryPoint = "FreeImage_TagToString")] - private static unsafe extern byte* TagToString_(FREE_IMAGE_MDMODEL model, FITAG tag, uint Make); - - #endregion - - #region Rotation and flipping - - /// - /// This function rotates a 1-, 8-bit greyscale or a 24-, 32-bit color image by means of 3 shears. - /// 1-bit images rotation is limited to integer multiple of 90�. - /// null is returned for other values. - /// - /// Handle to a FreeImage bitmap. - /// The angle of rotation. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_RotateClassic")] - [Obsolete("RotateClassic is deprecated (use Rotate instead).")] - public static extern FIBITMAP RotateClassic(FIBITMAP dib, double angle); - - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_Rotate")] - internal static extern FIBITMAP Rotate(FIBITMAP dib, double angle, IntPtr backgroundColor); - - /// - /// This function performs a rotation and / or translation of an 8-bit greyscale, - /// 24- or 32-bit image, using a 3rd order (cubic) B-Spline. - /// - /// Handle to a FreeImage bitmap. - /// The angle of rotation. - /// Horizontal image translation. - /// Vertical image translation. - /// Rotation center x-coordinate. - /// Rotation center y-coordinate. - /// When true the irrelevant part of the image is set to a black color, - /// otherwise, a mirroring technique is used to fill irrelevant pixels. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_RotateEx")] - public static extern FIBITMAP RotateEx(FIBITMAP dib, double angle, - double x_shift, double y_shift, double x_origin, double y_origin, bool use_mask); - - /// - /// Flip the input dib horizontally along the vertical axis. - /// - /// Handle to a FreeImage bitmap. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_FlipHorizontal")] - public static extern bool FlipHorizontal(FIBITMAP dib); - - /// - /// Flip the input dib vertically along the horizontal axis. - /// - /// Handle to a FreeImage bitmap. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_FlipVertical")] - public static extern bool FlipVertical(FIBITMAP dib); - - /// - /// Performs a lossless rotation or flipping on a JPEG file. - /// - /// Source file. - /// Destination file; can be the source file; will be overwritten. - /// The operation to apply. - /// To avoid lossy transformation, you can set the perfect parameter to true. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, CharSet = CharSet.Unicode, EntryPoint = "FreeImage_JPEGTransformU")] - public static extern bool JPEGTransform(string src_file, string dst_file, - FREE_IMAGE_JPEG_OPERATION operation, bool perfect); - - #endregion - - #region Upsampling / downsampling - - /// - /// Performs resampling (or scaling, zooming) of a greyscale or RGB(A) image - /// to the desired destination width and height. - /// - /// Handle to a FreeImage bitmap. - /// Destination width. - /// Destination height. - /// The filter to apply. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_Rescale")] - public static extern FIBITMAP Rescale(FIBITMAP dib, int dst_width, int dst_height, FREE_IMAGE_FILTER filter); - - /// - /// Creates a thumbnail from a greyscale or RGB(A) image, keeping aspect ratio. - /// - /// Handle to a FreeImage bitmap. - /// Thumbnail square size. - /// When true HDR images are transperantly converted to standard images. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_MakeThumbnail")] - public static extern FIBITMAP MakeThumbnail(FIBITMAP dib, int max_pixel_size, bool convert); - - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_EnlargeCanvas")] - internal static extern FIBITMAP EnlargeCanvas(FIBITMAP dib, - int left, int top, int right, int bottom, IntPtr color, FREE_IMAGE_COLOR_OPTIONS options); - - #endregion - - #region Color manipulation - - /// - /// Perfoms an histogram transformation on a 8-, 24- or 32-bit image. - /// - /// Handle to a FreeImage bitmap. - /// The lookup table. - /// It's size is assumed to be 256 in length. - /// The color channel to be transformed. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_AdjustCurve")] - public static extern bool AdjustCurve(FIBITMAP dib, byte[] lookUpTable, FREE_IMAGE_COLOR_CHANNEL channel); - - /// - /// Performs gamma correction on a 8-, 24- or 32-bit image. - /// - /// Handle to a FreeImage bitmap. - /// The parameter represents the gamma value to use (gamma > 0). - /// A value of 1.0 leaves the image alone, less than one darkens it, and greater than one lightens it. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_AdjustGamma")] - public static extern bool AdjustGamma(FIBITMAP dib, double gamma); - - /// - /// Adjusts the brightness of a 8-, 24- or 32-bit image by a certain amount. - /// - /// Handle to a FreeImage bitmap. - /// A value 0 means no change, - /// less than 0 will make the image darker and greater than 0 will make the image brighter. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_AdjustBrightness")] - public static extern bool AdjustBrightness(FIBITMAP dib, double percentage); - - /// - /// Adjusts the contrast of a 8-, 24- or 32-bit image by a certain amount. - /// - /// Handle to a FreeImage bitmap. - /// A value 0 means no change, - /// less than 0 will decrease the contrast and greater than 0 will increase the contrast of the image. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_AdjustContrast")] - public static extern bool AdjustContrast(FIBITMAP dib, double percentage); - - /// - /// Inverts each pixel data. - /// - /// Handle to a FreeImage bitmap. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_Invert")] - public static extern bool Invert(FIBITMAP dib); - - /// - /// Computes the image histogram. - /// - /// Handle to a FreeImage bitmap. - /// Array of integers with a size of 256. - /// Channel to compute from. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetHistogram")] - public static extern bool GetHistogram(FIBITMAP dib, int[] histo, FREE_IMAGE_COLOR_CHANNEL channel); - - #endregion - - #region Channel processing - - /// - /// Retrieves the red, green, blue or alpha channel of a 24- or 32-bit image. - /// - /// Handle to a FreeImage bitmap. - /// The color channel to extract. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetChannel")] - public static extern FIBITMAP GetChannel(FIBITMAP dib, FREE_IMAGE_COLOR_CHANNEL channel); - - /// - /// Insert a 8-bit dib into a 24- or 32-bit image. - /// Both images must have to same width and height. - /// - /// Handle to a FreeImage bitmap. - /// Handle to the bitmap to insert. - /// The color channel to replace. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetChannel")] - public static extern bool SetChannel(FIBITMAP dib, FIBITMAP dib8, FREE_IMAGE_COLOR_CHANNEL channel); - - /// - /// Retrieves the real part, imaginary part, magnitude or phase of a complex image. - /// - /// Handle to a FreeImage bitmap. - /// The color channel to extract. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetComplexChannel")] - public static extern FIBITMAP GetComplexChannel(FIBITMAP src, FREE_IMAGE_COLOR_CHANNEL channel); - - /// - /// Set the real or imaginary part of a complex image. - /// Both images must have to same width and height. - /// - /// Handle to a FreeImage bitmap. - /// Handle to a FreeImage bitmap. - /// The color channel to replace. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SetComplexChannel")] - public static extern bool SetComplexChannel(FIBITMAP dst, FIBITMAP src, FREE_IMAGE_COLOR_CHANNEL channel); - - #endregion - - #region Copy / Paste / Composite routines - - /// - /// Copy a sub part of the current dib image. - /// - /// Handle to a FreeImage bitmap. - /// Specifies the left position of the cropped rectangle. - /// Specifies the top position of the cropped rectangle. - /// Specifies the right position of the cropped rectangle. - /// Specifies the bottom position of the cropped rectangle. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_Copy")] - public static extern FIBITMAP Copy(FIBITMAP dib, int left, int top, int right, int bottom); - - /// - /// Alpha blend or combine a sub part image with the current dib image. - /// The bit depth of the dst bitmap must be greater than or equal to the bit depth of the src. - /// - /// Handle to a FreeImage bitmap. - /// Handle to a FreeImage bitmap. - /// Specifies the left position of the sub image. - /// Specifies the top position of the sub image. - /// alpha blend factor. - /// The source and destination images are alpha blended if alpha=0..255. - /// If alpha > 255, then the source image is combined to the destination image. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_Paste")] - public static extern bool Paste(FIBITMAP dst, FIBITMAP src, int left, int top, int alpha); - - /// - /// This function composite a transparent foreground image against a single background color or - /// against a background image. - /// - /// Handle to a FreeImage bitmap. - /// When true the background of fg is used if it contains one. - /// The application background is used if useFileBkg is false. - /// Image used as background when useFileBkg is false or fg has no background - /// and appBkColor is null. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_Composite")] - public static extern FIBITMAP Composite(FIBITMAP fg, bool useFileBkg, ref RGBQUAD appBkColor, FIBITMAP bg); - - /// - /// This function composite a transparent foreground image against a single background color or - /// against a background image. - /// - /// Handle to a FreeImage bitmap. - /// When true the background of fg is used if it contains one. - /// The application background is used if useFileBkg is false - /// and 'appBkColor' is not null. - /// Image used as background when useFileBkg is false or fg has no background - /// and appBkColor is null. - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_Composite")] - public static extern FIBITMAP Composite(FIBITMAP fg, bool useFileBkg, RGBQUAD[] appBkColor, FIBITMAP bg); - - /// - /// Performs a lossless crop on a JPEG file. - /// - /// Source filename. - /// Destination filename. - /// Specifies the left position of the cropped rectangle. - /// Specifies the top position of the cropped rectangle. - /// Specifies the right position of the cropped rectangle. - /// Specifies the bottom position of the cropped rectangle. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, CharSet = CharSet.Unicode, EntryPoint = "FreeImage_JPEGCropU")] - public static extern bool JPEGCrop(string src_file, string dst_file, int left, int top, int right, int bottom); - - /// - /// Applies the alpha value of each pixel to its color components. - /// The aplha value stays unchanged. - /// Only works with 32-bits color depth. - /// - /// Handle to a FreeImage bitmap. - /// Returns true on success, false on failure. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_PreMultiplyWithAlpha")] - public static extern bool PreMultiplyWithAlpha(FIBITMAP dib); - - #endregion - - #region Miscellaneous algorithms - - /// - /// Solves a Poisson equation, remap result pixels to [0..1] and returns the solution. - /// - /// Handle to a FreeImage bitmap. - /// Number of cycles in the multigrid algorithm (usually 2 or 3) - /// Handle to a FreeImage bitmap. - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_MultigridPoissonSolver")] - public static extern FIBITMAP MultigridPoissonSolver(FIBITMAP Laplacian, int ncycle); - - #endregion - - #region Colors - - /// - /// Creates a lookup table to be used with which may adjusts brightness and - /// contrast, correct gamma and invert the image with a single call to . - /// - /// Output lookup table to be used with . - /// The size of 'lookUpTable' is assumed to be 256. - /// Percentage brightness value where -100 <= brightness <= 100. - /// A value of 0 means no change, less than 0 will make the image darker and greater - /// than 0 will make the image brighter. - /// Percentage contrast value where -100 <= contrast <= 100. - /// A value of 0 means no change, less than 0 will decrease the contrast - /// and greater than 0 will increase the contrast of the image. - /// Gamma value to be used for gamma correction. - /// A value of 1.0 leaves the image alone, less than one darkens it, - /// and greater than one lightens it. - /// If set to true, the image will be inverted. - /// The number of adjustments applied to the resulting lookup table - /// compared to a blind lookup table. - /// - /// This function creates a lookup table to be used with which may adjust - /// brightness and contrast, correct gamma and invert the image with a single call to - /// . If more than one of these image display properties need to be adjusted, - /// using a combined lookup table should be preferred over calling each adjustment function - /// separately. That's particularly true for huge images or if performance is an issue. Then, - /// the expensive process of iterating over all pixels of an image is performed only once and - /// not up to four times. - /// - /// Furthermore, the lookup table created does not depend on the order, in which each single - /// adjustment operation is performed. Due to rounding and byte casting issues, it actually - /// matters in which order individual adjustment operations are performed. Both of the following - /// snippets most likely produce different results: - /// - /// - /// // snippet 1: contrast, brightness - /// AdjustContrast(dib, 15.0); - /// AdjustBrightness(dib, 50.0); - /// - /// - /// - /// // snippet 2: brightness, contrast - /// AdjustBrightness(dib, 50.0); - /// AdjustContrast(dib, 15.0); - /// - /// - /// Better and even faster would be snippet 3: - /// - /// - /// // snippet 3: - /// byte[] lut = new byte[256]; - /// GetAdjustColorsLookupTable(lut, 50.0, 15.0, 1.0, false); - /// AdjustCurve(dib, lut, FREE_IMAGE_COLOR_CHANNEL.FICC_RGB); - /// - /// - /// This function is also used internally by , which does not return the - /// lookup table, but uses it to call on the passed image. - /// - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_GetAdjustColorsLookupTable")] - public static extern int GetAdjustColorsLookupTable(byte[] lookUpTable, double brightness, double contrast, double gamma, bool invert); - - /// - /// Adjusts an image's brightness, contrast and gamma as well as it may - /// optionally invert the image within a single operation. - /// - /// Handle to a FreeImage bitmap. - /// Percentage brightness value where -100 <= brightness <= 100. - /// A value of 0 means no change, less than 0 will make the image darker and greater - /// than 0 will make the image brighter. - /// Percentage contrast value where -100 <= contrast <= 100. - /// A value of 0 means no change, less than 0 will decrease the contrast - /// and greater than 0 will increase the contrast of the image. - /// Gamma value to be used for gamma correction. - /// A value of 1.0 leaves the image alone, less than one darkens it, - /// and greater than one lightens it. - /// This parameter must not be zero or smaller than zero. - /// If so, it will be ignored and no gamma correction will be performed on the image. - /// If set to true, the image will be inverted. - /// Returns true on success, false on failure. - /// - /// This function adjusts an image's brightness, contrast and gamma as well as it - /// may optionally invert the image within a single operation. If more than one of - /// these image display properties need to be adjusted, using this function should - /// be preferred over calling each adjustment function separately. That's particularly - /// true for huge images or if performance is an issue. - /// - /// This function relies on , - /// which creates a single lookup table, that combines all adjustment operations requested. - /// - /// Furthermore, the lookup table created by does - /// not depend on the order, in which each single adjustment operation is performed. - /// Due to rounding and byte casting issues, it actually matters in which order individual - /// adjustment operations are performed. Both of the following snippets most likely produce - /// different results: - /// - /// - /// // snippet 1: contrast, brightness - /// AdjustContrast(dib, 15.0); - /// AdjustBrightness(dib, 50.0); - /// - /// - /// - /// // snippet 2: brightness, contrast - /// AdjustBrightness(dib, 50.0); - /// AdjustContrast(dib, 15.0); - /// - /// - /// Better and even faster would be snippet 3: - /// - /// - /// // snippet 3: - /// AdjustColors(dib, 50.0, 15.0, 1.0, false); - /// - /// - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_AdjustColors")] - public static extern bool AdjustColors(FIBITMAP dib, double brightness, double contrast, double gamma, bool invert); - - /// - /// Applies color mapping for one or several colors on a 1-, 4- or 8-bit - /// palletized or a 16-, 24- or 32-bit high color image. - /// - /// Handle to a FreeImage bitmap. - /// Array of colors to be used as the mapping source. - /// Array of colors to be used as the mapping destination. - /// The number of colors to be mapped. This is the size of both - /// srccolors and dstcolors. - /// If true, 32-bit images and colors are treated as 24-bit. - /// If true, source and destination colors are swapped, that is, - /// each destination color is also mapped to the corresponding source color. - /// The total number of pixels changed. - /// - /// This function maps up to colors specified in - /// to these specified in . - /// Thereby, color srccolors[N], if found in the image, will be replaced by color - /// dstcolors[N]. If is true, additionally all colors - /// specified in are also mapped to these specified - /// in . For high color images, the actual image data will be - /// modified whereas, for palletized images only the palette will be changed. - /// - /// The function returns the number of pixels changed or zero, if no pixels were changed. - /// - /// Both arrays and are assumed - /// not to hold less than colors. - /// - /// For 16-bit images, all colors specified are transparently converted to their - /// proper 16-bit representation (either in RGB555 or RGB565 format, which is determined - /// by the image's red- green- and blue-mask). - /// - /// Note, that this behaviour is different from what does, - /// which modifies the actual image data on palletized images. - /// - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ApplyColorMapping")] - public static extern uint ApplyColorMapping(FIBITMAP dib, RGBQUAD[] srccolors, RGBQUAD[] dstcolors, uint count, bool ignore_alpha, bool swap); - - /// - /// Swaps two specified colors on a 1-, 4- or 8-bit palletized - /// or a 16-, 24- or 32-bit high color image. - /// - /// Handle to a FreeImage bitmap. - /// One of the two colors to be swapped. - /// The other of the two colors to be swapped. - /// If true, 32-bit images and colors are treated as 24-bit. - /// The total number of pixels changed. - /// - /// This function swaps the two specified colors and - /// on a palletized or high color image. - /// For high color images, the actual image data will be modified whereas, for palletized - /// images only the palette will be changed. - /// - /// Note, that this behaviour is different from what does, - /// which modifies the actual image data on palletized images. - /// - /// This is just a thin wrapper for and resolves to: - /// - /// - /// return ApplyColorMapping(dib, color_a, color_b, 1, ignore_alpha, true); - /// - /// - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SwapColors")] - public static extern uint SwapColors(FIBITMAP dib, ref RGBQUAD color_a, ref RGBQUAD color_b, bool ignore_alpha); - - /// - /// Applies palette index mapping for one or several indices - /// on a 1-, 4- or 8-bit palletized image. - /// - /// Handle to a FreeImage bitmap. - /// Array of palette indices to be used as the mapping source. - /// Array of palette indices to be used as the mapping destination. - /// The number of palette indices to be mapped. This is the size of both - /// srcindices and dstindices - /// If true, source and destination palette indices are swapped, that is, - /// each destination index is also mapped to the corresponding source index. - /// The total number of pixels changed. - /// - /// This function maps up to palette indices specified in - /// to these specified in . - /// Thereby, index srcindices[N], if present in the image, will be replaced by index - /// dstindices[N]. If is true, additionally all indices - /// specified in are also mapped to these specified in - /// . - /// - /// The function returns the number of pixels changed or zero, if no pixels were changed. - /// Both arrays and are assumed not to - /// hold less than indices. - /// - /// Note, that this behaviour is different from what does, which - /// modifies the actual image data on palletized images. - /// - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_ApplyPaletteIndexMapping")] - public static extern uint ApplyPaletteIndexMapping(FIBITMAP dib, byte[] srcindices, byte[] dstindices, uint count, bool swap); - - /// - /// Swaps two specified palette indices on a 1-, 4- or 8-bit palletized image. - /// - /// Handle to a FreeImage bitmap. - /// One of the two palette indices to be swapped. - /// The other of the two palette indices to be swapped. - /// The total number of pixels changed. - /// - /// This function swaps the two specified palette indices index_a and - /// index_b on a palletized image. Therefore, not the palette, but the - /// actual image data will be modified. - /// - /// Note, that this behaviour is different from what does on palletized images, - /// which only swaps the colors in the palette. - /// - /// This is just a thin wrapper for and resolves to: - /// - /// - /// return ApplyPaletteIndexMapping(dib, index_a, index_b, 1, true); - /// - /// - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_SwapPaletteIndices")] - public static extern uint SwapPaletteIndices(FIBITMAP dib, ref byte index_a, ref byte index_b); - - [DllImport(FreeImageLibrary, EntryPoint = "FreeImage_FillBackground")] - internal static extern bool FillBackground(FIBITMAP dib, IntPtr color, FREE_IMAGE_COLOR_OPTIONS options); - - #endregion - } -} - -///////////////////////////////////////////////////// -// // -// Wrapper functions // -// // -///////////////////////////////////////////////////// - - #region Structs - -namespace FreeImageAPI.IO -{ - /// - /// Wrapper for a custom handle. - /// - /// - /// The fi_handle of FreeImage in C++ is a simple pointer, but in .NET - /// it's not that simple. This wrapper uses fi_handle in two different ways. - /// - /// We implement a new plugin and FreeImage gives us a handle (pointer) that - /// we can simply pass through to the given functions in a 'FreeImageIO' - /// structure. - /// But when we want to use LoadFromhandle or SaveToHandle we need - /// a fi_handle (that we receive again in our own functions). - /// This handle is for example a stream (see LoadFromStream / SaveToStream) - /// that we want to work with. To know which stream a read/write is meant for - /// we could use a hash value that the wrapper itself handles or we can - /// go the unmanaged way of using a handle. - /// Therefor we use a to receive a unique pointer that we can - /// convert back into a .NET object. - /// When the fi_handle instance is no longer needed the instance must be disposed - /// by the creater manually! It is recommended to use the using statement to - /// be sure the instance is always disposed: - /// - /// - /// using (fi_handle handle = new fi_handle(object)) - /// { - /// callSomeFunctions(handle); - /// } - /// - /// - /// What does that mean? - /// If we get a fi_handle from unmanaged code we get a pointer to unmanaged - /// memory that we do not have to care about, and just pass ist back to FreeImage. - /// If we have to create a handle our own we use the standard constructur - /// that fills the with an pointer that represents the given object. - /// With calling the is used to retrieve the original - /// object we passed through the constructor. - /// - /// This way we can implement a fi_handle that works with managed an unmanaged - /// code. - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct fi_handle : IComparable, IComparable, IEquatable, IDisposable - { - /// - /// The handle to wrap. - /// - public IntPtr handle; - - /// - /// Initializes a new instance wrapping a managed object. - /// - /// The object to wrap. - /// - /// is null. - public fi_handle(object obj) - { - if (obj == null) - { - throw new ArgumentNullException("obj"); - } - GCHandle gch = GCHandle.Alloc(obj, GCHandleType.Normal); - handle = GCHandle.ToIntPtr(gch); - } - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(fi_handle left, fi_handle right) - { - return (left.handle == right.handle); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(fi_handle left, fi_handle right) - { - return (left.handle != right.handle); - } - - /// - /// Gets whether the pointer is a null pointer. - /// - public bool IsNull - { - get - { - return (handle == IntPtr.Zero); - } - } - - /// - /// Returns the object assigned to the handle in case this instance - /// was created by managed code. - /// - /// assigned to this handle or null on failure. - internal object GetObject() - { - object result = null; - if (handle != IntPtr.Zero) - { - try - { - result = GCHandle.FromIntPtr(handle).Target; - } - catch - { - } - } - return result; - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return handle.ToString(); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return handle.GetHashCode(); - } - - /// - /// Tests whether the specified object is a structure - /// and is equivalent to this structure. - /// - /// The object to test. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is fi_handle) && (this == ((fi_handle)obj))); - } - - /// - /// Indicates whether the current object is equal to another object of the same type. - /// - /// An object to compare with this object. - /// True if the current object is equal to the other parameter; otherwise, false. - public bool Equals(fi_handle other) - { - return (this == other); - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is fi_handle)) - { - throw new ArgumentException("obj"); - } - return CompareTo((fi_handle)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(fi_handle other) - { - return handle.ToInt64().CompareTo(other.handle.ToInt64()); - } - - /// - /// Releases all resources used by the instance. - /// - public void Dispose() - { - if (this.handle != IntPtr.Zero) - { - try - { - GCHandle.FromIntPtr(handle).Free(); - } - catch - { - } - finally - { - this.handle = IntPtr.Zero; - } - } - } - } -} - -namespace FreeImageAPI -{ - /// - /// The FI1BIT structure represents a single bit. - /// It's value can be 0 or 1. - /// - [DebuggerDisplay("{value}"), - Serializable] - public struct FI1BIT - { - /// - /// Represents the largest possible value of . This field is constant. - /// - public const byte MaxValue = 0x01; - - /// - /// Represents the smallest possible value of . This field is constant. - /// - public const byte MinValue = 0x00; - - /// - /// The value of the structure. - /// - private byte value; - - /// - /// Initializes a new instance based on the specified value. - /// - /// The value to initialize with. - private FI1BIT(byte value) - { - this.value = (byte)(value & MaxValue); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator byte(FI1BIT value) - { - return value.value; - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator FI1BIT(byte value) - { - return new FI1BIT(value); - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return value.ToString(); - } - } -} - -namespace FreeImageAPI -{ - /// - /// The FI4BIT structure represents the half of a . - /// It's valuerange is between 0 and 15. - /// - [DebuggerDisplay("{value}"), - Serializable] - public struct FI4BIT - { - /// - /// Represents the largest possible value of . This field is constant. - /// - public const byte MaxValue = 0x0F; - - /// - /// Represents the smallest possible value of . This field is constant. - /// - public const byte MinValue = 0x00; - - /// - /// The value of the structure. - /// - private byte value; - - /// - /// Initializes a new instance based on the specified value. - /// - /// The value to initialize with. - private FI4BIT(byte value) - { - this.value = (byte)(value & MaxValue); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator byte(FI4BIT value) - { - return value.value; - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator FI4BIT(byte value) - { - return new FI4BIT(value); - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return value.ToString(); - } - } -} - -namespace FreeImageAPI -{ - /// - /// The FI16RGB555 structure describes a color consisting of relative - /// intensities of red, green, blue and alpha value. Each single color - /// component consumes 5 bits and so, takes values in the range from 0 to 31. - /// - /// - /// For easy integration of the underlying structure into the .NET framework, - /// the FI16RGB555 structure implements implicit conversion operators to - /// convert the represented color to and from the - /// type. This makes the type a real replacement - /// for the FI16RGB555 structure and my be used in all situations which require - /// an FI16RGB555 type. - /// - /// - /// - /// The following code example demonstrates the various conversions between the - /// FI16RGB555 structure and the structure. - /// - /// FI16RGB555 fi16rgb; - /// // Initialize the structure using a native .NET Color structure. - /// fi16rgb = new FI16RGB555(Color.Indigo); - /// // Initialize the structure using the implicit operator. - /// fi16rgb = Color.DarkSeaGreen; - /// // Convert the FI16RGB555 instance into a native .NET Color - /// // using its implicit operator. - /// Color color = fi16rgb; - /// // Using the structure's Color property for converting it - /// // into a native .NET Color. - /// Color another = fi16rgb.Color; - /// - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct FI16RGB555 : IComparable, IComparable, IEquatable - { - /// - /// The value of the color. - /// - private ushort value; - - /// - /// Initializes a new instance based on the specified . - /// - /// to initialize with. - public FI16RGB555(Color color) - { - value = (ushort)( - (((color.R * 31) / 255) << FreeImage.FI16_555_RED_SHIFT) + - (((color.G * 31) / 255) << FreeImage.FI16_555_GREEN_SHIFT) + - (((color.B * 31) / 255) << FreeImage.FI16_555_BLUE_SHIFT)); - } - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(FI16RGB555 left, FI16RGB555 right) - { - return (left.value == right.value); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(FI16RGB555 left, FI16RGB555 right) - { - return (!(left == right)); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator FI16RGB555(Color value) - { - return new FI16RGB555(value); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator Color(FI16RGB555 value) - { - return value.Color; - } - - /// - /// Gets or sets the of the structure. - /// - public Color Color - { - get - { - return Color.FromArgb( - ((value & FreeImage.FI16_555_RED_MASK) >> FreeImage.FI16_555_RED_SHIFT) * 255 / 31, - ((value & FreeImage.FI16_555_GREEN_MASK) >> FreeImage.FI16_555_GREEN_SHIFT) * 255 / 31, - ((value & FreeImage.FI16_555_BLUE_MASK) >> FreeImage.FI16_555_BLUE_SHIFT) * 255 / 31); - } - set - { - this.value = (ushort)( - (((value.R * 31) / 255) << FreeImage.FI16_555_RED_SHIFT) + - (((value.G * 31) / 255) << FreeImage.FI16_555_GREEN_SHIFT) + - (((value.B * 31) / 255) << FreeImage.FI16_555_BLUE_SHIFT)); - } - } - - /// - /// Gets or sets the red color component. - /// - public byte Red - { - get - { - return (byte)(((value & FreeImage.FI16_555_RED_MASK) >> FreeImage.FI16_555_RED_SHIFT) * 255 / 31); - } - set - { - this.value = (ushort)((this.value & (~FreeImage.FI16_555_RED_MASK)) | (((value * 31) / 255) << FreeImage.FI16_555_RED_SHIFT)); - } - } - - /// - /// Gets or sets the green color component. - /// - public byte Green - { - get - { - return (byte)(((value & FreeImage.FI16_555_GREEN_MASK) >> FreeImage.FI16_555_GREEN_SHIFT) * 255 / 31); - } - set - { - this.value = (ushort)((this.value & (~FreeImage.FI16_555_GREEN_MASK)) | (((value * 31) / 255) << FreeImage.FI16_555_GREEN_SHIFT)); - } - } - - /// - /// Gets or sets the blue color component. - /// - public byte Blue - { - get - { - return (byte)(((value & FreeImage.FI16_555_BLUE_MASK) >> FreeImage.FI16_555_BLUE_SHIFT) * 255 / 31); - } - set - { - this.value = (ushort)((this.value & (~FreeImage.FI16_555_BLUE_MASK)) | (((value * 31) / 255) << FreeImage.FI16_555_BLUE_SHIFT)); - } - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is FI16RGB555)) - { - throw new ArgumentException("obj"); - } - return CompareTo((FI16RGB555)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(FI16RGB555 other) - { - return this.Color.ToArgb().CompareTo(other.Color.ToArgb()); - } - - /// - /// Tests whether the specified object is a structure - /// and is equivalent to this structure. - /// - /// The object to test. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public override bool Equals(object obj) - { - return base.Equals(obj); - } - - /// - /// Tests whether the specified structure is equivalent to this structure. - /// - /// A structure to compare to this instance. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public bool Equals(FI16RGB555 other) - { - return (this == other); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return base.GetHashCode(); - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return FreeImage.ColorToString(Color); - } - } -} - -namespace FreeImageAPI -{ - /// - /// The FI16RGB565 structure describes a color consisting of relative - /// intensities of red, green, blue and alpha value. Each single color - /// component consumes 5 bits and so, takes values in the range from 0 to 31. - /// - /// - /// For easy integration of the underlying structure into the .NET framework, - /// the FI16RGB565 structure implements implicit conversion operators to - /// convert the represented color to and from the - /// type. This makes the type a real replacement - /// for the FI16RGB565 structure and my be used in all situations which require - /// an FI16RGB565 type. - /// - /// - /// - /// The following code example demonstrates the various conversions between the - /// FI16RGB565 structure and the structure. - /// - /// FI16RGB565 fi16rgb; - /// // Initialize the structure using a native .NET Color structure. - /// fi16rgb = new FI16RGB565(Color.Indigo); - /// // Initialize the structure using the implicit operator. - /// fi16rgb = Color.DarkSeaGreen; - /// // Convert the FI16RGB565 instance into a native .NET Color - /// // using its implicit operator. - /// Color color = fi16rgb; - /// // Using the structure's Color property for converting it - /// // into a native .NET Color. - /// Color another = fi16rgb.Color; - /// - /// - [Serializable, StructLayout(LayoutKind.Sequential)] - public struct FI16RGB565 : IComparable, IComparable, IEquatable - { - /// - /// The value of the color. - /// - private ushort value; - - /// - /// Initializes a new instance based on the specified . - /// - /// to initialize with. - public FI16RGB565(Color color) - { - value = (ushort)( - (((color.R * 31) / 255) << FreeImage.FI16_565_RED_SHIFT) + - (((color.G * 63) / 255) << FreeImage.FI16_565_GREEN_SHIFT) + - (((color.B * 31) / 255) << FreeImage.FI16_565_BLUE_SHIFT)); - } - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(FI16RGB565 left, FI16RGB565 right) - { - return (left.value == right.value); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(FI16RGB565 left, FI16RGB565 right) - { - return (!(left == right)); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator FI16RGB565(Color value) - { - return new FI16RGB565(value); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator Color(FI16RGB565 value) - { - return value.Color; - } - - /// - /// Gets or sets the of the structure. - /// - public Color Color - { - get - { - return Color.FromArgb( - ((value & FreeImage.FI16_565_RED_MASK) >> FreeImage.FI16_565_RED_SHIFT) * 255 / 31, - ((value & FreeImage.FI16_565_GREEN_MASK) >> FreeImage.FI16_565_GREEN_SHIFT) * 255 / 63, - ((value & FreeImage.FI16_565_BLUE_MASK) >> FreeImage.FI16_565_BLUE_SHIFT) * 255 / 31); - } - set - { - this.value = (ushort)( - (((value.R * 31) / 255) << FreeImage.FI16_565_RED_SHIFT) + - (((value.G * 63) / 255) << FreeImage.FI16_565_GREEN_SHIFT) + - (((value.B * 31) / 255) << FreeImage.FI16_565_BLUE_SHIFT)); - } - } - - /// - /// Gets or sets the red color component. - /// - public byte Red - { - get - { - return (byte)(((value & FreeImage.FI16_565_RED_MASK) >> FreeImage.FI16_565_RED_SHIFT) * 255 / 31); - } - set - { - this.value = (ushort)((this.value & (~FreeImage.FI16_565_RED_MASK)) | (((value * 31) / 255) << FreeImage.FI16_565_RED_SHIFT)); - } - } - - /// - /// Gets or sets the green color component. - /// - public byte Green - { - get - { - return (byte)(((value & FreeImage.FI16_565_GREEN_MASK) >> FreeImage.FI16_565_GREEN_SHIFT) * 255 / 63); - } - set - { - this.value = (ushort)((this.value & (~FreeImage.FI16_565_GREEN_MASK)) | (((value * 63) / 255) << FreeImage.FI16_565_GREEN_SHIFT)); - } - } - - /// - /// Gets or sets the blue color component. - /// - public byte Blue - { - get - { - return (byte)(((value & FreeImage.FI16_565_BLUE_MASK) >> FreeImage.FI16_565_BLUE_SHIFT) * 255 / 31); - } - set - { - this.value = (ushort)((this.value & (~FreeImage.FI16_565_BLUE_MASK)) | (((value * 31) / 255) << FreeImage.FI16_565_BLUE_SHIFT)); - } - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is FI16RGB565)) - { - throw new ArgumentException("obj"); - } - return CompareTo((FI16RGB565)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(FI16RGB565 other) - { - return this.Color.ToArgb().CompareTo(other.Color.ToArgb()); - } - - /// - /// Tests whether the specified object is a structure - /// and is equivalent to this structure. - /// - /// The object to test. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public override bool Equals(object obj) - { - return base.Equals(obj); - } - - /// - /// Tests whether the specified structure is equivalent to this structure. - /// - /// A structure to compare to this instance. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public bool Equals(FI16RGB565 other) - { - return (this == other); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return base.GetHashCode(); - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return FreeImage.ColorToString(Color); - } - } -} - -namespace FreeImageAPI -{ - /// - /// The FIRational structure represents a fraction via two - /// instances which are interpreted as numerator and denominator. - /// - /// - /// The structure tries to approximate the value of - /// when creating a new instance by using a better algorithm than FreeImage does. - /// - /// The structure implements the following operators: - /// +, -, ++, --, ==, != , >, >==, <, <== and ~ (which switches nominator and denomiator). - /// - /// The structure can be converted into all .NET standard types either implicit or - /// explicit. - /// - [Serializable, StructLayout(LayoutKind.Sequential), ComVisible(true)] - public struct FIRational : IConvertible, IComparable, IFormattable, IComparable, IEquatable - { - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private int numerator; - - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private int denominator; - - /// - /// Represents the largest possible value of . This field is constant. - /// - public static readonly FIRational MaxValue = new FIRational(Int32.MaxValue, 1); - - /// - /// Represents the smallest possible value of . This field is constant. - /// - public static readonly FIRational MinValue = new FIRational(Int32.MinValue, 1); - - /// - /// Represents the smallest positive value greater than zero. This field is constant. - /// - public static readonly FIRational Epsilon = new FIRational(1, Int32.MaxValue); - - /// - /// Initializes a new instance based on the specified parameters. - /// - /// The numerator. - /// The denominator. - public FIRational(int n, int d) - { - numerator = n; - denominator = d; - Normalize(); - } - - /// - /// Initializes a new instance based on the specified parameters. - /// - /// The tag to read the data from. - public unsafe FIRational(FITAG tag) - { - switch (FreeImage.GetTagType(tag)) - { - case FREE_IMAGE_MDTYPE.FIDT_SRATIONAL: - int* value = (int*)FreeImage.GetTagValue(tag); - numerator = (int)value[0]; - denominator = (int)value[1]; - Normalize(); - return; - default: - throw new ArgumentException("tag"); - } - } - - /// - /// Initializes a new instance based on the specified parameters. - /// - /// The value to convert into a fraction. - /// - /// cannot be converted into a fraction - /// represented by two integer values. - public FIRational(decimal value) - { - try - { - int sign = value < 0 ? -1 : 1; - value = Math.Abs(value); - try - { - int[] contFract = CreateContinuedFraction(value); - CreateFraction(contFract, out numerator, out denominator); - Normalize(); - } - catch - { - numerator = 0; - denominator = 1; - } - if (Math.Abs(((decimal)numerator / (decimal)denominator) - value) > 0.0001m) - { - int maxDen = (Int32.MaxValue / (int)value) - 2; - maxDen = maxDen < 10000 ? maxDen : 10000; - ApproximateFraction(value, maxDen, out numerator, out denominator); - Normalize(); - if (Math.Abs(((decimal)numerator / (decimal)denominator) - value) > 0.0001m) - { - throw new OverflowException("Unable to convert value into a fraction"); - } - } - numerator *= sign; - Normalize(); - } - catch (Exception ex) - { - throw new OverflowException("Unable to calculate fraction.", ex); - } - } - - /// - /// The numerator of the fraction. - /// - public int Numerator - { - get { return numerator; } - } - - /// - /// The denominator of the fraction. - /// - public int Denominator - { - get { return denominator; } - } - - /// - /// Returns the truncated value of the fraction. - /// - /// - public int Truncate() - { - return denominator > 0 ? (int)(numerator / denominator) : 0; - } - - /// - /// Returns whether the fraction is representing an integer value. - /// - public bool IsInteger - { - get - { - return (denominator == 1 || - (denominator != 0 && (numerator % denominator == 0)) || - (denominator == 0 && numerator == 0)); - } - } - - /// - /// Calculated the greatest common divisor of 'a' and 'b'. - /// - private static long Gcd(long a, long b) - { - a = Math.Abs(a); - b = Math.Abs(b); - long r; - while (b > 0) - { - r = a % b; - a = b; - b = r; - } - return a; - } - - /// - /// Calculated the smallest common multiple of 'a' and 'b'. - /// - private static long Scm(int n, int m) - { - return Math.Abs((long)n * (long)m) / Gcd(n, m); - } - - /// - /// Normalizes the fraction. - /// - private void Normalize() - { - if (denominator == 0) - { - numerator = 0; - denominator = 1; - return; - } - - if (numerator != 1 && denominator != 1) - { - int common = (int)Gcd(numerator, denominator); - if (common != 1 && common != 0) - { - numerator /= common; - denominator /= common; - } - } - - if (denominator < 0) - { - numerator *= -1; - denominator *= -1; - } - } - - /// - /// Normalizes a fraction. - /// - private static void Normalize(ref long numerator, ref long denominator) - { - if (denominator == 0) - { - numerator = 0; - denominator = 1; - } - else if (numerator != 1 && denominator != 1) - { - long common = Gcd(numerator, denominator); - if (common != 1) - { - numerator /= common; - denominator /= common; - } - } - if (denominator < 0) - { - numerator *= -1; - denominator *= -1; - } - } - - /// - /// Returns the digits after the point. - /// - private static int GetDigits(decimal value) - { - int result = 0; - value -= decimal.Truncate(value); - while (value != 0) - { - value *= 10; - value -= decimal.Truncate(value); - result++; - } - return result; - } - - /// - /// Creates a continued fraction of a decimal value. - /// - private static int[] CreateContinuedFraction(decimal value) - { - int precision = GetDigits(value); - decimal epsilon = 0.0000001m; - List list = new List(); - value = Math.Abs(value); - - byte b = 0; - - list.Add((int)value); - value -= ((int)value); - - while (value != 0m) - { - if (++b == byte.MaxValue || value < epsilon) - { - break; - } - value = 1m / value; - if (Math.Abs((Math.Round(value, precision - 1) - value)) < epsilon) - { - value = Math.Round(value, precision - 1); - } - list.Add((int)value); - value -= ((int)value); - } - return list.ToArray(); - } - - /// - /// Creates a fraction from a continued fraction. - /// - private static void CreateFraction(int[] continuedFraction, out int numerator, out int denominator) - { - numerator = 1; - denominator = 0; - int temp; - - for (int i = continuedFraction.Length - 1; i > -1; i--) - { - temp = numerator; - numerator = continuedFraction[i] * numerator + denominator; - denominator = temp; - } - } - - /// - /// Tries 'brute force' to approximate with a fraction. - /// - private static void ApproximateFraction(decimal value, int maxDen, out int num, out int den) - { - num = 0; - den = 0; - decimal bestDifference = 1m; - decimal currentDifference = -1m; - int digits = GetDigits(value); - - if (digits <= 9) - { - int mul = 1; - for (int i = 1; i <= digits; i++) - { - mul *= 10; - } - if (mul <= maxDen) - { - num = (int)(value * mul); - den = mul; - return; - } - } - - for (int i = 1; i <= maxDen; i++) - { - int numerator = (int)Math.Floor(value * (decimal)i + 0.5m); - currentDifference = Math.Abs(value - (decimal)numerator / (decimal)i); - if (currentDifference < bestDifference) - { - num = numerator; - den = i; - bestDifference = currentDifference; - } - } - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return ((IConvertible)this).ToDouble(null).ToString(); - } - - /// - /// Tests whether the specified object is a structure - /// and is equivalent to this structure. - /// - /// The object to test. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is FIRational) && (this == ((FIRational)obj))); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return base.GetHashCode(); - } - - #region Operators - - /// - /// Standard implementation of the operator. - /// - public static FIRational operator +(FIRational r1) - { - return r1; - } - - /// - /// Standard implementation of the operator. - /// - public static FIRational operator -(FIRational r1) - { - r1.numerator *= -1; - return r1; - } - - /// - /// Returns the reciprocal value of this instance. - /// - public static FIRational operator ~(FIRational r1) - { - int temp = r1.denominator; - r1.denominator = r1.numerator; - r1.numerator = temp; - r1.Normalize(); - return r1; - } - - /// - /// Standard implementation of the operator. - /// - public static FIRational operator ++(FIRational r1) - { - checked - { - r1.numerator += r1.denominator; - } - return r1; - } - - /// - /// Standard implementation of the operator. - /// - public static FIRational operator --(FIRational r1) - { - checked - { - r1.numerator -= r1.denominator; - } - return r1; - } - - /// - /// Standard implementation of the operator. - /// - public static FIRational operator +(FIRational r1, FIRational r2) - { - long numerator = 0; - long denominator = Scm(r1.denominator, r2.denominator); - numerator = (r1.numerator * (denominator / r1.denominator)) + (r2.numerator * (denominator / r2.denominator)); - Normalize(ref numerator, ref denominator); - checked - { - return new FIRational((int)numerator, (int)denominator); - } - } - - /// - /// Standard implementation of the operator. - /// - public static FIRational operator -(FIRational r1, FIRational r2) - { - return r1 + (-r2); - } - - /// - /// Standard implementation of the operator. - /// - public static FIRational operator *(FIRational r1, FIRational r2) - { - long numerator = r1.numerator * r2.numerator; - long denominator = r1.denominator * r2.denominator; - Normalize(ref numerator, ref denominator); - checked - { - return new FIRational((int)numerator, (int)denominator); - } - } - - /// - /// Standard implementation of the operator. - /// - public static FIRational operator /(FIRational r1, FIRational r2) - { - int temp = r2.denominator; - r2.denominator = r2.numerator; - r2.numerator = temp; - return r1 * r2; - } - - /// - /// Standard implementation of the operator. - /// - public static FIRational operator %(FIRational r1, FIRational r2) - { - r2.Normalize(); - if (Math.Abs(r2.numerator) < r2.denominator) - return new FIRational(0, 0); - int div = (int)(r1 / r2); - return r1 - (r2 * div); - } - - /// - /// Standard implementation of the operator. - /// - public static bool operator ==(FIRational r1, FIRational r2) - { - r1.Normalize(); - r2.Normalize(); - return (r1.numerator == r2.numerator) && (r1.denominator == r2.denominator); - } - - /// - /// Standard implementation of the operator. - /// - public static bool operator !=(FIRational r1, FIRational r2) - { - return !(r1 == r2); - } - - /// - /// Standard implementation of the operator. - /// - public static bool operator >(FIRational r1, FIRational r2) - { - long denominator = Scm(r1.denominator, r2.denominator); - return (r1.numerator * (denominator / r1.denominator)) > (r2.numerator * (denominator / r2.denominator)); - } - - /// - /// Standard implementation of the operator. - /// - public static bool operator <(FIRational r1, FIRational r2) - { - long denominator = Scm(r1.denominator, r2.denominator); - return (r1.numerator * (denominator / r1.denominator)) < (r2.numerator * (denominator / r2.denominator)); - } - - /// - /// Standard implementation of the operator. - /// - public static bool operator >=(FIRational r1, FIRational r2) - { - long denominator = Scm(r1.denominator, r2.denominator); - return (r1.numerator * (denominator / r1.denominator)) >= (r2.numerator * (denominator / r2.denominator)); - } - - /// - /// Standard implementation of the operator. - /// - public static bool operator <=(FIRational r1, FIRational r2) - { - long denominator = Scm(r1.denominator, r2.denominator); - return (r1.numerator * (denominator / r1.denominator)) <= (r2.numerator * (denominator / r2.denominator)); - } - - #endregion - - #region Conversions - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator bool(FIRational value) - { - return (value.numerator != 0); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator byte(FIRational value) - { - return (byte)(double)value; - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator char(FIRational value) - { - return (char)(double)value; - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator decimal(FIRational value) - { - return value.denominator == 0 ? 0m : (decimal)value.numerator / (decimal)value.denominator; - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator double(FIRational value) - { - return value.denominator == 0 ? 0d : (double)value.numerator / (double)value.denominator; - } - - /// - /// Converts the value of a structure to an structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator short(FIRational value) - { - return (short)(double)value; - } - - /// - /// Converts the value of a structure to an structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator int(FIRational value) - { - return (int)(double)value; - } - - /// - /// Converts the value of a structure to an structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator long(FIRational value) - { - return (byte)(double)value; - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator float(FIRational value) - { - return value.denominator == 0 ? 0f : (float)value.numerator / (float)value.denominator; - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator sbyte(FIRational value) - { - return (sbyte)(double)value; - } - - /// - /// Converts the value of a structure to an structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator ushort(FIRational value) - { - return (ushort)(double)value; - } - - /// - /// Converts the value of a structure to an structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator uint(FIRational value) - { - return (uint)(double)value; - } - - /// - /// Converts the value of a structure to an structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator ulong(FIRational value) - { - return (ulong)(double)value; - } - - // - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator FIRational(bool value) - { - return new FIRational(value ? 1 : 0, 1); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator FIRational(byte value) - { - return new FIRational(value, 1); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator FIRational(char value) - { - return new FIRational(value, 1); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator FIRational(decimal value) - { - return new FIRational(value); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator FIRational(double value) - { - return new FIRational((decimal)value); - } - - /// - /// Converts the value of an structure to a structure. - /// - /// An structure. - /// A new instance of initialized to . - public static implicit operator FIRational(short value) - { - return new FIRational(value, 1); - } - - /// - /// Converts the value of an structure to a structure. - /// - /// An structure. - /// A new instance of initialized to . - public static implicit operator FIRational(int value) - { - return new FIRational(value, 1); - } - - /// - /// Converts the value of an structure to a structure. - /// - /// An structure. - /// A new instance of initialized to . - public static explicit operator FIRational(long value) - { - return new FIRational((int)value, 1); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator FIRational(sbyte value) - { - return new FIRational(value, 1); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator FIRational(float value) - { - return new FIRational((decimal)value); - } - - /// - /// Converts the value of an structure to a structure. - /// - /// An structure. - /// A new instance of initialized to . - public static implicit operator FIRational(ushort value) - { - return new FIRational(value, 1); - } - - /// - /// Converts the value of an structure to a structure. - /// - /// An structure. - /// A new instance of initialized to . - public static explicit operator FIRational(uint value) - { - return new FIRational((int)value, 1); - } - - /// - /// Converts the value of an structure to a structure. - /// - /// An structure. - /// A new instance of initialized to . - public static explicit operator FIRational(ulong value) - { - return new FIRational((int)value, 1); - } - - #endregion - - #region IConvertible Member - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Double; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - return (bool)this; - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return (byte)this; - } - - char IConvertible.ToChar(IFormatProvider provider) - { - return (char)this; - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - return Convert.ToDateTime(((IConvertible)this).ToDouble(provider)); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return this; - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return this; - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return (short)this; - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return (int)this; - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return (long)this; - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return (sbyte)this; - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return this; - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(((double)this).ToString(), provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - return Convert.ChangeType(((IConvertible)this).ToDouble(provider), conversionType, provider); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return (ushort)this; - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return (uint)this; - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return (ulong)this; - } - - #endregion - - #region IComparable Member - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is FIRational)) - { - throw new ArgumentException(); - } - return CompareTo((FIRational)obj); - } - - #endregion - - #region IFormattable Member - - /// - /// Formats the value of the current instance using the specified format. - /// - /// The String specifying the format to use. - /// The IFormatProvider to use to format the value. - /// A String containing the value of the current instance in the specified format. - public string ToString(string format, IFormatProvider formatProvider) - { - if (format == null) - { - format = ""; - } - return String.Format(formatProvider, format, ((IConvertible)this).ToDouble(formatProvider)); - } - - #endregion - - #region IEquatable Member - - /// - /// Tests whether the specified structure is equivalent to this structure. - /// - /// A structure to compare to this instance. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public bool Equals(FIRational other) - { - return (this == other); - } - - #endregion - - #region IComparable Member - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(FIRational other) - { - FIRational difference = this - other; - difference.Normalize(); - if (difference.numerator > 0) return 1; - if (difference.numerator < 0) return -1; - else return 0; - } - - #endregion - } -} - -namespace FreeImageAPI -{ - /// - /// The FIURational structure represents a fraction via two - /// instances which are interpreted as numerator and denominator. - /// - /// - /// The structure tries to approximate the value of - /// when creating a new instance by using a better algorithm than FreeImage does. - /// - /// The structure implements the following operators: - /// +, ++, --, ==, != , >, >==, <, <== and ~ (which switches nominator and denomiator). - /// - /// The structure can be converted into all .NET standard types either implicit or - /// explicit. - /// - [Serializable, StructLayout(LayoutKind.Sequential), ComVisible(true)] - public struct FIURational : IConvertible, IComparable, IFormattable, IComparable, IEquatable - { - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private uint numerator; - - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private uint denominator; - - /// - /// Represents the largest possible value of . This field is constant. - /// - public static readonly FIURational MaxValue = new FIURational(UInt32.MaxValue, 1u); - - /// - /// Represents the smallest possible value of . This field is constant. - /// - public static readonly FIURational MinValue = new FIURational(0u, 1u); - - /// - /// Represents the smallest positive value greater than zero. This field is constant. - /// - public static readonly FIURational Epsilon = new FIURational(1u, UInt32.MaxValue); - - /// - /// Initializes a new instance based on the specified parameters. - /// - /// The numerator. - /// The denominator. - public FIURational(uint n, uint d) - { - numerator = n; - denominator = d; - Normalize(); - } - - /// - /// Initializes a new instance based on the specified parameters. - /// - /// The tag to read the data from. - public unsafe FIURational(FITAG tag) - { - switch (FreeImage.GetTagType(tag)) - { - case FREE_IMAGE_MDTYPE.FIDT_RATIONAL: - uint* pvalue = (uint*)FreeImage.GetTagValue(tag); - numerator = pvalue[0]; - denominator = pvalue[1]; - Normalize(); - return; - default: - throw new ArgumentException("tag"); - } - } - - /// - ///Initializes a new instance based on the specified parameters. - /// - /// The value to convert into a fraction. - /// - /// cannot be converted into a fraction - /// represented by two unsigned integer values. - public FIURational(decimal value) - { - try - { - if (value < 0) - { - throw new OverflowException("value"); - } - try - { - int[] contFract = CreateContinuedFraction(value); - CreateFraction(contFract, out numerator, out denominator); - Normalize(); - } - catch - { - numerator = 0; - denominator = 1; - } - if (Math.Abs(((decimal)numerator / (decimal)denominator) - value) > 0.0001m) - { - int maxDen = (Int32.MaxValue / (int)value) - 2; - maxDen = maxDen < 10000 ? maxDen : 10000; - ApproximateFraction(value, maxDen, out numerator, out denominator); - Normalize(); - if (Math.Abs(((decimal)numerator / (decimal)denominator) - value) > 0.0001m) - { - throw new OverflowException("Unable to convert value into a fraction"); - } - } - Normalize(); - } - catch (Exception ex) - { - throw new OverflowException("Unable to calculate fraction.", ex); - } - } - - /// - /// The numerator of the fraction. - /// - public uint Numerator - { - get { return numerator; } - } - - /// - /// The denominator of the fraction. - /// - public uint Denominator - { - get { return denominator; } - } - - /// - /// Returns the truncated value of the fraction. - /// - /// - public int Truncate() - { - return denominator > 0 ? (int)(numerator / denominator) : 0; - } - - /// - /// Returns whether the fraction is representing an integer value. - /// - public bool IsInteger - { - get - { - return (denominator == 1 || - (denominator != 0 && (numerator % denominator == 0)) || - (denominator == 0 && numerator == 0)); - } - } - - /// - /// Calculated the greatest common divisor of 'a' and 'b'. - /// - private static ulong Gcd(ulong a, ulong b) - { - ulong r; - while (b > 0) - { - r = a % b; - a = b; - b = r; - } - return a; - } - - /// - /// Calculated the smallest common multiple of 'a' and 'b'. - /// - private static ulong Scm(uint n, uint m) - { - return (ulong)n * (ulong)m / Gcd(n, m); - } - - /// - /// Normalizes the fraction. - /// - private void Normalize() - { - if (denominator == 0) - { - numerator = 0; - denominator = 1; - return; - } - - if (numerator != 1 && denominator != 1) - { - uint common = (uint)Gcd(numerator, denominator); - if (common != 1 && common != 0) - { - numerator /= common; - denominator /= common; - } - } - } - - /// - /// Normalizes a fraction. - /// - private static void Normalize(ref ulong numerator, ref ulong denominator) - { - if (denominator == 0) - { - numerator = 0; - denominator = 1; - } - else if (numerator != 1 && denominator != 1) - { - ulong common = Gcd(numerator, denominator); - if (common != 1) - { - numerator /= common; - denominator /= common; - } - } - } - - /// - /// Returns the digits after the point. - /// - private static int GetDigits(decimal value) - { - int result = 0; - value -= decimal.Truncate(value); - while (value != 0) - { - value *= 10; - value -= decimal.Truncate(value); - result++; - } - return result; - } - - /// - /// Creates a continued fraction of a decimal value. - /// - private static int[] CreateContinuedFraction(decimal value) - { - int precision = GetDigits(value); - decimal epsilon = 0.0000001m; - List list = new List(); - value = Math.Abs(value); - - byte b = 0; - - list.Add((int)value); - value -= ((int)value); - - while (value != 0m) - { - if (++b == byte.MaxValue || value < epsilon) - { - break; - } - value = 1m / value; - if (Math.Abs((Math.Round(value, precision - 1) - value)) < epsilon) - { - value = Math.Round(value, precision - 1); - } - list.Add((int)value); - value -= ((int)value); - } - return list.ToArray(); - } - - /// - /// Creates a fraction from a continued fraction. - /// - private static void CreateFraction(int[] continuedFraction, out uint numerator, out uint denominator) - { - numerator = 1; - denominator = 0; - uint temp; - - for (int i = continuedFraction.Length - 1; i > -1; i--) - { - temp = numerator; - numerator = (uint)(continuedFraction[i] * numerator + denominator); - denominator = temp; - } - } - - /// - /// Tries 'brute force' to approximate with a fraction. - /// - private static void ApproximateFraction(decimal value, int maxDen, out uint num, out uint den) - { - num = 0; - den = 0; - decimal bestDifference = 1m; - decimal currentDifference = -1m; - int digits = GetDigits(value); - - if (digits <= 9) - { - uint mul = 1; - for (int i = 1; i <= digits; i++) - { - mul *= 10; - } - if (mul <= maxDen) - { - num = (uint)(value * mul); - den = mul; - return; - } - } - - for (uint u = 1; u <= maxDen; u++) - { - uint numerator = (uint)Math.Floor(value * (decimal)u + 0.5m); - currentDifference = Math.Abs(value - (decimal)numerator / (decimal)u); - if (currentDifference < bestDifference) - { - num = numerator; - den = u; - bestDifference = currentDifference; - } - } - } - - /// - /// Converts the numeric value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return ((IConvertible)this).ToDouble(null).ToString(); - } - - /// - /// Tests whether the specified object is a structure - /// and is equivalent to this structure. - /// - /// The object to test. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is FIURational) && (this == ((FIURational)obj))); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return base.GetHashCode(); - } - - #region Operators - - /// - /// Standard implementation of the operator. - /// - public static FIURational operator +(FIURational value) - { - return value; - } - - /// - /// Returns the reciprocal value of this instance. - /// - public static FIURational operator ~(FIURational value) - { - uint temp = value.denominator; - value.denominator = value.numerator; - value.numerator = temp; - value.Normalize(); - return value; - } - - /// - /// Standard implementation of the operator. - /// - public static FIURational operator ++(FIURational value) - { - checked - { - value.numerator += value.denominator; - } - return value; - } - - /// - /// Standard implementation of the operator. - /// - public static FIURational operator --(FIURational value) - { - checked - { - value.numerator -= value.denominator; - } - return value; - } - - /// - /// Standard implementation of the operator. - /// - public static FIURational operator +(FIURational left, FIURational right) - { - ulong numerator = 0; - ulong denominator = Scm(left.denominator, right.denominator); - numerator = (left.numerator * (denominator / left.denominator)) + - (right.numerator * (denominator / right.denominator)); - Normalize(ref numerator, ref denominator); - checked - { - return new FIURational((uint)numerator, (uint)denominator); - } - } - - /// - /// Standard implementation of the operator. - /// - public static FIURational operator -(FIURational left, FIURational right) - { - checked - { - if (left.denominator != right.denominator) - { - uint denom = left.denominator; - left.numerator *= right.denominator; - left.denominator *= right.denominator; - right.numerator *= denom; - right.denominator *= denom; - } - left.numerator -= right.numerator; - left.Normalize(); - return left; - } - } - - /// - /// Standard implementation of the operator. - /// - public static FIURational operator *(FIURational left, FIURational r2) - { - ulong numerator = left.numerator * r2.numerator; - ulong denominator = left.denominator * r2.denominator; - Normalize(ref numerator, ref denominator); - checked - { - return new FIURational((uint)numerator, (uint)denominator); - } - } - - /// - /// Standard implementation of the operator. - /// - public static FIURational operator /(FIURational left, FIURational right) - { - uint temp = right.denominator; - right.denominator = right.numerator; - right.numerator = temp; - return left * right; - } - - /// - /// Standard implementation of the operator. - /// - public static FIURational operator %(FIURational left, FIURational right) - { - right.Normalize(); - if (Math.Abs(right.numerator) < right.denominator) - return new FIURational(0, 0); - int div = (int)(left / right); - return left - (right * div); - } - - /// - /// Standard implementation of the operator. - /// - public static bool operator ==(FIURational left, FIURational right) - { - left.Normalize(); - right.Normalize(); - return (left.numerator == right.numerator) && (left.denominator == right.denominator); - } - - /// - /// Standard implementation of the operator. - /// - public static bool operator !=(FIURational left, FIURational right) - { - left.Normalize(); - right.Normalize(); - return (left.numerator != right.numerator) || (left.denominator != right.denominator); - } - - /// - /// Standard implementation of the operator. - /// - public static bool operator >(FIURational left, FIURational right) - { - ulong denominator = Scm(left.denominator, right.denominator); - return (left.numerator * (denominator / left.denominator)) > - (right.numerator * (denominator / right.denominator)); - } - - /// - /// Standard implementation of the operator. - /// - public static bool operator <(FIURational left, FIURational right) - { - ulong denominator = Scm(left.denominator, right.denominator); - return (left.numerator * (denominator / left.denominator)) < - (right.numerator * (denominator / right.denominator)); - } - - /// - /// Standard implementation of the operator. - /// - public static bool operator >=(FIURational left, FIURational right) - { - ulong denominator = Scm(left.denominator, right.denominator); - return (left.numerator * (denominator / left.denominator)) >= - (right.numerator * (denominator / right.denominator)); - } - - /// - /// Standard implementation of the operator. - /// - public static bool operator <=(FIURational left, FIURational right) - { - ulong denominator = Scm(left.denominator, right.denominator); - return (left.numerator * (denominator / left.denominator)) <= - (right.numerator * (denominator / right.denominator)); - } - - #endregion - - #region Conversions - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator bool(FIURational value) - { - return (value.numerator != 0); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator byte(FIURational value) - { - return (byte)(double)value; - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator char(FIURational value) - { - return (char)(double)value; - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator decimal(FIURational value) - { - return value.denominator == 0 ? 0m : (decimal)value.numerator / (decimal)value.denominator; - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator double(FIURational value) - { - return value.denominator == 0 ? 0d : (double)value.numerator / (double)value.denominator; - } - - /// - /// Converts the value of a structure to an structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator short(FIURational value) - { - return (short)(double)value; - } - - /// - /// Converts the value of a structure to an structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator int(FIURational value) - { - return (int)(double)value; - } - - /// - /// Converts the value of a structure to an structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator long(FIURational value) - { - return (byte)(double)value; - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator float(FIURational value) - { - return value.denominator == 0 ? 0f : (float)value.numerator / (float)value.denominator; - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator sbyte(FIURational value) - { - return (sbyte)(double)value; - } - - /// - /// Converts the value of a structure to an structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator ushort(FIURational value) - { - return (ushort)(double)value; - } - - /// - /// Converts the value of a structure to an structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator uint(FIURational value) - { - return (uint)(double)value; - } - - /// - /// Converts the value of a structure to an structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator ulong(FIURational value) - { - return (ulong)(double)value; - } - - // - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator FIURational(bool value) - { - return new FIURational(value ? 1u : 0u, 1u); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator FIURational(byte value) - { - return new FIURational(value, 1); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator FIURational(char value) - { - return new FIURational(value, 1); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator FIURational(decimal value) - { - return new FIURational(value); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator FIURational(double value) - { - return new FIURational((decimal)value); - } - - /// - /// Converts the value of an structure to a structure. - /// - /// An structure. - /// A new instance of initialized to . - public static implicit operator FIURational(short value) - { - return new FIURational((uint)value, 1u); - } - - /// - /// Converts the value of an structure to a structure. - /// - /// An structure. - /// A new instance of initialized to . - public static implicit operator FIURational(int value) - { - return new FIURational((uint)value, 1u); - } - - /// - /// Converts the value of an structure to a structure. - /// - /// An structure. - /// A new instance of initialized to . - public static explicit operator FIURational(long value) - { - return new FIURational((uint)value, 1u); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static implicit operator FIURational(sbyte value) - { - return new FIURational((uint)value, 1u); - } - - /// - /// Converts the value of a structure to a structure. - /// - /// A structure. - /// A new instance of initialized to . - public static explicit operator FIURational(float value) - { - return new FIURational((decimal)value); - } - - /// - /// Converts the value of an structure to a structure. - /// - /// An structure. - /// A new instance of initialized to . - public static implicit operator FIURational(ushort value) - { - return new FIURational(value, 1); - } - - /// - /// Converts the value of an structure to a structure. - /// - /// An structure. - /// A new instance of initialized to . - public static explicit operator FIURational(uint value) - { - return new FIURational(value, 1u); - } - - /// - /// Converts the value of an structure to a structure. - /// - /// An structure. - /// A new instance of initialized to . - public static explicit operator FIURational(ulong value) - { - return new FIURational((uint)value, 1u); - } - - #endregion - - #region IConvertible Member - - TypeCode IConvertible.GetTypeCode() - { - return TypeCode.Double; - } - - bool IConvertible.ToBoolean(IFormatProvider provider) - { - return (bool)this; - } - - byte IConvertible.ToByte(IFormatProvider provider) - { - return (byte)this; - } - - char IConvertible.ToChar(IFormatProvider provider) - { - return (char)this; - } - - DateTime IConvertible.ToDateTime(IFormatProvider provider) - { - return Convert.ToDateTime(((IConvertible)this).ToDouble(provider)); - } - - decimal IConvertible.ToDecimal(IFormatProvider provider) - { - return this; - } - - double IConvertible.ToDouble(IFormatProvider provider) - { - return this; - } - - short IConvertible.ToInt16(IFormatProvider provider) - { - return (short)this; - } - - int IConvertible.ToInt32(IFormatProvider provider) - { - return (int)this; - } - - long IConvertible.ToInt64(IFormatProvider provider) - { - return (long)this; - } - - sbyte IConvertible.ToSByte(IFormatProvider provider) - { - return (sbyte)this; - } - - float IConvertible.ToSingle(IFormatProvider provider) - { - return this; - } - - string IConvertible.ToString(IFormatProvider provider) - { - return ToString(((double)this).ToString(), provider); - } - - object IConvertible.ToType(Type conversionType, IFormatProvider provider) - { - return Convert.ChangeType(((IConvertible)this).ToDouble(provider), conversionType, provider); - } - - ushort IConvertible.ToUInt16(IFormatProvider provider) - { - return (ushort)this; - } - - uint IConvertible.ToUInt32(IFormatProvider provider) - { - return (uint)this; - } - - ulong IConvertible.ToUInt64(IFormatProvider provider) - { - return (ulong)this; - } - - #endregion - - #region IComparable Member - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is FIURational)) - { - throw new ArgumentException(); - } - return CompareTo((FIURational)obj); - } - - #endregion - - #region IFormattable Member - - /// - /// Formats the value of the current instance using the specified format. - /// - /// The String specifying the format to use. - /// The IFormatProvider to use to format the value. - /// A String containing the value of the current instance in the specified format. - public string ToString(string format, IFormatProvider formatProvider) - { - if (format == null) - { - format = ""; - } - return String.Format(formatProvider, format, ((IConvertible)this).ToDouble(formatProvider)); - } - - #endregion - - #region IEquatable Member - - /// - /// Tests whether the specified structure is equivalent to this structure. - /// - /// A structure to compare to this instance. - /// true if is a structure - /// equivalent to this structure; otherwise, false. - public bool Equals(FIURational other) - { - return (this == other); - } - - #endregion - - #region IComparable Member - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(FIURational other) - { - FIURational difference = this - other; - difference.Normalize(); - if (difference.numerator > 0) return 1; - if (difference.numerator < 0) return -1; - else return 0; - } - - #endregion - } -} - - #endregion - - #region Classes - -namespace FreeImageAPI -{ - /// - /// Encapsulates a FreeImage-bitmap. - /// - [Serializable, Guid("64a4c935-b757-499c-ab8c-6110316a9e51")] - public class FreeImageBitmap : MarshalByRefObject, ICloneable, IDisposable, IEnumerable, ISerializable - { - #region Fields - - /// - /// Indicates whether this instance is disposed. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private bool disposed; - - /// - /// Tab object. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private object tag; - - /// - /// Object used to syncronize lock methods. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private object lockObject = new object(); - - /// - /// Holds information used by SaveAdd() methods. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private SaveInformation saveInformation = new SaveInformation(); - - /// - /// The stream that this instance was loaded from or - /// null if it has been cloned or deserialized. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private Stream stream; - - /// - /// True if the stream must be disposed with this - /// instance. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private bool disposeStream; - - /// - /// The number of frames contained by a mutlipage bitmap. - /// Default value is 1 and only changed if needed. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private int frameCount = 1; - - /// - /// The index of the loaded frame. - /// Default value is 0 and only changed if needed. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private int frameIndex = 0; - - /// - /// Format of the sourceimage. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private FREE_IMAGE_FORMAT originalFormat = FREE_IMAGE_FORMAT.FIF_UNKNOWN; - - /// - /// Handle to the encapsulated FreeImage-bitmap. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private FIBITMAP dib; - - private const string ErrorLoadingBitmap = "Unable to load bitmap."; - private const string ErrorLoadingFrame = "Unable to load frame."; - private const string ErrorCreatingBitmap = "Unable to create bitmap."; - private const string ErrorUnloadBitmap = "Unable to unload bitmap."; - - #endregion - - #region Constructors and Destructor - - /// - /// Initializes a new instance of the class. - /// - protected FreeImageBitmap() - { - } - - /// - /// Initializes a new instance of the class. - /// For internal use only. - /// - /// The operation failed. - internal protected FreeImageBitmap(FIBITMAP dib) - { - if (dib.IsNull) - { - throw new Exception(ErrorLoadingBitmap); - } - this.dib = dib; - AddMemoryPressure(); - } - - /// - /// Initializes a new instance of the class - /// bases on the specified image. - /// - /// The original to clone from. - /// The operation failed. - /// is a null reference. - public FreeImageBitmap(FreeImageBitmap original) - { - if (original == null) - { - throw new ArgumentNullException("original"); - } - original.EnsureNotDisposed(); - dib = FreeImage.Clone(original.dib); - if (dib.IsNull) - { - throw new Exception(ErrorLoadingBitmap); - } - originalFormat = original.originalFormat; - AddMemoryPressure(); - } - - /// - /// Initializes a new instance of the class - /// bases on the specified image with the specified size. - /// - /// The original to clone from. - /// The Size structure that represent the - /// size of the new . - /// The operation failed. - /// is a null reference. - /// - /// or are less or equal zero. - /// - public FreeImageBitmap(FreeImageBitmap original, Size newSize) - : this(original, newSize.Width, newSize.Height) - { - } - - /// - /// Initializes a new instance of the class - /// bases on the specified image with the specified size. - /// - /// The original to clone from. - /// Width of the new . - /// Height of the new . - /// The operation failed. - /// is a null reference. - /// - /// or are less or equal zero. - public FreeImageBitmap(FreeImageBitmap original, int width, int height) - { - if (original == null) - { - throw new ArgumentNullException("original"); - } - if (width <= 0) - { - throw new ArgumentOutOfRangeException("width"); - } - if (height <= 0) - { - throw new ArgumentOutOfRangeException("height"); - } - original.EnsureNotDisposed(); - dib = FreeImage.Rescale(original.dib, width, height, FREE_IMAGE_FILTER.FILTER_BICUBIC); - if (dib.IsNull) - { - throw new Exception(ErrorLoadingBitmap); - } - originalFormat = original.originalFormat; - AddMemoryPressure(); - } - - /// - /// Initializes a new instance of the class - /// bases on the specified image. - /// - /// The original to clone from. - /// - /// Although this constructor supports creating images in both formats - /// - /// and , bitmaps - /// created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - /// images respectively. Currently, there is no support for automatic premultiplying images in - /// . - /// - /// The operation failed. - public FreeImageBitmap(Image original) - : this(original as Bitmap) - { - } - - /// - /// Initializes a new instance of the class - /// bases on the specified image with the specified size. - /// - /// The original to clone from. - /// The Size structure that represent the - /// size of the new . - /// - /// Although this constructor supports creating images in both formats - /// - /// and , bitmaps - /// created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - /// images respectively. Currently, there is no support for automatic premultiplying images in - /// . - /// - /// The operation failed. - /// is a null reference. - /// - /// or are less or equal zero. - /// - public FreeImageBitmap(Image original, Size newSize) - : this(original as Bitmap, newSize.Width, newSize.Height) - { - } - - /// - /// Initializes a new instance of the class - /// bases on the specified image with the specified size. - /// - /// The original to clone from. - /// The width, in pixels, of the new . - /// The height, in pixels, of the new . - /// - /// Although this constructor supports creating images in both formats - /// - /// and , bitmaps - /// created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - /// images respectively. Currently, there is no support for automatic premultiplying images in - /// . - /// - /// The operation failed. - /// is a null reference. - /// - /// or are less or equal zero. - public FreeImageBitmap(Image original, int width, int height) - : this(original as Bitmap, width, height) - { - } - - /// - /// Initializes a new instance of the class - /// bases on the specified image. - /// - /// The original to clone from. - /// - /// Although this constructor supports creating images in both formats - /// - /// and , bitmaps - /// created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - /// images respectively. Currently, there is no support for automatic premultiplying images in - /// . - /// - /// is a null reference. - /// The operation failed. - public FreeImageBitmap(Bitmap original) - { - if (original == null) - { - throw new ArgumentNullException("original"); - } - dib = FreeImage.CreateFromBitmap(original, true); - if (dib.IsNull) - { - throw new Exception(ErrorLoadingBitmap); - } - originalFormat = FreeImage.GetFormat(original.RawFormat); - AddMemoryPressure(); - } - - /// - /// Initializes a new instance of the class - /// bases on the specified image with the specified size. - /// - /// The original to clone from. - /// The Size structure that represent the - /// size of the new . - /// - /// Although this constructor supports creating images in both formats - /// - /// and , bitmaps - /// created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - /// images respectively. Currently, there is no support for automatic premultiplying images in - /// . - /// - /// The operation failed. - /// is a null reference. - /// - /// or are less or equal zero. - /// - public FreeImageBitmap(Bitmap original, Size newSize) - : this(original, newSize.Width, newSize.Height) - { - } - - /// - /// Initializes a new instance of the class - /// bases on the specified image with the specified size. - /// - /// The original to clone from. - /// The width, in pixels, of the new . - /// The height, in pixels, of the new . - /// - /// Although this constructor supports creating images in both formats - /// - /// and , bitmaps - /// created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - /// images respectively. Currently, there is no support for automatic premultiplying images in - /// . - /// - /// The operation failed. - /// is a null reference. - /// - /// or are less or equal zero. - public FreeImageBitmap(Bitmap original, int width, int height) - { - if (original == null) - { - throw new ArgumentNullException("original"); - } - if (width <= 0) - { - throw new ArgumentOutOfRangeException("width"); - } - if (height <= 0) - { - throw new ArgumentOutOfRangeException("height"); - } - FIBITMAP temp = FreeImage.CreateFromBitmap(original, true); - if (temp.IsNull) - { - throw new Exception(ErrorLoadingBitmap); - } - dib = FreeImage.Rescale(temp, width, height, FREE_IMAGE_FILTER.FILTER_BICUBIC); - FreeImage.Unload(temp); - if (dib.IsNull) - { - throw new Exception(ErrorLoadingBitmap); - } - originalFormat = FreeImage.GetFormat(original.RawFormat); - AddMemoryPressure(); - } - - /// - /// Initializes a new instance of the class - /// bases on the specified stream. - /// - /// Stream to read from. - /// Ignored. - /// The operation failed. - /// is a null reference. - /// - /// You must keep the stream open for the lifetime of the . - /// - public FreeImageBitmap(Stream stream, bool useIcm) - : this(stream) - { - } - - /// - /// Initializes a new instance of the class - /// bases on the specified stream. - /// - /// Stream to read from. - /// The operation failed. - /// is a null reference. - /// - /// You must keep the stream open for the lifetime of the . - /// - public FreeImageBitmap(Stream stream) - : this(stream, FREE_IMAGE_FORMAT.FIF_UNKNOWN, FREE_IMAGE_LOAD_FLAGS.DEFAULT) - { - } - - /// - /// Initializes a new instance of the class - /// bases on the specified stream in the specified format. - /// - /// Stream to read from. - /// Format of the image. - /// The operation failed. - /// is a null reference. - /// - /// You must keep the stream open for the lifetime of the . - /// - public FreeImageBitmap(Stream stream, FREE_IMAGE_FORMAT format) - : this(stream, format, FREE_IMAGE_LOAD_FLAGS.DEFAULT) - { - } - - /// - /// Initializes a new instance of the class - /// bases on the specified stream with the specified loading flags. - /// - /// Stream to read from. - /// Flags to enable or disable plugin-features. - /// The operation failed. - /// is a null reference. - /// - /// You must keep the stream open for the lifetime of the . - /// - public FreeImageBitmap(Stream stream, FREE_IMAGE_LOAD_FLAGS flags) - : this(stream, FREE_IMAGE_FORMAT.FIF_UNKNOWN, flags) - { - } - - /// - /// Initializes a new instance of the class - /// bases on the specified stream in the specified format - /// with the specified loading flags. - /// - /// Stream to read from. - /// Format of the image. - /// Flags to enable or disable plugin-features. - /// The operation failed. - /// is a null reference. - /// - /// You must keep the stream open for the lifetime of the . - /// - public FreeImageBitmap(Stream stream, FREE_IMAGE_FORMAT format, FREE_IMAGE_LOAD_FLAGS flags) - { - if (stream == null) - { - throw new ArgumentNullException("stream"); - } - this.stream = stream; - disposeStream = false; - LoadFromStream(stream, format, flags); - } - - /// - /// Initializes a new instance of the class bases on the specified file. - /// - /// The complete name of the file to load. - /// The operation failed. - /// is a null reference. - /// does not exist. - public FreeImageBitmap(string filename) - : this(filename, FREE_IMAGE_LOAD_FLAGS.DEFAULT) - { - } - - /// - /// Initializes a new instance of the class bases on the specified file. - /// - /// The complete name of the file to load. - /// Ignored. - /// The operation failed. - /// is a null reference. - /// does not exist. - public FreeImageBitmap(string filename, bool useIcm) - : this(filename) - { - } - - /// - /// Initializes a new instance of the class bases on the specified file - /// with the specified loading flags. - /// - /// The complete name of the file to load. - /// Flags to enable or disable plugin-features. - /// The operation failed. - /// is a null reference. - /// does not exist. - public FreeImageBitmap(string filename, FREE_IMAGE_LOAD_FLAGS flags) - : this(filename, FREE_IMAGE_FORMAT.FIF_UNKNOWN, flags) - { - } - - /// - /// Initializes a new instance of the class bases on the specified file - /// in the specified format. - /// - /// The complete name of the file to load. - /// Format of the image. - /// The operation failed. - /// is a null reference. - /// does not exist. - public FreeImageBitmap(string filename, FREE_IMAGE_FORMAT format) - : this(filename, format, FREE_IMAGE_LOAD_FLAGS.DEFAULT) - { - } - - /// - /// Initializes a new instance of the class bases on the specified file - /// in the specified format with the specified loading flags. - /// - /// The complete name of the file to load. - /// Format of the image. - /// Flags to enable or disable plugin-features. - /// The operation failed. - /// is a null reference. - /// does not exist. - public FreeImageBitmap(string filename, FREE_IMAGE_FORMAT format, FREE_IMAGE_LOAD_FLAGS flags) - { - if (filename == null) - { - throw new ArgumentNullException("filename"); - } - if (!File.Exists(filename)) - { - throw new FileNotFoundException("filename"); - } - - saveInformation.filename = filename; - stream = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read); - disposeStream = true; - LoadFromStream(stream, format, flags); - } - - /// - /// Initializes a new instance of the class - /// bases on the specified size. - /// - /// The width, in pixels, of the new . - /// The height, in pixels, of the new . - /// The operation failed. - public FreeImageBitmap(int width, int height) - { - dib = FreeImage.Allocate( - width, - height, - 24, - FreeImage.FI_RGBA_RED_MASK, - FreeImage.FI_RGBA_GREEN_MASK, - FreeImage.FI_RGBA_BLUE_MASK); - if (dib.IsNull) - { - throw new Exception(ErrorCreatingBitmap); - } - AddMemoryPressure(); - } - - /// - /// Initializes a new instance of the class bases on the specified resource. - /// - /// The class used to extract the resource. - /// The name of the resource. - /// The operation failed. - public FreeImageBitmap(Type type, string resource) - : this(type.Module.Assembly.GetManifestResourceStream(type, resource)) - { - } - - /// - /// Initializes a new instance of the class bases on the specified size - /// and with the resolution of the specified object. - /// - /// The width, in pixels, of the new . - /// The height, in pixels, of the new . - /// The Graphics object that specifies the resolution for the new . - /// The operation failed. - /// is a null reference. - public FreeImageBitmap(int width, int height, Graphics g) - : this(width, height) - { - FreeImage.SetResolutionX(dib, (uint)g.DpiX); - FreeImage.SetResolutionY(dib, (uint)g.DpiY); - } - - /// - /// Initializes a new instance of the class bases on the specified size and format. - /// - /// The width, in pixels, of the new . - /// The height, in pixels, of the new . - /// The PixelFormat enumeration for the new . - /// - /// Although this constructor supports creating images in both formats - /// - /// and , bitmaps - /// created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - /// images respectively. Currently, there is no support for automatic premultiplying images in - /// . - /// - /// The operation failed. - /// is invalid. - /// - /// or are less or equal zero. - public FreeImageBitmap(int width, int height, PixelFormat format) - { - if (width <= 0) - { - throw new ArgumentOutOfRangeException("width"); - } - if (height <= 0) - { - throw new ArgumentOutOfRangeException("height"); - } - uint bpp, redMask, greenMask, blueMask; - FREE_IMAGE_TYPE type; - if (!FreeImage.GetFormatParameters(format, out type, out bpp, out redMask, out greenMask, out blueMask)) - { - throw new ArgumentException("format is invalid"); - } - dib = FreeImage.AllocateT(type, width, height, (int)bpp, redMask, greenMask, blueMask); - if (dib.IsNull) - { - throw new Exception(ErrorCreatingBitmap); - } - AddMemoryPressure(); - } - - /// - /// Initializes a new instance of the class bases on the specified size and type. - /// Only non standard bitmaps are supported. - /// - /// The width, in pixels, of the new . - /// The height, in pixels, of the new . - /// The type of the bitmap. - /// The operation failed. - /// - /// is FIT_BITMAP or FIT_UNKNOWN. - /// is invalid. - /// - /// or are less or equal zero. - public FreeImageBitmap(int width, int height, FREE_IMAGE_TYPE type) - { - if (width <= 0) - { - throw new ArgumentOutOfRangeException("width"); - } - if (height <= 0) - { - throw new ArgumentOutOfRangeException("height"); - } - if ((type == FREE_IMAGE_TYPE.FIT_BITMAP) || (type == FREE_IMAGE_TYPE.FIT_UNKNOWN)) - { - throw new ArgumentException("type is invalid."); - } - dib = FreeImage.AllocateT(type, width, height, 0, 0u, 0u, 0u); - if (dib.IsNull) - { - throw new Exception(ErrorCreatingBitmap); - } - AddMemoryPressure(); - } - - /// - /// Initializes a new instance of the class bases on the specified size, - /// pixel format and pixel data. - /// - /// The width, in pixels, of the new . - /// The height, in pixels, of the new . - /// Integer that specifies the byte offset between the beginning - /// of one scan line and the next. This is usually (but not necessarily) - /// the number of bytes in the pixel format (for example, 2 for 16 bits per pixel) - /// multiplied by the width of the bitmap. The value passed to this parameter must - /// be a multiple of four.. - /// The PixelFormat enumeration for the new . - /// Pointer to an array of bytes that contains the pixel data. - /// - /// Although this constructor supports creating images in both formats - /// - /// and , bitmaps - /// created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - /// images respectively. Currently, there is no support for automatic premultiplying images in - /// . - /// - /// The operation failed. - /// is invalid. - /// - /// or are less or equal zero. - public FreeImageBitmap(int width, int height, int stride, PixelFormat format, IntPtr scan0) - { - if (width <= 0) - { - throw new ArgumentOutOfRangeException("width"); - } - if (height <= 0) - { - throw new ArgumentOutOfRangeException("height"); - } - uint bpp, redMask, greenMask, blueMask; - FREE_IMAGE_TYPE type; - bool topDown = (stride > 0); - stride = (stride > 0) ? stride : (stride * -1); - - if (!FreeImage.GetFormatParameters(format, out type, out bpp, out redMask, out greenMask, out blueMask)) - { - throw new ArgumentException("format is invalid."); - } - - dib = FreeImage.ConvertFromRawBits( - scan0, type, width, height, stride, bpp, redMask, greenMask, blueMask, topDown); - - if (dib.IsNull) - { - throw new Exception(ErrorCreatingBitmap); - } - AddMemoryPressure(); - } - - /// - /// Initializes a new instance of the class bases on the specified size, - /// pixel format and pixel data. - /// - /// The width, in pixels, of the new . - /// The height, in pixels, of the new . - /// Integer that specifies the byte offset between the beginning - /// of one scan line and the next. This is usually (but not necessarily) - /// the number of bytes in the pixel format (for example, 2 for 16 bits per pixel) - /// multiplied by the width of the bitmap. The value passed to this parameter must - /// be a multiple of four.. - /// The PixelFormat enumeration for the new . - /// Array of bytes containing the bitmap data. - /// - /// Although this constructor supports creating images in both formats - /// - /// and , bitmaps - /// created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - /// images respectively. Currently, there is no support for automatic premultiplying images in - /// . - /// - /// The operation failed. - /// is invalid. - /// - /// or are less or equal zero. - /// is null - public FreeImageBitmap(int width, int height, int stride, PixelFormat format, byte[] bits) - { - if (width <= 0) - { - throw new ArgumentOutOfRangeException("width"); - } - if (height <= 0) - { - throw new ArgumentOutOfRangeException("height"); - } - if (bits == null) - { - throw new ArgumentNullException("bits"); - } - uint bpp, redMask, greenMask, blueMask; - FREE_IMAGE_TYPE type; - bool topDown = (stride > 0); - stride = (stride > 0) ? stride : (stride * -1); - - if (!FreeImage.GetFormatParameters(format, out type, out bpp, out redMask, out greenMask, out blueMask)) - { - throw new ArgumentException("format is invalid."); - } - - dib = FreeImage.ConvertFromRawBits( - bits, type, width, height, stride, bpp, redMask, greenMask, blueMask, topDown); - - if (dib.IsNull) - { - throw new Exception(ErrorCreatingBitmap); - } - AddMemoryPressure(); - } - - /// - /// Initializes a new instance of the class bases on the specified size, - /// pixel format and pixel data. - /// - /// The width, in pixels, of the new . - /// The height, in pixels, of the new . - /// Integer that specifies the byte offset between the beginning - /// of one scan line and the next. This is usually (but not necessarily) - /// the number of bytes in the pixel format (for example, 2 for 16 bits per pixel) - /// multiplied by the width of the bitmap. The value passed to this parameter must - /// be a multiple of four.. - /// The color depth of the new - /// The type for the new . - /// Pointer to an array of bytes that contains the pixel data. - /// The operation failed. - /// is invalid. - /// - /// or are less or equal zero. - public FreeImageBitmap(int width, int height, int stride, int bpp, FREE_IMAGE_TYPE type, IntPtr scan0) - { - if (width <= 0) - { - throw new ArgumentOutOfRangeException("width"); - } - if (height <= 0) - { - throw new ArgumentOutOfRangeException("height"); - } - uint redMask, greenMask, blueMask; - bool topDown = (stride > 0); - stride = (stride > 0) ? stride : (stride * -1); - - if (!FreeImage.GetTypeParameters(type, bpp, out redMask, out greenMask, out blueMask)) - { - throw new ArgumentException("bpp and type are invalid or not supported."); - } - - dib = FreeImage.ConvertFromRawBits( - scan0, type, width, height, stride, (uint)bpp, redMask, greenMask, blueMask, topDown); - - if (dib.IsNull) - { - throw new Exception(ErrorCreatingBitmap); - } - AddMemoryPressure(); - } - - /// - /// Initializes a new instance of the class bases on the specified size, - /// pixel format and pixel data. - /// - /// The width, in pixels, of the new . - /// The height, in pixels, of the new . - /// Integer that specifies the byte offset between the beginning - /// of one scan line and the next. This is usually (but not necessarily) - /// the number of bytes in the pixel format (for example, 2 for 16 bits per pixel) - /// multiplied by the width of the bitmap. The value passed to this parameter must - /// be a multiple of four.. - /// The color depth of the new - /// The type for the new . - /// Array of bytes containing the bitmap data. - /// The operation failed. - /// is invalid. - /// - /// or are less or equal zero. - /// is null - public FreeImageBitmap(int width, int height, int stride, int bpp, FREE_IMAGE_TYPE type, byte[] bits) - { - if (width <= 0) - { - throw new ArgumentOutOfRangeException("width"); - } - if (height <= 0) - { - throw new ArgumentOutOfRangeException("height"); - } - if (bits == null) - { - throw new ArgumentNullException("bits"); - } - uint redMask, greenMask, blueMask; - bool topDown = (stride > 0); - stride = (stride > 0) ? stride : (stride * -1); - - if (!FreeImage.GetTypeParameters(type, bpp, out redMask, out greenMask, out blueMask)) - { - throw new ArgumentException("bpp and type are invalid or not supported."); - } - - dib = FreeImage.ConvertFromRawBits( - bits, type, width, height, stride, (uint)bpp, redMask, greenMask, blueMask, topDown); - - if (dib.IsNull) - { - throw new Exception(ErrorCreatingBitmap); - } - AddMemoryPressure(); - } - - /// - /// Initializes a new instance of the class. - /// - /// The operation failed. - /// The operation failed. - public FreeImageBitmap(SerializationInfo info, StreamingContext context) - { - try - { - byte[] data = (byte[])info.GetValue("Bitmap Data", typeof(byte[])); - if ((data != null) && (data.Length > 0)) - { - MemoryStream memory = new MemoryStream(data); - FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_TIFF; - dib = FreeImage.LoadFromStream(memory, ref format); - - if (dib.IsNull) - { - throw new Exception(ErrorLoadingBitmap); - } - - AddMemoryPressure(); - } - } - catch (Exception ex) - { - throw new SerializationException("Deserialization failed.", ex); - } - } - - /// - /// Frees all managed and unmanaged ressources. - /// - ~FreeImageBitmap() - { - Dispose(false); - } - - #endregion - - #region Operators - - /// - /// Converts a instance to a instance. - /// - /// A instance. - /// A new instance of initialized to . - /// - /// The explicit conversion from into Bitmap - /// allows to create an instance on the fly and use it as if - /// was a Bitmap. This way it can be directly used with a - /// PixtureBox for example without having to call any - /// conversion operations. - /// - public static explicit operator Bitmap(FreeImageBitmap value) - { - return value.ToBitmap(); - } - - /// - /// Converts a instance to a instance. - /// - /// A instance. - /// A new instance of initialized to . - /// - /// The explicit conversion from into - /// allows to create an instance on the fly to perform - /// image processing operations and converting it back. - /// - public static explicit operator FreeImageBitmap(Bitmap value) - { - return new FreeImageBitmap(value); - } - - /// - /// Determines whether two specified objects have the same value. - /// - /// A or a null reference (Nothing in Visual Basic). - /// A or a null reference (Nothing in Visual Basic). - /// - /// true if the value of left is the same as the value of right; otherwise, false. - /// - public static bool operator ==(FreeImageBitmap left, FreeImageBitmap right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - else if (object.ReferenceEquals(left, null) || object.ReferenceEquals(right, null)) - { - return false; - } - else - { - left.EnsureNotDisposed(); - right.EnsureNotDisposed(); - return FreeImage.Compare(left.dib, right.dib, FREE_IMAGE_COMPARE_FLAGS.COMPLETE); - } - } - - /// - /// Determines whether two specified objects have different values. - /// - /// A or a null reference (Nothing in Visual Basic). - /// A or a null reference (Nothing in Visual Basic). - /// - /// true if the value of left is different from the value of right; otherwise, false. - /// - public static bool operator !=(FreeImageBitmap left, FreeImageBitmap right) - { - return (!(left == right)); - } - - #endregion - - #region Properties - - /// - /// Type of the bitmap. - /// - public FREE_IMAGE_TYPE ImageType - { - get - { - EnsureNotDisposed(); - return FreeImage.GetImageType(dib); - } - } - - /// - /// Number of palette entries. - /// - public int ColorsUsed - { - get - { - EnsureNotDisposed(); - return (int)FreeImage.GetColorsUsed(dib); - } - } - - /// - /// The number of unique colors actually used by the bitmap. This might be different from - /// what ColorsUsed returns, which actually returns the palette size for palletised images. - /// Works for FIT_BITMAP type bitmaps only. - /// - public int UniqueColors - { - get - { - EnsureNotDisposed(); - return FreeImage.GetUniqueColors(dib); - } - } - - /// - /// The size of one pixel in the bitmap in bits. - /// - public int ColorDepth - { - get - { - EnsureNotDisposed(); - return (int)FreeImage.GetBPP(dib); - } - } - - /// - /// Width of the bitmap in pixel units. - /// - public int Width - { - get - { - EnsureNotDisposed(); - return (int)FreeImage.GetWidth(dib); - } - } - - /// - /// Height of the bitmap in pixel units. - /// - public int Height - { - get - { - EnsureNotDisposed(); - return (int)FreeImage.GetHeight(dib); - } - } - - /// - /// Returns the width of the bitmap in bytes, rounded to the next 32-bit boundary. - /// - public int Pitch - { - get - { - EnsureNotDisposed(); - return (int)FreeImage.GetPitch(dib); - } - } - - /// - /// Size of the bitmap in memory. - /// - public int DataSize - { - get - { - EnsureNotDisposed(); - return (int)FreeImage.GetDIBSize(dib); - } - } - - /// - /// Returns a structure that represents the palette of a FreeImage bitmap. - /// - /// is false. - public Palette Palette - { - get - { - EnsureNotDisposed(); - if (HasPalette) - { - return new Palette(dib); - } - throw new InvalidOperationException("This bitmap does not have a palette."); - } - } - - /// - /// Gets whether the bitmap is RGB 555. - /// - public bool IsRGB555 - { - get - { - EnsureNotDisposed(); - return FreeImage.IsRGB555(dib); - } - } - - /// - /// Gets whether the bitmap is RGB 565. - /// - public bool IsRGB565 - { - get - { - EnsureNotDisposed(); - return FreeImage.IsRGB565(dib); - } - } - - /// - /// Gets the horizontal resolution, in pixels per inch, of this . - /// - public float HorizontalResolution - { - get - { - EnsureNotDisposed(); - return (float)FreeImage.GetResolutionX(dib); - } - private set - { - EnsureNotDisposed(); - FreeImage.SetResolutionX(dib, (uint)value); - } - } - - /// - /// Gets the vertical resolution, in pixels per inch, of this . - /// - public float VerticalResolution - { - get - { - EnsureNotDisposed(); - return (float)FreeImage.GetResolutionY(dib); - } - private set - { - EnsureNotDisposed(); - FreeImage.SetResolutionY(dib, (uint)value); - } - } - - /// - /// Returns the structure of this . - /// - public BITMAPINFOHEADER InfoHeader - { - get - { - EnsureNotDisposed(); - return FreeImage.GetInfoHeaderEx(dib); - } - } - - /// - /// Returns the structure of a this . - /// - public BITMAPINFO Info - { - get - { - EnsureNotDisposed(); - return FreeImage.GetInfoEx(dib); - } - } - - /// - /// Investigates the color type of this - /// by reading the bitmaps pixel bits and analysing them. - /// - public FREE_IMAGE_COLOR_TYPE ColorType - { - get - { - EnsureNotDisposed(); - return FreeImage.GetColorType(dib); - } - } - - /// - /// Bit pattern describing the red color component of a pixel in this . - /// - public uint RedMask - { - get - { - EnsureNotDisposed(); - return FreeImage.GetRedMask(dib); - } - } - - /// - /// Bit pattern describing the green color component of a pixel in this . - /// - public uint GreenMask - { - get - { - EnsureNotDisposed(); - return FreeImage.GetGreenMask(dib); - } - } - - /// - /// Bit pattern describing the blue color component of a pixel in this . - /// - public uint BlueMask - { - get - { - EnsureNotDisposed(); - return FreeImage.GetBlueMask(dib); - } - } - - /// - /// Number of transparent colors in a palletised . - /// - public int TransparencyCount - { - get - { - EnsureNotDisposed(); - return (int)FreeImage.GetTransparencyCount(dib); - } - } - - /// - /// Get or sets transparency table of this . - /// - public byte[] TransparencyTable - { - get - { - EnsureNotDisposed(); - return FreeImage.GetTransparencyTableEx(dib); - } - set - { - EnsureNotDisposed(); - FreeImage.SetTransparencyTable(dib, value); - } - } - - /// - /// Gets or sets whether this is transparent. - /// - public bool IsTransparent - { - get - { - EnsureNotDisposed(); - return FreeImage.IsTransparent(dib); - } - set - { - EnsureNotDisposed(); - FreeImage.SetTransparent(dib, value); - } - } - - /// - /// Gets whether this has a file background color. - /// - public bool HasBackgroundColor - { - get - { - EnsureNotDisposed(); - return FreeImage.HasBackgroundColor(dib); - } - } - - /// - /// Gets or sets the background color of this . - /// In case the value is null, the background color is removed. - /// - /// Get: There is no background color available. - /// Set: Setting background color failed. - public Color? BackgroundColor - { - get - { - EnsureNotDisposed(); - if (!FreeImage.HasBackgroundColor(dib)) - { - throw new InvalidOperationException("No background color available."); - } - RGBQUAD rgbq; - FreeImage.GetBackgroundColor(dib, out rgbq); - return rgbq.Color; - } - set - { - EnsureNotDisposed(); - if (!FreeImage.SetBackgroundColor(dib, (value.HasValue ? new RGBQUAD[] { value.Value } : null))) - { - throw new Exception("Setting background color failed."); - } - } - } - - /// - /// Pointer to the data-bits of this . - /// - public IntPtr Bits - { - get - { - EnsureNotDisposed(); - return FreeImage.GetBits(dib); - } - } - - /// - /// Width, in bytes, of this . - /// - public int Line - { - get - { - EnsureNotDisposed(); - return (int)FreeImage.GetLine(dib); - } - } - - /// - /// Pointer to the scanline of the top most pixel row of this . - /// - public IntPtr Scan0 - { - get - { - EnsureNotDisposed(); - return FreeImage.GetScanLine(dib, (int)(FreeImage.GetHeight(dib) - 1)); - } - } - - /// - /// Width, in bytes, of this . - /// In case this is top down Stride will be positive, else negative. - /// - public int Stride - { - get - { - return -Line; - } - } - - /// - /// Gets attribute flags for the pixel data of this . - /// - public unsafe int Flags - { - get - { - EnsureNotDisposed(); - int result = 0; - byte alpha; - int cd = ColorDepth; - - if ((cd == 32) || (FreeImage.GetTransparencyCount(dib) != 0)) - { - result += (int)ImageFlags.HasAlpha; - } - - if (cd == 32) - { - uint width = FreeImage.GetWidth(dib); - uint height = FreeImage.GetHeight(dib); - for (int y = 0; y < height; y++) - { - RGBQUAD* scanline = (RGBQUAD*)FreeImage.GetScanLine(dib, y); - for (int x = 0; x < width; x++) - { - alpha = scanline[x].Color.A; - if (alpha != byte.MinValue && alpha != byte.MaxValue) - { - result += (int)ImageFlags.HasTranslucent; - y = (int)height; - break; - } - } - } - } - else if (FreeImage.GetTransparencyCount(dib) != 0) - { - byte[] transTable = FreeImage.GetTransparencyTableEx(dib); - for (int i = 0; i < transTable.Length; i++) - { - if (transTable[i] != byte.MinValue && transTable[i] != byte.MaxValue) - { - result += (int)ImageFlags.HasTranslucent; - break; - } - } - } - - if (FreeImage.GetICCProfileEx(dib).IsCMYK) - { - result += (int)ImageFlags.ColorSpaceCmyk; - } - else - { - result += (int)ImageFlags.ColorSpaceRgb; - } - - if (FreeImage.GetColorType(dib) == FREE_IMAGE_COLOR_TYPE.FIC_MINISBLACK || - FreeImage.GetColorType(dib) == FREE_IMAGE_COLOR_TYPE.FIC_MINISWHITE) - { - result += (int)ImageFlags.ColorSpaceGray; - } - - if (originalFormat == FREE_IMAGE_FORMAT.FIF_BMP || - originalFormat == FREE_IMAGE_FORMAT.FIF_FAXG3 || - originalFormat == FREE_IMAGE_FORMAT.FIF_ICO || - originalFormat == FREE_IMAGE_FORMAT.FIF_JPEG || - originalFormat == FREE_IMAGE_FORMAT.FIF_PCX || - originalFormat == FREE_IMAGE_FORMAT.FIF_PNG || - originalFormat == FREE_IMAGE_FORMAT.FIF_PSD || - originalFormat == FREE_IMAGE_FORMAT.FIF_TIFF) - { - result += (int)ImageFlags.HasRealDpi; - } - - return result; - } - } - - /// - /// Gets the width and height of this . - /// - public SizeF PhysicalDimension - { - get - { - EnsureNotDisposed(); - return new SizeF((float)FreeImage.GetWidth(dib), (float)FreeImage.GetHeight(dib)); - } - } - - /// - /// Gets the pixel format for this . - /// - public PixelFormat PixelFormat - { - get - { - EnsureNotDisposed(); - return FreeImage.GetPixelFormat(dib); - } - } - - /// - /// Gets IDs of the property items stored in this . - /// - public int[] PropertyIdList - { - get - { - EnsureNotDisposed(); - List list = new List(); - ImageMetadata metaData = new ImageMetadata(dib, true); - - foreach (MetadataModel metadataModel in metaData) - { - foreach (MetadataTag metadataTag in metadataModel) - { - list.Add(metadataTag.ID); - } - } - - return list.ToArray(); - } - } - - /// - /// Gets all the property items (pieces of metadata) stored in this . - /// - public PropertyItem[] PropertyItems - { - get - { - EnsureNotDisposed(); - List list = new List(); - ImageMetadata metaData = new ImageMetadata(dib, true); - - foreach (MetadataModel metadataModel in metaData) - { - foreach (MetadataTag metadataTag in metadataModel) - { - list.Add(metadataTag.GetPropertyItem()); - } - } - - return list.ToArray(); - } - } - - /// - /// Gets the format of this . - /// - public ImageFormat RawFormat - { - get - { - EnsureNotDisposed(); - Attribute guidAttribute = - Attribute.GetCustomAttribute( - typeof(FreeImageBitmap), typeof(System.Runtime.InteropServices.GuidAttribute) - ); - return (guidAttribute == null) ? - null : - new ImageFormat(new Guid(((GuidAttribute)guidAttribute).Value)); - } - } - - /// - /// Gets the width and height, in pixels, of this . - /// - public Size Size - { - get - { - EnsureNotDisposed(); - return new Size(Width, Height); - } - } - - /// - /// Gets or sets an object that provides additional data about the . - /// - public Object Tag - { - get - { - EnsureNotDisposed(); - return tag; - } - set - { - EnsureNotDisposed(); - tag = value; - } - } - - /// - /// Gets whether this has been disposed. - /// - public bool IsDisposed - { - get - { - return disposed; - } - } - - /// - /// Gets a new instance of a metadata representing class. - /// - public ImageMetadata Metadata - { - get - { - EnsureNotDisposed(); - return new ImageMetadata(dib, true); - } - } - - /// - /// Gets or sets the comment of this . - /// Supported formats are JPEG, PNG and GIF. - /// - public string Comment - { - get - { - EnsureNotDisposed(); - return FreeImage.GetImageComment(dib); - } - set - { - EnsureNotDisposed(); - FreeImage.SetImageComment(dib, value); - } - } - - /// - /// Returns whether this has a palette. - /// - public bool HasPalette - { - get - { - EnsureNotDisposed(); - return (FreeImage.GetPalette(dib) != IntPtr.Zero); - } - } - - /// - /// Gets or sets the entry used as transparent color in this . - /// Only works for 1-, 4- and 8-bpp. - /// - public int TransparentIndex - { - get - { - EnsureNotDisposed(); - return FreeImage.GetTransparentIndex(dib); - } - set - { - EnsureNotDisposed(); - FreeImage.SetTransparentIndex(dib, value); - } - } - - /// - /// Gets the number of frames in this . - /// - public int FrameCount - { - get - { - EnsureNotDisposed(); - return frameCount; - } - } - - /// - /// Gets the ICCProfile structure of this . - /// - public FIICCPROFILE ICCProfile - { - get - { - EnsureNotDisposed(); - return FreeImage.GetICCProfileEx(dib); - } - } - - /// - /// Gets the format of the original image in case - /// this was loaded from a file or stream. - /// - public FREE_IMAGE_FORMAT ImageFormat - { - get - { - EnsureNotDisposed(); - return originalFormat; - } - } - - /// - /// Gets the encapsulated FIBITMAP. - /// - internal FIBITMAP Dib - { - get { EnsureNotDisposed(); return dib; } - } - - #endregion - - #region Methods - - /// - /// Gets the bounds of this in the specified unit. - /// - /// One of the values indicating - /// the unit of measure for the bounding rectangle. - /// The that represents the bounds of this - /// , in the specified unit. - public RectangleF GetBounds(ref GraphicsUnit pageUnit) - { - EnsureNotDisposed(); - pageUnit = GraphicsUnit.Pixel; - return new RectangleF( - 0f, - 0f, - (float)FreeImage.GetWidth(dib), - (float)FreeImage.GetHeight(dib)); - } - - /// - /// Gets the specified property item from this . - /// - /// The ID of the property item to get. - /// The this method gets. - public PropertyItem GetPropertyItem(int propid) - { - EnsureNotDisposed(); - ImageMetadata metadata = new ImageMetadata(dib, true); - foreach (MetadataModel metadataModel in metadata) - { - foreach (MetadataTag tag in metadataModel) - { - if (tag.ID == propid) - { - return tag.GetPropertyItem(); - } - } - } - return null; - } - - /// - /// Returns a thumbnail for this . - /// - /// The width, in pixels, of the requested thumbnail image. - /// The height, in pixels, of the requested thumbnail image. - /// Ignored. - /// Ignored. - /// A that represents the thumbnail. - public FreeImageBitmap GetThumbnailImage(int thumbWidth, int thumbHeight, - Image.GetThumbnailImageAbort callback, IntPtr callBackData) - { - EnsureNotDisposed(); - FreeImageBitmap result = null; - FIBITMAP newDib = FreeImage.Rescale( - dib, thumbWidth, thumbHeight, FREE_IMAGE_FILTER.FILTER_BICUBIC); - if (!newDib.IsNull) - { - result = new FreeImageBitmap(newDib); - } - return result; - } - - /// - /// Returns a thumbnail for this , keeping aspect ratio. - /// defines the maximum width or height - /// of the thumbnail. - /// - /// Thumbnail square size. - /// When true HDR images are transperantly - /// converted to standard images. - /// The thumbnail in a new instance. - public FreeImageBitmap GetThumbnailImage(int maxPixelSize, bool convert) - { - EnsureNotDisposed(); - FreeImageBitmap result = null; - FIBITMAP newDib = FreeImage.MakeThumbnail(dib, maxPixelSize, convert); - if (!newDib.IsNull) - { - result = new FreeImageBitmap(newDib); - } - return result; - } - - /// - /// Converts this instance to a instance. - /// - /// A new instance of initialized this instance. - public Bitmap ToBitmap() - { - EnsureNotDisposed(); - return FreeImage.GetBitmap(dib, true); - } - - /// - /// Returns an instance of , representing the scanline - /// specified by of this . - /// Since FreeImage bitmaps are always bottum up aligned, keep in mind that scanline 0 is the - /// bottom-most line of the image. - /// - /// Number of the scanline to retrieve. - /// An instance of representing the - /// th scanline. - /// - /// List of return-types of T: - /// - /// Color Depth / TypeResult Type - /// 1 () - /// 4 () - /// 8 () - /// 16 () - /// 16 - 555 () - /// 16 - 565 () - /// 24 () - /// 32 () - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// FreeImageBitmap bitmap = new FreeImageBitmap(@"C:\Pictures\picture.bmp"); - /// if (bitmap.ColorDepth == 32) - /// { - /// Scanline<RGBQUAD> scanline = bitmap.GetScanline<RGBQUAD>(0); - /// foreach (RGBQUAD pixel in scanline) - /// { - /// Console.WriteLine(pixel); - /// } - /// } - /// - /// - /// - /// The bitmap's type or color depth are not supported. - /// - /// - /// is no valid value. - /// - public Scanline GetScanline(int scanline) where T : struct - { - EnsureNotDisposed(); - return new Scanline(dib, scanline); - } - - /// - /// Returns an instance of , representing the scanline - /// specified by of this . - /// Since FreeImage bitmaps are always bottum up aligned, keep in mind that scanline 0 is the - /// bottom-most line of the image. - /// - /// Number of the scanline to retrieve. - /// An instance of representing the - /// th scanline. - /// - /// List of return-types of T: - /// - /// Color Depth / TypeResult Type - /// 1 () - /// 4 () - /// 8 () - /// 16 () - /// 16 - 555 () - /// 16 - 565 () - /// 24 () - /// 32 () - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// FreeImageBitmap bitmap = new FreeImageBitmap(@"C:\Pictures\picture.bmp"); - /// if (bitmap.ColorDepth == 32) - /// { - /// Scanline<RGBQUAD> scanline = (Scanline<RGBQUAD>)bitmap.GetScanline(0); - /// foreach (RGBQUAD pixel in scanline) - /// { - /// Console.WriteLine(pixel); - /// } - /// } - /// - /// - /// - /// The type of the bitmap or color depth are not supported. - /// - /// - /// is no valid value. - /// - public object GetScanline(int scanline) - { - EnsureNotDisposed(); - object result = null; - int width = (int)FreeImage.GetWidth(dib); - - switch (FreeImage.GetImageType(dib)) - { - case FREE_IMAGE_TYPE.FIT_BITMAP: - - switch (FreeImage.GetBPP(dib)) - { - case 1u: result = new Scanline(dib, scanline, width); break; - case 4u: result = new Scanline(dib, scanline, width); break; - case 8u: result = new Scanline(dib, scanline, width); break; - case 16u: - if ((RedMask == FreeImage.FI16_555_RED_MASK) && - (GreenMask == FreeImage.FI16_555_GREEN_MASK) && - (BlueMask == FreeImage.FI16_555_BLUE_MASK)) - { - result = new Scanline(dib, scanline, width); - } - else if ((RedMask == FreeImage.FI16_565_RED_MASK) && - (GreenMask == FreeImage.FI16_565_GREEN_MASK) && - (BlueMask == FreeImage.FI16_565_BLUE_MASK)) - { - result = new Scanline(dib, scanline, width); - } - else - { - result = new Scanline(dib, scanline, width); - } - break; - case 24u: result = new Scanline(dib, scanline, width); break; - case 32u: result = new Scanline(dib, scanline, width); break; - default: throw new ArgumentException("Color depth is not supported."); - } - break; - - case FREE_IMAGE_TYPE.FIT_COMPLEX: result = new Scanline(dib, scanline, width); break; - case FREE_IMAGE_TYPE.FIT_DOUBLE: result = new Scanline(dib, scanline, width); break; - case FREE_IMAGE_TYPE.FIT_FLOAT: result = new Scanline(dib, scanline, width); break; - case FREE_IMAGE_TYPE.FIT_INT16: result = new Scanline(dib, scanline, width); break; - case FREE_IMAGE_TYPE.FIT_INT32: result = new Scanline(dib, scanline, width); break; - case FREE_IMAGE_TYPE.FIT_RGB16: result = new Scanline(dib, scanline, width); break; - case FREE_IMAGE_TYPE.FIT_RGBA16: result = new Scanline(dib, scanline, width); break; - case FREE_IMAGE_TYPE.FIT_RGBAF: result = new Scanline(dib, scanline, width); break; - case FREE_IMAGE_TYPE.FIT_RGBF: result = new Scanline(dib, scanline, width); break; - case FREE_IMAGE_TYPE.FIT_UINT16: result = new Scanline(dib, scanline, width); break; - case FREE_IMAGE_TYPE.FIT_UINT32: result = new Scanline(dib, scanline, width); break; - case FREE_IMAGE_TYPE.FIT_UNKNOWN: - default: throw new ArgumentException("Type is not supported."); - } - - return result; - } - - /// - /// Returns a pointer to the specified scanline. - /// Due to FreeImage bitmaps are bottum up, - /// scanline 0 is the most bottom line of the image. - /// - /// Number of the scanline. - /// Pointer to the scanline. - public IntPtr GetScanlinePointer(int scanline) - { - EnsureNotDisposed(); - return FreeImage.GetScanLine(dib, scanline); - } - - /// - /// Returns a list of structures, representing the scanlines of this . - /// Due to FreeImage bitmaps are bottum up, scanline 0 is the - /// bottom-most line of the image. - /// Each color depth has a different representing structure due to different memory layouts. - /// - /// - /// List of return-types of T: - /// - /// Color Depth / TypeResult Type of IEnmuerable<Scanline<T>> - /// 1 () - /// 4 () - /// 8 () - /// 16 () - /// 16 - 555 () - /// 16 - 565 () - /// 24 () - /// 32 () - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - public IList GetScanlines() - { - EnsureNotDisposed(); - - int height = (int)FreeImage.GetHeight(dib); - IList list; - - switch (FreeImage.GetImageType(dib)) - { - case FREE_IMAGE_TYPE.FIT_BITMAP: - - switch (FreeImage.GetBPP(dib)) - { - case 1u: list = new List>(height); break; - case 4u: list = new List>(height); break; - case 8u: list = new List>(height); break; - case 16u: - if (FreeImage.IsRGB555(dib)) - { - list = new List>(height); - } - else if (FreeImage.IsRGB565(dib)) - { - list = new List>(height); - } - else - { - list = new List>(height); - } - break; - case 24u: list = new List>(height); break; - case 32u: list = new List>(height); break; - default: throw new ArgumentException("Color depth is not supported."); - } - break; - - case FREE_IMAGE_TYPE.FIT_COMPLEX: list = new List>(height); break; - case FREE_IMAGE_TYPE.FIT_DOUBLE: list = new List>(height); break; - case FREE_IMAGE_TYPE.FIT_FLOAT: list = new List>(height); break; - case FREE_IMAGE_TYPE.FIT_INT16: list = new List>(height); break; - case FREE_IMAGE_TYPE.FIT_INT32: list = new List>(height); break; - case FREE_IMAGE_TYPE.FIT_RGB16: list = new List>(height); break; - case FREE_IMAGE_TYPE.FIT_RGBA16: list = new List>(height); break; - case FREE_IMAGE_TYPE.FIT_RGBAF: list = new List>(height); break; - case FREE_IMAGE_TYPE.FIT_RGBF: list = new List>(height); break; - case FREE_IMAGE_TYPE.FIT_UINT16: list = new List>(height); break; - case FREE_IMAGE_TYPE.FIT_UINT32: list = new List>(height); break; - case FREE_IMAGE_TYPE.FIT_UNKNOWN: - default: throw new ArgumentException("Type is not supported."); - } - - for (int i = 0; i < height; i++) - { - list.Add(GetScanline(i)); - } - - return list; - } - - /// - /// Removes the specified property item from this . - /// - /// The ID of the property item to remove. - public void RemovePropertyItem(int propid) - { - EnsureNotDisposed(); - ImageMetadata mdata = new ImageMetadata(dib, true); - foreach (MetadataModel model in mdata) - { - foreach (MetadataTag tag in model) - { - if (tag.ID == propid) - { - model.RemoveTag(tag.Key); - return; - } - } - } - } - - /// - /// This method rotates, flips, or rotates and flips this . - /// - /// A RotateFlipType member - /// that specifies the type of rotation and flip to apply to this . - public void RotateFlip(RotateFlipType rotateFlipType) - { - EnsureNotDisposed(); - - FIBITMAP newDib = new FIBITMAP(); - uint bpp = FreeImage.GetBPP(dib); - - switch (rotateFlipType) - { - case RotateFlipType.RotateNoneFlipX: - - FreeImage.FlipHorizontal(dib); - break; - - case RotateFlipType.RotateNoneFlipY: - - FreeImage.FlipVertical(dib); - break; - - case RotateFlipType.RotateNoneFlipXY: - - FreeImage.FlipHorizontal(dib); - FreeImage.FlipVertical(dib); - break; - - case RotateFlipType.Rotate90FlipNone: - - newDib = (bpp == 4u) ? FreeImage.Rotate4bit(dib, 90d) : FreeImage.Rotate(dib, 90d); - break; - - case RotateFlipType.Rotate90FlipX: - - newDib = (bpp == 4u) ? FreeImage.Rotate4bit(dib, 90d) : FreeImage.Rotate(dib, 90d); - FreeImage.FlipHorizontal(newDib); - break; - - case RotateFlipType.Rotate90FlipY: - - newDib = (bpp == 4u) ? FreeImage.Rotate4bit(dib, 90d) : FreeImage.Rotate(dib, 90d); - FreeImage.FlipVertical(newDib); - break; - - case RotateFlipType.Rotate90FlipXY: - - newDib = (bpp == 4u) ? FreeImage.Rotate4bit(dib, 90d) : FreeImage.Rotate(dib, 90d); - FreeImage.FlipHorizontal(newDib); - FreeImage.FlipVertical(newDib); - break; - - case RotateFlipType.Rotate180FlipXY: - newDib = FreeImage.Clone(dib); - break; - } - ReplaceDib(newDib); - } - - /// - /// Copies the metadata from another . - /// - /// The bitmap to read the metadata from. - /// - /// is a null reference. - /// - public void CloneMetadataFrom(FreeImageBitmap bitmap) - { - if (bitmap == null) - { - throw new ArgumentNullException("bitmap"); - } - EnsureNotDisposed(); - bitmap.EnsureNotDisposed(); - FreeImage.CloneMetadata(dib, bitmap.dib); - } - - /// - /// Copies the metadata from another using - /// the provided options. - /// - /// The bitmap to read the metadata from. - /// Specifies the way the metadata is copied. - /// - /// is a null reference. - /// - public void CloneMetadataFrom(FreeImageBitmap bitmap, FREE_IMAGE_METADATA_COPY flags) - { - if (bitmap == null) - { - throw new ArgumentNullException("bitmap"); - } - EnsureNotDisposed(); - bitmap.EnsureNotDisposed(); - FreeImage.CloneMetadataEx(bitmap.dib, dib, flags); - } - - /// - /// Saves this to the specified file. - /// - /// A string that contains the name of the file to which - /// to save this . - /// is null or empty. - /// Saving the image failed. - public void Save(string filename) - { - Save(filename, FREE_IMAGE_FORMAT.FIF_UNKNOWN, FREE_IMAGE_SAVE_FLAGS.DEFAULT); - } - - /// - /// Saves this to the specified file in the specified format. - /// - /// A string that contains the name of the file to which - /// to save this . - /// An that specifies the format of the saved image. - /// is null or empty. - /// Saving the image failed. - public void Save(string filename, FREE_IMAGE_FORMAT format) - { - Save(filename, format, FREE_IMAGE_SAVE_FLAGS.DEFAULT); - } - - /// - /// Saves this to the specified file in the specified format - /// using the specified saving flags. - /// - /// A string that contains the name of the file to which - /// to save this . - /// An that specifies the format of the saved image. - /// Flags to enable or disable plugin-features. - /// is null or empty. - /// Saving the image failed. - public void Save(string filename, FREE_IMAGE_FORMAT format, FREE_IMAGE_SAVE_FLAGS flags) - { - EnsureNotDisposed(); - if (string.IsNullOrEmpty(filename)) - { - throw new ArgumentException("filename"); - } - if (!FreeImage.SaveEx(dib, filename, format, flags)) - { - throw new Exception("Unable to save bitmap"); - } - - saveInformation.filename = filename; - saveInformation.format = format; - saveInformation.saveFlags = flags; - } - - /// - /// Saves this to the specified stream in the specified format. - /// - /// The stream where this will be saved. - /// An that specifies the format of the saved image. - /// is a null reference. - /// Saving the image failed. - public void Save(Stream stream, FREE_IMAGE_FORMAT format) - { - Save(stream, format, FREE_IMAGE_SAVE_FLAGS.DEFAULT); - } - - /// - /// Saves this to the specified stream in the specified format - /// using the specified saving flags. - /// - /// The stream where this will be saved. - /// An that specifies the format of the saved image. - /// Flags to enable or disable plugin-features. - /// is a null reference. - /// Saving the image failed. - public void Save(Stream stream, FREE_IMAGE_FORMAT format, FREE_IMAGE_SAVE_FLAGS flags) - { - EnsureNotDisposed(); - if (stream == null) - { - throw new ArgumentNullException("stream"); - } - if (!FreeImage.SaveToStream(dib, stream, format, flags)) - { - throw new Exception("Unable to save bitmap"); - } - - saveInformation.filename = null; - } - - /// - /// Adds a frame to the file specified in a previous call to the - /// method. - /// - /// - /// This instance has not been saved to a file using Save(...) before. - public void SaveAdd() - { - SaveAdd(this); - } - - /// - /// Adds a frame to the file specified in a previous call to the method. - /// - /// The position at which the frame should be inserted. - /// - /// This instance has not yet been saved to a file using the Save(...) method. - /// is out of range. - public void SaveAdd(int insertPosition) - { - SaveAdd(this, insertPosition); - } - - /// - /// Adds a frame to the file specified in a previous call to the method. - /// - /// A that contains the frame to add. - /// - /// This instance has not yet been saved to a file using the Save(...) method. - public void SaveAdd(FreeImageBitmap bitmap) - { - if (saveInformation.filename == null) - { - throw new InvalidOperationException("This operation requires a previous call of Save()."); - } - - SaveAdd( - saveInformation.filename, - bitmap, - saveInformation.format, - saveInformation.loadFlags, - saveInformation.saveFlags); - } - - /// - /// Adds a frame to the file specified in a previous call to the method. - /// - /// A that contains the frame to add. - /// The position at which the frame should be inserted. - /// - /// This instance has not yet been saved to a file using the Save(...) method. - /// is out of range. - public void SaveAdd(FreeImageBitmap bitmap, int insertPosition) - { - if (saveInformation.filename == null) - { - throw new InvalidOperationException("This operation requires a previous call of Save()."); - } - - SaveAdd( - saveInformation.filename, - bitmap, - insertPosition, - saveInformation.format, - saveInformation.loadFlags, - saveInformation.saveFlags); - } - - /// - /// Adds a frame to the file specified. - /// - /// File to add this frame to. - /// is a null reference. - /// does not exist. - /// Saving the image has failed. - public void SaveAdd(string filename) - { - SaveAdd( - filename, - this, - FREE_IMAGE_FORMAT.FIF_UNKNOWN, - FREE_IMAGE_LOAD_FLAGS.DEFAULT, - FREE_IMAGE_SAVE_FLAGS.DEFAULT); - } - - /// - /// Adds a frame to the file specified. - /// - /// File to add this frame to. - /// The position at which the frame should be inserted. - /// is a null reference. - /// does not exist. - /// Saving the image has failed. - /// is out of range. - public void SaveAdd(string filename, int insertPosition) - { - SaveAdd( - filename, - this, - insertPosition, - FREE_IMAGE_FORMAT.FIF_UNKNOWN, - FREE_IMAGE_LOAD_FLAGS.DEFAULT, - FREE_IMAGE_SAVE_FLAGS.DEFAULT); - } - - /// - /// Adds a frame to the file specified using the specified parameters. - /// - /// File to add this frame to. - /// Format of the image. - /// Flags to enable or disable plugin-features. - /// Flags to enable or disable plugin-features. - /// is a null reference. - /// does not exist. - /// Saving the image has failed. - public void SaveAdd( - string filename, - FREE_IMAGE_FORMAT format, - FREE_IMAGE_LOAD_FLAGS loadFlags, - FREE_IMAGE_SAVE_FLAGS saveFlags) - { - SaveAdd( - filename, - this, - format, - loadFlags, - saveFlags); - } - - /// - /// Adds a frame to the file specified using the specified parameters. - /// - /// File to add this frame to. - /// The position at which the frame should be inserted. - /// Format of the image. - /// Flags to enable or disable plugin-features. - /// Flags to enable or disable plugin-features. - /// is a null reference. - /// does not exist. - /// Saving the image has failed. - /// is out of range. - public void SaveAdd( - string filename, - int insertPosition, - FREE_IMAGE_FORMAT format, - FREE_IMAGE_LOAD_FLAGS loadFlags, - FREE_IMAGE_SAVE_FLAGS saveFlags) - { - SaveAdd( - filename, - this, - insertPosition, - format, - loadFlags, - saveFlags); - } - - /// - /// Selects the frame specified by the index. - /// - /// The index of the active frame. - /// - /// is out of range. - /// The operation failed. - /// The source of the bitmap is not available. - /// - public void SelectActiveFrame(int frameIndex) - { - EnsureNotDisposed(); - if ((frameIndex < 0) || (frameIndex >= frameCount)) - { - throw new ArgumentOutOfRangeException("frameIndex"); - } - - if (frameIndex != this.frameIndex) - { - if (stream == null) - { - throw new InvalidOperationException("No source available."); - } - - FREE_IMAGE_FORMAT format = originalFormat; - FIMULTIBITMAP mdib = FreeImage.OpenMultiBitmapFromStream(stream, ref format, saveInformation.loadFlags); - if (mdib.IsNull) - throw new Exception(ErrorLoadingBitmap); - - try - { - if (frameIndex >= FreeImage.GetPageCount(mdib)) - { - throw new ArgumentOutOfRangeException("frameIndex"); - } - - FIBITMAP newDib = FreeImage.LockPage(mdib, frameIndex); - if (newDib.IsNull) - { - throw new Exception(ErrorLoadingFrame); - } - - try - { - FIBITMAP clone = FreeImage.Clone(newDib); - if (clone.IsNull) - { - throw new Exception(ErrorCreatingBitmap); - } - ReplaceDib(clone); - } - finally - { - if (!newDib.IsNull) - { - FreeImage.UnlockPage(mdib, newDib, false); - } - } - } - finally - { - if (!FreeImage.CloseMultiBitmapEx(ref mdib)) - { - throw new Exception(ErrorUnloadBitmap); - } - } - - this.frameIndex = frameIndex; - } - } - - /// - /// Creates a GDI bitmap object from this . - /// - /// A handle to the GDI bitmap object that this method creates. - public IntPtr GetHbitmap() - { - EnsureNotDisposed(); - return FreeImage.GetHbitmap(dib, IntPtr.Zero, false); - } - - /// - /// Creates a GDI bitmap object from this . - /// - /// A structure that specifies the background color. - /// This parameter is ignored if the bitmap is totally opaque. - /// A handle to the GDI bitmap object that this method creates. - public IntPtr GetHbitmap(Color background) - { - EnsureNotDisposed(); - using (FreeImageBitmap temp = new FreeImageBitmap(this)) - { - temp.BackgroundColor = background; - return temp.GetHbitmap(); - } - } - - /// - /// Returns the handle to an icon. - /// - /// A Windows handle to an icon with the same image as this . - public IntPtr GetHicon() - { - EnsureNotDisposed(); - using (Bitmap bitmap = FreeImage.GetBitmap(dib, true)) - { - return bitmap.GetHicon(); - } - } - - /// - /// Creates a GDI bitmap object from this with the same - /// color depth as the primary device. - /// - /// A handle to the GDI bitmap object that this method creates. - public IntPtr GetHbitmapForDevice() - { - EnsureNotDisposed(); - return FreeImage.GetBitmapForDevice(dib, IntPtr.Zero, false); - } - - /// - /// Gets the of the specified pixel in this . - /// - /// The x-coordinate of the pixel to retrieve. - /// The y-coordinate of the pixel to retrieve. - /// A structure that represents the color of the specified pixel. - /// The operation failed. - /// The type of this bitmap is not supported. - public unsafe Color GetPixel(int x, int y) - { - EnsureNotDisposed(); - if (FreeImage.GetImageType(dib) == FREE_IMAGE_TYPE.FIT_BITMAP) - { - if (ColorDepth == 16 || ColorDepth == 24 || ColorDepth == 32) - { - RGBQUAD rgbq; - if (!FreeImage.GetPixelColor(dib, (uint)x, (uint)y, out rgbq)) - { - throw new Exception("FreeImage.GetPixelColor() failed"); - } - return rgbq.Color; - } - else if (ColorDepth == 1 || ColorDepth == 4 || ColorDepth == 8) - { - byte index; - if (!FreeImage.GetPixelIndex(dib, (uint)x, (uint)y, out index)) - { - throw new Exception("FreeImage.GetPixelIndex() failed"); - } - RGBQUAD* palette = (RGBQUAD*)FreeImage.GetPalette(dib); - return palette[index].Color; - } - } - throw new NotSupportedException("The type of the image is not supported"); - } - - /// - /// Makes the default transparent color transparent for this . - /// - public void MakeTransparent() - { - EnsureNotDisposed(); - MakeTransparent(Color.Transparent); - } - - /// - /// Makes the specified color transparent for this . - /// - /// The structure that represents - /// the color to make transparent. - /// - /// This method is not implemented. - public void MakeTransparent(Color transparentColor) - { - EnsureNotDisposed(); - throw new System.NotImplementedException(); - } - - /// - /// Sets the of the specified pixel in this . - /// - /// The x-coordinate of the pixel to set. - /// The y-coordinate of the pixel to set. - /// A structure that represents the color - /// to assign to the specified pixel. - /// The operation failed. - /// The type of this bitmap is not supported. - public unsafe void SetPixel(int x, int y, Color color) - { - EnsureNotDisposed(); - if (FreeImage.GetImageType(dib) == FREE_IMAGE_TYPE.FIT_BITMAP) - { - if (ColorDepth == 16 || ColorDepth == 24 || ColorDepth == 32) - { - RGBQUAD rgbq = color; - if (!FreeImage.SetPixelColor(dib, (uint)x, (uint)y, ref rgbq)) - { - throw new Exception("FreeImage.SetPixelColor() failed"); - } - return; - } - else if (ColorDepth == 1 || ColorDepth == 4 || ColorDepth == 8) - { - uint colorsUsed = FreeImage.GetColorsUsed(dib); - RGBQUAD* palette = (RGBQUAD*)FreeImage.GetPalette(dib); - for (int i = 0; i < colorsUsed; i++) - { - if (palette[i].Color == color) - { - byte index = (byte)i; - if (!FreeImage.SetPixelIndex(dib, (uint)x, (uint)y, ref index)) - { - throw new Exception("FreeImage.SetPixelIndex() failed"); - } - return; - } - } - throw new ArgumentOutOfRangeException("color"); - } - } - throw new NotSupportedException("The type of the image is not supported"); - } - - /// - /// Sets the resolution for this . - /// - /// The horizontal resolution, in dots per inch, of this . - /// The vertical resolution, in dots per inch, of this . - public void SetResolution(float xDpi, float yDpi) - { - EnsureNotDisposed(); - FreeImage.SetResolutionX(dib, (uint)xDpi); - FreeImage.SetResolutionY(dib, (uint)yDpi); - } - - /// - /// This function is not yet implemented. - /// - /// - /// This method is not implemented. - public BitmapData LockBits(Rectangle rect, ImageLockMode flags, PixelFormat format) - { - throw new NotImplementedException(); - } - - /// - /// This function is not yet implemented. - /// - /// - /// This method is not implemented. - public BitmapData LockBits(Rectangle rect, ImageLockMode flags, PixelFormat format, BitmapData bitmapData) - { - throw new NotImplementedException(); - } - - /// - /// This function is not yet implemented. - /// - /// - /// This method is not implemented. - public void UnlockBits(BitmapData bitmapdata) - { - throw new NotImplementedException(); - } - - /// - /// Converts this into a different color depth. - /// The parameter specifies color depth, greyscale conversion - /// and palette reorder. - /// Adding the flag - /// will first perform a convesion to greyscale. This can be done with any target - /// color depth. - /// Adding the flag - /// will allow the algorithm to reorder the palette. This operation will not be performed to - /// non-greyscale images to prevent data loss by mistake. - /// - /// A bitfield containing information about the conversion - /// to perform. - /// Returns true on success, false on failure. - public bool ConvertColorDepth(FREE_IMAGE_COLOR_DEPTH bpp) - { - EnsureNotDisposed(); - return ReplaceDib(FreeImage.ConvertColorDepth(dib, bpp, false)); - } - - /// - /// Converts this to - /// initializing a new instance. - /// In case source and destination type are the same, the operation fails. - /// An error message can be catched using the 'Message' event. - /// - /// Destination type. - /// True to scale linear, else false. - /// Returns true on success, false on failure. - public bool ConvertType(FREE_IMAGE_TYPE type, bool scaleLinear) - { - EnsureNotDisposed(); - return (ImageType == type) ? false : ReplaceDib(FreeImage.ConvertToType(dib, type, scaleLinear)); - } - - /// - /// Converts this to . - /// In case source and destination type are the same, the operation fails. - /// An error message can be catched using the 'Message' event. - /// - /// Destination type. - /// True to scale linear, else false. - /// The converted instance. - public FreeImageBitmap GetTypeConvertedInstance(FREE_IMAGE_TYPE type, bool scaleLinear) - { - EnsureNotDisposed(); - FreeImageBitmap result = null; - if (ImageType != type) - { - FIBITMAP newDib = FreeImage.ConvertToType(dib, type, scaleLinear); - if (!newDib.IsNull) - { - result = new FreeImageBitmap(newDib); - } - } - return result; - } - - /// - /// Converts this into a different color depth initializing - /// a new instance. - /// The parameter specifies color depth, greyscale conversion - /// and palette reorder. - /// Adding the flag will - /// first perform a convesion to greyscale. This can be done with any target color depth. - /// Adding the flag will - /// allow the algorithm to reorder the palette. This operation will not be performed to - /// non-greyscale images to prevent data loss by mistake. - /// - /// A bitfield containing information about the conversion - /// to perform. - /// The converted instance. - public FreeImageBitmap GetColorConvertedInstance(FREE_IMAGE_COLOR_DEPTH bpp) - { - EnsureNotDisposed(); - FreeImageBitmap result = null; - FIBITMAP newDib = FreeImage.ConvertColorDepth(dib, bpp, false); - if (newDib == dib) - { - newDib = FreeImage.Clone(dib); - } - if (!newDib.IsNull) - { - result = new FreeImageBitmap(newDib); - } - return result; - } - - /// - /// Rescales this to the specified size using the - /// specified filter. - /// - /// The Size structure that represent the - /// size of the new . - /// Filter to use for resizing. - /// Returns true on success, false on failure. - public bool Rescale(Size newSize, FREE_IMAGE_FILTER filter) - { - return Rescale(newSize.Width, newSize.Height, filter); - } - - /// - /// Rescales this to the specified size using the - /// specified filter. - /// - /// Width of the new . - /// Height of the new . - /// Filter to use for resizing. - /// Returns true on success, false on failure. - public bool Rescale(int width, int height, FREE_IMAGE_FILTER filter) - { - EnsureNotDisposed(); - return ReplaceDib(FreeImage.Rescale(dib, width, height, filter)); - } - - /// - /// Rescales this to the specified size using the - /// specified filter initializing a new instance. - /// - /// The Size structure that represent the - /// size of the new . - /// Filter to use for resizing. - /// The rescaled instance. - public FreeImageBitmap GetScaledInstance(Size newSize, FREE_IMAGE_FILTER filter) - { - return GetScaledInstance(newSize.Width, newSize.Height, filter); - } - - /// - /// Rescales this to the specified size using the - /// specified filter initializing a new instance. - /// - /// Width of the new . - /// Height of the new . - /// Filter to use for resizing. - /// The rescaled instance. - public FreeImageBitmap GetScaledInstance(int width, int height, FREE_IMAGE_FILTER filter) - { - EnsureNotDisposed(); - FreeImageBitmap result = null; - FIBITMAP newDib = FreeImage.Rescale(dib, width, height, filter); - if (!newDib.IsNull) - { - result = new FreeImageBitmap(newDib); - } - return result; - } - - /// - /// Enlarges or shrinks this selectively per side and fills - /// newly added areas with the specified background color. - /// See for further details. - /// - /// The type of the specified color. - /// The number of pixels, the image should be enlarged on its left side. - /// Negative values shrink the image on its left side. - /// The number of pixels, the image should be enlarged on its top side. - /// Negative values shrink the image on its top side. - /// The number of pixels, the image should be enlarged on its right side. - /// Negative values shrink the image on its right side. - /// The number of pixels, the image should be enlarged on its bottom side. - /// Negative values shrink the image on its bottom side. - /// The color, the enlarged sides of the image should be filled with. - /// true on success, false on failure. - public bool EnlargeCanvas(int left, int top, int right, int bottom, T? color) where T : struct - { - return EnlargeCanvas(left, top, right, bottom, color, FREE_IMAGE_COLOR_OPTIONS.FICO_DEFAULT); - } - - /// - /// Enlarges or shrinks this selectively per side and fills - /// newly added areas with the specified background color. - /// See for further details. - /// - /// The type of the specified color. - /// The number of pixels, the image should be enlarged on its left side. - /// Negative values shrink the image on its left side. - /// The number of pixels, the image should be enlarged on its top side. - /// Negative values shrink the image on its top side. - /// The number of pixels, the image should be enlarged on its right side. - /// Negative values shrink the image on its right side. - /// The number of pixels, the image should be enlarged on its bottom side. - /// Negative values shrink the image on its bottom side. - /// The color, the enlarged sides of the image should be filled with. - /// Options that affect the color search process for palletized images. - /// true on success, false on failure. - public bool EnlargeCanvas(int left, int top, int right, int bottom, - T? color, FREE_IMAGE_COLOR_OPTIONS options) where T : struct - { - EnsureNotDisposed(); - return ReplaceDib(FreeImage.EnlargeCanvas(dib, left, top, right, bottom, color, options)); - } - - /// - /// Enlarges or shrinks this selectively per side and fills - /// newly added areas with the specified background color returning a new instance. - /// See for further details. - /// - /// The type of the specified color. - /// The number of pixels, the image should be enlarged on its left side. - /// Negative values shrink the image on its left side. - /// The number of pixels, the image should be enlarged on its top side. - /// Negative values shrink the image on its top side. - /// The number of pixels, the image should be enlarged on its right side. - /// Negative values shrink the image on its right side. - /// The number of pixels, the image should be enlarged on its bottom side. - /// Negative values shrink the image on its bottom side. - /// The color, the enlarged sides of the image should be filled with. - /// The enlarged instance. - public FreeImageBitmap GetEnlargedInstance(int left, int top, int right, int bottom, - T? color) where T : struct - { - return GetEnlargedInstance(left, top, right, bottom, color, FREE_IMAGE_COLOR_OPTIONS.FICO_DEFAULT); - } - - /// - /// Enlarges or shrinks this selectively per side and fills - /// newly added areas with the specified background color returning a new instance. - /// See for further details. - /// - /// The type of the specified color. - /// The number of pixels, the image should be enlarged on its left side. - /// Negative values shrink the image on its left side. - /// The number of pixels, the image should be enlarged on its top side. - /// Negative values shrink the image on its top side. - /// The number of pixels, the image should be enlarged on its right side. - /// Negative values shrink the image on its right side. - /// The number of pixels, the image should be enlarged on its bottom side. - /// Negative values shrink the image on its bottom side. - /// The color, the enlarged sides of the image should be filled with. - /// Options that affect the color search process for palletized images. - /// The enlarged instance. - public FreeImageBitmap GetEnlargedInstance(int left, int top, int right, int bottom, - T? color, FREE_IMAGE_COLOR_OPTIONS options) where T : struct - { - EnsureNotDisposed(); - FreeImageBitmap result = null; - FIBITMAP newDib = FreeImage.EnlargeCanvas(dib, left, top, right, bottom, color, options); - if (!newDib.IsNull) - { - result = new FreeImageBitmap(newDib); - } - return result; - } - - /// - /// Quantizes this from 24 bit to 8bit creating a new - /// palette with the specified using the specified - /// . - /// - /// The color reduction algorithm to be used. - /// Size of the desired output palette. - /// Returns true on success, false on failure. - public bool Quantize(FREE_IMAGE_QUANTIZE algorithm, int paletteSize) - { - return Quantize(algorithm, paletteSize, 0, (RGBQUAD[])null); - } - - /// - /// Quantizes this from 24 bit to 8bit creating a new - /// palette with the specified using the specified - /// and the specified - /// palette up to the - /// specified length. - /// - /// The color reduction algorithm to be used. - /// Size of the desired output palette. - /// The provided palette. - /// Returns true on success, false on failure. - public bool Quantize(FREE_IMAGE_QUANTIZE algorithm, int paletteSize, Palette reservePalette) - { - return Quantize(algorithm, paletteSize, reservePalette.Length, reservePalette.Data); - } - - /// - /// Quantizes this from 24 bit to 8bit creating a new - /// palette with the specified using the specified - /// and the specified - /// palette up to the - /// specified length. - /// - /// The color reduction algorithm to be used. - /// Size of the desired output palette. - /// Size of the provided palette of ReservePalette. - /// The provided palette. - /// Returns true on success, false on failure. - public bool Quantize(FREE_IMAGE_QUANTIZE algorithm, int paletteSize, int reserveSize, Palette reservePalette) - { - return Quantize(algorithm, paletteSize, reserveSize, reservePalette.Data); - } - - /// - /// Quantizes this from 24 bit to 8bit creating a new - /// palette with the specified using the specified - /// and the specified - /// palette up to the - /// specified length. - /// - /// The color reduction algorithm to be used. - /// Size of the desired output palette. - /// Size of the provided palette of ReservePalette. - /// The provided palette. - /// Returns true on success, false on failure. - public bool Quantize(FREE_IMAGE_QUANTIZE algorithm, int paletteSize, int reserveSize, RGBQUAD[] reservePalette) - { - EnsureNotDisposed(); - return ReplaceDib(FreeImage.ColorQuantizeEx(dib, algorithm, paletteSize, reserveSize, reservePalette)); - } - - /// - /// Quantizes this from 24 bit, using the specified - /// initializing a new 8 bit instance with the - /// specified . - /// - /// The color reduction algorithm to be used. - /// Size of the desired output palette. - /// The quantized instance. - public FreeImageBitmap GetQuantizedInstance(FREE_IMAGE_QUANTIZE algorithm, int paletteSize) - { - return GetQuantizedInstance(algorithm, paletteSize, 0, (RGBQUAD[])null); - } - - /// - /// Quantizes this from 24 bit, using the specified - /// and palette - /// initializing a new 8 bit instance with the specified . - /// - /// The color reduction algorithm to be used. - /// Size of the desired output palette. - /// The provided palette. - /// The quantized instance. - public FreeImageBitmap GetQuantizedInstance(FREE_IMAGE_QUANTIZE algorithm, int paletteSize, Palette reservePalette) - { - return GetQuantizedInstance(algorithm, paletteSize, reservePalette.Length, reservePalette); - } - - /// - /// Quantizes this from 24 bit, using the specified - /// and up to - /// entries from palette initializing - /// a new 8 bit instance with the specified . - /// - /// The color reduction algorithm to be used. - /// Size of the desired output palette. - /// Size of the provided palette. - /// The provided palette. - /// The quantized instance. - public FreeImageBitmap GetQuantizedInstance(FREE_IMAGE_QUANTIZE algorithm, int paletteSize, int reserveSize, Palette reservePalette) - { - return GetQuantizedInstance(algorithm, paletteSize, reserveSize, reservePalette.Data); - } - - /// - /// Quantizes this from 24 bit, using the specified - /// and up to - /// entries from palette initializing - /// a new 8 bit instance with the specified . - /// - /// The color reduction algorithm to be used. - /// Size of the desired output palette. - /// Size of the provided palette. - /// The provided palette. - /// The quantized instance. - public FreeImageBitmap GetQuantizedInstance(FREE_IMAGE_QUANTIZE algorithm, int paletteSize, int reserveSize, RGBQUAD[] reservePalette) - { - EnsureNotDisposed(); - FreeImageBitmap result = null; - FIBITMAP newDib = FreeImage.ColorQuantizeEx(dib, algorithm, paletteSize, reserveSize, reservePalette); - if (!newDib.IsNull) - { - result = new FreeImageBitmap(newDib); - } - return result; - } - - /// - /// Converts a High Dynamic Range image to a 24-bit RGB image using a global - /// operator based on logarithmic compression of luminance values, imitating - /// the human response to light. - /// - /// A gamma correction that is applied after the tone mapping. - /// A value of 1 means no correction. - /// Scale factor allowing to adjust the brightness of the output image. - /// Returns true on success, false on failure. - public bool TmoDrago03(double gamma, double exposure) - { - EnsureNotDisposed(); - return ReplaceDib(FreeImage.TmoDrago03(dib, gamma, exposure)); - } - - /// - /// Converts a High Dynamic Range image to a 24-bit RGB image using a global operator inspired - /// by photoreceptor physiology of the human visual system. - /// - /// Controls the overall image intensity in the range [-8, 8]. - /// Controls the overall image contrast in the range [0.3, 1.0[. - /// Returns true on success, false on failure. - public bool TmoReinhard05(double intensity, double contrast) - { - EnsureNotDisposed(); - return ReplaceDib(FreeImage.TmoReinhard05(dib, intensity, contrast)); - } - - /// - /// Apply the Gradient Domain High Dynamic Range Compression to a RGBF image and convert to 24-bit RGB. - /// - /// Color saturation (s parameter in the paper) in [0.4..0.6] - /// Atenuation factor (beta parameter in the paper) in [0.8..0.9] - /// Returns true on success, false on failure. - public bool TmoFattal02(double color_saturation, double attenuation) - { - EnsureNotDisposed(); - return ReplaceDib(FreeImage.TmoFattal02(dib, color_saturation, attenuation)); - } - - /// - /// This method rotates a 1-, 4-, 8-bit greyscale or a 24-, 32-bit color image by means of 3 shears. - /// For 1- and 4-bit images, rotation is limited to angles whose value is an integer - /// multiple of 90. - /// - /// The angle of rotation. - /// Returns true on success, false on failure. - public bool Rotate(double angle) - { - EnsureNotDisposed(); - bool result = false; - if (ColorDepth == 4) - { - result = ReplaceDib(FreeImage.Rotate4bit(dib, angle)); - } - else - { - result = ReplaceDib(FreeImage.Rotate(dib, angle)); - } - return result; - } - - /// - /// This method rotates a 1-, 4-, 8-bit greyscale or a 24-, 32-bit color image by means of 3 shears. - /// For 1- and 4-bit images, rotation is limited to angles whose value is an integer - /// multiple of 90. - /// - /// The type of the color to use as background. - /// The angle of rotation. - /// The color used used to fill the bitmap's background. - /// Returns true on success, false on failure. - public bool Rotate(double angle, T? backgroundColor) where T : struct - { - EnsureNotDisposed(); - bool result = false; - if (ColorDepth == 4) - { - result = ReplaceDib(FreeImage.Rotate4bit(dib, angle)); - } - else - { - result = ReplaceDib(FreeImage.Rotate(dib, angle, backgroundColor)); - } - return result; - } - - /// - /// Rotates this by the specified angle initializing a new instance. - /// For 1- and 4-bit images, rotation is limited to angles whose value is an integer - /// multiple of 90. - /// - /// The type of the color to use as background. - /// The angle of rotation. - /// The color used used to fill the bitmap's background. - /// The rotated instance. - public FreeImageBitmap GetRotatedInstance(double angle, T? backgroundColor) where T : struct - { - EnsureNotDisposed(); - FreeImageBitmap result = null; - FIBITMAP newDib; - if (ColorDepth == 4) - { - newDib = FreeImage.Rotate4bit(dib, angle); - } - else - { - newDib = FreeImage.Rotate(dib, angle, backgroundColor); - } - if (!newDib.IsNull) - { - result = new FreeImageBitmap(newDib); - } - return result; - } - - /// - /// Rotates this by the specified angle initializing a new instance. - /// For 1- and 4-bit images, rotation is limited to angles whose value is an integer - /// multiple of 90. - /// - /// The angle of rotation. - /// The rotated instance. - public FreeImageBitmap GetRotatedInstance(double angle) - { - EnsureNotDisposed(); - FreeImageBitmap result = null; - FIBITMAP newDib; - if (ColorDepth == 4) - { - newDib = FreeImage.Rotate4bit(dib, angle); - } - else - { - newDib = FreeImage.Rotate(dib, angle); - } - if (!newDib.IsNull) - { - result = new FreeImageBitmap(newDib); - } - return result; - } - - /// - /// This method performs a rotation and / or translation of an 8-bit greyscale, - /// 24- or 32-bit image, using a 3rd order (cubic) B-Spline. - /// - /// The angle of rotation. - /// Horizontal image translation. - /// Vertical image translation. - /// Rotation center x-coordinate. - /// Rotation center y-coordinate. - /// When true the irrelevant part of the image is set to a black color, - /// otherwise, a mirroring technique is used to fill irrelevant pixels. - /// Returns true on success, false on failure. - public bool Rotate(double angle, double xShift, double yShift, - double xOrigin, double yOrigin, bool useMask) - { - EnsureNotDisposed(); - return ReplaceDib(FreeImage.RotateEx(dib, angle, xShift, yShift, xOrigin, yOrigin, useMask)); - } - - /// - /// This method performs a rotation and / or translation of an 8-bit greyscale, - /// 24- or 32-bit image, using a 3rd order (cubic) B-Spline initializing a new instance. - /// - /// The angle of rotation. - /// Horizontal image translation. - /// Vertical image translation. - /// Rotation center x-coordinate. - /// Rotation center y-coordinate. - /// When true the irrelevant part of the image is set to a black color, - /// otherwise, a mirroring technique is used to fill irrelevant pixels. - /// The rotated instance. - public FreeImageBitmap GetRotatedInstance(double angle, double xShift, double yShift, - double xOrigin, double yOrigin, bool useMask) - { - EnsureNotDisposed(); - FreeImageBitmap result = null; - FIBITMAP newDib = FreeImage.RotateEx( - dib, angle, xShift, yShift, xOrigin, yOrigin, useMask); - if (!newDib.IsNull) - { - result = new FreeImageBitmap(newDib); - } - return result; - } - - /// - /// Perfoms an histogram transformation on a 8-, 24- or 32-bit image. - /// - /// The lookup table (LUT). - /// It's size is assumed to be 256 in length. - /// The color channel to be transformed. - /// Returns true on success, false on failure. - public bool AdjustCurve(byte[] lookUpTable, FREE_IMAGE_COLOR_CHANNEL channel) - { - EnsureNotDisposed(); - return FreeImage.AdjustCurve(dib, lookUpTable, channel); - } - - /// - /// Performs gamma correction on a 8-, 24- or 32-bit image. - /// - /// The parameter represents the gamma value to use (gamma > 0). - /// A value of 1.0 leaves the image alone, less than one darkens it, and greater than one lightens it. - /// Returns true on success, false on failure. - public bool AdjustGamma(double gamma) - { - EnsureNotDisposed(); - return FreeImage.AdjustGamma(dib, gamma); - } - - /// - /// Adjusts the brightness of a 8-, 24- or 32-bit image by a certain amount. - /// - /// A value 0 means no change, - /// less than 0 will make the image darker and greater than 0 will make the image brighter. - /// Returns true on success, false on failure. - public bool AdjustBrightness(double percentage) - { - EnsureNotDisposed(); - return FreeImage.AdjustBrightness(dib, percentage); - } - - /// - /// Adjusts the contrast of a 8-, 24- or 32-bit image by a certain amount. - /// - /// A value 0 means no change, - /// less than 0 will decrease the contrast and greater than 0 will increase the contrast of the image. - /// Returns true on success, false on failure. - public bool AdjustContrast(double percentage) - { - EnsureNotDisposed(); - return FreeImage.AdjustContrast(dib, percentage); - } - - /// - /// Inverts each pixel data. - /// - /// Returns true on success, false on failure. - public bool Invert() - { - EnsureNotDisposed(); - return FreeImage.Invert(dib); - } - - /// - /// Computes the image histogram. - /// - /// Channel to compute from. - /// Array of integers containing the histogram. - /// Returns true on success, false on failure. - public bool GetHistogram(FREE_IMAGE_COLOR_CHANNEL channel, out int[] histogram) - { - EnsureNotDisposed(); - histogram = new int[256]; - return FreeImage.GetHistogram(dib, histogram, channel); - } - - /// - /// Retrieves the red, green, blue or alpha channel of a 24- or 32-bit image. - /// - /// The color channel to extract. - /// The color channel in a new instance. - public FreeImageBitmap GetChannel(FREE_IMAGE_COLOR_CHANNEL channel) - { - EnsureNotDisposed(); - FreeImageBitmap result = null; - FIBITMAP newDib = FreeImage.GetChannel(dib, channel); - if (!newDib.IsNull) - { - result = new FreeImageBitmap(newDib); - } - return result; - } - - /// - /// Insert a 8-bit dib into a 24- or 32-bit image. - /// Both images must have to same width and height. - /// - /// The to insert. - /// The color channel to replace. - /// Returns true on success, false on failure. - public bool SetChannel(FreeImageBitmap bitmap, FREE_IMAGE_COLOR_CHANNEL channel) - { - EnsureNotDisposed(); - bitmap.EnsureNotDisposed(); - return FreeImage.SetChannel(dib, bitmap.dib, channel); - } - - /// - /// Retrieves the real part, imaginary part, magnitude or phase of a complex image. - /// - /// The color channel to extract. - /// The color channel in a new instance. - public FreeImageBitmap GetComplexChannel(FREE_IMAGE_COLOR_CHANNEL channel) - { - EnsureNotDisposed(); - FreeImageBitmap result = null; - FIBITMAP newDib = FreeImage.GetComplexChannel(dib, channel); - if (!newDib.IsNull) - { - result = new FreeImageBitmap(newDib); - } - return result; - } - - /// - /// Set the real or imaginary part of a complex image. - /// Both images must have to same width and height. - /// - /// The to insert. - /// The color channel to replace. - /// Returns true on success, false on failure. - public bool SetComplexChannel(FreeImageBitmap bitmap, FREE_IMAGE_COLOR_CHANNEL channel) - { - EnsureNotDisposed(); - bitmap.EnsureNotDisposed(); - return FreeImage.SetComplexChannel(dib, bitmap.dib, channel); - } - - /// - /// Copy a sub part of this . - /// - /// The subpart to copy. - /// The sub part in a new instance. - public FreeImageBitmap Copy(Rectangle rect) - { - EnsureNotDisposed(); - return Copy(rect.Left, rect.Top, rect.Right, rect.Bottom); - } - - /// - /// Copy a sub part of this . - /// - /// Specifies the left position of the cropped rectangle. - /// Specifies the top position of the cropped rectangle. - /// Specifies the right position of the cropped rectangle. - /// Specifies the bottom position of the cropped rectangle. - /// The sub part in a new instance. - public FreeImageBitmap Copy(int left, int top, int right, int bottom) - { - EnsureNotDisposed(); - FreeImageBitmap result = null; - FIBITMAP newDib = FreeImage.Copy(dib, left, top, right, bottom); - if (!newDib.IsNull) - { - result = new FreeImageBitmap(newDib); - } - return result; - } - - /// - /// Alpha blend or combine a sub part image with this . - /// The bit depth of must be greater than or equal to the bit depth this instance. - /// - /// The to paste into this instance. - /// Specifies the left position of the sub image. - /// Specifies the top position of the sub image. - /// alpha blend factor. - /// The source and destination images are alpha blended if alpha=0..255. - /// If alpha > 255, then the source image is combined to the destination image. - /// Returns true on success, false on failure. - public bool Paste(FreeImageBitmap bitmap, int left, int top, int alpha) - { - EnsureNotDisposed(); - bitmap.EnsureNotDisposed(); - return FreeImage.Paste(dib, bitmap.dib, left, top, alpha); - } - - /// - /// Alpha blend or combine a sub part image with tthis . - /// The bit depth of must be greater than or equal to the bit depth this instance. - /// - /// The to paste into this instance. - /// Specifies the position of the sub image. - /// alpha blend factor. - /// The source and destination images are alpha blended if alpha=0..255. - /// If alpha > 255, then the source image is combined to the destination image. - /// Returns true on success, false on failure. - public bool Paste(FreeImageBitmap bitmap, Point point, int alpha) - { - EnsureNotDisposed(); - return Paste(bitmap, point.X, point.Y, alpha); - } - - /// - /// This method composite a transparent foreground image against a single background color or - /// against a background image. - /// In case is false and - /// and - /// are null, a checkerboard will be used as background. - /// - /// When true the background of this instance is used - /// if it contains one. - /// Backgroundcolor used in case is false - /// and is not null. - /// Background used in case - /// is false and is a null reference. - /// Returns true on success, false on failure. - public bool Composite(bool useBitmapBackground, Color? applicationBackground, FreeImageBitmap bitmapBackGround) - { - EnsureNotDisposed(); - bitmapBackGround.EnsureNotDisposed(); - RGBQUAD? rgb = applicationBackground; - return ReplaceDib( - FreeImage.Composite( - dib, - useBitmapBackground, - rgb.HasValue ? new RGBQUAD[] { rgb.Value } : null, - bitmapBackGround.dib)); - } - - /// - /// Applies the alpha value of each pixel to its color components. - /// The aplha value stays unchanged. - /// Only works with 32-bits color depth. - /// - /// Returns true on success, false on failure. - public bool PreMultiplyWithAlpha() - { - EnsureNotDisposed(); - return FreeImage.PreMultiplyWithAlpha(dib); - } - - /// - /// Solves a Poisson equation, remap result pixels to [0..1] and returns the solution. - /// - /// Number of cycles in the multigrid algorithm (usually 2 or 3) - /// Returns true on success, false on failure. - public bool MultigridPoissonSolver(int ncycle) - { - EnsureNotDisposed(); - return ReplaceDib(FreeImage.MultigridPoissonSolver(dib, ncycle)); - } - - /// - /// Adjusts an image's brightness, contrast and gamma as well as it may - /// optionally invert the image within a single operation. - /// - /// Percentage brightness value where -100 <= brightness <= 100. - /// A value of 0 means no change, less than 0 will make the image darker and greater - /// than 0 will make the image brighter. - /// Percentage contrast value where -100 <= contrast <= 100. - /// A value of 0 means no change, less than 0 will decrease the contrast - /// and greater than 0 will increase the contrast of the image. - /// Gamma value to be used for gamma correction. - /// A value of 1.0 leaves the image alone, less than one darkens it, - /// and greater than one lightens it. - /// This parameter must not be zero or smaller than zero. - /// If so, it will be ignored and no gamma correction will be performed on the image. - /// If set to true, the image will be inverted. - /// Returns true on success, false on failure. - public bool AdjustColors(double brightness, double contrast, double gamma, bool invert) - { - EnsureNotDisposed(); - return FreeImage.AdjustColors(dib, brightness, contrast, gamma, invert); - } - - /// - /// Applies color mapping for one or several colors on a 1-, 4- or 8-bit - /// palletized or a 16-, 24- or 32-bit high color image. - /// - /// Array of colors to be used as the mapping source. - /// Array of colors to be used as the mapping destination. - /// If true, 32-bit images and colors are treated as 24-bit. - /// If true, source and destination colors are swapped, that is, - /// each destination color is also mapped to the corresponding source color. - /// The total number of pixels changed. - /// - /// or is a null reference. - /// - /// - /// has a different length than . - /// - public uint ApplyColorMapping(RGBQUAD[] srccolors, RGBQUAD[] dstcolors, bool ignore_alpha, bool swap) - { - EnsureNotDisposed(); - if (srccolors == null) - { - throw new ArgumentNullException("srccolors"); - } - if (dstcolors == null) - { - throw new ArgumentNullException("dstcolors"); - } - if (srccolors.Length != dstcolors.Length) - { - throw new ArgumentException("srccolors and dstcolors must have the same length."); - } - return FreeImage.ApplyColorMapping(dib, srccolors, dstcolors, (uint)srccolors.Length, ignore_alpha, swap); - } - - /// - /// Swaps two specified colors on a 1-, 4- or 8-bit palletized - /// or a 16-, 24- or 32-bit high color image. - /// - /// One of the two colors to be swapped. - /// The other of the two colors to be swapped. - /// If true, 32-bit images and colors are treated as 24-bit. - /// The total number of pixels changed. - public uint SwapColors(RGBQUAD color_a, RGBQUAD color_b, bool ignore_alpha) - { - EnsureNotDisposed(); - return FreeImage.SwapColors(dib, ref color_a, ref color_b, ignore_alpha); - } - - /// - /// Applies palette index mapping for one or several indices - /// on a 1-, 4- or 8-bit palletized image. - /// - /// Array of palette indices to be used as the mapping source. - /// Array of palette indices to be used as the mapping destination. - /// The number of palette indices to be mapped. This is the size of both - /// srcindices and dstindices - /// If true, source and destination palette indices are swapped, that is, - /// each destination index is also mapped to the corresponding source index. - /// The total number of pixels changed. - /// - /// or is a null reference. - /// - /// - /// has a different length than . - /// - public uint ApplyPaletteIndexMapping(byte[] srcindices, byte[] dstindices, uint count, bool swap) - { - EnsureNotDisposed(); - if (srcindices == null) - { - throw new ArgumentNullException("srcindices"); - } - if (dstindices == null) - { - throw new ArgumentNullException("dstindices"); - } - if (srcindices.Length != dstindices.Length) - { - throw new ArgumentException("srcindices and dstindices must have the same length."); - } - return FreeImage.ApplyPaletteIndexMapping(dib, srcindices, dstindices, (uint)srcindices.Length, swap); - } - - /// - /// Swaps two specified palette indices on a 1-, 4- or 8-bit palletized image. - /// - /// One of the two palette indices to be swapped. - /// The other of the two palette indices to be swapped. - /// The total number of pixels changed. - public uint SwapPaletteIndices(byte index_a, byte index_b) - { - EnsureNotDisposed(); - return FreeImage.SwapPaletteIndices(dib, ref index_a, ref index_b); - } - - /// - /// Sets all pixels of this to the specified color. - /// See for further details. - /// - /// The type of the specified color. - /// The color to fill this with. - /// true on success, false on failure. - public bool FillBackground(T color) where T : struct - { - return FillBackground(color, FREE_IMAGE_COLOR_OPTIONS.FICO_DEFAULT); - } - - /// - /// Sets all pixels of this to the specified color. - /// See for further details. - /// - /// The type of the specified color. - /// The color to fill this with. - /// Options that affect the color search process for palletized images. - /// true on success, false on failure. - public bool FillBackground(T color, FREE_IMAGE_COLOR_OPTIONS options) where T : struct - { - EnsureNotDisposed(); - return FreeImage.FillBackground(dib, color, options); - } - - /// - /// Creates a new ICC-Profile. - /// - /// The data of the new ICC-Profile. - /// The new ICC-Profile of the bitmap. - /// is a null reference. - public FIICCPROFILE CreateICCProfile(byte[] data) - { - if (data == null) - { - throw new ArgumentNullException("data"); - } - return CreateICCProfile(data, data.Length); - } - - /// - /// Creates a new ICC-Profile. - /// - /// The data of the new ICC-Profile. - /// The number of bytes of to use. - /// The new ICC-Profile of the bitmap. - /// is null. - public FIICCPROFILE CreateICCProfile(byte[] data, int size) - { - EnsureNotDisposed(); - if (data == null) - { - throw new ArgumentNullException("data"); - } - return FreeImage.CreateICCProfileEx(dib, data, size); - } - - /// - /// Determines whether this and the specified instances are the same. - /// - /// The object to test. - /// true if this instance is the same - /// or if both are null references; otherwise, false. - public override bool Equals(object obj) - { - return ReferenceEquals(this, obj); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return dib.GetHashCode(); - } - - #endregion - - #region Static functions - - /// - /// Returns a value that indicates whether the pixel format for this contains alpha information. - /// - /// The to test. - /// true if pixfmt contains alpha information; otherwise, false. - public static bool IsAlphaPixelFormat(PixelFormat pixfmt) - { - return Bitmap.IsAlphaPixelFormat(pixfmt); - } - - /// - /// Returns a value that indicates whether the pixel format is 32 bits per pixel. - /// - /// The to test. - /// true if pixfmt is canonical; otherwise, false. - public static bool IsCanonicalPixelFormat(PixelFormat pixfmt) - { - return Bitmap.IsCanonicalPixelFormat(pixfmt); - } - - /// - /// Returns a value that indicates whether the pixel format is 64 bits per pixel. - /// - /// The enumeration to test. - /// true if pixfmt is extended; otherwise, false. - public static bool IsExtendedPixelFormat(PixelFormat pixfmt) - { - return Bitmap.IsExtendedPixelFormat(pixfmt); - } - - /// - /// Creates a from a Windows handle to an icon. - /// - /// A handle to an icon. - /// The that this method creates. - public static FreeImageBitmap FromHicon(IntPtr hicon) - { - using (Bitmap bitmap = Bitmap.FromHicon(hicon)) - { - return new FreeImageBitmap(bitmap); - } - } - - /// - /// Creates a from the specified Windows resource. - /// - /// A handle to an instance of the executable - /// file that contains the resource. - /// A string containing the name of the resource bitmap. - /// The that this method creates. - public static FreeImageBitmap FromResource(IntPtr hinstance, string bitmapName) - { - using (Bitmap bitmap = Bitmap.FromResource(hinstance, bitmapName)) - { - return new FreeImageBitmap(bitmap); - } - } - - /// - /// Creates a from the specified file. - /// - /// A string that contains the name of the file - /// from which to create the . - /// The this method creates. - public static FreeImageBitmap FromFile(string filename) - { - return new FreeImageBitmap(filename); - } - - /// - /// Creates a from the specified file - /// using embedded color management information in that file. - /// - /// A string that contains the - /// name of the file from which to create the . - /// Ignored. - /// The this method creates. - public static FreeImageBitmap FromFile(string filename, bool useEmbeddedColorManagement) - { - return new FreeImageBitmap(filename); - } - - /// - /// Creates a from a handle to a GDI bitmap. - /// - /// The GDI bitmap handle from which to create the . - /// The this method creates. - public static FreeImageBitmap FromHbitmap(IntPtr hbitmap) - { - FreeImageBitmap result = null; - FIBITMAP newDib = FreeImage.CreateFromHbitmap(hbitmap, IntPtr.Zero); - if (!newDib.IsNull) - { - result = new FreeImageBitmap(newDib); - } - return result; - } - - /// - /// Creates a from a handle to a GDI bitmap and a handle to a GDI palette. - /// - /// The GDI bitmap handle from which to create the . - /// Ignored. - /// The this method creates. - public static FreeImageBitmap FromHbitmap(IntPtr hbitmap, IntPtr hpalette) - { - return FromHbitmap(hbitmap); - } - - /// - /// Frees a bitmap handle. - /// - /// Handle to a bitmap. - /// true on success, false on failure. - public static bool FreeHbitmap(IntPtr hbitmap) - { - return FreeImage.FreeHbitmap(hbitmap); - } - - /// - /// Creates a from the specified data stream. - /// - /// A that contains the data for this . - /// The this method creates. - public static FreeImageBitmap FromStream(Stream stream) - { - return new FreeImageBitmap(stream); - } - - /// - /// Creates a from the specified data stream. - /// - /// A that contains the data for this . - /// Ignored. - /// The this method creates. - public static FreeImageBitmap FromStream(Stream stream, bool useEmbeddedColorManagement) - { - return new FreeImageBitmap(stream); - } - - /// - /// Creates a from the specified data stream. - /// - /// A that contains the data for this . - /// Ignored. - /// Ignored. - /// The this method creates. - public static FreeImageBitmap FromStream(Stream stream, bool useEmbeddedColorManagement, bool validateImageData) - { - return new FreeImageBitmap(stream); - } - - /// - /// Returns the color depth, in number of bits per pixel, - /// of the specified pixel format. - /// - /// The member that specifies - /// the format for which to find the size. - /// The color depth of the specified pixel format. - public static int GetPixelFormatSize(PixelFormat pixfmt) - { - return Bitmap.GetPixelFormatSize(pixfmt); - } - - /// - /// Performs a lossless rotation or flipping on a JPEG file. - /// - /// Source file. - /// Destination file; can be the source file; will be overwritten. - /// The operation to apply. - /// To avoid lossy transformation, you can set the perfect parameter to true. - /// Returns true on success, false on failure. - public static bool JPEGTransform(string source, string destination, FREE_IMAGE_JPEG_OPERATION operation, bool perfect) - { - return FreeImage.JPEGTransform(source, destination, operation, perfect); - } - - /// - /// Performs a lossless crop on a JPEG file. - /// - /// Source filename. - /// Destination filename. - /// Specifies the cropped rectangle. - /// Returns true on success, false on failure. - /// - /// or is null. - /// - /// - /// does not exist. - /// - public static bool JPEGCrop(string source, string destination, Rectangle rect) - { - if (source == null) - { - throw new ArgumentNullException("source"); - } - if (!File.Exists(source)) - { - throw new FileNotFoundException("source"); - } - if (destination == null) - { - throw new ArgumentNullException("destination"); - } - return JPEGCrop(source, destination, rect.Left, rect.Top, rect.Right, rect.Bottom); - } - - /// - /// Performs a lossless crop on a JPEG file. - /// - /// Source filename. - /// Destination filename. - /// Specifies the left position of the cropped rectangle. - /// Specifies the top position of the cropped rectangle. - /// Specifies the right position of the cropped rectangle. - /// Specifies the bottom position of the cropped rectangle. - /// Returns true on success, false on failure. - /// - /// or is null. - /// - /// - /// does not exist. - /// - public static bool JPEGCrop(string source, string destination, int left, int top, int right, int bottom) - { - if (source == null) - { - throw new ArgumentNullException("source"); - } - if (!File.Exists(source)) - { - throw new FileNotFoundException("source"); - } - if (destination == null) - { - throw new ArgumentNullException("destination"); - } - return FreeImage.JPEGCrop(source, destination, left, top, right, bottom); - } - - /// - /// Converts a X11 color name into a corresponding RGB value. - /// - /// Name of the color to convert. - /// Red component. - /// Green component. - /// Blue component. - /// Returns true on success, false on failure. - /// is null. - public static bool LookupX11Color(string color, out byte red, out byte green, out byte blue) - { - if (color == null) - { - throw new ArgumentNullException("color"); - } - return FreeImage.LookupX11Color(color, out red, out green, out blue); - } - - /// - /// Converts a SVG color name into a corresponding RGB value. - /// - /// Name of the color to convert. - /// Red component. - /// Green component. - /// Blue component. - /// Returns true on success, false on failure. - /// is null. - public static bool LookupSVGColor(string color, out byte red, out byte green, out byte blue) - { - if (color == null) - { - throw new ArgumentNullException("color"); - } - return FreeImage.LookupSVGColor(color, out red, out green, out blue); - } - - /// - /// Creates a lookup table to be used with AdjustCurve() which - /// may adjusts brightness and contrast, correct gamma and invert the image with a - /// single call to AdjustCurve(). - /// - /// Output lookup table to be used with AdjustCurve(). - /// The size of is assumed to be 256. - /// Percentage brightness value where -100 <= brightness <= 100. - /// A value of 0 means no change, less than 0 will make the image darker and greater - /// than 0 will make the image brighter. - /// Percentage contrast value where -100 <= contrast <= 100. - /// A value of 0 means no change, less than 0 will decrease the contrast - /// and greater than 0 will increase the contrast of the image. - /// Gamma value to be used for gamma correction. - /// A value of 1.0 leaves the image alone, less than one darkens it, - /// and greater than one lightens it. - /// If set to true, the image will be inverted. - /// The number of adjustments applied to the resulting lookup table - /// compared to a blind lookup table. - /// is null. - /// is not 256. - public static int GetAdjustColorsLookupTable(byte[] lookUpTable, double brightness, double contrast, double gamma, bool invert) - { - if (lookUpTable == null) - { - throw new ArgumentNullException("lookUpTable"); - } - if (lookUpTable.Length != 256) - { - throw new ArgumentException("lookUpTable"); - } - return FreeImage.GetAdjustColorsLookupTable(lookUpTable, brightness, contrast, gamma, invert); - } - - /// - /// Adds a specified frame to the file specified using the specified parameters. - /// Use this method to save selected frames from an to a multiple-frame image. - /// - /// File to add this frame to. - /// A that contains the frame to add. - /// Format of the image. - /// Flags to enable or disable plugin-features. - /// Flags to enable or disable plugin-features. - /// - /// or is null. - /// - /// does not exist. - /// Saving the image failed. - public static void SaveAdd( - string filename, - FreeImageBitmap bitmap, - FREE_IMAGE_FORMAT format, - FREE_IMAGE_LOAD_FLAGS loadFlags, - FREE_IMAGE_SAVE_FLAGS saveFlags) - { - if (filename == null) - { - throw new ArgumentNullException("filename"); - } - if (!File.Exists(filename)) - { - throw new FileNotFoundException("filename"); - } - if (bitmap == null) - { - throw new ArgumentNullException("bitmap"); - } - bitmap.EnsureNotDisposed(); - - FIBITMAP dib = bitmap.dib; - if (dib.IsNull) - throw new ArgumentNullException("bitmap"); - - FIMULTIBITMAP mpBitmap = - FreeImage.OpenMultiBitmapEx(filename, ref format, loadFlags, false, false, true); - - if (mpBitmap.IsNull) - throw new Exception(ErrorLoadingBitmap); - - FreeImage.AppendPage(mpBitmap, bitmap.dib); - - if (!FreeImage.CloseMultiBitmap(mpBitmap, saveFlags)) - throw new Exception(ErrorUnloadBitmap); - } - - /// - /// Adds a specified frame to the file specified using the specified parameters. - /// Use this method to save selected frames from an image to a multiple-frame image. - /// - /// File to add this frame to. - /// A that contains the frame to add. - /// The position of the inserted frame. - /// Format of the image. - /// Flags to enable or disable plugin-features. - /// Flags to enable or disable plugin-features. - /// - /// or is null. - /// - /// does not exist. - /// Saving the image failed. - /// is out of range. - public static void SaveAdd( - string filename, - FreeImageBitmap bitmap, - int insertPosition, - FREE_IMAGE_FORMAT format, - FREE_IMAGE_LOAD_FLAGS loadFlags, - FREE_IMAGE_SAVE_FLAGS saveFlags) - { - if (filename == null) - { - throw new ArgumentNullException("filename"); - } - if (!File.Exists(filename)) - { - throw new FileNotFoundException("filename"); - } - if (bitmap == null) - { - throw new ArgumentNullException("bitmap"); - } - if (insertPosition < 0) - { - throw new ArgumentOutOfRangeException("insertPosition"); - } - bitmap.EnsureNotDisposed(); - - FIBITMAP dib = bitmap.dib; - if (dib.IsNull) - throw new ArgumentNullException("bitmap"); - - FIMULTIBITMAP mpBitmap = - FreeImage.OpenMultiBitmapEx(filename, ref format, loadFlags, false, false, true); - - if (mpBitmap.IsNull) - throw new Exception(ErrorLoadingBitmap); - - int pageCount = FreeImage.GetPageCount(mpBitmap); - - if (insertPosition > pageCount) - throw new ArgumentOutOfRangeException("insertPosition"); - - if (insertPosition == pageCount) - FreeImage.AppendPage(mpBitmap, bitmap.dib); - else - FreeImage.InsertPage(mpBitmap, insertPosition, bitmap.dib); - - if (!FreeImage.CloseMultiBitmap(mpBitmap, saveFlags)) - throw new Exception(ErrorUnloadBitmap); - } - - /// - /// Returns a new instance of the class which - /// has no public accessible constructor. - /// - /// A new instace of . - public static PropertyItem CreateNewPropertyItem() - { - return FreeImage.CreatePropertyItem(); - } - - #endregion - - #region Helper functions - - /// - /// Throws an exception in case the instance has already been disposed. - /// - private void EnsureNotDisposed() - { - lock (lockObject) - { - if (!this.disposed) - { - return; - } - } - throw new ObjectDisposedException(ToString()); - } - - /// - /// Tries to replace the wrapped with a new one. - /// In case the new dib is null or the same as the already - /// wrapped one, nothing will be changed and the result will - /// be false. - /// Otherwise the wrapped will be unloaded and replaced. - /// - /// The new dib. - /// Returns true on success, false on failure. - private bool ReplaceDib(FIBITMAP newDib) - { - bool result = false; - if ((dib != newDib) && (!newDib.IsNull)) - { - UnloadDib(); - dib = newDib; - AddMemoryPressure(); - result = true; - } - return result; - } - - /// - /// Unloads currently wrapped or unlocks the locked page - /// in case it came from a multipaged bitmap. - /// - private void UnloadDib() - { - if (!dib.IsNull) - { - long size = FreeImage.GetDIBSize(dib); - FreeImage.UnloadEx(ref dib); - if (size > 0L) - GC.RemoveMemoryPressure(size); - } - } - - /// - /// Informs the runtime about unmanaged allocoted memory. - /// - private void AddMemoryPressure() - { - long dataSize; - if ((dataSize = DataSize) > 0L) - GC.AddMemoryPressure(dataSize); - } - - /// - /// Opens the stream and reads the number of available pages. - /// Then loads the first page to this instance. - /// - private void LoadFromStream(Stream stream, FREE_IMAGE_FORMAT format, FREE_IMAGE_LOAD_FLAGS flags) - { - FIMULTIBITMAP mdib = FreeImage.OpenMultiBitmapFromStream(stream, ref format, flags); - if (mdib.IsNull) - { - throw new Exception(ErrorLoadingBitmap); - } - try - { - frameCount = FreeImage.GetPageCount(mdib); - } - finally - { - if (!FreeImage.CloseMultiBitmapEx(ref mdib)) - { - throw new Exception(ErrorUnloadBitmap); - } - } - - dib = FreeImage.LoadFromStream(stream, flags, ref format); - if (dib.IsNull) - { - throw new Exception(ErrorLoadingBitmap); - } - - saveInformation.loadFlags = flags; - originalFormat = format; - AddMemoryPressure(); - } - - #endregion - - #region Interfaces - - /// - /// Helper class to store informations for . - /// - private sealed class SaveInformation : ICloneable - { - public string filename; - public FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_UNKNOWN; - public FREE_IMAGE_LOAD_FLAGS loadFlags = FREE_IMAGE_LOAD_FLAGS.DEFAULT; - public FREE_IMAGE_SAVE_FLAGS saveFlags = FREE_IMAGE_SAVE_FLAGS.DEFAULT; - - public object Clone() - { - return base.MemberwiseClone(); - } - } - - /// - /// Creates a deep copy of this . - /// - /// A deep copy of this . - public object Clone() - { - EnsureNotDisposed(); - FreeImageBitmap result = null; - FIBITMAP newDib = FreeImage.Clone(dib); - if (!dib.IsNull) - { - result = new FreeImageBitmap(newDib); - result.saveInformation = (SaveInformation)saveInformation.Clone(); - result.tag = tag; - result.originalFormat = originalFormat; - } - return result; - } - - /// - /// Performs application-defined tasks associated with freeing, - /// releasing, or resetting unmanaged resources. - /// - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - /// - /// Performs application-defined tasks associated with freeing, - /// releasing, or resetting unmanaged resources. - /// - /// If true managed ressources are released. - protected virtual void Dispose(bool disposing) - { - // Only clean up once - lock (lockObject) - { - if (disposed) - { - return; - } - disposed = true; - } - - // Clean up managed resources - if (disposing) - { - if (stream != null) - { - if (disposeStream) - { - stream.Dispose(); - } - stream = null; - } - } - - tag = null; - saveInformation = null; - - // Clean up unmanaged resources - UnloadDib(); - } - - /// - /// Retrieves an object that can iterate through the individual scanlines in this . - /// - /// An for the . - /// The bitmaps's type is not supported. - IEnumerator IEnumerable.GetEnumerator() - { - return GetScanlines().GetEnumerator(); - } - - void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) - { - EnsureNotDisposed(); - using (MemoryStream memory = new MemoryStream(DataSize)) - { - if (!FreeImage.SaveToStream(dib, memory, FREE_IMAGE_FORMAT.FIF_TIFF, FREE_IMAGE_SAVE_FLAGS.TIFF_LZW)) - { - throw new SerializationException(); - } - memory.Capacity = (int)memory.Length; - info.AddValue("Bitmap Data", memory.GetBuffer()); - } - } - - #endregion - } -} - -namespace FreeImageAPI -{ - /// - /// Class handling non-bitmap related functions. - /// - public static class FreeImageEngine - { - #region Callback - - // Callback delegate - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly OutputMessageFunction outputMessageFunction; - - static FreeImageEngine() - { - // Check if FreeImage.dll is present and cancel setting the callbackfuntion if not - if (!IsAvailable) - { - return; - } - // Create a delegate (function pointer) to 'OnMessage' - outputMessageFunction = new OutputMessageFunction(OnMessage); - // Set the callback - FreeImage.SetOutputMessage(outputMessageFunction); - } - - /// - /// Internal callback - /// - private static void OnMessage(FREE_IMAGE_FORMAT fif, string message) - { - // Get a local copy of the multicast-delegate - OutputMessageFunction m = Message; - - // Check the local copy instead of the static instance - // to prevent a second thread from setting the delegate - // to null, which would cause a nullreference exception - if (m != null) - { - // Invoke the multicast-delegate - m.Invoke(fif, message); - } - } - - /// - /// Gets a value indicating if the FreeImage DLL is available or not. - /// - public static bool IsAvailable - { - get - { - return FreeImage.IsAvailable(); - } - } - - /// - /// Internal errors in FreeImage generate a logstring that can be - /// captured by this event. - /// - public static event OutputMessageFunction Message; - - #endregion - - /// - /// Gets a string containing the current version of the library. - /// - public static string Version - { - get - { - return FreeImage.GetVersion(); - } - } - - /// - /// Gets a string containing a standard copyright message. - /// - public static string CopyrightMessage - { - get - { - return FreeImage.GetCopyrightMessage(); - } - } - - /// - /// Gets whether the platform is using Little Endian. - /// - public static bool IsLittleEndian - { - get - { - return FreeImage.IsLittleEndian(); - } - } - } -} - -namespace FreeImageAPI.Plugins -{ - /// - /// Class representing a FreeImage format. - /// - public sealed class FreeImagePlugin - { - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private readonly FREE_IMAGE_FORMAT fif; - - /// - /// Initializes a new instance of this class. - /// - /// The FreeImage format to wrap. - internal FreeImagePlugin(FREE_IMAGE_FORMAT fif) - { - this.fif = fif; - } - - /// - /// Gets the format of this instance. - /// - public FREE_IMAGE_FORMAT FIFormat - { - get - { - return fif; - } - } - - /// - /// Gets or sets whether this plugin is enabled. - /// - public bool Enabled - { - get - { - return (FreeImage.IsPluginEnabled(fif) == 1); - } - set - { - FreeImage.SetPluginEnabled(fif, value); - } - } - - /// - /// Gets a string describing the format. - /// - public string Format - { - get - { - return FreeImage.GetFormatFromFIF(fif); - } - } - - /// - /// Gets a comma-delimited file extension list describing the bitmap formats - /// this plugin can read and/or write. - /// - public string ExtentsionList - { - get - { - return FreeImage.GetFIFExtensionList(fif); - } - } - - /// - /// Gets a descriptive string that describes the bitmap formats - /// this plugin can read and/or write. - /// - public string Description - { - get - { - return FreeImage.GetFIFDescription(fif); - } - } - - /// - /// Returns a regular expression string that can be used by - /// a regular expression engine to identify the bitmap. - /// FreeImageQt makes use of this function. - /// - public string RegExpr - { - get - { - return FreeImage.GetFIFRegExpr(fif); - } - } - - /// - /// Gets whether this plugin can load bitmaps. - /// - public bool SupportsReading - { - get - { - return FreeImage.FIFSupportsReading(fif); - } - } - - /// - /// Gets whether this plugin can save bitmaps. - /// - public bool SupportsWriting - { - get - { - return FreeImage.FIFSupportsWriting(fif); - } - } - - /// - /// Checks whether this plugin can save a bitmap in the desired data type. - /// - /// The desired image type. - /// True if this plugin can save bitmaps as the desired type, else false. - public bool SupportsExportType(FREE_IMAGE_TYPE type) - { - return FreeImage.FIFSupportsExportType(fif, type); - } - - /// - /// Checks whether this plugin can save bitmaps in the desired bit depth. - /// - /// The desired bit depth. - /// True if this plugin can save bitmaps in the desired bit depth, else false. - public bool SupportsExportBPP(int bpp) - { - return FreeImage.FIFSupportsExportBPP(fif, bpp); - } - - /// - /// Gets whether this plugin can load or save an ICC profile. - /// - public bool SupportsICCProfiles - { - get - { - return FreeImage.FIFSupportsICCProfiles(fif); - } - } - - /// - /// Checks whether an extension is valid for this format. - /// - /// The desired extension. - /// True if the extension is valid for this format, false otherwise. - public bool ValidExtension(string extension) - { - return FreeImage.IsExtensionValidForFIF(fif, extension); - } - - /// - /// Checks whether an extension is valid for this format. - /// - /// The desired extension. - /// The string comparison type. - /// True if the extension is valid for this format, false otherwise. - public bool ValidExtension(string extension, StringComparison comparisonType) - { - return FreeImage.IsExtensionValidForFIF(fif, extension, comparisonType); - } - - /// - /// Checks whether a filename is valid for this format. - /// - /// The desired filename. - /// True if the filename is valid for this format, false otherwise. - public bool ValidFilename(string filename) - { - return FreeImage.IsFilenameValidForFIF(fif, filename); - } - - /// - /// Checks whether a filename is valid for this format. - /// - /// The desired filename. - /// The string comparison type. - /// True if the filename is valid for this format, false otherwise. - public bool ValidFilename(string filename, StringComparison comparisonType) - { - return FreeImage.IsFilenameValidForFIF(fif, filename, comparisonType); - } - - /// - /// Gets a descriptive string that describes the bitmap formats - /// this plugin can read and/or write. - /// - /// A descriptive string that describes the bitmap formats. - public override string ToString() - { - return Description; - } - } -} - -namespace FreeImageAPI.IO -{ - /// - /// Internal class wrapping stream io functions. - /// - /// - /// FreeImage can read files from a disk or a network drive but also allows the user to - /// implement their own loading or saving functions to load them directly from an ftp or web - /// server for example. - /// - /// In .NET streams are a common way to handle data. The FreeImageStreamIO class handles - /// the loading and saving from and to streams. It implements the funtions FreeImage needs - /// to load data from an an arbitrary source. - /// - /// The class is for internal use only. - /// - internal static class FreeImageStreamIO - { - /// - /// structure that can be used to read from streams via - /// . - /// - public static readonly FreeImageIO io; - - /// - /// Initializes a new instances which can be used to - /// create a FreeImage compatible structure. - /// - static FreeImageStreamIO() - { - io.readProc = new ReadProc(streamRead); - io.writeProc = new WriteProc(streamWrite); - io.seekProc = new SeekProc(streamSeek); - io.tellProc = new TellProc(streamTell); - } - - /// - /// Reads the requested data from the stream and writes it to the given address. - /// - static unsafe uint streamRead(IntPtr buffer, uint size, uint count, fi_handle handle) - { - Stream stream = handle.GetObject() as Stream; - if ((stream == null) || (!stream.CanRead)) - { - return 0; - } - uint readCount = 0; - byte* ptr = (byte*)buffer; - byte[] bufferTemp = new byte[size]; - int read; - while (readCount < count) - { - read = stream.Read(bufferTemp, 0, (int)size); - if (read != (int)size) - { - stream.Seek(-read, SeekOrigin.Current); - break; - } - for (int i = 0; i < read; i++, ptr++) - { - *ptr = bufferTemp[i]; - } - readCount++; - } - return (uint)readCount; - } - - /// - /// Reads the given data and writes it into the stream. - /// - static unsafe uint streamWrite(IntPtr buffer, uint size, uint count, fi_handle handle) - { - Stream stream = handle.GetObject() as Stream; - if ((stream == null) || (!stream.CanWrite)) - { - return 0; - } - uint writeCount = 0; - byte[] bufferTemp = new byte[size]; - byte* ptr = (byte*)buffer; - while (writeCount < count) - { - for (int i = 0; i < size; i++, ptr++) - { - bufferTemp[i] = *ptr; - } - try - { - stream.Write(bufferTemp, 0, bufferTemp.Length); - } - catch - { - return writeCount; - } - writeCount++; - } - return writeCount; - } - - /// - /// Moves the streams position. - /// - static int streamSeek(fi_handle handle, int offset, SeekOrigin origin) - { - Stream stream = handle.GetObject() as Stream; - if (stream == null) - { - return 1; - } - stream.Seek((long)offset, origin); - return 0; - } - - /// - /// Returns the streams current position - /// - static int streamTell(fi_handle handle) - { - Stream stream = handle.GetObject() as Stream; - if (stream == null) - { - return -1; - } - return (int)stream.Position; - } - } -} - -namespace FreeImageAPI.Metadata -{ - /// - /// Provides additional information specific for GIF files. This class cannot be inherited. - /// - public class GifInformation : MDM_ANIMATION - { - /// - /// Initializes a new instance of the class - /// with the specified . - /// - /// A reference to a instance. - public GifInformation(FreeImageBitmap bitmap) - : base(bitmap.Dib) - { - } - - /// - /// Gets or sets a value indicating whether this frame uses the - /// GIF image's global palette. If set to false, this - /// frame uses its local palette. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public bool? UseGlobalPalette - { - get - { - byte? useGlobalPalette = GetTagValue("NoLocalPalette"); - return useGlobalPalette.HasValue ? (useGlobalPalette.Value != 0) : default(bool?); - } - set - { - byte? val = null; - if (value.HasValue) - { - val = (byte)(value.Value ? 1 : 0); - } - SetTagValue("NoLocalPalette", val); - } - } - - /// - /// Creates a global palette for the GIF image, intialized with all entries of the - /// current local palette. - /// The property will be set to true when - /// invoking this method. This effectively enables the newly created global palette. - /// - /// - /// The image does not have a palette. - /// - public void CreateGlobalPalette() - { - CreateGlobalPalette(new Palette(dib)); - } - - /// - /// Creates a global palette for the GIF image with the specified size, intialized - /// with the first entries of the current local palette. - /// The property will be set to true when - /// invoking this method. This effectively enables the newly created global palette. - /// - /// The size of the newly created global palette. - /// - /// is a null reference. - public void CreateGlobalPalette(int size) - { - CreateGlobalPalette(new Palette(dib), size); - } - - /// - /// Creates a global palette for the GIF image, intialized with the entries - /// of the specified palette. - /// The property will be set to true when - /// invoking this method. This effectively enables the newly created global palette. - /// - /// The palette that contains the initial values for - /// the newly created global palette. - /// - /// is a null reference. - public void CreateGlobalPalette(Palette palette) - { - if (palette == null) - { - throw new ArgumentNullException("palette"); - } - - GlobalPalette = palette; - UseGlobalPalette = true; - } - - /// - /// Creates a global palette for the GIF image with the specified size, intialized - /// with the first entries of the specified palette. - /// The property will be set to true when - /// invoking this method. This effectively enables the newly created global palette. - /// - /// The palette that contains the initial values for - /// the newly created global palette. - /// The size of the newly created global palette. - /// - /// is a null reference. - public void CreateGlobalPalette(Palette palette, int size) - { - if (palette == null) - { - throw new ArgumentNullException("palette"); - } - if (size <= 0) - { - throw new ArgumentOutOfRangeException("size"); - } - - Palette pal = new Palette(size); - pal.CopyFrom(palette); - GlobalPalette = palette; - UseGlobalPalette = true; - } - } -} - -namespace FreeImageAPI.Metadata -{ - /// - /// Class handling metadata of a FreeImage bitmap. - /// - public class ImageMetadata : IEnumerable, IComparable, IComparable - { - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private readonly List data; - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private readonly FIBITMAP dib; - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private bool hideEmptyModels; - - /// - /// Initializes a new instance based on the specified , - /// showing all known models. - /// - /// Handle to a FreeImage bitmap. - public ImageMetadata(FIBITMAP dib) : this(dib, false) { } - - /// - /// Initializes a new instance based on the specified , - /// showing or hiding empry models. - /// - /// Handle to a FreeImage bitmap. - /// When true, empty metadata models - /// will be hidden until a tag to this model is added. - public ImageMetadata(FIBITMAP dib, bool hideEmptyModels) - { - if (dib.IsNull) throw new ArgumentNullException("dib"); - data = new List(FreeImage.FREE_IMAGE_MDMODELS.Length); - this.dib = dib; - this.hideEmptyModels = hideEmptyModels; - - data.Add(new MDM_ANIMATION(dib)); - data.Add(new MDM_COMMENTS(dib)); - data.Add(new MDM_CUSTOM(dib)); - data.Add(new MDM_EXIF_EXIF(dib)); - data.Add(new MDM_EXIF_GPS(dib)); - data.Add(new MDM_INTEROP(dib)); - data.Add(new MDM_EXIF_MAIN(dib)); - data.Add(new MDM_MAKERNOTE(dib)); - data.Add(new MDM_GEOTIFF(dib)); - data.Add(new MDM_IPTC(dib)); - data.Add(new MDM_NODATA(dib)); - data.Add(new MDM_XMP(dib)); - } - - /// - /// Gets or sets the of the specified type. - /// In case the getter returns null the model is not contained - /// by the list. - /// null can be used calling the setter to destroy the model. - /// - /// Type of the model. - /// The object of the specified type. - public MetadataModel this[FREE_IMAGE_MDMODEL model] - { - get - { - for (int i = 0; i < data.Count; i++) - { - if (data[i].Model == model) - { - if (!data[i].Exists && hideEmptyModels) - { - return null; - } - return data[i]; - } - } - return null; - } - } - - /// - /// Gets or sets the at the specified index. - /// In case the getter returns null the model is not contained - /// by the list. - /// null can be used calling the setter to destroy the model. - /// - /// Index of the within - /// this instance. - /// The - /// object at the specified index. - public MetadataModel this[int index] - { - get - { - if (index < 0 || index >= data.Count) - { - throw new ArgumentOutOfRangeException("index"); - } - return (hideEmptyModels && !data[index].Exists) ? null : data[index]; - } - } - - /// - /// Returns a list of all visible - /// MetadataModels. - /// - public List List - { - get - { - if (hideEmptyModels) - { - List result = new List(); - for (int i = 0; i < data.Count; i++) - { - if (data[i].Exists) - { - result.Add(data[i]); - } - } - return result; - } - else - { - return data; - } - } - } - - /// - /// Adds new tag to the bitmap or updates its value in case it already exists. - /// will be used as key. - /// - /// The tag to add or update. - /// Returns true on success, false on failure. - /// - /// is null. - public bool AddTag(MetadataTag tag) - { - for (int i = 0; i < data.Count; i++) - { - if (tag.Model == data[i].Model) - { - return data[i].AddTag(tag); - } - } - return false; - } - - /// - /// Returns the number of visible - /// MetadataModels. - /// - public int Count - { - get - { - if (hideEmptyModels) - { - int count = 0; - for (int i = 0; i < data.Count; i++) - { - if (data[i].Exists) - { - count++; - } - } - return count; - } - else - { - return data.Count; - } - } - } - - /// - /// Gets or sets whether empty - /// MetadataModels are hidden. - /// - public bool HideEmptyModels - { - get - { - return hideEmptyModels; - } - set - { - hideEmptyModels = value; - } - } - - /// - /// Retrieves an object that can iterate through the individual - /// MetadataModels - /// in this . - /// - /// An for this . - public IEnumerator GetEnumerator() - { - if (hideEmptyModels) - { - List tempList = new List(data.Count); - for (int i = 0; i < data.Count; i++) - { - if (data[i].Exists) - { - tempList.Add(data[i]); - } - } - return tempList.GetEnumerator(); - } - else - { - return data.GetEnumerator(); - } - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is ImageMetadata)) - { - throw new ArgumentException("obj"); - } - return CompareTo((ImageMetadata)obj); - } - - /// - /// Compares this instance with a specified object. - /// - /// A to compare. - /// A signed number indicating the relative values of this instance - /// and . - public int CompareTo(ImageMetadata other) - { - return this.dib.CompareTo(other.dib); - } - } -} - -namespace FreeImageAPI.Plugins -{ - /// - /// Class representing own FreeImage-Plugins. - /// - /// - /// FreeImages itself is plugin based. Each supported format is integrated by a seperat plugin, - /// that handles loading, saving, descriptions, identifing ect. - /// And of course the user can create own plugins and use them in FreeImage. - /// To do that the above mentioned predefined methodes need to be implemented. - /// - /// The class below handles the creation of such a plugin. The class itself is abstract - /// as well as some core functions that need to be implemented. - /// The class can be used to enable or disable the plugin in FreeImage after regististration or - /// retrieve the formatid, assigned by FreeImage. - /// The class handles the callback functions, garbage collector and pointer operation to make - /// the implementation as user friendly as possible. - /// - /// How to: - /// There are two functions that need to be implemented: - /// and - /// . - /// is used by the constructor - /// of the abstract class. FreeImage wants a list of the implemented functions. Each function is - /// represented by a function pointer (a .NET ). In case a function - /// is not implemented FreeImage receives an empty delegate). To tell the constructor - /// which functions have been implemented the information is represented by a disjunction of - /// . - /// - /// For example: - /// return MethodFlags.LoadProc | MethodFlags.SaveProc; - /// - /// The above statement means that LoadProc and SaveProc have been implemented by the user. - /// Keep in mind, that each function has a standard implementation that has static return - /// values that may cause errors if listed in - /// without a real implementation. - /// - /// is used by some checks of FreeImage and - /// must be implemented. for example can be - /// implemented if the plugin supports reading, but it doesn't have to, the plugin could only - /// be used to save an already loaded bitmap in a special format. - /// - public abstract class LocalPlugin - { - /// - /// Struct containing function pointers. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private Plugin plugin; - - /// - /// Delegate for register callback by FreeImage. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private InitProc initProc; - - /// - /// The format id assiged to the plugin. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_UNKNOWN; - - /// - /// When true the plugin was registered successfully else false. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected readonly bool registered = false; - - /// - /// A copy of the functions used to register. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected readonly MethodFlags implementedMethods; - - /// - /// MethodFlags defines values to fill a bitfield telling which - /// functions have been implemented by a plugin. - /// - [Flags] - protected enum MethodFlags - { - /// - /// No mothods implemented. - /// - None = 0x0, - - /// - /// DescriptionProc has been implemented. - /// - DescriptionProc = 0x1, - - /// - /// ExtensionListProc has been implemented. - /// - ExtensionListProc = 0x2, - - /// - /// RegExprProc has been implemented. - /// - RegExprProc = 0x4, - - /// - /// OpenProc has been implemented. - /// - OpenProc = 0x8, - - /// - /// CloseProc has been implemented. - /// - CloseProc = 0x10, - - /// - /// PageCountProc has been implemented. - /// - PageCountProc = 0x20, - - /// - /// PageCapabilityProc has been implemented. - /// - PageCapabilityProc = 0x40, - - /// - /// LoadProc has been implemented. - /// - LoadProc = 0x80, - - /// - /// SaveProc has been implemented. - /// - SaveProc = 0x100, - - /// - /// ValidateProc has been implemented. - /// - ValidateProc = 0x200, - - /// - /// MimeProc has been implemented. - /// - MimeProc = 0x400, - - /// - /// SupportsExportBPPProc has been implemented. - /// - SupportsExportBPPProc = 0x800, - - /// - /// SupportsExportTypeProc has been implemented. - /// - SupportsExportTypeProc = 0x1000, - - /// - /// SupportsICCProfilesProc has been implemented. - /// - SupportsICCProfilesProc = 0x2000 - } - - // Functions that must be implemented. - - /// - /// Function that returns a bitfield containing the - /// implemented methods. - /// - /// Bitfield of the implemented methods. - protected abstract MethodFlags GetImplementedMethods(); - - /// - /// Implementation of FormatProc - /// - /// A string containing the plugins format. - protected abstract string FormatProc(); - - // Functions that can be implemented. - - /// - /// Function that can be implemented. - /// - protected virtual string DescriptionProc() { return ""; } - /// - /// Function that can be implemented. - /// - protected virtual string ExtensionListProc() { return ""; } - /// - /// Function that can be implemented. - /// - protected virtual string RegExprProc() { return ""; } - /// - /// Function that can be implemented. - /// - protected virtual IntPtr OpenProc(ref FreeImageIO io, fi_handle handle, bool read) { return IntPtr.Zero; } - /// - /// Function that can be implemented. - /// - protected virtual void CloseProc(ref FreeImageIO io, fi_handle handle, IntPtr data) { } - /// - /// Function that can be implemented. - /// - protected virtual int PageCountProc(ref FreeImageIO io, fi_handle handle, IntPtr data) { return 0; } - /// - /// Function that can be implemented. - /// - protected virtual int PageCapabilityProc(ref FreeImageIO io, fi_handle handle, IntPtr data) { return 0; } - /// - /// Function that can be implemented. - /// - protected virtual FIBITMAP LoadProc(ref FreeImageIO io, fi_handle handle, int page, int flags, IntPtr data) { return FIBITMAP.Zero; } - /// - /// Function that can be implemented. - /// - protected virtual bool SaveProc(ref FreeImageIO io, FIBITMAP dib, fi_handle handle, int page, int flags, IntPtr data) { return false; } - /// - /// Function that can be implemented. - /// - protected virtual bool ValidateProc(ref FreeImageIO io, fi_handle handle) { return false; } - /// - /// Function that can be implemented. - /// - protected virtual string MimeProc() { return ""; } - /// - /// Function that can be implemented. - /// - protected virtual bool SupportsExportBPPProc(int bpp) { return false; } - /// - /// Function that can be implemented. - /// - protected virtual bool SupportsExportTypeProc(FREE_IMAGE_TYPE type) { return false; } - /// - /// Function that can be implemented. - /// - protected virtual bool SupportsICCProfilesProc() { return false; } - - /// - /// The constructor automatically registeres the plugin in FreeImage. - /// To do this it prepares a FreeImage defined structure with function pointers - /// to the implemented functions or null if not implemented. - /// Before registing the functions they are pinned in memory so the garbage collector - /// can't move them around in memory after we passed there addresses to FreeImage. - /// - public LocalPlugin() - { - implementedMethods = GetImplementedMethods(); - - if ((implementedMethods & MethodFlags.DescriptionProc) != 0) - { - plugin.descriptionProc = new DescriptionProc(DescriptionProc); - } - if ((implementedMethods & MethodFlags.ExtensionListProc) != 0) - { - plugin.extensionListProc = new ExtensionListProc(ExtensionListProc); - } - if ((implementedMethods & MethodFlags.RegExprProc) != 0) - { - plugin.regExprProc = new RegExprProc(RegExprProc); - } - if ((implementedMethods & MethodFlags.OpenProc) != 0) - { - plugin.openProc = new OpenProc(OpenProc); - } - if ((implementedMethods & MethodFlags.CloseProc) != 0) - { - plugin.closeProc = new CloseProc(CloseProc); - } - if ((implementedMethods & MethodFlags.PageCountProc) != 0) - { - plugin.pageCountProc = new PageCountProc(PageCountProc); - } - if ((implementedMethods & MethodFlags.PageCapabilityProc) != 0) - { - plugin.pageCapabilityProc = new PageCapabilityProc(PageCapabilityProc); - } - if ((implementedMethods & MethodFlags.LoadProc) != 0) - { - plugin.loadProc = new LoadProc(LoadProc); - } - if ((implementedMethods & MethodFlags.SaveProc) != 0) - { - plugin.saveProc = new SaveProc(SaveProc); - } - if ((implementedMethods & MethodFlags.ValidateProc) != 0) - { - plugin.validateProc = new ValidateProc(ValidateProc); - } - if ((implementedMethods & MethodFlags.MimeProc) != 0) - { - plugin.mimeProc = new MimeProc(MimeProc); - } - if ((implementedMethods & MethodFlags.SupportsExportBPPProc) != 0) - { - plugin.supportsExportBPPProc = new SupportsExportBPPProc(SupportsExportBPPProc); - } - if ((implementedMethods & MethodFlags.SupportsExportTypeProc) != 0) - { - plugin.supportsExportTypeProc = new SupportsExportTypeProc(SupportsExportTypeProc); - } - if ((implementedMethods & MethodFlags.SupportsICCProfilesProc) != 0) - { - plugin.supportsICCProfilesProc = new SupportsICCProfilesProc(SupportsICCProfilesProc); - } - - // FormatProc is always implemented - plugin.formatProc = new FormatProc(FormatProc); - - // InitProc is the register call back. - initProc = new InitProc(RegisterProc); - - // Register the plugin. The result will be saved and can be accessed later. - registered = FreeImage.RegisterLocalPlugin(initProc, null, null, null, null) != FREE_IMAGE_FORMAT.FIF_UNKNOWN; - if (registered) - { - PluginRepository.RegisterLocalPlugin(this); - } - } - - private void RegisterProc(ref Plugin plugin, int format_id) - { - // Copy the function pointers - plugin = this.plugin; - // Retrieve the format if assigned to this plugin by FreeImage. - format = (FREE_IMAGE_FORMAT)format_id; - } - - /// - /// Gets or sets if the plugin is enabled. - /// - public bool Enabled - { - get - { - if (registered) - { - return (FreeImage.IsPluginEnabled(format) > 0); - } - else - { - throw new ObjectDisposedException("plugin not registered"); - } - } - set - { - if (registered) - { - FreeImage.SetPluginEnabled(format, value); - } - else - { - throw new ObjectDisposedException("plugin not registered"); - } - } - } - - /// - /// Gets if the plugin was registered successfully. - /// - public bool Registered - { - get { return registered; } - } - - /// - /// Gets the FreeImage assigned to this plugin. - /// - public FREE_IMAGE_FORMAT Format - { - get - { - return format; - } - } - - /// - /// Reads from an unmanaged stream. - /// - protected unsafe int Read(FreeImageIO io, fi_handle handle, uint size, uint count, ref byte[] buffer) - { - fixed (byte* ptr = buffer) - { - return (int)io.readProc(new IntPtr(ptr), size, count, handle); - } - } - - /// - /// Reads a single byte from an unmanaged stream. - /// - protected unsafe int ReadByte(FreeImageIO io, fi_handle handle) - { - byte buffer = 0; - return (int)io.readProc(new IntPtr(&buffer), 1, 1, handle) > 0 ? buffer : -1; - } - - /// - /// Writes to an unmanaged stream. - /// - protected unsafe int Write(FreeImageIO io, fi_handle handle, uint size, uint count, ref byte[] buffer) - { - fixed (byte* ptr = buffer) - { - return (int)io.writeProc(new IntPtr(ptr), size, count, handle); - } - } - - /// - /// Writes a single byte to an unmanaged stream. - /// - protected unsafe int WriteByte(FreeImageIO io, fi_handle handle, byte value) - { - return (int)io.writeProc(new IntPtr(&value), 1, 1, handle); - } - - /// - /// Seeks in an unmanaged stream. - /// - protected int Seek(FreeImageIO io, fi_handle handle, int offset, SeekOrigin origin) - { - return io.seekProc(handle, offset, origin); - } - - /// - /// Retrieves the position of an unmanaged stream. - /// - protected int Tell(FreeImageIO io, fi_handle handle) - { - return io.tellProc(handle); - } - } -} - -namespace FreeImageAPI -{ - /// - /// Represents unmanaged memory, containing an array of a given structure. - /// - /// Structuretype represented by the instance. - /// - /// and can not be marshalled. - /// - /// Use instead of and - /// instead of . - /// - public unsafe class MemoryArray : IDisposable, ICloneable, ICollection, IEnumerable, IEquatable> where T : struct - { - /// - /// Baseaddress of the wrapped memory. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected byte* baseAddress; - - /// - /// Number of elements being wrapped. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected int length; - - /// - /// Size, in bytes, of each element. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly int size; - - /// - /// Array of T containing a single element. - /// The array is used as a workaround, because there are no pointer for generic types. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected T[] buffer; - - /// - /// Pointer to the element of buffer. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected byte* ptr; - - /// - /// Handle for pinning buffer. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected GCHandle handle; - - /// - /// Indicates whether the wrapped memory is handled like a bitfield. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected readonly bool isOneBit; - - /// - /// Indicates whther the wrapped memory is handles like 4-bit blocks. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected readonly bool isFourBit; - - /// - /// An object that can be used to synchronize access to the . - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected object syncRoot = null; - - static MemoryArray() - { - T[] dummy = new T[2]; - long marshalledSize = Marshal.SizeOf(typeof(T)); - long structureSize = - Marshal.UnsafeAddrOfPinnedArrayElement(dummy, 1).ToInt64() - - Marshal.UnsafeAddrOfPinnedArrayElement(dummy, 0).ToInt64(); - if (marshalledSize != structureSize) - { - throw new NotSupportedException( - "The desired type can not be handled, " + - "because its managed and unmanaged size in bytes are different."); - } - - size = (int)marshalledSize; - } - - /// - /// Initializes a new instance. - /// - protected MemoryArray() - { - } - - /// - /// Initializes a new instance of the class. - /// - /// Address of the memory block. - /// Length of the array. - /// - /// is null. - /// - /// is less or equal zero. - /// - /// The type is not supported. - public MemoryArray(IntPtr baseAddress, int length) - : this(baseAddress.ToPointer(), length) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// Address of the memory block. - /// Length of the array. - /// - /// is null. - /// - /// is less or equal zero. - /// - /// The type is not supported. - public MemoryArray(void* baseAddress, int length) - { - if (typeof(T) == typeof(FI1BIT)) - { - isOneBit = true; - } - else if (typeof(T) == typeof(FI4BIT)) - { - isFourBit = true; - } - - if (baseAddress == null) - { - throw new ArgumentNullException("baseAddress"); - } - if (length < 1) - { - throw new ArgumentOutOfRangeException("length"); - } - - this.baseAddress = (byte*)baseAddress; - this.length = (int)length; - - if (!isOneBit && !isFourBit) - { - // Create an array containing a single element. - // Due to the fact, that it's not possible to create pointers - // of generic types, an array is used to obtain the memory - // address of an element of T. - this.buffer = new T[1]; - // The array is pinned immediately to prevent the GC from - // moving it to a different position in memory. - this.handle = GCHandle.Alloc(buffer, GCHandleType.Pinned); - // The array and its content have beed pinned, so that its address - // can be safely requested and stored for the whole lifetime - // of the instace. - this.ptr = (byte*)handle.AddrOfPinnedObject(); - } - } - - /// - /// Frees the allocated . - /// - ~MemoryArray() - { - Dispose(false); - } - - /// - /// Tests whether two specified structures are equivalent. - /// - /// The that is to the left of the equality operator. - /// The that is to the right of the equality operator. - /// - /// true if the two structures are equal; otherwise, false. - /// - public static bool operator ==(MemoryArray left, MemoryArray right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - if (object.ReferenceEquals(right, null) || - object.ReferenceEquals(left, null) || - (left.length != right.length)) - { - return false; - } - if (left.baseAddress == right.baseAddress) - { - return true; - } - return FreeImage.CompareMemory(left.baseAddress, right.baseAddress, (uint)left.length); - } - - /// - /// Tests whether two specified structures are different. - /// - /// The that is to the left of the inequality operator. - /// The that is to the right of the inequality operator. - /// - /// true if the two structures are different; otherwise, false. - /// - public static bool operator !=(MemoryArray left, MemoryArray right) - { - return (!(left == right)); - } - - /// - /// Gets the value at the specified position. - /// - /// A 32-bit integer that represents the position - /// of the array element to get. - /// The value at the specified position. - /// - /// is outside the range of valid indexes - /// for the unmanaged array. - public T GetValue(int index) - { - if ((index >= this.length) || (index < 0)) - { - throw new ArgumentOutOfRangeException("index"); - } - - return GetValueInternal(index); - } - - private T GetValueInternal(int index) - { - EnsureNotDisposed(); - if (isOneBit) - { - return (T)(object)(FI1BIT)(((baseAddress[index / 8] & ((1 << (7 - (index % 8))))) == 0) ? 0 : 1); - } - else if (isFourBit) - { - return (T)(object)(FI4BIT)(((index % 2) == 0) ? (baseAddress[index / 2] >> 4) : (baseAddress[index / 2] & 0x0F)); - } - else - { - CopyMemory(ptr, baseAddress + (index * size), size); - return buffer[0]; - } - } - - /// - /// Sets a value to the element at the specified position. - /// - /// The new value for the specified element. - /// A 32-bit integer that represents the - /// position of the array element to set. - /// - /// is outside the range of valid indexes - /// for the unmanaged array. - public void SetValue(T value, int index) - { - if ((index >= this.length) || (index < 0)) - { - throw new ArgumentOutOfRangeException("index"); - } - SetValueInternal(value, index); - } - - private void SetValueInternal(T value, int index) - { - EnsureNotDisposed(); - if (isOneBit) - { - if ((FI1BIT)(object)value != 0) - { - baseAddress[index / 8] |= (byte)(1 << (7 - (index % 8))); - } - else - { - baseAddress[index / 8] &= (byte)(~(1 << (7 - (index % 8)))); - } - } - else if (isFourBit) - { - if ((index % 2) == 0) - { - baseAddress[index / 2] = (byte)((baseAddress[index / 2] & 0x0F) | ((FI4BIT)(object)value << 4)); - } - else - { - baseAddress[index / 2] = (byte)((baseAddress[index / 2] & 0xF0) | ((FI4BIT)(object)value & 0x0F)); - } - } - else - { - buffer[0] = value; - CopyMemory(baseAddress + (index * size), ptr, size); - } - } - - /// - /// Gets the values at the specified position and length. - /// - /// A 32-bit integer that represents the position - /// of the array elements to get. - /// A 32-bit integer that represents the length - /// of the array elements to get. - /// The values at the specified position and length. - /// - /// is outside the range of valid indexes - /// for the unmanaged array or is greater than the number of elements - /// from to the end of the unmanaged array. - public T[] GetValues(int index, int length) - { - EnsureNotDisposed(); - if ((index >= this.length) || (index < 0)) - { - throw new ArgumentOutOfRangeException("index"); - } - if (((index + length) > this.length) || (length < 1)) - { - throw new ArgumentOutOfRangeException("length"); - } - - T[] data = new T[length]; - if (isOneBit || isFourBit) - { - for (int i = 0; i < length; i++) - { - data[i] = GetValueInternal(i); - } - } - else - { - GCHandle handle = GCHandle.Alloc(data, GCHandleType.Pinned); - byte* dst = (byte*)Marshal.UnsafeAddrOfPinnedArrayElement(data, 0); - CopyMemory(dst, baseAddress + (size * index), size * length); - handle.Free(); - } - return data; - } - - /// - /// Sets the values at the specified position. - /// - /// An array containing the new values for the specified elements. - /// A 32-bit integer that represents the position - /// of the array elements to set. - /// - /// is a null reference (Nothing in Visual Basic). - /// - /// is outside the range of valid indexes - /// for the unmanaged array or is greater than the number of elements - /// from to the end of the array. - public void SetValues(T[] values, int index) - { - EnsureNotDisposed(); - if (values == null) - { - throw new ArgumentNullException("values"); - } - if ((index >= this.length) || (index < 0)) - { - throw new ArgumentOutOfRangeException("index"); - } - if ((index + values.Length) > this.length) - { - throw new ArgumentOutOfRangeException("values.Length"); - } - - if (isOneBit || isFourBit) - { - for (int i = 0; i != values.Length; ) - { - SetValueInternal(values[i++], index++); - } - } - else - { - GCHandle handle = GCHandle.Alloc(values, GCHandleType.Pinned); - byte* src = (byte*)Marshal.UnsafeAddrOfPinnedArrayElement(values, 0); - CopyMemory(baseAddress + (index * size), src, size * length); - handle.Free(); - } - } - - /// - /// Copies the entire array to a compatible one-dimensional , - /// starting at the specified index of the target array. - /// - /// The one-dimensional that is the destination - /// of the elements copied from . - /// The must have zero-based indexing. - /// The zero-based index in - /// at which copying begins. - public void CopyTo(Array array, int index) - { - EnsureNotDisposed(); - if (!(array is T[])) - { - throw new InvalidCastException("array"); - } - try - { - CopyTo((T[])array, 0, index, length); - } - catch (ArgumentOutOfRangeException ex) - { - throw new ArgumentException(ex.Message, ex); - } - } - - /// - /// Copies a range of elements from the unmanaged array starting at the specified - /// and pastes them to - /// starting at the specified . - /// The length and the indexes are specified as 32-bit integers. - /// - /// The array that receives the data. - /// A 32-bit integer that represents the index - /// in the unmanaged array at which copying begins. - /// A 32-bit integer that represents the index in - /// the destination array at which storing begins. - /// A 32-bit integer that represents the number of elements to copy. - /// - /// is a null reference (Nothing in Visual Basic). - /// - /// is outside the range of valid indexes - /// for the unmanaged array or is greater than the number of elements - /// from to the end of the unmanaged array - /// -or- - /// is outside the range of valid indexes - /// for the array or is greater than the number of elements - /// from to the end of the array. - /// - public void CopyTo(T[] array, int sourceIndex, int destinationIndex, int length) - { - EnsureNotDisposed(); - if (array == null) - { - throw new ArgumentNullException("array"); - } - if ((sourceIndex >= this.length) || (sourceIndex < 0)) - { - throw new ArgumentOutOfRangeException("sourceIndex"); - } - if ((destinationIndex >= array.Length) || (destinationIndex < 0)) - { - throw new ArgumentOutOfRangeException("destinationIndex"); - } - if ((sourceIndex + length > this.length) || - (destinationIndex + length > array.Length) || - (length < 1)) - { - throw new ArgumentOutOfRangeException("length"); - } - - if (isOneBit || isFourBit) - { - for (int i = 0; i != length; i++) - { - array[destinationIndex++] = GetValueInternal(sourceIndex++); - } - } - else - { - GCHandle handle = GCHandle.Alloc(array, GCHandleType.Pinned); - byte* dst = (byte*)Marshal.UnsafeAddrOfPinnedArrayElement(array, destinationIndex); - CopyMemory(dst, baseAddress + (size * sourceIndex), size * length); - handle.Free(); - } - } - - /// - /// Copies a range of elements from the array starting at the specified - /// and pastes them to the unmanaged array - /// starting at the specified . - /// The length and the indexes are specified as 32-bit integers. - /// - /// The array that holds the data. - /// A 32-bit integer that represents the index - /// in the array at which copying begins. - /// A 32-bit integer that represents the index in - /// the unmanaged array at which storing begins. - /// A 32-bit integer that represents the number of elements to copy. - /// - /// is a null reference (Nothing in Visual Basic). - /// - /// is outside the range of valid indexes - /// for the array or is greater than the number of elements - /// from to the end of the array - /// -or- - /// is outside the range of valid indexes - /// for the unmanaged array or is greater than the number of elements - /// from to the end of the unmanaged array. - /// - public void CopyFrom(T[] array, int sourceIndex, int destinationIndex, int length) - { - EnsureNotDisposed(); - if (array == null) - { - throw new ArgumentNullException("array"); - } - if ((destinationIndex >= this.length) || (destinationIndex < 0)) - { - throw new ArgumentOutOfRangeException("destinationIndex"); - } - if ((sourceIndex >= array.Length) || (sourceIndex < 0)) - { - throw new ArgumentOutOfRangeException("sourceIndex"); - } - if ((destinationIndex + length > this.length) || - (sourceIndex + length > array.Length) || - (length < 1)) - { - throw new ArgumentOutOfRangeException("length"); - } - - if (isOneBit || isFourBit) - { - for (int i = 0; i != length; i++) - { - SetValueInternal(array[sourceIndex++], destinationIndex++); - } - } - else - { - GCHandle handle = GCHandle.Alloc(array, GCHandleType.Pinned); - byte* src = (byte*)Marshal.UnsafeAddrOfPinnedArrayElement(array, sourceIndex); - CopyMemory(baseAddress + (size * destinationIndex), src, size * length); - handle.Free(); - } - } - - /// - /// Returns the represented block of memory as an array of . - /// - /// The represented block of memory. - public byte[] ToByteArray() - { - EnsureNotDisposed(); - byte[] result; - if (isOneBit) - { - result = new byte[(length + 7) / 8]; - } - else if (isFourBit) - { - result = new byte[(length + 3) / 4]; - } - else - { - result = new byte[size * length]; - } - fixed (byte* dst = result) - { - CopyMemory(dst, baseAddress, result.Length); - } - return result; - } - - /// - /// Gets or sets the value at the specified position in the array. - /// - /// A 32-bit integer that represents the position - /// of the array element to get. - /// The value at the specified position in the array. - /// - /// is outside the range of valid indexes - /// for the unmanaged array. - public T this[int index] - { - get - { - return GetValue(index); - } - set - { - SetValue(value, index); - } - } - - /// - /// Gets or sets the values of the unmanaged array. - /// - public T[] Data - { - get - { - return GetValues(0, length); - } - set - { - if (value == null) - { - throw new ArgumentNullException("value"); - } - if (value.Length != length) - { - throw new ArgumentOutOfRangeException("value.Lengt"); - } - SetValues(value, 0); - } - } - - /// - /// Gets the length of the unmanaged array. - /// - public int Length - { - get - { - EnsureNotDisposed(); - return length; - } - } - - /// - /// Gets the base address of the represented memory block. - /// - public IntPtr BaseAddress - { - get - { - EnsureNotDisposed(); - return new IntPtr(baseAddress); - } - } - - /// - /// Creates a shallow copy of the . - /// - /// A shallow copy of the . - public object Clone() - { - EnsureNotDisposed(); - return new MemoryArray(baseAddress, length); - } - - /// - /// Gets a 32-bit integer that represents the total number of elements - /// in the . - /// - public int Count - { - get { EnsureNotDisposed(); return length; } - } - - /// - /// Gets a value indicating whether access to the - /// is synchronized (thread safe). - /// - public bool IsSynchronized - { - get { EnsureNotDisposed(); return false; } - } - - /// - /// Gets an object that can be used to synchronize access to the . - /// - public object SyncRoot - { - get - { - EnsureNotDisposed(); - if (syncRoot == null) - { - System.Threading.Interlocked.CompareExchange(ref syncRoot, new object(), null); - } - return syncRoot; - } - } - - /// - /// Retrieves an object that can iterate through the individual - /// elements in this . - /// - /// An for the . - public IEnumerator GetEnumerator() - { - EnsureNotDisposed(); - T[] values = GetValues(0, length); - for (int i = 0; i != values.Length; i++) - { - yield return values[i]; - } - } - - /// - /// Retrieves an object that can iterate through the individual - /// elements in this . - /// - /// An for the . - IEnumerator IEnumerable.GetEnumerator() - { - EnsureNotDisposed(); - T[] values = GetValues(0, length); - for (int i = 0; i != values.Length; i++) - { - yield return values[i]; - } - } - - /// - /// Releases all ressources. - /// - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - /// - /// Releases allocated handles associated with this instance. - /// - /// true to release managed resources. - protected virtual void Dispose(bool disposing) - { - if (baseAddress != null) - { - if (handle.IsAllocated) - handle.Free(); - baseAddress = null; - buffer = null; - length = 0; - syncRoot = null; - } - } - - /// - /// Throws an if - /// this instance is disposed. - /// - protected virtual void EnsureNotDisposed() - { - if (baseAddress == null) - throw new ObjectDisposedException("This instance is disposed."); - } - - /// - /// Tests whether the specified structure is equivalent to this - /// structure. - /// - /// The structure to test. - /// true if is a - /// instance equivalent to this structure; otherwise, - /// false. - public override bool Equals(object obj) - { - EnsureNotDisposed(); - return ((obj is MemoryArray) && Equals((MemoryArray)obj)); - } - - /// - /// Tests whether the specified structure is equivalent to this - /// structure. - /// - /// The structure to test. - /// true if is equivalent to this - /// structure; otherwise, - /// false. - public bool Equals(MemoryArray other) - { - EnsureNotDisposed(); - return ((this.baseAddress == other.baseAddress) && (this.length == other.length)); - } - - /// - /// Serves as a hash function for a particular type. - /// - /// A hash code for the current . - public override int GetHashCode() - { - EnsureNotDisposed(); - return (int)baseAddress ^ length; - } - - /// - /// Copies a block of memory from one location to another. - /// - /// Pointer to the starting address of the copy destination. - /// Pointer to the starting address of the block of memory to be copied. - /// Size of the block of memory to copy, in bytes. - protected static unsafe void CopyMemory(byte* dest, byte* src, int len) - { - if (len >= 0x10) - { - do - { - *((int*)dest) = *((int*)src); - *((int*)(dest + 4)) = *((int*)(src + 4)); - *((int*)(dest + 8)) = *((int*)(src + 8)); - *((int*)(dest + 12)) = *((int*)(src + 12)); - dest += 0x10; - src += 0x10; - } - while ((len -= 0x10) >= 0x10); - } - if (len > 0) - { - if ((len & 8) != 0) - { - *((int*)dest) = *((int*)src); - *((int*)(dest + 4)) = *((int*)(src + 4)); - dest += 8; - src += 8; - } - if ((len & 4) != 0) - { - *((int*)dest) = *((int*)src); - dest += 4; - src += 4; - } - if ((len & 2) != 0) - { - *((short*)dest) = *((short*)src); - dest += 2; - src += 2; - } - if ((len & 1) != 0) - { - *dest = *src; - } - } - } - } -} - -namespace FreeImageAPI.Metadata -{ - /// - /// Base class that represents a collection of all tags contained in a metadata model. - /// - /// - /// The MetedataModel class is an abstract base class, which is inherited by - /// several derived classes, one for each existing metadata model. - /// - public abstract class MetadataModel : IEnumerable - { - /// - /// Handle to the encapsulated FreeImage-bitmap. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - protected readonly FIBITMAP dib; - - /// - /// Initializes a new instance of this class. - /// - /// Handle to a FreeImage bitmap. - /// - /// is null. - protected MetadataModel(FIBITMAP dib) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - this.dib = dib; - } - - /// - /// Retrieves the datamodel that this instance represents. - /// - public abstract FREE_IMAGE_MDMODEL Model - { - get; - } - - /// - /// Adds new tag to the bitmap or updates its value in case it already exists. - /// will be used as key. - /// - /// The tag to add or update. - /// Returns true on success, false on failure. - /// - /// is null. - /// - /// The tags model differs from this instances model. - public bool AddTag(MetadataTag tag) - { - if (tag == null) - { - throw new ArgumentNullException("tag"); - } - if (tag.Model != Model) - { - throw new ArgumentException("tag.Model"); - } - return tag.AddToImage(dib); - } - - /// - /// Adds a list of tags to the bitmap or updates their values in case they already exist. - /// will be used as key. - /// - /// A list of tags to add or update. - /// Returns the number of successfully added tags. - /// - /// is null. - public int AddTag(IEnumerable list) - { - if (list == null) - { - throw new ArgumentNullException("list"); - } - int count = 0; - foreach (MetadataTag tag in list) - { - if (tag.Model == Model && tag.AddToImage(dib)) - { - count++; - } - } - return count; - } - - /// - /// Removes the specified tag from the bitmap. - /// - /// The key of the tag. - /// Returns true on success, false on failure. - /// - /// is null. - public bool RemoveTag(string key) - { - if (key == null) - { - throw new ArgumentNullException("key"); - } - return FreeImage.SetMetadata(Model, dib, key, FITAG.Zero); - } - - /// - /// Destroys the metadata model - /// which will remove all tags of this model from the bitmap. - /// - /// Returns true on success, false on failure. - public bool DestoryModel() - { - return FreeImage.SetMetadata(Model, dib, null, FITAG.Zero); - } - - /// - /// Returns the specified metadata tag. - /// - /// The key of the tag. - /// The metadata tag. - /// - /// is null. - public MetadataTag GetTag(string key) - { - if (key == null) - { - throw new ArgumentNullException("key"); - } - MetadataTag tag; - return FreeImage.GetMetadata(Model, dib, key, out tag) ? tag : null; - } - - /// - /// Returns whether the specified tag exists. - /// - /// The key of the tag. - /// True in case the tag exists, else false. - /// - /// is null. - public bool TagExists(string key) - { - if (key == null) - { - throw new ArgumentNullException("key"); - } - MetadataTag tag; - return FreeImage.GetMetadata(Model, dib, key, out tag); - } - - /// - /// Returns a list of all metadata tags this instance represents. - /// - public List List - { - get - { - List list = new List((int)FreeImage.GetMetadataCount(Model, dib)); - MetadataTag tag; - FIMETADATA mdHandle = FreeImage.FindFirstMetadata(Model, dib, out tag); - if (!mdHandle.IsNull) - { - do - { - list.Add(tag); - } - while (FreeImage.FindNextMetadata(mdHandle, out tag)); - FreeImage.FindCloseMetadata(mdHandle); - } - return list; - } - } - - /// - /// Returns the tag at the given index. - /// - /// Index of the tag to return. - /// The tag at the given index. - protected MetadataTag GetTagFromIndex(int index) - { - if (index >= Count || index < 0) - { - throw new ArgumentOutOfRangeException("index"); - } - MetadataTag tag; - int count = 0; - FIMETADATA mdHandle = FreeImage.FindFirstMetadata(Model, dib, out tag); - if (!mdHandle.IsNull) - { - try - { - do - { - if (count++ == index) - { - break; - } - } - while (FreeImage.FindNextMetadata(mdHandle, out tag)); - } - finally - { - FreeImage.FindCloseMetadata(mdHandle); - } - } - return tag; - } - - /// - /// Returns the metadata tag at the given index. This operation is slow when accessing all tags. - /// - /// Index of the tag. - /// The metadata tag. - /// - /// is greater or equal Count - /// or index is less than zero. - public MetadataTag this[int index] - { - get - { - return GetTagFromIndex(index); - } - } - - /// - /// Retrieves an object that can iterate through the individual MetadataTags in this MetadataModel. - /// - /// An for the - /// . - public IEnumerator GetEnumerator() - { - return List.GetEnumerator(); - } - - /// - /// Returns the number of metadata tags this instance represents. - /// - public int Count - { - get { return (int)FreeImage.GetMetadataCount(Model, dib); } - } - - /// - /// Returns whether this model exists in the bitmaps metadata structure. - /// - public bool Exists - { - get - { - return Count > 0; - } - } - - /// - /// Searches for a pattern in each metadata tag and returns the result as a list. - /// - /// The regular expression to use for the search. - /// A bitfield that controls which fields should be searched in. - /// A list containing all found metadata tags. - /// - /// is null. - /// - /// is empty. - public List RegexSearch(string searchPattern, MD_SEARCH_FLAGS flags) - { - if (searchPattern == null) - { - throw new ArgumentNullException("searchString"); - } - if (searchPattern.Length == 0) - { - throw new ArgumentException("searchString is empty"); - } - List result = new List(Count); - Regex regex = new Regex(searchPattern); - List list = List; - foreach (MetadataTag tag in list) - { - if (((flags & MD_SEARCH_FLAGS.KEY) > 0) && regex.Match(tag.Key).Success) - { - result.Add(tag); - continue; - } - if (((flags & MD_SEARCH_FLAGS.DESCRIPTION) > 0) && regex.Match(tag.Description).Success) - { - result.Add(tag); - continue; - } - if (((flags & MD_SEARCH_FLAGS.TOSTRING) > 0) && regex.Match(tag.ToString()).Success) - { - result.Add(tag); - continue; - } - } - result.Capacity = result.Count; - return result; - } - - /// - /// Returns the value of the specified tag. - /// - /// Type of the tag's data. - /// The key of the tag. - /// The value of the specified tag. - protected T? GetTagValue(string key) where T : struct - { - if (string.IsNullOrEmpty(key)) - { - throw new ArgumentNullException("key"); - } - MetadataTag tag = GetTag(key); - if (tag != null) - { - T[] value = tag.Value as T[]; - if ((value != null) && (value.Length != 0)) - { - return value[0]; - } - } - return null; - } - - /// - /// Returns an array containing the data of the specified tag. - /// - /// The type of the tag's data. - /// The key of the tag. - /// An array containing the data of the specified tag. - protected T[] GetTagArray(string key) where T : struct - { - if (string.IsNullOrEmpty(key)) - { - throw new ArgumentNullException("key"); - } - MetadataTag tag = GetTag(key); - return (tag == null) ? null : tag.Value as T[]; - } - - /// - /// Returns the string contained by the specified tag. - /// - /// The key of the tag. - /// The string contained by the specified tag. - protected string GetTagText(string key) - { - if (string.IsNullOrEmpty(key)) - { - throw new ArgumentNullException("key"); - } - MetadataTag tag = GetTag(key); - return (tag == null) ? null : tag.Value as string; - } - - /// - /// Returns an array containg the data of the specified tag - /// as unsigned 32bit integer. - /// - /// The key of the tag. - /// An array containg the data of the specified tag - /// as unsigned 32bit integer. - protected uint[] GetUInt32Array(string key) - { - if (string.IsNullOrEmpty(key)) - { - throw new ArgumentNullException("key"); - } - uint[] result = null; - MetadataTag tag = GetTag(key); - if (tag != null) - { - object value = tag.Value; - if (value != null) - { - if (value is ushort[]) - { - ushort[] array = (ushort[])value; - result = new uint[array.Length]; - for (int i = 0, j = array.Length; i < j; i++) - { - result[i] = (uint)array[i]; - } - } - else if (value is uint[]) - { - result = (uint[])value; - } - } - } - return result; - } - - /// - /// Returns the value of the tag as unsigned 32bit integer. - /// - /// The key of the tag. - /// The value of the tag as unsigned 32bit integer. - protected uint? GetUInt32Value(string key) - { - uint[] value = GetUInt32Array(key); - return value == null ? default(uint?) : value[0]; - } - - /// - /// Sets the value of the specified tag. - /// - /// The type of the tag's data. - /// The key of the tag. - /// The new value of the specified tag or null. - protected void SetTagValue(string key, T? value) where T : struct - { - SetTagValue(key, value.HasValue ? new T[] { value.Value } : null); - } - - /// - /// Sets the value of the specified tag. - /// - /// The key of the tag. - /// The new value of the specified tag or null. - protected void SetTagValue(string key, object value) - { - if (string.IsNullOrEmpty(key)) - { - throw new ArgumentNullException("key"); - } - if (value == null) - { - RemoveTag(key); - } - else - { - MetadataTag tag = GetTag(key); - if (tag == null) - { - tag = new MetadataTag(Model); - tag.Key = key; - tag.Value = value; - AddTag(tag); - } - else - { - tag.Value = value; - } - } - } - - /// - /// Sets the value of the specified tag as undefined. - /// - /// The key of the tag. - /// The new value of the specified tag or null. - protected void SetTagValueUndefined(string key, byte[] value) - { - if (string.IsNullOrEmpty(key)) - { - throw new ArgumentNullException("key"); - } - if (value == null) - { - RemoveTag(key); - } - else - { - MetadataTag tag = GetTag(key); - if (tag == null) - { - tag = new MetadataTag(Model); - tag.Key = key; - tag.SetValue(value, FREE_IMAGE_MDTYPE.FIDT_UNDEFINED); - AddTag(tag); - } - else - { - tag.Value = value; - } - } - } - - /// - /// Returns the equivalent for the - /// specified . - /// - /// The string containing the . - /// The equivalent for the - /// specified . - protected static DirectionReference? ToDirectionType(string s) - { - if (string.IsNullOrEmpty(s)) - return null; - switch (s[0]) - { - case 'T': - return DirectionReference.TrueDirection; - case 'M': - return DirectionReference.MagneticDirection; - default: - return DirectionReference.Undefined; - } - } - - /// - /// Returns the equivalent for the - /// specified . - /// - /// The to convert. - /// The equivalent for the - /// specified . - protected static string ToString(DirectionReference? type) - { - if (type.HasValue) - { - switch (type.Value) - { - case DirectionReference.TrueDirection: - return "T"; - case DirectionReference.MagneticDirection: - return "M"; - default: - return "\0"; - } - } - return null; - } - - /// - /// Returns the equivalent for the - /// specified . - /// - /// The string containing the . - /// The equivalent for the - /// specified . - protected static VelocityUnit? ToUnitType(string s) - { - if (string.IsNullOrEmpty(s)) - return null; - switch (s[0]) - { - case 'K': - return VelocityUnit.Kilometers; - case 'M': - return VelocityUnit.Miles; - case 'N': - return VelocityUnit.Knots; - default: - return VelocityUnit.Undefinied; - } - } - - /// - /// Returns the equivalent for the - /// specified . - /// - /// The to convert. - /// The equivalent for the - /// specified . - protected static string ToString(VelocityUnit? type) - { - if (type.HasValue) - { - switch (type.Value) - { - case VelocityUnit.Kilometers: - return "K"; - case VelocityUnit.Miles: - return "M"; - case VelocityUnit.Knots: - return "N"; - default: - return "\0"; - } - } - return null; - } - - /// - /// Returns the equivalent for the - /// specified . - /// - /// The string containing the . - /// The equivalent for the - /// specified . - protected static LongitudeType? ToLongitudeType(string s) - { - if (string.IsNullOrEmpty(s)) - return null; - switch (s[0]) - { - case 'E': - return LongitudeType.East; - case 'W': - return LongitudeType.West; - default: - return LongitudeType.Undefined; - } - } - - /// - /// Returns the equivalent for the - /// specified . - /// - /// The to convert. - /// The equivalent for the - /// specified . - protected static string ToString(LongitudeType? type) - { - if (type.HasValue) - { - switch (type.Value) - { - case LongitudeType.East: - return "E"; - case LongitudeType.West: - return "W"; - default: - return "\0"; - } - } - return null; - } - - /// - /// Returns the equivalent for the - /// specified . - /// - /// The string containing the . - /// The equivalent for the - /// specified . - protected static LatitudeType? ToLatitudeType(string s) - { - if (string.IsNullOrEmpty(s)) - return null; - switch (s[0]) - { - case 'N': - return LatitudeType.North; - case 'S': - return LatitudeType.South; - default: - return LatitudeType.Undefined; - } - } - - /// - /// Returns the equivalent for the - /// specified . - /// - /// The to convert. - /// The equivalent for the - /// specified . - protected static string ToString(LatitudeType? type) - { - if (type.HasValue) - { - switch (type.Value) - { - case LatitudeType.North: - return "N"; - case LatitudeType.South: - return "S"; - default: - return "\0"; - } - } - return null; - } - - /// - /// Returns the equivalent for the - /// specified . - /// - /// The string containing the . - /// The equivalent for the - /// specified . - protected static InteroperabilityMode? ToInteroperabilityType(string s) - { - if (string.IsNullOrEmpty(s)) - return null; - if (s.StartsWith("R98")) - return InteroperabilityMode.R98; - if (s.StartsWith("THM")) - return InteroperabilityMode.THM; - return InteroperabilityMode.Undefined; - } - - /// - /// Returns the equivalent for the - /// specified . - /// - /// The to convert. - /// The equivalent for the - /// specified . - protected static string ToString(InteroperabilityMode? type) - { - if (type.HasValue) - { - switch (type.Value) - { - case InteroperabilityMode.R98: - return "R98"; - case InteroperabilityMode.THM: - return "THM"; - default: - return "\0\0\0"; - } - } - return null; - } - - /// - /// Specified different unit types. - /// - public enum VelocityUnit - { - /// - /// No or unknown type. - /// - Undefinied, - - /// - /// Kilometers per hour. - /// - Kilometers, - - /// - /// Miles per hour. - /// - Miles, - - /// - /// Knots. - /// - Knots, - } - - /// - /// Specifies different direction types. - /// - public enum DirectionReference - { - /// - /// No or unknown direction type. - /// - Undefined, - - /// - /// True direction. - /// - TrueDirection, - - /// - /// Magnatic direction. - /// - MagneticDirection, - } - - /// - /// Specifies the type of a latitude value. - /// - public enum LatitudeType - { - /// - /// No or unknown type. - /// - Undefined, - - /// - /// North. - /// - North, - - /// - /// South. - /// - South, - } - - /// - /// Specifies the type of a longitude value. - /// - public enum LongitudeType - { - /// - /// No or unknown type. - /// - Undefined, - - /// - /// East. - /// - East, - - /// - /// West. - /// - West, - } - - /// - /// Specifies different altitude types. - /// - public enum AltitudeType - { - /// - /// No or unknown type. - /// - Undefined, - - /// - /// East. - /// - AboveSeaLevel, - - /// - /// West. - /// - BelowSeaLevel, - } - - /// - /// Specifies interoperability types. - /// - public enum InteroperabilityMode - { - /// - /// No or unknown type. - /// - Undefined, - - /// - /// Indicates a file conforming to R98 file specification of Recommended - /// Exif Interoperability Rules (ExifR98) or to DCF basic file stipulated - /// by Design Rule for Camera File System. - /// - R98, - - /// - /// Indicates a file conforming to DCF thumbnail file stipulated by Design - /// rule for Camera File System. - /// - THM, - } - - /// - /// Specifies orientation of images. - /// - public enum ExifImageOrientation : ushort - { - /// - /// Undefinied orientation. - /// - Undefined, - - /// - /// TopLeft. - /// - TopLeft = 1, - - /// - /// TopRight. - /// - TopRight, - - /// - /// BottomRight. - /// - BottomRight, - - /// - /// BottomLeft. - /// - BottomLeft, - - /// - /// LeftTop. - /// - LeftTop, - - /// - /// RightTop. - /// - RightTop, - - /// - /// RightBottom. - /// - RightBottom, - - /// - /// LeftBottom. - /// - LeftBottom, - } - - /// - /// Converts the model of the MetadataModel object to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - return Model.ToString(); - } - } -} - - #region Metadata Models - -namespace FreeImageAPI.Metadata -{ - /// - /// Represents a collection of all tags contained in the metadata model - /// . - /// - public class MDM_ANIMATION : MetadataModel - { - /// - /// Initializes a new instance of this class. - /// - /// Handle to a FreeImage bitmap. - public MDM_ANIMATION(FIBITMAP dib) : base(dib) { } - - /// - /// Retrieves the datamodel that this instance represents. - /// - public override FREE_IMAGE_MDMODEL Model - { - get { return FREE_IMAGE_MDMODEL.FIMD_ANIMATION; } - } - - /// - /// Gets or sets the width of the entire canvas area, that each page is displayed in. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public ushort? LogicalWidth - { - get - { - return GetTagValue("LogicalWidth"); - } - set - { - SetTagValue("LogicalWidth", value); - } - } - - /// - /// Gets or sets the height of the entire canvas area, that each page is displayed in. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public ushort? LogicalHeight - { - get - { - return GetTagValue("LogicalHeight"); - } - set - { - SetTagValue("LogicalHeight", value); - } - } - - /// - /// Gets or sets the global palette of the GIF image. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public Palette GlobalPalette - { - get - { - MetadataTag mdtag = GetTag("GlobalPalette"); - return (mdtag == null) ? null : new Palette(mdtag); - } - set - { - SetTagValue("GlobalPalette", (value != null) ? null : value.Data); - } - } - - /// - /// Gets or sets the number of replays for the animation. - /// Use 0 (zero) to specify an infinte number of replays. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public uint? LoopCount - { - get - { - return GetTagValue("Loop"); - } - set - { - SetTagValue("Loop", value); - } - } - - /// - /// Gets or sets the horizontal offset within the logical canvas area, this frame is to be displayed at. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public ushort? FrameLeft - { - get - { - return GetTagValue("FrameLeft"); - } - set - { - SetTagValue("FrameLeft", value); - } - } - - /// - /// Gets or sets the vertical offset within the logical canvas area, this frame is to be displayed at. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public ushort? FrameTop - { - get - { - return GetTagValue("FrameTop"); - } - set - { - SetTagValue("FrameTop", value); - } - } - - /// - /// Gets or sets a flag to supress saving the dib's attached palette - /// (making it use the global palette). The local palette is the palette used by a page. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public bool? NoLocalPalette - { - get - { - byte? useGlobalPalette = GetTagValue("NoLocalPalette"); - return useGlobalPalette.HasValue ? (useGlobalPalette.Value != 0) : default(bool?); - } - set - { - byte? val = null; - if (value.HasValue) - { - val = (byte)(value.Value ? 1 : 0); - } - SetTagValue("NoLocalPalette", val); - } - } - - /// - /// Gets or sets a value indicating whether the image is interlaced. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public bool? Interlaced - { - get - { - byte? useGlobalPalette = GetTagValue("Interlaced"); - return useGlobalPalette.HasValue ? (useGlobalPalette.Value != 0) : default(bool?); - } - set - { - byte? val = null; - if (value.HasValue) - { - val = (byte)(value.Value ? 1 : 0); - } - SetTagValue("Interlaced", val); - } - } - - /// - /// Gets or sets the amout of time in milliseconds this frame is to be displayed. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public uint? FrameTime - { - get - { - return GetTagValue("FrameTime"); - } - set - { - SetTagValue("FrameTime", value); - } - } - - /// - /// Gets or sets this frame's disposal method. Generally, this method defines, how to - /// remove or replace a frame when the next frame has to be drawn. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public DisposalMethodType? DisposalMethod - { - get - { - return GetTagValue("DisposalMethod"); - } - set - { - SetTagValue("DisposalMethod", value); - } - } - } - - /// - /// Represents a collection of all tags contained in the metadata model - /// . - /// - public class MDM_COMMENTS : MetadataModel - { - /// - /// Initializes a new instance of this class. - /// - /// Handle to a FreeImage bitmap. - public MDM_COMMENTS(FIBITMAP dib) : base(dib) { } - - /// - /// Retrieves the datamodel that this instance represents. - /// - public override FREE_IMAGE_MDMODEL Model - { - get { return FREE_IMAGE_MDMODEL.FIMD_COMMENTS; } - } - - /// - /// Gets or sets the comment of the image. - /// Supported formats are JPEG, PNG and GIF. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string Comment - { - get - { - return GetTagText("Comment"); - } - set - { - SetTagValue("Comment", value); - } - } - } - - /// - /// Represents a collection of all tags contained in the metadata model - /// . - /// - public class MDM_CUSTOM : MetadataModel - { - /// - /// Initializes a new instance of this class. - /// - /// Handle to a FreeImage bitmap. - public MDM_CUSTOM(FIBITMAP dib) : base(dib) { } - - /// - /// Retrieves the datamodel that this instance represents. - /// - public override FREE_IMAGE_MDMODEL Model - { - get { return FREE_IMAGE_MDMODEL.FIMD_CUSTOM; } - } - } - - /// - /// Represents a collection of all tags contained in the metadata model - /// . - /// - public class MDM_EXIF_EXIF : MetadataModel - { - /// - /// Initializes a new instance of this class. - /// - /// Handle to a FreeImage bitmap. - public MDM_EXIF_EXIF(FIBITMAP dib) : base(dib) { } - - /// - /// Retrieves the datamodel that this instance represents. - /// - public override FREE_IMAGE_MDMODEL Model - { - get { return FREE_IMAGE_MDMODEL.FIMD_EXIF_EXIF; } - } - - /// - /// Gets or sets the version of this standard supported. - /// Constant length or 4. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public byte[] ExifVersion - { - get - { - return GetTagArray("ExifVersion"); - } - set - { - FreeImage.Resize(ref value, 4); - SetTagValueUndefined("ExifVersion", value); - } - } - - /// - /// Gets or sets the Flashpix format version supported by a FPXR file. - /// Constant length or 4. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public byte[] FlashpixVersion - { - get - { - return GetTagArray("FlashpixVersion"); - } - set - { - FreeImage.Resize(ref value, 4); - SetTagValueUndefined("FlashpixVersion", value); - } - } - - /// - /// Gets or sets the color space information tag. - /// See remarks for further information. - /// - /// - /// The following values are defined: - /// - /// - /// ID - /// Description - /// - /// - /// 1 - /// sRGB (default) - /// - /// - /// 0xFFFF - /// uncalibrated - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? ColorSpace - { - get - { - return GetTagValue("ColorSpace"); - } - set - { - SetTagValue("ColorSpace", value); - } - } - - /// - /// Gets or sets the valid width of a compressed image. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public uint? PixelXDimension - { - get - { - return GetUInt32Value("PixelXDimension"); - } - set - { - RemoveTag("PixelXDimension"); - if (value.HasValue) - { - SetTagValue("PixelXDimension", value.Value); - } - } - } - - /// - /// Gets or sets the valid height of a compressed image. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public uint? PixelYDimension - { - get - { - return GetUInt32Value("PixelYDimension"); - } - set - { - RemoveTag("PixelYDimension"); - if (value.HasValue) - { - SetTagValue("PixelYDimension", value.Value); - } - } - } - - /// - /// Gets or sets components configuration. See remarks for further information. - /// Constant length of 4. - /// - /// - /// The channels of each component are arranged in order from the 1st component to the 4th. - /// For uncompressed data the data arrangement is given in the PhotometricInterpretation tag. - /// However, since PhotometricInterpretation can only express the order of Y,Cb and Cr, - /// this tag is provided for cases when compressed data uses components other than Y, Cb, - /// and Cr and to enable support of other sequences. - /// Default = 4 5 6 0 (if RGB uncompressed) - /// The following values are defined: - /// - /// - /// ID - /// Description - /// - /// - /// 0 - /// does not exist - /// - /// - /// 1 - /// Y - /// - /// - /// 2 - /// Cb - /// - /// - /// 3 - /// Cr - /// - /// - /// 4 - /// R - /// - /// - /// 5 - /// R - /// - /// - /// 6 - /// R - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public byte[] ComponentsConfiguration - { - get - { - return GetTagArray("ComponentsConfiguration"); - } - set - { - FreeImage.Resize(ref value, 4); - SetTagValueUndefined("ComponentsConfiguration", value); - } - } - - /// - /// Gets or sets compression mode used for a compressed image is indicated - /// in unit bits per pixel. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? CompressedBitsPerPixel - { - get - { - return GetTagValue("CompressedBitsPerPixel"); - } - set - { - SetTagValue("CompressedBitsPerPixel", value); - } - } - - /// - /// Gets or sets a tag for manufacturers of Exif writers to record any desired information. - /// The contents are up to the manufacturer, but this tag should not be used for any other - /// than its intended purpose. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public byte[] MakerNote - { - get - { - return GetTagArray("FlashpixVersion"); - } - set - { - SetTagValueUndefined("FlashpixVersion", value); - } - } - - /// - /// Gets or sets a tag for Exif users to write keywords or comments on the image besides - /// those in ImageDescription, and without the character code limitations of the ImageDescription tag. - /// Minimum length of 8. See remarks for further information. - /// - /// - /// The character code used in the UserComment tag is identified based on an ID code in a fixed 8-byte - /// area at the start of the tag data area. The unused portion of the area is padded with NULL. - /// The ID code for the UserComment area may be a Defined code such as JIS or ASCII, or may be Undefined. - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public byte[] UserComment - { - get - { - return GetTagArray("UserComment"); - } - set - { - FreeImage.Resize(ref value, 8, int.MaxValue); - SetTagValueUndefined("UserComment", value); - } - } - - /// - /// Gets or sets the name of an audio file related to the image data. - /// The format is 8.3. - /// Constant length of 12 - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string RelatedSoundFile - { - get - { - string text = GetTagText("RelatedSoundFile"); - if (!string.IsNullOrEmpty(text)) - { - text = text.Substring(0, text.Length - 1); - } - return text; - } - set - { - if (value != null) - { - FreeImage.Resize(ref value, 12); - value += '\0'; - } - SetTagValue("RelatedSoundFile", value); - } - } - - /// - /// Gets or sets the date and time when the original image data was generated. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public DateTime? DateTimeOriginal - { - get - { - DateTime? result = null; - string text = GetTagText("DateTimeOriginal"); - if (text != null) - { - try - { - result = System.DateTime.ParseExact(text, "yyyy:MM:dd HH:mm:ss\0", null); - } - catch - { - } - } - return result; - } - set - { - string val = null; - if (value.HasValue) - { - try - { - val = value.Value.ToString("yyyy:MM:dd HH:mm:ss\0"); - } - catch - { - } - } - SetTagValue("DateTimeOriginal", val); - } - } - - /// - /// Gets or sets the date and time when the image was stored as digital data. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public DateTime? DateTimeDigitized - { - get - { - DateTime? result = null; - string text = GetTagText("DateTimeDigitized"); - if (text != null) - { - try - { - result = System.DateTime.ParseExact(text, "yyyy:MM:dd HH:mm:ss\0", null); - } - catch - { - } - } - return result; - } - set - { - string val = null; - if (value.HasValue) - { - try - { - val = value.Value.ToString("yyyy:MM:dd HH:mm:ss\0"); - } - catch - { - } - } - SetTagValue("DateTimeDigitized", val); - } - } - - /// - /// Gets or sets a tag used to record fractions of seconds for the DateTime tag. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string SubsecTime - { - get - { - string text = GetTagText("SubsecTime"); - if (!string.IsNullOrEmpty(text)) - { - text = text.Substring(0, text.Length - 1); - } - return text; - } - set - { - if (value != null) - { - value += '\0'; - } - SetTagValue("SubsecTime", value); - } - } - - /// - /// Gets or sets a tag used to record fractions of seconds for the DateTimeOriginal tag. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string SubsecTimeOriginal - { - get - { - string text = GetTagText("SubsecTimeOriginal"); - if (!string.IsNullOrEmpty(text)) - { - text = text.Substring(0, text.Length - 1); - } - return text; - } - set - { - if (value != null) - { - value += '\0'; - } - SetTagValue("SubsecTimeOriginal", value); - } - } - - /// - /// Gets or sets a tag used to record fractions of seconds for the DateTimeDigitized tag. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string SubsecTimeDigitized - { - get - { - string text = GetTagText("SubsecTimeDigitized"); - if (!string.IsNullOrEmpty(text)) - { - text = text.Substring(0, text.Length - 1); - } - return text; - } - set - { - if (value != null) - { - value += '\0'; - } - SetTagValue("SubsecTimeDigitized", value); - } - } - - /// - /// Gets or the exposure time, given in seconds (sec). - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? ExposureTime - { - get - { - return GetTagValue("ExposureTime"); - } - set - { - SetTagValue("ExposureTime", value); - } - } - - /// - /// Gets or the F number. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? FNumber - { - get - { - return GetTagValue("FNumber"); - } - set - { - SetTagValue("FNumber", value); - } - } - - /// - /// Gets or sets the class of the program used by the camera to set exposure when the - /// picture is taken. - /// See remarks for further information. - /// - /// - /// The following values are defined: - /// - /// - /// ID - /// Description - /// - /// - /// 0 - /// not defined - /// - /// - /// 1 - /// manual - /// - /// - /// 2 - /// normal program - /// - /// - /// 3 - /// aperture priority - /// - /// - /// 4 - /// shutter priority - /// - /// - /// 5 - /// create program - /// - /// - /// 6 - /// action program - /// - /// - /// 7 - /// portrait mode - /// - /// - /// 8 - /// landscape mode - /// - /// - /// others - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? ExposureProgram - { - get - { - return GetTagValue("ExposureProgram"); - } - set - { - SetTagValue("ExposureProgram", value); - } - } - - /// - /// Gets or sets the spectral sensitivity of each channel of the camera used. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string SpectralSensitivity - { - get - { - string text = GetTagText("SpectralSensitivity"); - if (!string.IsNullOrEmpty(text)) - { - text = text.Substring(0, text.Length - 1); - } - return text; - } - set - { - if (value != null) - { - value += '\0'; - } - SetTagValue("SpectralSensitivity", value); - } - } - - /// - /// Gets or sets the the ISO Speed and ISO Latitude of the camera or input device as - /// specified in ISO 12232. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public ushort[] ISOSpeedRatings - { - get - { - return GetTagArray("ISOSpeedRatings"); - } - set - { - SetTagValue("ISOSpeedRatings", value); - } - } - - /// - /// Gets or sets the Opto-Electric Conversion Function (OECF) specified in ISO 14524. - /// OECF is the relationship between the camera optical input and the image values. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public byte[] OECF - { - get - { - return GetTagArray("OECF"); - } - set - { - SetTagValueUndefined("OECF", value); - } - } - - /// - /// Gets or sets the shutter speed. The unit is the APEX (Additive System of Photographic Exposure). - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIRational? ShutterSpeedValue - { - get - { - return GetTagValue("ShutterSpeedValue"); - } - set - { - SetTagValue("ShutterSpeedValue", value); - } - } - - /// - /// Gets or sets the lens aperture. The unit is the APEX value. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? ApertureValue - { - get - { - return GetTagValue("ApertureValue"); - } - set - { - SetTagValue("ApertureValue", value); - } - } - - /// - /// Gets or sets the value of brightness. The unit is the APEX value. - /// Ordinarily it is given in the range of -99.99 to 99.99. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIRational? BrightnessValue - { - get - { - return GetTagValue("BrightnessValue"); - } - set - { - SetTagValue("BrightnessValue", value); - } - } - - /// - /// Gets or sets the exposure bias. The unit is the APEX value. - /// Ordinarily it is given in the range of �99.99 to 99.99. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIRational? ExposureBiasValue - { - get - { - return GetTagValue("ExposureBiasValue"); - } - set - { - SetTagValue("ExposureBiasValue", value); - } - } - - /// - /// Gets or sets the smallest F number of the lens. The unit is the APEX value. - /// Ordinarily it is given in the range of 00.00 to 99.99, - /// but it is not limited to this range. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? MaxApertureValue - { - get - { - return GetTagValue("MaxApertureValue"); - } - set - { - SetTagValue("MaxApertureValue", value); - } - } - - /// - /// Gets or sets distance to the subject, given in meters. - /// Note that if the numerator of the recorded value is FFFFFFFF, infinity shall be indicated; - /// and if the numerator is 0, distance unknown shall be indicated. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? SubjectDistance - { - get - { - return GetTagValue("SubjectDistance"); - } - set - { - SetTagValue("SubjectDistance", value); - } - } - - /// - /// Gets or sets the metering mode. See remarks for further information. - /// - /// - /// The following values are defined: - /// - /// - /// ID - /// Description - /// - /// - /// 0 - /// unknown - /// - /// - /// 1 - /// average - /// - /// - /// 2 - /// center-weighted-average - /// - /// - /// 3 - /// spot - /// - /// - /// 4 - /// multi-spot - /// - /// - /// 5 - /// pattern - /// - /// - /// 6 - /// partial - /// - /// - /// other - /// reserved - /// - /// - /// 255 - /// other - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? MeteringMode - { - get - { - return GetTagValue("MeteringMode"); - } - set - { - SetTagValue("MeteringMode", value); - } - } - - /// - /// Gets or sets the kind of light source. - /// See remarks for further information. - /// - /// - /// The following values are defined: - /// - /// - /// ID - /// Description - /// - /// - /// 0 - /// unknown - /// - /// - /// 1 - /// daylight - /// - /// - /// 2 - /// fluorescent - /// - /// - /// 3 - /// tungsten - /// - /// - /// 4 - /// flash - /// - /// - /// 9 - /// fine weather - /// - /// - /// 10 - /// cloudy weather - /// - /// - /// 11 - /// shade - /// - /// - /// 12 - /// daylight fluorecent (D 5700 - 7100K) - /// - /// - /// 13 - /// day white fluorescent (N 4600 - 5400K) - /// - /// - /// 14 - /// cool white fluorescent (W 3900 - 4500K) - /// - /// - /// 15 - /// white fluorescent (WW 3200 - 3700K) - /// - /// - /// 17 - /// standard light A - /// - /// - /// 18 - /// standard light B - /// - /// - /// 19 - /// standard light C - /// - /// - /// 20 - /// D55 - /// - /// - /// 21 - /// D65 - /// - /// - /// 22 - /// D75 - /// - /// - /// 23 - /// D50 - /// - /// - /// 24 - /// ISO studio tungsten - /// - /// - /// 255 - /// other light source - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? LightSource - { - get - { - return GetTagValue("LightSource"); - } - set - { - SetTagValue("LightSource", value); - } - } - - /// - /// Gets or sets a value indicating the status of flash when the image was shot. - /// Bit 0 indicates the flash firing status, bits 1 and 2 indicate the flash return - /// status, bits 3 and 4 indicate the flash mode, bit 5 indicates whether the flash - /// function is present, and bit 6 indicates "red eye" mode. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public ushort? Flash - { - get - { - return GetTagValue("Flash"); - } - set - { - SetTagValue("Flash", value); - } - } - - /// - /// Gets or sets a value indicating the location and area of the main subject in - /// the overall scene. Variable length between 2 and 4. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public ushort[] SubjectArea - { - get - { - return GetTagArray("SubjectArea"); - } - set - { - FreeImage.Resize(ref value, 2, 4); - SetTagValue("SubjectArea", value); - } - } - - /// - /// Gets or sets the actual focal length of the lens, in mm. - /// Conversion is not made to the focal length of a 35 mm film camera. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? FocalLength - { - get - { - return GetTagValue("FocalLength"); - } - set - { - SetTagValue("FocalLength", value); - } - } - - /// - /// Gets or sets the strobe energy at the time the image is captured, - /// as measured in Beam Candle Power Seconds (BCPS). - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? FlashEnergy - { - get - { - return GetTagValue("FlashEnergy"); - } - set - { - SetTagValue("FlashEnergy", value); - } - } - - /// - /// Gets or sets the camera or input device spatial frequency table and SFR values - /// in the direction of image width, image height, and diagonal direction, - /// as specified in ISO 12233. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public byte[] SpatialFrequencyResponse - { - get - { - return GetTagArray("SpatialFrequencyResponse"); - } - set - { - SetTagValueUndefined("SpatialFrequencyResponse", value); - } - } - - /// - /// Gets or sets the number of pixels in the image width (X) direction per - /// FocalPlaneResolutionUnit on the camera focal plane. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? FocalPlaneXResolution - { - get - { - return GetTagValue("FocalPlaneXResolution"); - } - set - { - SetTagValue("FocalPlaneXResolution", value); - } - } - - /// - /// Gets or sets the number of pixels in the image height (Y) direction per - /// FocalPlaneResolutionUnit on the camera focal plane. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? FocalPlaneYResolution - { - get - { - return GetTagValue("FocalPlaneYResolution"); - } - set - { - SetTagValue("FocalPlaneYResolution", value); - } - } - - /// - /// Gets or sets the unit for measuring FocalPlaneXResolution and FocalPlaneYResolution. - /// This value is the same as the ResolutionUnit. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public ushort? FocalPlaneResolutionUnit - { - get - { - return GetTagValue("FocalPlaneResolutionUnit"); - } - set - { - SetTagValue("FocalPlaneResolutionUnit", value); - } - } - - /// - /// Gets or sets the location of the main subject in the scene. - /// The value of this tag represents the pixel at the center of the main subject - /// relative to the left edge, prior to rotation processing as per the Rotation tag. - /// The first value indicates the X column number and second indicates the Y row number. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public ushort? SubjectLocation - { - get - { - return GetTagValue("SubjectLocation"); - } - set - { - SetTagValue("SubjectLocation", value); - } - } - - /// - /// Gets or sets the exposure index selected on the camera or input device at the - /// time the image was captured. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? ExposureIndex - { - get - { - return GetTagValue("ExposureIndex"); - } - set - { - SetTagValue("ExposureIndex", value); - } - } - - /// - /// Gets or sets the image sensor type on the camera or input device. - /// See remarks for further information. - /// - /// - /// The following values are defined: - /// - /// - /// ID - /// Description - /// - /// - /// 1 - /// not defined - /// - /// - /// 2 - /// one-chip color area sensor - /// - /// - /// 3 - /// two-chip color area sensor - /// - /// - /// 4 - /// three-chip color area sensor - /// - /// - /// 5 - /// color sequential area sensor - /// - /// - /// 7 - /// trilinear sensor - /// - /// - /// 8 - /// color sequential linear sensor - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? SensingMethod - { - get - { - return GetTagValue("SensingMethod"); - } - set - { - SetTagValue("SensingMethod", value); - } - } - - /// - /// Gets or sets the image source. If a DSC recorded the image, this tag value of this - /// tag always be set to 3, indicating that the image was recorded on a DSC. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public byte? FileSource - { - get - { - return GetTagValue("FileSource"); - } - set - { - SetTagValueUndefined("FileSource", value.HasValue ? new byte[] { value.Value } : null); - } - } - - /// - /// Gets or sets the type of scene. If a DSC recorded the image, this tag value shall - /// always be set to 1, indicating that the image was directly photographed. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public byte? SceneType - { - get - { - return GetTagValue("SceneType"); - } - set - { - SetTagValueUndefined("SceneType", value.HasValue ? new byte[] { value.Value } : null); - } - } - - /// - /// Gets or sets the color filter array (CFA) geometric pattern of the image sensor - /// when a one-chip color area sensor is used. It does not apply to all sensing methods. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public byte[] CFAPattern - { - get - { - return GetTagArray("CFAPattern"); - } - set - { - SetTagValueUndefined("CFAPattern", value); - } - } - - /// - /// Gets or sets the use of special processing on image data, such as rendering geared to output. - /// When special processing is performed, the reader is expected to disable or minimize any - /// further processing. See remarks for further information. - /// - /// - /// The following values are definied: - /// - /// - /// ID - /// Description - /// - /// - /// 0 - /// normal process - /// - /// - /// 1 - /// custom process - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? CustomRendered - { - get - { - return GetTagValue("CustomRendered"); - } - set - { - SetTagValue("CustomRendered", value); - } - } - - /// - /// Gets or sets the exposure mode set when the image was shot. - /// In auto-bracketing mode, the camera shoots a series of frames of the same scene - /// at different exposure settings. See remarks for further information. - /// - /// - /// The following values are definied: - /// - /// - /// ID - /// Description - /// - /// - /// 0 - /// auto exposure - /// - /// - /// 1 - /// manual exposure - /// - /// - /// 2 - /// auto bracket - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? ExposureMode - { - get - { - return GetTagValue("ExposureMode"); - } - set - { - SetTagValue("ExposureMode", value); - } - } - - /// - /// Gets or sets the white balance mode set when the image was shot. - /// See remarks for further information. - /// - /// - /// The following values are definied: - /// - /// - /// ID - /// Description - /// - /// - /// 0 - /// auto white balance - /// - /// - /// 1 - /// manual white balance - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? WhiteBalance - { - get - { - return GetTagValue("WhiteBalance"); - } - set - { - SetTagValue("WhiteBalance", value); - } - } - - /// - /// Gets or sets the digital zoom ratio when the image was shot. - /// If the numerator of the recorded value is 0, this indicates that digital zoom was not used. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? DigitalZoomRatio - { - get - { - return GetTagValue("DigitalZoomRatio"); - } - set - { - SetTagValue("DigitalZoomRatio", value); - } - } - - /// - /// Gets or sets the equivalent focal length assuming a 35mm film camera, in mm. - /// A value of 0 means the focal length is unknown. Note that this tag differs - /// from the FocalLength tag. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public ushort? FocalLengthIn35mmFilm - { - get - { - return GetTagValue("DigitalZoomRatio"); - } - set - { - SetTagValue("DigitalZoomRatio", value); - } - } - - /// - /// Gets or sets the type of scene that was shot. - /// It can also be used to record the mode in which the image was shot. - /// See remarks for further information. - /// - /// - /// The following values are definied: - /// - /// - /// ID - /// Description - /// - /// - /// 0 - /// standard - /// - /// - /// 1 - /// landscape - /// - /// - /// 2 - /// portrait - /// - /// - /// 3 - /// night scene - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? SceneCaptureType - { - get - { - return GetTagValue("SceneCaptureType"); - } - set - { - SetTagValue("SceneCaptureType", value); - } - } - - /// - /// Gets or sets the degree of overall image gain adjustment. - /// See remarks for further information. - /// - /// - /// The following values are definied: - /// - /// - /// ID - /// Description - /// - /// - /// 0 - /// none - /// - /// - /// 1 - /// low gain up - /// - /// - /// 2 - /// high gain up - /// - /// - /// 3 - /// low gain down - /// - /// - /// 4 - /// high gain down - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? GainControl - { - get - { - return GetTagValue("GainControl"); - } - set - { - SetTagValue("GainControl", value); - } - } - - /// - /// Gets or sets the direction of contrast processing applied by the camera - /// when the image was shot. - /// See remarks for further information. - /// - /// - /// The following values are definied: - /// - /// - /// ID - /// Description - /// - /// - /// 0 - /// normal - /// - /// - /// 1 - /// soft - /// - /// - /// 2 - /// hard - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? Contrast - { - get - { - return GetTagValue("Contrast"); - } - set - { - SetTagValue("Contrast", value); - } - } - - /// - /// Gets or sets the direction of saturation processing applied by the camera - /// when the image was shot. - /// See remarks for further information. - /// - /// - /// The following values are definied: - /// - /// - /// ID - /// Description - /// - /// - /// 0 - /// normal - /// - /// - /// 1 - /// low saturation - /// - /// - /// 2 - /// high saturation - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? Saturation - { - get - { - return GetTagValue("Saturation"); - } - set - { - SetTagValue("Saturation", value); - } - } - - /// - /// Gets or sets the direction of sharpness processing applied by the camera - /// when the image was shot. - /// See remarks for further information. - /// - /// - /// The following values are definied: - /// - /// - /// ID - /// Description - /// - /// - /// 0 - /// normal - /// - /// - /// 1 - /// soft - /// - /// - /// 2 - /// hard - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? Sharpness - { - get - { - return GetTagValue("Sharpness"); - } - set - { - SetTagValue("Sharpness", value); - } - } - - /// - /// Gets or sets information on the picture-taking conditions of a particular camera model. - /// The tag is used only to indicate the picture-taking conditions in the reader. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public byte[] DeviceSettingDescription - { - get - { - return GetTagArray("DeviceSettingDescription"); - } - set - { - SetTagValueUndefined("DeviceSettingDescription", value); - } - } - - /// - /// Gets or sets the distance to the subject. - /// See remarks for further information. - /// - /// - /// The following values are definied: - /// - /// - /// ID - /// Description - /// - /// - /// 0 - /// unknown - /// - /// - /// 1 - /// macro - /// - /// - /// 2 - /// close view - /// - /// - /// 3 - /// distant view - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? SubjectDistanceRange - { - get - { - return GetTagValue("SubjectDistanceRange"); - } - set - { - SetTagValue("SubjectDistanceRange", value); - } - } - - /// - /// Gets or sets an identifier assigned uniquely to each image. - /// It is recorded as an ASCII string equivalent to hexadecimal notation and 128-bit fixed length. - /// Constant length of 32. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ImageUniqueID - { - get - { - string text = GetTagText("ImageUniqueID"); - if (!string.IsNullOrEmpty(text)) - { - text = text.Substring(0, text.Length - 1); - } - return text; - } - set - { - if (value != null) - { - FreeImage.Resize(ref value, 32); - value += '\0'; - } - SetTagValue("ImageUniqueID", value); - } - } - } - - /// - /// Represents a collection of all tags contained in the metadata model - /// . - /// - public class MDM_EXIF_GPS : MetadataModel - { - /// - /// Initializes a new instance of this class. - /// - /// Handle to a FreeImage bitmap. - public MDM_EXIF_GPS(FIBITMAP dib) : base(dib) { } - - /// - /// Retrieves the datamodel that this instance represents. - /// - public override FREE_IMAGE_MDMODEL Model - { - get { return FREE_IMAGE_MDMODEL.FIMD_EXIF_GPS; } - } - - /// - /// Gets or sets the GPS version ID. Constant length of 4. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public byte[] VersionID - { - get - { - return GetTagArray("GPSVersionID"); - } - set - { - FreeImage.Resize(ref value, 4); - SetTagValue("GPSVersionID", value); - } - } - - /// - /// Gets or sets a value indicating whether the - /// is north or south latitude. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public LatitudeType? LatitudeDirection - { - get - { - return ToLatitudeType(GetTagText("GPSLatitudeRef")); - } - set - { - SetTagValue("GPSLatitudeRef", ToString(value) + '\0'); - } - } - - /// - /// Gets or sets the latitude of the image. The latitude is expressed as three rational - /// values giving the degrees, minutes, and seconds, respectively. Constant length of 3. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - public FIURational[] Latitude - { - get - { - return GetTagArray("GPSLatitude"); - } - set - { - FreeImage.Resize(ref value, 3); - SetTagValue("GPSLatitude", value); - } - } - - /// - /// Gets or sets a value indicating whether - /// is east or west longitude. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public LongitudeType? LongitudeDirection - { - get - { - return ToLongitudeType(GetTagText("GPSLongitudeRef")); - } - set - { - SetTagValue("GPSLongitudeRef", ToString(value) + '\0'); - } - } - - /// - /// Gets or sets the longitude of the image. The longitude is expressed as three rational - /// values giving the degrees, minutes, and seconds, respectively. Constant length of 3. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - public FIURational[] Longitude - { - get - { - return GetTagArray("GPSLongitude"); - } - set - { - FreeImage.Resize(ref value, 3); - SetTagValue("GPSLongitude", value); - } - } - - /// - /// Gets a value indicating whether is sea level and the altitude - /// is above sea level. If the altitude is below sea level is - /// indicated as an absolute value. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public AltitudeType? AltitudeDirection - { - get - { - byte? flag = GetTagValue("GPSAltitudeRef"); - if (flag.HasValue) - { - switch (flag.Value) - { - case 0: - return AltitudeType.AboveSeaLevel; - case 1: - return AltitudeType.BelowSeaLevel; - default: - return AltitudeType.Undefined; - } - } - return null; - } - set - { - byte? val = null; - if (value.HasValue) - { - switch (value.Value) - { - case AltitudeType.AboveSeaLevel: - val = 0; - break; - - case AltitudeType.BelowSeaLevel: - val = 1; - break; - - default: - val = 2; - break; - } - } - SetTagValue("GPSAltitudeRef", val); - } - } - - /// - /// Gets or sets the altitude based on the reference in . - /// Altitude is expressed as one rational value. The reference unit is meters. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? Altitude - { - get - { - return GetTagValue("GPSAltitude"); - } - set - { - SetTagValue("GPSAltitude", value); - } - } - - /// - /// Gets or sets the sign of the . - /// - /// - /// This is a derived property. There is no metadata tag directly associated - /// with this property value. - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public int? AltitudeSign - { - get - { - AltitudeType? seaLevel = AltitudeDirection; - if (seaLevel.HasValue) - { - return (seaLevel.Value == AltitudeType.BelowSeaLevel) ? -1 : 1; - } - return null; - } - set - { - if (value.HasValue) - { - AltitudeDirection = value.Value >= 0 ? AltitudeType.AboveSeaLevel : AltitudeType.BelowSeaLevel; - } - else - { - AltitudeDirection = null; - } - } - } - - /// - /// Gets or sets the signed altitude. - /// Altitude is expressed as one rational value. The reference unit is meters. - /// - /// - /// Altitude is too large to fit into a FIRational. - /// - /// - /// This is a derived property. There is no metadata tag directly associated - /// with this property value. - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public FIRational? SignedAltitude - { - get - { - FIRational? result = null; - FIURational? altitude = Altitude; - if (altitude.HasValue) - { - int sign = AltitudeSign ?? 1; - if (((int)altitude.Value.Numerator < 0) || ((int)altitude.Value.Denominator < 0)) - throw new OverflowException(); - result = new FIRational((int)altitude.Value.Numerator * sign, (int)altitude.Value.Denominator); - } - return result; - } - set - { - FIURational? val = null; - if (value.HasValue) - { - if (value.Value < 0) - { - AltitudeSign = -1; - value = -value.Value; - } - else - { - AltitudeSign = 1; - } - val = new FIURational((uint)value.Value.Numerator, (uint)value.Value.Denominator); - } - Altitude = val; - } - } - - - /// - /// Gets or sets the time as UTC (Coordinated Universal Time). Constant length of 3. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public TimeSpan? TimeStamp - { - get - { - FIURational[] stamp = GetTagArray("GPSTimeStamp"); - if ((stamp == null) || stamp.Length != 3) - { - return null; - } - else - { - return new TimeSpan((int)stamp[0], (int)stamp[1], (int)stamp[2]); - } - } - set - { - FIURational[] stamp = null; - if (value.HasValue) - { - TimeSpan span = value.Value; - stamp = new FIURational[3]; - stamp[0] = span.Hours; - stamp[1] = span.Minutes; - stamp[2] = span.Seconds; - } - SetTagValue("GPSTimeStamp", stamp); - } - } - - /// - /// Gets or sets the GPS satellites used for measurements. This tag can be used to describe - /// the number of satellites, their ID number, angle of elevation, azimuth, SNR and other - /// information in ASCII notation. The format is not specified. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string Satellites - { - get - { - string result = GetTagText("GPSSatellites"); - if (!string.IsNullOrEmpty(result)) - { - result = result.Substring(0, result.Length - 1); - } - return result; - } - set - { - if (value != null) - { - value += '\0'; - } - SetTagValue("GPSTimeStamp", value); - } - } - - /// - /// Gets or sets a value indicating the status of the GPS receiver when the image was recorded. - /// true indicates measurement was in progress; - /// false indicates measurement was Interoperability. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public bool? Status - { - get - { - string text = GetTagText("GPSStatus"); - return string.IsNullOrEmpty(text) ? default(bool?) : text[0] == 'A'; - } - set - { - SetTagValue("GPSStatus", value.HasValue ? (value.Value ? "A\0" : "V\0") : null); - } - } - - /// - /// Gets or sets a value indicating the GPS measurement mode. - /// true indicates three-dimensional measurement; - /// false indicated two-dimensional measurement was in progress. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public bool? MeasureMode3D - { - get - { - string text = GetTagText("GPSMeasureMode"); - return string.IsNullOrEmpty(text) ? default(bool?) : text[0] == '3'; - } - set - { - SetTagValue("GPSMeasureMode", value.HasValue ? (value.Value ? "3\0" : "2\0") : null); - } - } - - /// - /// Gets or sets the GPS DOP (data degree of precision). An HDOP value is written during - /// two-dimensional measurement, and PDOP during three-dimensional measurement. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? DOP - { - get - { - return GetTagValue("GPSDOP"); - } - set - { - SetTagValue("GPSDOP", value); - } - } - - /// - /// Gets or sets the unit used to express the GPS receiver of movement. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - public VelocityUnit? SpeedUnit - { - get - { - return ToUnitType(GetTagText("GPSSpeedRef")); - } - set - { - SetTagValue("GPSSpeedRef", ToString(value) + '\0'); - } - } - - /// - /// Gets or sets the speed of GPS receiver movement. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - public FIURational? Speed - { - get - { - return GetTagValue("GPSSpeed"); - } - set - { - SetTagValue("GPSSpeed", value); - } - } - - /// - /// Gets or sets the reference for giving the direction of GPS receiver movement. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - public DirectionReference? TrackDirectionReference - { - get - { - return ToDirectionType(GetTagText("GPSTrackRef")); - } - set - { - SetTagValue("GPSTrackRef", ToString(value) + '\0'); - } - } - - /// - /// Gets or sets the direction of GPS receiver movement. - /// The range of values is from 0.00 to 359.99. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - public FIURational? Track - { - get - { - return GetTagValue("GPSTrack"); - } - set - { - SetTagValue("GPSTrack", value); - } - } - - /// - /// Gets or sets the reference for giving the direction of GPS receiver movement. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - public DirectionReference? ImageDirectionReference - { - get - { - return ToDirectionType(GetTagText("GPSImgDirectionRef")); - } - set - { - SetTagValue("GPSImgDirectionRef", ToString(value) + '\0'); - } - } - - /// - /// Gets or sets the direction of the image when it was captured. - /// The range of values is from 0.00 to 359.99. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - public FIURational? ImageDirection - { - get - { - return GetTagValue("GPSImgDirection"); - } - set - { - SetTagValue("GPSImgDirection", value); - } - } - - /// - /// Gets or sets the geodetic survey data used by the GPS receiver. If the survey data - /// is restricted to Japan, the value of this tag is 'TOKYO' or 'WGS-84'. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string MapDatum - { - get - { - string result = GetTagText("GPSMapDatum"); - if (!string.IsNullOrEmpty(result)) - { - result = result.Substring(0, result.Length - 1); - } - return result; - } - set - { - SetTagValue("GPSMapDatum", value + '\0'); - } - } - - /// - /// Gets or sets a value indicating whether the destination point - /// is north or south latitude. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - public LatitudeType? DestinationLatitudeDirection - { - get - { - return ToLatitudeType(GetTagText("GPSDestLatitudeRef")); - } - set - { - SetTagValue("GPSDestLatitudeRef", ToString(value) + '\0'); - } - } - - /// - /// Gets or sets the latitude of the destination point. The latitude is expressed as three rational - /// values giving the degrees, minutes, and seconds, respectively. Constant length of 3. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - public FIURational[] DestinationLatitude - { - get - { - return GetTagArray("GPSDestLatitude"); - } - set - { - FreeImage.Resize(ref value, 3); - SetTagValue("GPSDestLatitude", value); - } - } - - /// - /// Gets or sets a value indicating whether the destination point - /// is east or west longitude. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - public LongitudeType? DestinationLongitudeDirection - { - get - { - return ToLongitudeType(GetTagText("GPSDestLongitudeRef")); - } - set - { - SetTagValue("GPSDestLongitudeRef", ToString(value) + '\0'); - } - } - - /// - /// Gets or sets the longitude of the destination point. The longitude is expressed as three rational - /// values giving the degrees, minutes, and seconds, respectively. Constant length of 3. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational[] DestinationLongitude - { - get - { - return GetTagArray("GPSDestLongitude"); - } - set - { - FreeImage.Resize(ref value, 3); - SetTagValue("GPSDestLongitude", value); - } - } - - /// - /// Gets or sets the reference used for giving the bearing to the destination point. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - public DirectionReference? DestinationDirectionReference - { - get - { - return ToDirectionType(GetTagText("GPSDestBearingRef")); - } - set - { - SetTagValue("GPSDestBearingRef", ToString(value) + '\0'); - } - } - - /// - /// Gets or sets the bearing to the destination point. - /// The range of values is from 0.00 to 359.99. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - public FIURational? DestinationBearing - { - get - { - return GetTagValue("GPSDestBearing"); - } - set - { - SetTagValue("GPSDestBearing", value); - } - } - - /// - /// Gets or sets the unit used to express the distance to the destination point. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - public VelocityUnit? DestinationUnit - { - get - { - return ToUnitType(GetTagText("GPSDestDistanceRef")); - } - set - { - SetTagValue("GPSDestDistanceRef", ToString(value) + '\0'); - } - } - - /// - /// Gets or sets a character string recording the name of the method used - /// for location finding. The first byte indicates the character code used, - /// and this is followed by the name of the method. Since the Type is not ASCII, - /// NULL termination is not necessary. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public byte[] ProcessingMethod - { - get - { - return GetTagArray("GPSProcessingMethod"); - } - set - { - SetTagValue("GPSProcessingMethod", value); - } - } - - /// - /// Gets or sets a character string recording the name of the GPS area. - /// The first byte indicates the character code used, and this is followed by - /// the name of the GPS area. Since the Type is not ASCII, NULL termination is - /// not necessary. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public byte[] AreaInformation - { - get - { - return GetTagArray("GPSAreaInformation"); - } - set - { - SetTagValue("GPSAreaInformation", value); - } - } - - /// - /// Gets or sets date and time information relative to UTC (Coordinated Universal Time). - /// - /// - /// This is a derived property. There is no metadata tag directly associated - /// with this property value. - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public DateTime? DateTimeStamp - { - get - { - DateTime? date = DateStamp; - TimeSpan? time = TimeStamp; - if ((date == null) && (time == null)) - { - return null; - } - else - { - if (date == null) - { - date = DateTime.MinValue; - } - if (time == null) - { - time = TimeSpan.MinValue; - } - return date.Value.Add(time.Value); - } - } - set - { - if (value.HasValue) - { - DateStamp = value.Value.Date; - TimeStamp = value.Value.TimeOfDay; - } - else - { - DateStamp = null; - TimeStamp = null; - } - } - } - - /// - /// Gets or sets date information relative to UTC (Coordinated Universal Time). - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public DateTime? DateStamp - { - get - { - string stamp = GetTagText("GPSDateStamp"); - if (stamp != null) - { - try - { - return DateTime.ParseExact(stamp, "yyyy:MM:dd\0", null); - } - catch - { - } - } - return null; - } - set - { - string val = null; - if (value.HasValue) - { - try - { - val = value.Value.ToString("yyyy:MM:dd\0"); - } - catch - { - } - } - SetTagValue("GPSDateStamp", val); - } - } - - /// - /// Gets or sets a value indicating whether differential correction was applied to - /// the GPS receiver. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public bool? IsDifferential - { - get - { - ushort? value = GetTagValue("GPSDifferential"); - return value.HasValue ? (value != 0) : (default(bool?)); - } - set - { - SetTagValue("GPSDifferential", value.HasValue ? (object)(value.Value ? (ushort)1 : (ushort)0) : (null)); - } - } - } - - /// - /// Represents a collection of all tags contained in the metadata model - /// . - /// - public class MDM_INTEROP : MetadataModel - { - /// - /// Initializes a new instance of this class. - /// - /// Handle to a FreeImage bitmap. - public MDM_INTEROP(FIBITMAP dib) : base(dib) { } - - /// - /// Retrieves the datamodel that this instance represents. - /// - public override FREE_IMAGE_MDMODEL Model - { - get { return FREE_IMAGE_MDMODEL.FIMD_EXIF_INTEROP; } - } - - /// - /// Gets or sets the identification of the Interoperability rule. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public InteroperabilityMode? Identification - { - get - { - return ToInteroperabilityType(GetTagText("InteroperabilityIndex")); - } - set - { - SetTagValue("InteroperabilityIndex", ToString(value) + '\0'); - } - } - } - - /// - /// Represents a collection of all tags contained in the metadata model - /// . - /// - /// This class is obsolete. Use class instead. - /// - [Obsolete("To be removed in future releases. Use MDM_EXIF_MAIN instead.")] - public class MDM_MAIN : MDM_EXIF_MAIN - { - /// - /// Initializes a new instance of this class. - /// - /// Handle to a FreeImage bitmap. - public MDM_MAIN(FIBITMAP dib) : base(dib) { } - } - - /// - /// Represents a collection of all tags contained in the metadata model - /// . - /// - public class MDM_EXIF_MAIN : MetadataModel - { - /// - /// Initializes a new instance of this class. - /// - /// Handle to a FreeImage bitmap. - public MDM_EXIF_MAIN(FIBITMAP dib) : base(dib) { } - - /// - /// Retrieves the datamodel that this instance represents. - /// - public override FREE_IMAGE_MDMODEL Model - { - get { return FREE_IMAGE_MDMODEL.FIMD_EXIF_MAIN; } - } - - /// - /// Gets or sets the number of columns of image data, equal to the number - /// of pixels per row. In JPEG compressed data a JPEG marker is used - /// instead of this tag. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public uint? ImageWidth - { - get - { - return GetUInt32Value("ImageWidth"); - } - set - { - RemoveTag("ImageWidth"); - if (value.HasValue) - { - SetTagValue("ImageWidth", value); - } - } - } - - /// - /// Gets or sets number of rows of image data. In JPEG compressed data a JPEG marker - /// is used instead of this tag. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public uint? ImageHeight - { - get - { - return GetUInt32Value("ImageLength"); - } - set - { - RemoveTag("ImageLength"); - if (value.HasValue) - { - SetTagValue("ImageLength", value); - } - } - } - - /// - /// Gets or sets number of bits per image component. In this standard - /// each component of the image is 8 bits, so the value for this tag is 8. - /// Constant length of 3. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public ushort[] BitsPerSample - { - get - { - return GetTagArray("BitsPerSample"); - } - set - { - FreeImage.Resize(ref value, 3); - SetTagValue("BitsPerSample", value); - } - } - - /// - /// Gets or sets compression scheme used for the image data. When a primary image - /// is JPEG compressed, this designation is not necessary and is omitted. - /// When thumbnails use JPEG compression, this tag value is set to 6. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public ushort? Compression - { - get - { - return GetTagValue("Compression"); - } - set - { - SetTagValue("Compression", value); - } - } - - /// - /// Gets or sets pixel composition. In JPEG compressed data a JPEG marker is - /// used instead of this tag. See remarks for further information. - /// - /// - /// The following values are definied: - /// - /// - /// ID - /// Description - /// - /// - /// 2 - /// RGB - /// - /// - /// 6 - /// YCbCr - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? PhotometricInterpretation - { - get - { - return GetTagValue("PhotometricInterpretation"); - } - set - { - SetTagValue("PhotometricInterpretation", value); - } - } - - /// - /// Gets or sets the image orientation viewed in terms of rows and columns. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public ExifImageOrientation? Orientation - { - get - { - return (ExifImageOrientation?)GetTagValue("Orientation"); - } - set - { - SetTagValue("Orientation", (ushort?)value); - } - } - - /// - /// Gets or sets the number of components per pixel. Since this standard applies - /// to RGB and YCbCr images, the value set for this tag is 3. In JPEG compressed - /// data a JPEG marker is used instead of this tag. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public ushort? SamplesPerPixel - { - get - { - return GetTagValue("SamplesPerPixel"); - } - set - { - SetTagValue("SamplesPerPixel", value); - } - } - - /// - /// Gets or sets a value that indicates whether pixel components are recorded in - /// chunky or planar format. In JPEG compressed files a JPEG marker is used instead - /// of this tag. If this field does not exist, the TIFF default of 1 (chunky) is assumed. - /// See remarks for further information. - /// - /// - /// The following values are definied: - /// - /// - /// ID - /// Description - /// - /// - /// 1 - /// chunky format - /// - /// - /// 2 - /// planar format - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? PlanarConfiguration - { - get - { - return GetTagValue("PlanarConfiguration"); - } - set - { - SetTagValue("PlanarConfiguration", value); - } - } - - /// - /// Gets or sets the sampling ratio of chrominance components in relation to - /// the luminance component. In JPEG compressed dat a JPEG marker is used - /// instead of this tag. - /// See remarks for further information. - /// - /// - /// The following values are definied: - /// - /// - /// ID - /// Description - /// - /// - /// [2,1] - /// YCbCr4:2:2 - /// - /// - /// [2,2] - /// YCbCr4:2:0 - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort[] YCbCrSubSampling - { - get - { - return GetTagArray("YCbCrSubSampling"); - } - set - { - FreeImage.Resize(ref value, 2); - SetTagValue("YCbCrSubSampling", value); - } - } - - /// - /// Gets or sets position of chrominance components in relation to the luminance component. - /// See remarks for further information. - /// - /// - /// This field is designated only for JPEG compressed data or uncompressed YCbCr data. - /// The TIFF default is 1 (centered); but when Y:Cb:Cr = 4:2:2 it is recommended in - /// this standard that 2 (co-sited) be used to record data, in order to improve the - /// image quality when viewed on TV systems. - /// - /// When this field does not exist, the reader shall assume the TIFF default. - /// In the case of Y:Cb:Cr = 4:2:0, the TIFF default (centered) is recommended. - /// If the reader does not have the capability of supporting both kinds of YCbCrPositioning, - /// it shall follow the TIFF default regardless of the value in this field. - /// It is preferable that readers be able to support both centered and co-sited positioning. - /// - /// The following values are definied: - /// - /// - /// ID - /// Description - /// - /// - /// 1 - /// centered - /// - /// - /// 2 - /// co-sited - /// - /// - /// other - /// reserved - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? YCbCrPositioning - { - get - { - return GetTagValue("YCbCrPositioning"); - } - set - { - SetTagValue("YCbCrPositioning", value); - } - } - - /// - /// Gets or sets the number of pixels per - /// in the direction. When the image resolution is unknown, - /// 72 [dpi] is designated. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? XResolution - { - get - { - return GetTagValue("XResolution"); - } - set - { - SetTagValue("XResolution", value); - } - } - - /// - /// Gets or sets the number of pixels per - /// in the direction. When the image resolution is unknown, - /// 72 [dpi] is designated. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational? YResolution - { - get - { - return GetTagValue("YResolution"); - } - set - { - SetTagValue("YResolution", value); - } - } - - /// - /// Gets or sets the unit for measuring and . - /// The same unit is used for both and . - /// If the image resolution in unknown, 2 (inches) is designated. - /// See remarks for further information. - /// - /// - /// The following values are definied: - /// - /// - /// ID - /// Description - /// - /// - /// 2 - /// inches - /// - /// - /// 3 - /// YCbCr4:2:0 - /// - /// - /// other - /// centimeters - /// - /// - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort? ResolutionUnit - { - get - { - return GetTagValue("ResolutionUnit"); - } - set - { - SetTagValue("ResolutionUnit", value); - } - } - - /// - /// Gets or sets the byte offset of that strip. - /// It is recommended that this be selected so the number of strip bytes - /// does not exceed 64 Kbytes. - /// With JPEG compressed data this designation is not needed and is omitted. - /// Constant length of * StripsPerImage. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - /// - public uint[] StripOffsets - { - get - { - return GetUInt32Array("StripOffsets"); - } - set - { - RemoveTag("StripOffsets"); - if (value != null) - { - SetTagValue("StripOffsets", value); - } - } - } - - /// - /// Gets or sets number of rows per strip. This is the number of rows in the image of - /// one strip when an image is divided into strips. With JPEG compressed data this - /// designation is not needed and is omitted. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - /// - public uint? RowsPerStrip - { - get - { - return GetUInt32Value("RowsPerStrip"); - } - set - { - RemoveTag("RowsPerStrip"); - if (value.HasValue) - { - SetTagValue("RowsPerStrip", value); - } - } - } - - /// - /// Gets or sets the total number of bytes in each strip. - /// With JPEG compressed data this designation is not needed and is omitted. - /// Constant length of * StripsPerImage. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public uint[] StripByteCounts - { - get - { - return GetUInt32Array("StripByteCounts"); - } - set - { - RemoveTag("StripByteCounts"); - if (value != null) - { - SetTagValue("StripByteCounts", value); - } - } - } - - /// - /// Gets or sets the offset to the start byte (SOI) of JPEG compressed thumbnail data. - /// This is not used for primary image JPEG data. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public uint? JPEGInterchangeFormat - { - get - { - return GetTagValue("JPEGInterchangeFormat"); - } - set - { - SetTagValue("JPEGInterchangeFormat", value); - } - } - - /// - /// Gets or sets the number of bytes of JPEG compressed thumbnail data. - /// - /// - /// This is not used for primary image JPEG data. - /// JPEG thumbnails are not divided but are recorded as a continuous - /// JPEG bitstream from SOI to EOI. APPn and COM markers should not be recorded. - /// Compressed thumbnails shall be recorded in no more than 64 Kbytes, - /// including all other data to be recorded in APP1. - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public uint? JPEGInterchangeFormatLength - { - get - { - return GetTagValue("JPEGInterchangeFormatLength"); - } - set - { - SetTagValue("JPEGInterchangeFormatLength", value); - } - } - - /// - /// Gets or sets a transfer function for the image, described in tabular style. - /// Constant length of 3 * 256. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public ushort[] TransferFunction - { - get - { - return GetTagArray("TransferFunction"); - } - set - { - FreeImage.Resize(ref value, 3 * 256); - SetTagValue("TransferFunction", value); - } - } - - /// - /// Gets or sets the chromaticity of the white point of the image. - /// Constant length of 2. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational[] WhitePoint - { - get - { - return GetTagArray("WhitePoint"); - } - set - { - FreeImage.Resize(ref value, 2); - SetTagValue("WhitePoint", value); - } - } - - /// - /// Gets or sets the chromaticity of the three primary colors of the image. - /// Constant length of 6. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational[] PrimaryChromaticities - { - get - { - return GetTagArray("PrimaryChromaticities"); - } - set - { - FreeImage.Resize(ref value, 6); - SetTagValue("PrimaryChromaticities", value); - } - } - - /// - /// Gets or sets the matrix coefficients for transformation from RGB to YCbCr image data. - /// Constant length of 3. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational[] YCbCrCoefficients - { - get - { - return GetTagArray("YCbCrCoefficients"); - } - set - { - FreeImage.Resize(ref value, 3); - SetTagValue("PrimaryChromaticities", value); - } - } - - /// - /// Gets or sets the reference black point value and reference white point value. - /// Constant length of 6. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public FIURational[] ReferenceBlackWhite - { - get - { - return GetTagArray("ReferenceBlackWhite"); - } - set - { - FreeImage.Resize(ref value, 6); - SetTagValue("ReferenceBlackWhite", value); - } - } - - /// - /// Gets or sets the date and time of image creation. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public DateTime? DateTime - { - get - { - DateTime? result = null; - string text = GetTagText("DateTime"); - if (text != null) - { - try - { - result = System.DateTime.ParseExact(text, "yyyy:MM:dd HH:mm:ss\0", null); - } - catch - { - } - } - return result; - } - set - { - string val = null; - if (value.HasValue) - { - try - { - val = value.Value.ToString("yyyy:MM:dd HH:mm:ss\0"); - } - catch - { - } - } - SetTagValue("DateTime", val); - } - } - - /// - /// Gets or sets a string giving the title of the image. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ImageDescription - { - get - { - string result = GetTagText("ImageDescription"); - if (!string.IsNullOrEmpty(result)) - { - result = result.Substring(0, result.Length - 1); - } - return result; - } - set - { - if (value != null) - { - value += '\0'; - } - SetTagValue("ImageDescription", value); - } - } - - /// - /// Gets or sets the manufacturer of the recording equipment. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string Make - { - get - { - string result = GetTagText("Make"); - if (!string.IsNullOrEmpty(result)) - { - result = result.Substring(0, result.Length - 1); - } - return result; - } - set - { - if (value != null) - { - value += '\0'; - } - SetTagValue("Make", value); - } - } - - /// - /// Gets or sets the model name or model number of the equipment. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string EquipmentModel - { - get - { - string result = GetTagText("Model"); - if (!string.IsNullOrEmpty(result)) - { - result = result.Substring(0, result.Length - 1); - } - return result; - } - set - { - if (value != null) - { - value += '\0'; - } - SetTagValue("Model", value); - } - } - - /// - /// Gets or sets the name and version of the software or firmware of the camera - /// or image input device used to generate the image. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string Software - { - get - { - string result = GetTagText("Software"); - if (!string.IsNullOrEmpty(result)) - { - result = result.Substring(0, result.Length - 1); - } - return result; - } - set - { - if (value != null) - { - value += '\0'; - } - SetTagValue("Software", value); - } - } - - /// - /// Gets or sets the name of the camera owner, photographer or image creator. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string Artist - { - get - { - string result = GetTagText("Artist"); - if (!string.IsNullOrEmpty(result)) - { - result = result.Substring(0, result.Length - 1); - } - return result; - } - set - { - if (value != null) - { - value += '\0'; - } - SetTagValue("Artist", value); - } - } - - /// - /// Gets or sets the photographer and editor copyrights. - /// Constant length of 1-2. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string[] Copyright - { - get - { - string[] result = null; - string text = GetTagText("Copyright"); - if (!string.IsNullOrEmpty(text)) - { - result = text.Split(new char[] { '\0' }, StringSplitOptions.RemoveEmptyEntries); - } - return result; - } - set - { - string val = null; - if (value != null) - { - if (value.Length == 1) - { - if (value[0] != null) - { - val = value[0] + '\0'; - } - } - else if (value.Length == 2) - { - if ((value[0] != null) && (value[1] != null)) - { - val = value[0] + '\0' + value[1] + '\0'; - } - } - } - SetTagValue("Copyright", val); - } - } - } - - /// - /// Represents a collection of all tags contained in the metadata model - /// . - /// - public class MDM_MAKERNOTE : MetadataModel - { - /// - /// Initializes a new instance of this class. - /// - /// Handle to a FreeImage bitmap. - public MDM_MAKERNOTE(FIBITMAP dib) : base(dib) { } - - /// - /// Retrieves the datamodel that this instance represents. - /// - public override FREE_IMAGE_MDMODEL Model - { - get { return FREE_IMAGE_MDMODEL.FIMD_EXIF_MAKERNOTE; } - } - } - - /// - /// Represents a collection of all tags contained in the metadata model - /// . - /// - public class MDM_GEOTIFF : MetadataModel - { - /// - /// Initializes a new instance of this class. - /// - /// Handle to a FreeImage bitmap. - public MDM_GEOTIFF(FIBITMAP dib) : base(dib) { } - - /// - /// Retrieves the datamodel that this instance represents. - /// - public override FREE_IMAGE_MDMODEL Model - { - get { return FREE_IMAGE_MDMODEL.FIMD_GEOTIFF; } - } - - /// - /// Gets or sets the value of the GeoTIFF GeoASCIIParamsTag. - /// - /// - /// The GeoASCIIParamsTag is used to store all of the valued - /// GeoKeys, referenced by the property. Since keys - /// defined in the GeoKeyDirectoryTag use offsets into this tag, any special - /// comments may be placed at the beginning of this tag. - /// For the most part, the only keys that are valued are - /// Citation keys, giving documentation and references for obscure - /// projections, datums, etc. - /// - /// Special handling is required for -valued keys. While it - /// is true that TIFF 6.0 permits multiple NULL-delimited strings within a single - /// ASCII tag, the secondary strings might not appear in the output of naive - /// tiffdump programs. For this reason, the NULL delimiter of each ASCII key - /// value shall be converted to a "|" (pipe) character before being installed - /// back into the holding tag, so that a dump of the tag - /// will look like this. - /// - /// AsciiTag="first_value|second_value|etc...last_value|" - /// - /// A baseline GeoTIFF-reader must check for and convert the final "|" pipe - /// character of a key back into a NULL before returning it to the client - /// software. - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public string GeoASCIIParams - { - get - { - string text = GetTagText("GeoASCIIParams"); - if (!string.IsNullOrEmpty(text)) - { - text = text.Substring(0, text.Length - 1); - } - return text; - } - set - { - if (value != null) - { - value += '\0'; - } - SetTagValue("GeoASCIIParams", value); - } - } - - /// - /// Gets or sets the value of the GeoTIFF GeoDoubleParamsTag. - /// - /// - /// The GeoDoubleParamsTag is used to store all of the valued - /// GeoKeys, referenced by the property. The meaning of - /// any value of this double array is determined from the GeoKeyDirectoryTag reference - /// pointing to it. values should first be converted to - /// and stored here. - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public double[] GeoDoubleParams - { - get - { - return GetTagArray("GeoDoubleParams"); - } - set - { - SetTagValue("GeoDoubleParams", value); - } - } - - /// - /// Gets or sets the value of the GeoTIFF GeoKeyDirectoryTag. - /// - /// - /// The GeoKeyDirectoryTag may be used to store the GeoKey Directory, which defines and - /// references the GeoKeys. - /// - /// The tag is an array of unsigned values, which are primarily - /// grouped into blocks of 4. The first 4 values are special, and contain GeoKey directory - /// header information. The header values consist of the following information, in order: - /// - /// Header={KeyDirectoryVersion, KeyRevision, MinorRevision, NumberOfKeys} - /// - /// where - /// - /// KeyDirectoryVersion indicates the current version of Key implementation, and will - /// only change if this Tag's Key structure is changed. (Similar to the TIFFVersion (42)). - /// The current DirectoryVersion number is 1. This value will most likely never change, - /// and may be used to ensure that this is a valid Key-implementation. - /// - /// KeyRevision indicates what revision of Key-Sets are used. - /// - /// MinorRevision indicates what set of Key-Codes are used. The complete revision number - /// is denoted <KeyRevision>.<MinorRevision>. - /// - /// NumberOfKeys indicates how many Keys are defined by the rest of this Tag. - /// - /// This header is immediately followed by a collection of <NumberOfKeys> KeyEntry - /// sets, each of which is also 4- long. Each KeyEntry is modeled on the - /// TIFFEntry format of the TIFF directory header, and is of the form: - /// - /// KeyEntry = { KeyID, TIFFTagLocation, Count, Value_Offset } - /// - /// where - /// - /// KeyID gives the Key-ID value of the Key (identical in function to TIFF tag ID, - /// but completely independent of TIFF tag-space), - /// - /// TIFFTagLocation indicates which TIFF tag contains the value(s) of the Key: if - /// TIFFTagLocation is 0, then the value is , and is contained in the - /// Value_Offset entry. Otherwise, the type (format) of the value is implied by the - /// TIFF-Type of the tag containing the value. - /// - /// Count indicates the number of values in this key. - /// - /// Value_Offset Value_Offset indicates the index-offset into the TagArray indicated - /// by TIFFTagLocation, if it is nonzero. If TIFFTagLocation is 0 (zero) , then Value_Offset - /// contains the actual () value of the Key, and Count=1 is implied. - /// Note that the offset is not a byte-offset, but rather an index based on the natural data - /// type of the specified tag array. - /// - /// Following the KeyEntry definitions, the KeyDirectory tag may also contain additional - /// values. For example, if a key requires multiple values, they shall - /// be placed at the end of this tag, and the KeyEntry will set - /// TIFFTagLocation=GeoKeyDirectoryTag, with the Value_Offset pointing to the location of the - /// value(s). - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public ushort[] GeoKeyDirectory - { - get - { - return GetTagArray("GeoKeyDirectory"); - } - set - { - SetTagValue("GeoKeyDirectory", value); - } - } - - /// - /// Gets or sets the value of the GeoTIFF ModelPixelScaleTag. - /// - /// - /// The ModelPixelScaleTag tag may be used to specify the size of raster pixel spacing - /// in the model space units, when the raster space can be embedded in the model space - /// coordinate system without rotation, and consists of the following 3 values: - /// - /// ModelPixelScaleTag = (ScaleX, ScaleY, ScaleZ) - /// - /// where ScaleX and ScaleY give the horizontal and vertical spacing of - /// raster pixels. The ScaleZ is primarily used to map the pixel value of a - /// digital elevation model into the correct Z-scale, and so for most other purposes - /// this value should be zero (since most model spaces are 2-D, with Z=0). - /// - /// A single tiepoint in the tag, together with this tag, - /// completely determine the relationship between raster and model space; thus they - /// comprise the two tags which Baseline GeoTIFF files most often will use to place a - /// raster image into a "standard position" in model space. - /// - /// Like the tag, this tag information is independent of the - /// XPosition, YPosition, Resolution and Orientation tags of the standard TIFF 6.0 spec. - /// However, simple reversals of orientation between raster and model space - /// (e.g. horizontal or vertical flips) may be indicated by reversal of sign in the - /// corresponding component of the ModelPixelScaleTag. GeoTIFF compliant readers must - /// honor this signreversal convention. - /// - /// This tag must not be used if the raster image requires rotation or shearing to place - /// it into the standard model space. In such cases the transformation shall be defined - /// with the more general . - /// - ///
Naming differences - /// In the native FreeImage library and thus, in the FreeImage API documentation, this - /// property's key is named GeoPixelScale. Since the GeoTIFF specification - /// as well as Java's EXIFTIFFTagSet class call this tag - /// , this property was renamed accordingly. - /// However, when accessing this property's tag by its object, - /// the native FreeImage tag key GeoPixelScale must be used. - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public double[] ModelPixelScale - { - get - { - return GetTagArray("GeoPixelScale"); - } - set - { - SetTagValue("GeoPixelScale", value); - } - } - - /// - /// Gets or sets the value of the GeoTIFF GeoTiePointsTag. - /// - /// - /// The GeoTiePointsTag stores raster -> model tiepoint pairs in the order - /// - /// ModelTiePoints = (...,I,J,K, X,Y,Z...), - /// - /// where (I,J,K) is the point at location (I,J) in raster space with - /// pixel-value K, and (X,Y,Z) is a vector in model space. In most cases - /// the model space is only two-dimensional, in which case both K and Z should be set - /// to zero; this third dimension is provided in anticipation of future support for 3D - /// digital elevation models and vertical coordinate systems. - /// - /// A raster image may be georeferenced simply by specifying its location, size and - /// orientation in the model coordinate space M. This may be done by specifying the - /// location of three of the four bounding corner points. However, tiepoints are only - /// to be considered exact at the points specified; thus defining such a set of - /// bounding tiepoints does not imply that the model space locations of the interior - /// of the image may be exactly computed by a linear interpolation of these tiepoints. - /// - /// However, since the relationship between the Raster space and the model space will - /// often be an exact, affine transformation, this relationship can be defined using - /// one set of tiepoints and the , described below, which - /// gives the vertical and horizontal raster grid cell size, specified in model units. - /// - /// If possible, the first tiepoint placed in this tag shall be the one establishing - /// the location of the point (0,0) in raster space. However, if this is not possible - /// (for example, if (0,0) is goes to a part of model space in which the projection is - /// ill-defined), then there is no particular order in which the tiepoints need be - /// listed. - /// - /// For orthorectification or mosaicking applications a large number of tiepoints may - /// be specified on a mesh over the raster image. However, the definition of associated - /// grid interpolation methods is not in the scope of the current GeoTIFF spec. - /// - ///
Naming differences - /// In the native FreeImage library and thus, in the FreeImage API documentation, this - /// property's key is named GeoTiePoints. Since the GeoTIFF specification - /// as well as Java's EXIFTIFFTagSet class call this tag - /// , this property was renamed accordingly. - /// However, when accessing this property's tag by its object, - /// the native FreeImage tag key GeoTiePoints must be used. - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public double[] ModelTiePoints - { - get - { - return GetTagArray("GeoTiePoints"); - } - set - { - SetTagValue("GeoTiePoints", value); - } - } - - /// - /// Gets or sets the value of the GeoTIFF ModelTransformationMatrixTag. - /// - /// - /// This tag may be used to specify the transformation matrix between the raster space - /// (and its dependent pixel-value space) and the (possibly 3D) model space. - /// - ///
Naming differences - /// In the native FreeImage library and thus, in the FreeImage API documentation, this - /// property's key is named GeoTransformationMatrix. Since the GeoTIFF specification - /// as well as Java's EXIFTIFFTagSet class call this tag - /// , this property was renamed accordingly. - /// However, when accessing this property's tag by its object, - /// the native FreeImage tag key GeoTransformationMatrix must be used. - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public double[] ModelTransformationMatrix - { - get - { - return GetTagArray("GeoTransformationMatrix"); - } - set - { - SetTagValue("GeoTransformationMatrix", value); - } - } - - /// - /// Gets or sets the value of the GeoTIFF IntergraphTransformationMatrixTag. - /// - /// - /// The IntergraphTransformationMatrixTag conflicts with an internal software implementation - /// at Intergraph, and so its use is no longer encouraged. A GeoTIFF reader should look first - /// for the new tag, and only if it is not found should it check for this older tag. If found, - /// it should only consider it to be contain valid GeoTIFF matrix information if the tag-count - /// is 16; the Intergraph version uses 17 values. - /// - ///
Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - ///
- public double[] IntergraphTransformationMatrix - { - get - { - return GetTagArray("Intergraph TransformationMatrix"); - } - set - { - SetTagValue("Intergraph TransformationMatrix", value); - } - } - - /// - /// Gets or sets the value of the GeoTIFF JPLCartoIFDOffsetTag. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public uint? JPLCartoIFDOffset - { - get - { - return GetTagValue("JPL Carto IFD offset"); - } - set - { - SetTagValue("JPL Carto IFD offset", value); - } - } - } - - /// - /// Represents a collection of all tags contained in the metadata model - /// . - /// - public class MDM_IPTC : MetadataModel - { - /// - /// Initializes a new instance of this class. - /// - /// Handle to a FreeImage bitmap. - public MDM_IPTC(FIBITMAP dib) : base(dib) { } - - /// - /// Retrieves the datamodel that this instance represents. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public override FREE_IMAGE_MDMODEL Model - { - get { return FREE_IMAGE_MDMODEL.FIMD_IPTC; } - } - - /// - /// Gets the Application Record Version. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public short? ApplicationRecordVersion - { - get - { - return GetTagValue("ApplicationRecordVersion"); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Object Type Reference. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ObjectTypeReference - { - get - { - return GetTagText("ObjectTypeReference"); - } - set - { - SetTagValue("ObjectTypeReference", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Object Attribute Reference. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ObjectAttributeReference - { - get - { - return GetTagText("ObjectAttributeReference"); - } - set - { - SetTagValue("ObjectAttributeReference", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Object Name. - /// This is also referred to as Title. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ObjectName - { - get - { - return GetTagText("ObjectName"); - } - set - { - SetTagValue("ObjectName", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Edit Status. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string EditStatus - { - get - { - return GetTagText("EditStatus"); - } - set - { - SetTagValue("EditStatus", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Editorial Update. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string EditorialUpdate - { - get - { - return GetTagText("EditorialUpdate"); - } - set - { - SetTagValue("EditorialUpdate", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Urgency. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string Urgency - { - get - { - return GetTagText("Urgency"); - } - set - { - SetTagValue("Urgency", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Subject Reference. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string SubjectReference - { - get - { - return GetTagText("SubjectReference"); - } - set - { - SetTagValue("SubjectReference", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Category. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string Category - { - get - { - return GetTagText("Category"); - } - set - { - SetTagValue("Category", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Supplemental Categories. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string SupplementalCategories - { - get - { - return GetTagText("SupplementalCategories"); - } - set - { - SetTagValue("SupplementalCategories", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Fixture Identifier. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string FixtureIdentifier - { - get - { - return GetTagText("FixtureIdentifier"); - } - set - { - SetTagValue("FixtureIdentifier", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Keywords. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string Keywords - { - get - { - return GetTagText("Keywords"); - } - set - { - SetTagValue("Keywords", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Content Location Code. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ContentLocationCode - { - get - { - return GetTagText("ContentLocationCode"); - } - set - { - SetTagValue("ContentLocationCode", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Content Location Name. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ContentLocationName - { - get - { - return GetTagText("ContentLocationName"); - } - set - { - SetTagValue("ContentLocationName", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Release Date. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ReleaseDate - { - get - { - return GetTagText("ReleaseDate"); - } - set - { - SetTagValue("ReleaseDate", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Release Time. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ReleaseTime - { - get - { - return GetTagText("ReleaseTime"); - } - set - { - SetTagValue("ReleaseTime", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Expiration Date. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ExpirationDate - { - get - { - return GetTagText("ExpirationDate"); - } - set - { - SetTagValue("ExpirationDate", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Expiration Time. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ExpirationTime - { - get - { - return GetTagText("ExpirationTime"); - } - set - { - SetTagValue("ExpirationTime", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Special Instructions. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string SpecialInstructions - { - get - { - return GetTagText("SpecialInstructions"); - } - set - { - SetTagValue("SpecialInstructions", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Action Advised. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ActionAdvised - { - get - { - return GetTagText("ActionAdvised"); - } - set - { - SetTagValue("ActionAdvised", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Reference Service. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ReferenceService - { - get - { - return GetTagText("ReferenceService"); - } - set - { - SetTagValue("ReferenceService", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Reference Date. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ReferenceDate - { - get - { - return GetTagText("ReferenceDate"); - } - set - { - SetTagValue("ReferenceDate", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Reference Number. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ReferenceNumber - { - get - { - return GetTagText("ReferenceNumber"); - } - set - { - SetTagValue("ReferenceNumber", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Date Created. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string DateCreated - { - get - { - return GetTagText("DateCreated"); - } - set - { - SetTagValue("DateCreated", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Time Created. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string TimeCreated - { - get - { - return GetTagText("TimeCreated"); - } - set - { - SetTagValue("TimeCreated", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Digital Creation Date. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string DigitalCreationDate - { - get - { - return GetTagText("DigitalCreationDate"); - } - set - { - SetTagValue("DigitalCreationDate", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Digital Creation Time. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string DigitalCreationTime - { - get - { - return GetTagText("DigitalCreationTime"); - } - set - { - SetTagValue("DigitalCreationTime", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Originating Program. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string OriginatingProgram - { - get - { - return GetTagText("OriginatingProgram"); - } - set - { - SetTagValue("OriginatingProgram", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Program Version. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ProgramVersion - { - get - { - return GetTagText("ProgramVersion"); - } - set - { - SetTagValue("ProgramVersion", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Object Cycle. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ObjectCycle - { - get - { - return GetTagText("ObjectCycle"); - } - set - { - SetTagValue("ObjectCycle", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag By Line. - /// This is the author's name. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ByLine - { - get - { - return GetTagText("By-line"); - } - set - { - SetTagValue("By-line", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag By Line Title. - /// This is the author's position. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ByLineTitle - { - get - { - return GetTagText("By-lineTitle"); - } - set - { - SetTagValue("By-lineTitle", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag City. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string City - { - get - { - return GetTagText("City"); - } - set - { - SetTagValue("City", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Sub Location. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string SubLocation - { - get - { - return GetTagText("SubLocation"); - } - set - { - SetTagValue("SubLocation", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Province State. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ProvinceState - { - get - { - return GetTagText("ProvinceState"); - } - set - { - SetTagValue("ProvinceState", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Country Primary Location Code. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string CountryPrimaryLocationCode - { - get - { - return GetTagText("Country-PrimaryLocationCode"); - } - set - { - SetTagValue("Country-PrimaryLocationCode", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Country Primary Location Name. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string CountryPrimaryLocationName - { - get - { - return GetTagText("Country-PrimaryLocationName"); - } - set - { - SetTagValue("Country-PrimaryLocationName", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Original Transmission Reference. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string OriginalTransmissionReference - { - get - { - return GetTagText("OriginalTransmissionReference"); - } - set - { - SetTagValue("OriginalTransmissionReference", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Headline. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string Headline - { - get - { - return GetTagText("Headline"); - } - set - { - SetTagValue("Headline", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Credit. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string Credit - { - get - { - return GetTagText("Credit"); - } - set - { - SetTagValue("Credit", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Source. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string Source - { - get - { - return GetTagText("Source"); - } - set - { - SetTagValue("Source", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Copyright Notice. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string CopyrightNotice - { - get - { - return GetTagText("CopyrightNotice"); - } - set - { - SetTagValue("CopyrightNotice", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Contact. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string Contact - { - get - { - return GetTagText("Contact"); - } - set - { - SetTagValue("Contact", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Caption Abstract. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string CaptionAbstract - { - get - { - return GetTagText("CaptionAbstract"); - } - set - { - SetTagValue("CaptionAbstract", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Writer Editor. - /// This is also referred to as Caption Writer. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string WriterEditor - { - get - { - return GetTagText("WriterEditor"); - } - set - { - SetTagValue("WriterEditor", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Rasterized Caption. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string RasterizedCaption - { - get - { - return GetTagText("RasterizedCaption"); - } - set - { - SetTagValue("RasterizedCaption", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Image Type. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ImageType - { - get - { - return GetTagText("ImageType"); - } - set - { - SetTagValue("ImageType", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Image Orientation. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ImageOrientation - { - get - { - return GetTagText("ImageOrientation"); - } - set - { - SetTagValue("ImageOrientation", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Language Identifier. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string LanguageIdentifier - { - get - { - return GetTagText("LanguageIdentifier"); - } - set - { - SetTagValue("LanguageIdentifier", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Audio Type. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string AudioType - { - get - { - return GetTagText("AudioType"); - } - set - { - SetTagValue("AudioType", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Audio Sampling Rate. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string AudioSamplingRate - { - get - { - return GetTagText("AudioSamplingRate"); - } - set - { - SetTagValue("AudioSamplingRate", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Audio Sampling Resolution. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string AudioSamplingResolution - { - get - { - return GetTagText("AudioSamplingResolution"); - } - set - { - SetTagValue("AudioSamplingResolution", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Audio Duration. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string AudioDuration - { - get - { - return GetTagText("AudioDuration"); - } - set - { - SetTagValue("AudioDuration", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Audio Outcue. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string AudioOutcue - { - get - { - return GetTagText("AudioOutcue"); - } - set - { - SetTagValue("AudioOutcue", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Job I D. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string JobID - { - get - { - return GetTagText("JobID"); - } - set - { - SetTagValue("JobID", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Master Document I D. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string MasterDocumentID - { - get - { - return GetTagText("MasterDocumentID"); - } - set - { - SetTagValue("MasterDocumentID", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Short Document I D. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ShortDocumentID - { - get - { - return GetTagText("ShortDocumentID"); - } - set - { - SetTagValue("ShortDocumentID", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Unique Document I D. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string UniqueDocumentID - { - get - { - return GetTagText("UniqueDocumentID"); - } - set - { - SetTagValue("UniqueDocumentID", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Owner I D. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string OwnerID - { - get - { - return GetTagText("OwnerID"); - } - set - { - SetTagValue("OwnerID", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Object Preview File Format. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ObjectPreviewFileFormat - { - get - { - return GetTagText("ObjectPreviewFileFormat"); - } - set - { - SetTagValue("ObjectPreviewFileFormat", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Object Preview File Version. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ObjectPreviewFileVersion - { - get - { - return GetTagText("ObjectPreviewFileVersion"); - } - set - { - SetTagValue("ObjectPreviewFileVersion", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Object Preview Data. - /// This is also referred to as Audio Outcue. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ObjectPreviewData - { - get - { - return GetTagText("ObjectPreviewData"); - } - set - { - SetTagValue("ObjectPreviewData", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Prefs. - /// This is also referred to as photo-mechanic preferences. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string Prefs - { - get - { - return GetTagText("Prefs"); - } - set - { - SetTagValue("Prefs", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Classify State. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ClassifyState - { - get - { - return GetTagText("ClassifyState"); - } - set - { - SetTagValue("ClassifyState", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Similarity Index. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string SimilarityIndex - { - get - { - return GetTagText("SimilarityIndex"); - } - set - { - SetTagValue("SimilarityIndex", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Document Notes. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string DocumentNotes - { - get - { - return GetTagText("DocumentNotes"); - } - set - { - SetTagValue("DocumentNotes", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Document History. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string DocumentHistory - { - get - { - return GetTagText("DocumentHistory"); - } - set - { - SetTagValue("DocumentHistory", value); - } - } - - /// - /// Gets or sets the value of the IPTC/NAA tag Exif Camera Info. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string ExifCameraInfo - { - get - { - return GetTagText("ExifCameraInfo"); - } - set - { - SetTagValue("ExifCameraInfo", value); - } - } - } - - /// - /// Represents a collection of all tags contained in the metadata model - /// . - /// - public class MDM_NODATA : MetadataModel - { - /// - /// Initializes a new instance of this class. - /// - /// Handle to a FreeImage bitmap. - public MDM_NODATA(FIBITMAP dib) : base(dib) { } - - /// - /// Retrieves the datamodel that this instance represents. - /// - public override FREE_IMAGE_MDMODEL Model - { - get { return FREE_IMAGE_MDMODEL.FIMD_NODATA; } - } - } - - /// - /// Represents a collection of all tags contained in the metadata model - /// . - /// - public class MDM_XMP : MetadataModel - { - /// - /// Initializes a new instance of this class. - /// - /// Handle to a FreeImage bitmap. - public MDM_XMP(FIBITMAP dib) : base(dib) { } - - /// - /// Retrieves the datamodel that this instance represents. - /// - public override FREE_IMAGE_MDMODEL Model - { - get { return FREE_IMAGE_MDMODEL.FIMD_XMP; } - } - - /// - /// Gets or sets the XMP XML content. - /// - /// - /// Handling of null values - /// A null value indicates, that the corresponding metadata tag is not - /// present in the metadata model. - /// Setting this property's value to a non-null reference creates the - /// metadata tag if necessary. - /// Setting this property's value to a null reference deletes the - /// metadata tag from the metadata model. - /// - public string Xml - { - get - { - return GetTagText("XMLPacket"); - } - set - { - SetTagValue("XMLPacket", value); - } - } - - /// - /// Gets an initialized to read the XMP XML content. - /// Returns null, if the metadata tag XMLPacket is not present in - /// this model. - /// - public XmlReader XmlReader - { - get - { - string xmlString = Xml; - if (xmlString == null) - { - return null; - } - else - { - MemoryStream stream = new MemoryStream(); - StreamWriter writer = new StreamWriter(stream); - writer.Write(xmlString); - return XmlReader.Create(stream); - } - } - } - } -} - - #endregion - -namespace FreeImageAPI.Metadata -{ - /// - /// Manages metadata objects and operations. - /// - public sealed class MetadataTag : IComparable, IComparable, ICloneable, IEquatable, IDisposable - { - /// - /// The encapsulated FreeImage-tag. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - internal FITAG tag; - - /// - /// The metadata model of . - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private FREE_IMAGE_MDMODEL model; - - /// - /// Indicates whether this instance has already been disposed. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private bool disposed = false; - - /// - /// Indicates whether this instance was created by FreeImage or - /// by the user. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private bool selfCreated; - - /// - /// List linking metadata-model and Type. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly Dictionary idList; - - /// - /// List linking Type and metadata-model. - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly Dictionary typeList; - - /// - /// Initializes a new instance of this class. - /// - private MetadataTag() - { - } - - /// - /// Initializes a new instance of this class. - /// - /// The new model the tag should be of. - public MetadataTag(FREE_IMAGE_MDMODEL model) - { - this.model = model; - tag = FreeImage.CreateTag(); - selfCreated = true; - - if (model == FREE_IMAGE_MDMODEL.FIMD_XMP) - { - Key = "XMLPacket"; - } - } - - /// - /// Initializes a new instance of this class. - /// - /// The to represent. - /// The bitmap was extracted from. - public MetadataTag(FITAG tag, FIBITMAP dib) - { - if (tag.IsNull) - { - throw new ArgumentNullException("tag"); - } - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - this.tag = tag; - model = GetModel(dib, tag); - selfCreated = false; - - if (model == FREE_IMAGE_MDMODEL.FIMD_XMP) - { - Key = "XMLPacket"; - } - } - - /// - /// Initializes a new instance of this class. - /// - /// The to represent. - /// The model of . - public MetadataTag(FITAG tag, FREE_IMAGE_MDMODEL model) - { - if (tag.IsNull) - { - throw new ArgumentNullException("tag"); - } - this.tag = tag; - this.model = model; - selfCreated = false; - - if (model == FREE_IMAGE_MDMODEL.FIMD_XMP) - { - Key = "XMLPacket"; - } - } - - static MetadataTag() - { - idList = new Dictionary(); - idList.Add(FREE_IMAGE_MDTYPE.FIDT_BYTE, typeof(byte)); - idList.Add(FREE_IMAGE_MDTYPE.FIDT_SHORT, typeof(ushort)); - idList.Add(FREE_IMAGE_MDTYPE.FIDT_LONG, typeof(uint)); - idList.Add(FREE_IMAGE_MDTYPE.FIDT_RATIONAL, typeof(FIURational)); - idList.Add(FREE_IMAGE_MDTYPE.FIDT_SBYTE, typeof(sbyte)); - idList.Add(FREE_IMAGE_MDTYPE.FIDT_UNDEFINED, typeof(byte)); - idList.Add(FREE_IMAGE_MDTYPE.FIDT_SSHORT, typeof(short)); - idList.Add(FREE_IMAGE_MDTYPE.FIDT_SLONG, typeof(int)); - idList.Add(FREE_IMAGE_MDTYPE.FIDT_SRATIONAL, typeof(FIRational)); - idList.Add(FREE_IMAGE_MDTYPE.FIDT_FLOAT, typeof(float)); - idList.Add(FREE_IMAGE_MDTYPE.FIDT_DOUBLE, typeof(double)); - idList.Add(FREE_IMAGE_MDTYPE.FIDT_IFD, typeof(uint)); - idList.Add(FREE_IMAGE_MDTYPE.FIDT_PALETTE, typeof(RGBQUAD)); - - typeList = new Dictionary(); - typeList.Add(typeof(ushort), FREE_IMAGE_MDTYPE.FIDT_SHORT); - typeList.Add(typeof(ushort[]), FREE_IMAGE_MDTYPE.FIDT_SHORT); - typeList.Add(typeof(string), FREE_IMAGE_MDTYPE.FIDT_ASCII); - typeList.Add(typeof(uint), FREE_IMAGE_MDTYPE.FIDT_LONG); - typeList.Add(typeof(uint[]), FREE_IMAGE_MDTYPE.FIDT_LONG); - typeList.Add(typeof(FIURational), FREE_IMAGE_MDTYPE.FIDT_RATIONAL); - typeList.Add(typeof(FIURational[]), FREE_IMAGE_MDTYPE.FIDT_RATIONAL); - typeList.Add(typeof(sbyte), FREE_IMAGE_MDTYPE.FIDT_SBYTE); - typeList.Add(typeof(sbyte[]), FREE_IMAGE_MDTYPE.FIDT_SBYTE); - typeList.Add(typeof(byte), FREE_IMAGE_MDTYPE.FIDT_BYTE); - typeList.Add(typeof(byte[]), FREE_IMAGE_MDTYPE.FIDT_BYTE); - typeList.Add(typeof(short), FREE_IMAGE_MDTYPE.FIDT_SSHORT); - typeList.Add(typeof(short[]), FREE_IMAGE_MDTYPE.FIDT_SSHORT); - typeList.Add(typeof(int), FREE_IMAGE_MDTYPE.FIDT_SLONG); - typeList.Add(typeof(int[]), FREE_IMAGE_MDTYPE.FIDT_SLONG); - typeList.Add(typeof(FIRational), FREE_IMAGE_MDTYPE.FIDT_SRATIONAL); - typeList.Add(typeof(FIRational[]), FREE_IMAGE_MDTYPE.FIDT_SRATIONAL); - typeList.Add(typeof(float), FREE_IMAGE_MDTYPE.FIDT_FLOAT); - typeList.Add(typeof(float[]), FREE_IMAGE_MDTYPE.FIDT_FLOAT); - typeList.Add(typeof(double), FREE_IMAGE_MDTYPE.FIDT_DOUBLE); - typeList.Add(typeof(double[]), FREE_IMAGE_MDTYPE.FIDT_DOUBLE); - typeList.Add(typeof(RGBQUAD), FREE_IMAGE_MDTYPE.FIDT_PALETTE); - typeList.Add(typeof(RGBQUAD[]), FREE_IMAGE_MDTYPE.FIDT_PALETTE); - } - - /// - /// Releases all resources used by the instance. - /// - ~MetadataTag() - { - Dispose(); - } - - /// - /// Determines whether two specified objects have the same value. - /// - /// A or a null reference (Nothing in Visual Basic). - /// A or a null reference (Nothing in Visual Basic). - /// - /// true if the value of left is the same as the value of right; otherwise, false. - /// - public static bool operator ==(MetadataTag left, MetadataTag right) - { - // Check whether both are null - if ((object)left == (object)right) - { - return true; - } - else if ((object)left == null || (object)right == null) - { - return false; - } - left.CheckDisposed(); - right.CheckDisposed(); - // Check all properties - if ((left.Key != right.Key) || - (left.ID != right.ID) || - (left.Description != right.Description) || - (left.Count != right.Count) || - (left.Length != right.Length) || - (left.Model != right.Model) || - (left.Type != right.Type)) - { - return false; - } - if (left.Length == 0) - { - return true; - } - IntPtr ptr1 = FreeImage.GetTagValue(left.tag); - IntPtr ptr2 = FreeImage.GetTagValue(right.tag); - return FreeImage.CompareMemory(ptr1, ptr2, left.Length); - } - - /// - /// Determines whether two specified objects have different values. - /// - /// A or a null reference (Nothing in Visual Basic). - /// A or a null reference (Nothing in Visual Basic). - /// - /// true if the value of left is different from the value of right; otherwise, false. - /// - public static bool operator !=(MetadataTag left, MetadataTag right) - { - return !(left == right); - } - - /// - /// Extracts the value of a instance to a handle. - /// - /// A instance. - /// A new instance of initialized to . - public static implicit operator FITAG(MetadataTag value) - { - return value.tag; - } - - private static FREE_IMAGE_MDMODEL GetModel(FIBITMAP dib, FITAG tag) - { - FITAG value; - foreach (FREE_IMAGE_MDMODEL model in FreeImage.FREE_IMAGE_MDMODELS) - { - FIMETADATA mData = FreeImage.FindFirstMetadata(model, dib, out value); - if (mData.IsNull) - { - continue; - } - try - { - do - { - if (value == tag) - { - return model; - } - } - while (FreeImage.FindNextMetadata(mData, out value)); - } - finally - { - if (!mData.IsNull) - { - FreeImage.FindCloseMetadata(mData); - } - } - } - throw new ArgumentException("'tag' is no metadata object of 'dib'"); - } - - /// - /// Gets the model of the metadata. - /// - public FREE_IMAGE_MDMODEL Model - { - get { CheckDisposed(); return model; } - } - - /// - /// Gets or sets the key of the metadata. - /// - public string Key - { - get { CheckDisposed(); return FreeImage.GetTagKey(tag); } - set - { - CheckDisposed(); - if ((model != FREE_IMAGE_MDMODEL.FIMD_XMP) || (value == "XMLPacket")) - { - FreeImage.SetTagKey(tag, value); - } - } - } - - /// - /// Gets or sets the description of the metadata. - /// - public string Description - { - get { CheckDisposed(); return FreeImage.GetTagDescription(tag); } - set { CheckDisposed(); FreeImage.SetTagDescription(tag, value); } - } - - /// - /// Gets or sets the ID of the metadata. - /// - public ushort ID - { - get { CheckDisposed(); return FreeImage.GetTagID(tag); } - set { CheckDisposed(); FreeImage.SetTagID(tag, value); } - } - - /// - /// Gets the type of the metadata. - /// - public FREE_IMAGE_MDTYPE Type - { - get { CheckDisposed(); return FreeImage.GetTagType(tag); } - internal set { FreeImage.SetTagType(tag, value); } - } - - /// - /// Gets the number of elements the metadata object contains. - /// - public uint Count - { - get { CheckDisposed(); return FreeImage.GetTagCount(tag); } - private set { FreeImage.SetTagCount(tag, value); } - } - - /// - /// Gets the length of the value in bytes. - /// - public uint Length - { - get { CheckDisposed(); return FreeImage.GetTagLength(tag); } - private set { FreeImage.SetTagLength(tag, value); } - } - - private unsafe byte[] GetData() - { - uint length = Length; - byte[] value = new byte[length]; - byte* ptr = (byte*)FreeImage.GetTagValue(tag); - for (int i = 0; i < length; i++) - { - value[i] = ptr[i]; - } - return value; - } - - /// - /// Gets or sets the value of the metadata. - /// - public object Value - { - get - { - unsafe - { - CheckDisposed(); - int cnt = (int)Count; - - if (Type == FREE_IMAGE_MDTYPE.FIDT_ASCII) - { - byte* value = (byte*)FreeImage.GetTagValue(tag); - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < cnt; i++) - { - sb.Append(Convert.ToChar(value[i])); - } - return sb.ToString(); - } - else if (Type == FREE_IMAGE_MDTYPE.FIDT_NOTYPE) - { - return null; - } - - Array array = Array.CreateInstance(idList[Type], Count); - void* src = (void*)FreeImage.GetTagValue(tag); - FreeImage.CopyMemory(array, src, Length); - return array; - } - } - set - { - SetValue(value); - } - } - - /// - /// Sets the value of the metadata. - /// In case value is of byte or byte[] is assumed. - /// In case value is of uint or uint[] is assumed. - /// - /// New data of the metadata. - /// True on success, false on failure. - /// - /// The data format is not supported. - /// - /// is null. - public bool SetValue(object value) - { - Type type = value.GetType(); - if (!typeList.ContainsKey(type)) - { - throw new NotSupportedException("The type of value is not supported"); - } - return SetValue(value, typeList[type]); - } - - /// - /// Sets the value of the metadata. - /// - /// New data of the metadata. - /// Type of the data. - /// True on success, false on failure. - /// - /// The data type is not supported. - /// - /// is null. - /// - /// and to not fit. - public bool SetValue(object value, FREE_IMAGE_MDTYPE type) - { - CheckDisposed(); - if ((!value.GetType().IsArray) && (!(value is string))) - { - Array array = Array.CreateInstance(value.GetType(), 1); - array.SetValue(value, 0); - return SetArrayValue(array, type); - } - return SetArrayValue(value, type); - } - - /// - /// Sets the value of this tag to the value of - /// using the given type. - /// - /// New value of the tag. - /// Data-type of the tag. - /// - /// - /// is a null reference. - /// - /// - /// is FIDT_ASCII and - /// is not String. - /// is not FIDT_ASCII and - /// is not Array. - /// - /// is FIDT_NOTYPE. - private unsafe bool SetArrayValue(object value, FREE_IMAGE_MDTYPE type) - { - if (value == null) - { - throw new ArgumentNullException("value"); - } - - byte[] data = null; - - if (type == FREE_IMAGE_MDTYPE.FIDT_ASCII) - { - string tempValue = value as string; - if (tempValue == null) - { - throw new ArgumentException("value"); - } - Type = type; - Length = Count = (uint)tempValue.Length; - data = new byte[Length]; - - for (int i = 0; i < tempValue.Length; i++) - { - data[i] = (byte)tempValue[i]; - } - } - else if (type == FREE_IMAGE_MDTYPE.FIDT_NOTYPE) - { - throw new NotSupportedException("type is not supported."); - } - else - { - Array array = value as Array; - if (array == null) - { - throw new ArgumentException("value"); - } - - if (array.Length != 0) - if (!CheckType(array.GetValue(0).GetType(), type)) - throw new ArgumentException("The type of value is incorrect."); - - Type = type; - Count = (uint)array.Length; - Length = (uint)(array.Length * Marshal.SizeOf(idList[type])); - data = new byte[Length]; - FreeImage.CopyMemory(data, array, Length); - } - - return FreeImage.SetTagValue(tag, data); - } - - private static bool CheckType(Type dataType, FREE_IMAGE_MDTYPE type) - { - if (dataType != null) - switch (type) - { - case FREE_IMAGE_MDTYPE.FIDT_ASCII: - return dataType == typeof(string); - case FREE_IMAGE_MDTYPE.FIDT_BYTE: - return dataType == typeof(byte); - case FREE_IMAGE_MDTYPE.FIDT_DOUBLE: - return dataType == typeof(double); - case FREE_IMAGE_MDTYPE.FIDT_FLOAT: - return dataType == typeof(float); - case FREE_IMAGE_MDTYPE.FIDT_IFD: - return dataType == typeof(uint); - case FREE_IMAGE_MDTYPE.FIDT_LONG: - return dataType == typeof(uint); - case FREE_IMAGE_MDTYPE.FIDT_NOTYPE: - return false; - case FREE_IMAGE_MDTYPE.FIDT_PALETTE: - return dataType == typeof(RGBQUAD); - case FREE_IMAGE_MDTYPE.FIDT_RATIONAL: - return dataType == typeof(FIURational); - case FREE_IMAGE_MDTYPE.FIDT_SBYTE: - return dataType == typeof(sbyte); - case FREE_IMAGE_MDTYPE.FIDT_SHORT: - return dataType == typeof(ushort); - case FREE_IMAGE_MDTYPE.FIDT_SLONG: - return dataType == typeof(int); - case FREE_IMAGE_MDTYPE.FIDT_SRATIONAL: - return dataType == typeof(FIRational); - case FREE_IMAGE_MDTYPE.FIDT_SSHORT: - return dataType == typeof(short); - case FREE_IMAGE_MDTYPE.FIDT_UNDEFINED: - return dataType == typeof(byte); - } - return false; - } - - /// - /// Add this metadata to an image. - /// - /// Handle to a FreeImage bitmap. - /// True on success, false on failure. - public bool AddToImage(FIBITMAP dib) - { - CheckDisposed(); - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - if (Key == null) - { - throw new ArgumentNullException("Key"); - } - if (!selfCreated) - { - tag = FreeImage.CloneTag(tag); - if (tag.IsNull) - { - throw new Exception("FreeImage.CloneTag() failed."); - } - selfCreated = true; - } - if (!FreeImage.SetMetadata(Model, dib, Key, tag)) - { - return false; - } - FREE_IMAGE_MDMODEL _model = Model; - string _key = Key; - selfCreated = false; - FreeImage.DeleteTag(tag); - return FreeImage.GetMetadata(_model, dib, _key, out tag); - } - - /// - /// Gets a .NET PropertyItem for this metadata tag. - /// - /// The .NET PropertyItem. - public unsafe System.Drawing.Imaging.PropertyItem GetPropertyItem() - { - System.Drawing.Imaging.PropertyItem item = FreeImage.CreatePropertyItem(); - item.Id = ID; - item.Len = (int)Length; - item.Type = (short)Type; - FreeImage.CopyMemory(item.Value = new byte[item.Len], FreeImage.GetTagValue(tag), item.Len); - return item; - } - - /// - /// Converts the value of the object - /// to its equivalent string representation. - /// - /// The string representation of the value of this instance. - public override string ToString() - { - CheckDisposed(); - string fiString = FreeImage.TagToString(model, tag, 0); - - if (String.IsNullOrEmpty(fiString)) - { - return tag.ToString(); - } - else - { - return fiString; - } - } - - /// - /// Creates a deep copy of this . - /// - /// A deep copy of this . - public object Clone() - { - CheckDisposed(); - MetadataTag clone = new MetadataTag(); - clone.model = model; - clone.tag = FreeImage.CloneTag(tag); - clone.selfCreated = true; - return clone; - } - - /// - /// Tests whether the specified object is a instance - /// and is equivalent to this instance. - /// - /// The object to test. - /// true if is a instance - /// equivalent to this instance; otherwise, false. - public override bool Equals(object obj) - { - return ((obj is MetadataTag) && (Equals((MetadataTag)obj))); - } - - /// - /// Tests whether the specified instance is equivalent to this instance. - /// - /// A instance to compare to this instance. - /// true if equivalent to this instance; - /// otherwise, false. - public bool Equals(MetadataTag other) - { - return (this == other); - } - - /// - /// Returns a hash code for this structure. - /// - /// An integer value that specifies the hash code for this . - public override int GetHashCode() - { - return tag.GetHashCode(); - } - - /// - /// Compares this instance with a specified . - /// - /// An object to compare with this instance. - /// A 32-bit signed integer indicating the lexical relationship between the two comparands. - /// is not a . - public int CompareTo(object obj) - { - if (obj == null) - { - return 1; - } - if (!(obj is MetadataTag)) - { - throw new ArgumentException("obj"); - } - return CompareTo((MetadataTag)obj); - } - - /// - /// Compares the current instance with another object of the same type. - /// - /// An object to compare with this instance. - /// A 32-bit signed integer that indicates the relative order of the objects being compared. - public int CompareTo(MetadataTag other) - { - CheckDisposed(); - other.CheckDisposed(); - return tag.CompareTo(other.tag); - } - - /// - /// Releases all resources used by the instance. - /// - public void Dispose() - { - if (!disposed) - { - disposed = true; - if (selfCreated) - { - FreeImage.DeleteTag(tag); - tag = FITAG.Zero; - } - } - } - - /// - /// Gets whether this instance has already been disposed. - /// - public bool Disposed - { - get { return disposed; } - } - - /// - /// Throwns an in case - /// this instance has already been disposed. - /// - private void CheckDisposed() - { - if (disposed) - { - throw new ObjectDisposedException("The object has already been disposed."); - } - } - } -} - -namespace FreeImageAPI -{ - /// - /// Provides methods for working with the standard bitmap palette. - /// - public sealed class Palette : MemoryArray - { - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private GCHandle paletteHandle; - - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private RGBQUAD[] array; - - /// - /// Initializes a new instance for the given FreeImage bitmap. - /// - /// Handle to a FreeImage bitmap. - /// is null. - /// is not - /// -or- - /// has more than 8bpp. - public Palette(FIBITMAP dib) - : base(FreeImage.GetPalette(dib), (int)FreeImage.GetColorsUsed(dib)) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - if (FreeImage.GetImageType(dib) != FREE_IMAGE_TYPE.FIT_BITMAP) - { - throw new ArgumentException("dib"); - } - if (FreeImage.GetBPP(dib) > 8u) - { - throw new ArgumentException("dib"); - } - } - - /// - /// Initializes a new instance for the given FITAG that contains - /// a palette. - /// - /// The tag containing the palette. - /// is null. - /// is not - /// . - public Palette(FITAG tag) - : base(FreeImage.GetTagValue(tag), (int)FreeImage.GetTagCount(tag)) - { - if (FreeImage.GetTagType(tag) != FREE_IMAGE_MDTYPE.FIDT_PALETTE) - { - throw new ArgumentException("tag"); - } - } - - /// - /// Initializes a new instance for the given MetadataTag that contains - /// a palette. - /// - /// The tag containing the palette. - /// is null. - /// is not - /// . - public Palette(MetadataTag tag) - : base(FreeImage.GetTagValue(tag.tag), (int)tag.Count) - { - if (FreeImage.GetTagType(tag) != FREE_IMAGE_MDTYPE.FIDT_PALETTE) - { - throw new ArgumentException("tag"); - } - } - - /// - /// Initializes a new instance for the given array of that contains - /// a palette. - /// - /// A RGBQUAD array containing the palette data to initialize this instance. - public Palette(RGBQUAD[] palette) - { - unsafe - { - this.array = (RGBQUAD[])palette.Clone(); - this.paletteHandle = GCHandle.Alloc(array, GCHandleType.Pinned); - - base.baseAddress = (byte*)this.paletteHandle.AddrOfPinnedObject(); - base.length = (int)this.array.Length; - - // Create an array containing a single element. - // Due to the fact, that it's not possible to create pointers - // of generic types, an array is used to obtain the memory - // address of an element of T. - base.buffer = new RGBQUAD[1]; - // The array is pinned immediately to prevent the GC from - // moving it to a different position in memory. - base.handle = GCHandle.Alloc(buffer, GCHandleType.Pinned); - // The array and its content have beed pinned, so that its address - // can be safely requested and stored for the whole lifetime - // of the instace. - base.ptr = (byte*)base.handle.AddrOfPinnedObject(); - } - } - - /// - /// Initializes a new instance for the given array of that contains - /// a palette. - /// - /// A Color array containing the palette data to initialize this instance. - public Palette(Color[] palette) - : this(RGBQUAD.ToRGBQUAD(palette)) - { - } - - /// - /// Initializes a new instance with the specified size. - /// - /// The size of the palette. - public Palette(int size) - : this(new RGBQUAD[size]) - { - } - - /// - /// Gets or sets the palette through an array of . - /// - public RGBQUAD[] AsArray - { - get - { - return Data; - } - set - { - Data = value; - } - } - - /// - /// Get an array of that the block of memory represents. - /// This property is used for internal palette operations. - /// - internal unsafe Color[] ColorData - { - get - { - EnsureNotDisposed(); - Color[] data = new Color[length]; - for (int i = 0; i < length; i++) - { - data[i] = Color.FromArgb((int)(((uint*)baseAddress)[i] | 0xFF000000)); - } - return data; - } - } - - /// - /// Returns the palette as an array of . - /// - /// The palette as an array of . - public RGBQUAD[] ToArray() - { - return Data; - } - - /// - /// Creates a linear palette based on the provided . - /// - /// The used to colorize the palette. - /// - /// Only call this method on linear palettes. - /// - public void Colorize(Color color) - { - Colorize(color, 0.5d); - } - - /// - /// Creates a linear palette based on the provided . - /// - /// The used to colorize the palette. - /// The position of the color within the new palette. - /// 0 < < 1. - /// - /// Only call this method on linear palettes. - /// - public void Colorize(Color color, double splitSize) - { - Colorize(color, (int)(length * splitSize)); - } - - /// - /// Creates a linear palette based on the provided . - /// - /// The used to colorize the palette. - /// The position of the color within the new palette. - /// 0 < < . - /// - /// Only call this method on linear palettes. - /// - public void Colorize(Color color, int splitSize) - { - EnsureNotDisposed(); - if (splitSize < 1 || splitSize >= length) - { - throw new ArgumentOutOfRangeException("splitSize"); - } - - RGBQUAD[] pal = new RGBQUAD[length]; - - double red = color.R; - double green = color.G; - double blue = color.B; - - int i = 0; - double r, g, b; - - r = red / splitSize; - g = green / splitSize; - b = blue / splitSize; - - for (; i <= splitSize; i++) - { - pal[i].rgbRed = (byte)(i * r); - pal[i].rgbGreen = (byte)(i * g); - pal[i].rgbBlue = (byte)(i * b); - } - - r = (255 - red) / (length - splitSize); - g = (255 - green) / (length - splitSize); - b = (255 - blue) / (length - splitSize); - - for (; i < length; i++) - { - pal[i].rgbRed = (byte)(red + ((i - splitSize) * r)); - pal[i].rgbGreen = (byte)(green + ((i - splitSize) * g)); - pal[i].rgbBlue = (byte)(blue + ((i - splitSize) * b)); - } - - Data = pal; - } - - /// - /// Creates a linear grayscale palette. - /// - public void CreateGrayscalePalette() - { - Colorize(Color.White, length - 1); - } - - /// - /// Creates a linear grayscale palette. - /// - /// true to create an inverse grayscale palette. - public void CreateGrayscalePalette(bool inverse) - { - Colorize(Color.White, inverse ? 0 : length - 1); - } - - /// - /// Creates a linear palette with the specified . - /// - /// - /// A linear grayscale palette contains all shades of colors from - /// black to white. This method creates a similar palette with the white - /// color being replaced by the specified color. - /// - /// The used to create the palette. - /// true to create an inverse palette. - public void CreateGrayscalePalette(Color color, bool inverse) - { - Colorize(color, inverse ? 0 : length - 1); - } - - /// - /// Reverses the palette. - /// - public void Reverse() - { - EnsureNotDisposed(); - if (array != null) - { - Array.Reverse(array); - } - else - { - RGBQUAD[] localArray = Data; - Array.Reverse(localArray); - Data = localArray; - } - } - - /// - /// Copies the values from the specified to this instance. - /// - /// The palette to copy from. - /// - /// is a null reference. - public void CopyFrom(Palette palette) - { - EnsureNotDisposed(); - if (palette == null) - { - throw new ArgumentNullException("palette"); - } - CopyFrom(palette.Data, 0, 0, Math.Min(palette.Length, this.Length)); - } - - /// - /// Copies the values from the specified to this instance, - /// starting at the specified . - /// - /// The palette to copy from. - /// The position in this instance where the values - /// will be copied to. - /// - /// is a null reference. - /// - /// is outside the range of valid indexes. - public void CopyFrom(Palette palette, int offset) - { - EnsureNotDisposed(); - CopyFrom(palette.Data, 0, offset, Math.Min(palette.Length, this.Length - offset)); - } - - /// - /// Saves this to the specified file. - /// - /// - /// A string that contains the name of the file to which to save this . - /// - public void Save(string filename) - { - using (Stream stream = new FileStream(filename, FileMode.Create, FileAccess.Write)) - { - Save(stream); - } - } - - /// - /// Saves this to the specified stream. - /// - /// - /// The where the image will be saved. - /// - public void Save(Stream stream) - { - Save(new BinaryWriter(stream)); - } - - /// - /// Saves this using the specified writer. - /// - /// - /// The used to save the image. - /// - public void Save(BinaryWriter writer) - { - EnsureNotDisposed(); - writer.Write(ToByteArray()); - } - - /// - /// Loads a palette from the specified file. - /// - /// The name of the palette file. - public void Load(string filename) - { - using (Stream stream = new FileStream(filename, FileMode.Open, FileAccess.Read)) - { - Load(stream); - } - } - - /// - /// Loads a palette from the specified stream. - /// - /// The stream to load the palette from. - public void Load(Stream stream) - { - Load(new BinaryReader(stream)); - } - - /// - /// Loads a palette from the reader. - /// - /// The reader to load the palette from. - public void Load(BinaryReader reader) - { - EnsureNotDisposed(); - unsafe - { - int size = length * sizeof(RGBQUAD); - byte[] data = reader.ReadBytes(size); - fixed (byte* src = data) - { - CopyMemory(baseAddress, src, data.Length); - } - } - } - - /// - /// Releases allocated handles associated with this instance. - /// - /// true to release managed resources. - protected override void Dispose(bool disposing) - { - if (paletteHandle.IsAllocated) - paletteHandle.Free(); - array = null; - - base.Dispose(disposing); - } - } -} - -namespace FreeImageAPI.Plugins -{ - /// - /// Class representing all registered in FreeImage. - /// - public static class PluginRepository - { - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly List plugins = null; - - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private static readonly List localPlugins = null; - - static PluginRepository() - { - plugins = new List(FreeImage.GetFIFCount()); - localPlugins = new List(0); - for (int i = 0; i < plugins.Capacity; i++) - { - plugins.Add(new FreeImagePlugin((FREE_IMAGE_FORMAT)i)); - } - } - - /// - /// Adds local plugin to this class. - /// - /// The registered plugin. - internal static void RegisterLocalPlugin(LocalPlugin localPlugin) - { - FreeImagePlugin plugin = new FreeImagePlugin(localPlugin.Format); - plugins.Add(plugin); - localPlugins.Add(plugin); - } - - /// - /// Returns an instance of , representing the given format. - /// - /// The representing format. - /// An instance of . - public static FreeImagePlugin Plugin(FREE_IMAGE_FORMAT fif) - { - return Plugin((int)fif); - } - - /// - /// Returns an instance of , - /// representing the format at the given index. - /// - /// The index of the representing format. - /// An instance of . - public static FreeImagePlugin Plugin(int index) - { - return (index >= 0) ? plugins[index] : null; - } - - /// - /// Returns an instance of . - /// is searched in: - /// Format, RegExpr, - /// ValidExtension and ValidFilename. - /// - /// The expression to search for. - /// An instance of . - public static FreeImagePlugin Plugin(string expression) - { - FreeImagePlugin result = null; - expression = expression.ToLower(); - - foreach (FreeImagePlugin plugin in plugins) - { - if (plugin.Format.ToLower().Contains(expression) || - plugin.RegExpr.ToLower().Contains(expression) || - plugin.ValidExtension(expression, StringComparison.CurrentCultureIgnoreCase) || - plugin.ValidFilename(expression, StringComparison.CurrentCultureIgnoreCase)) - { - result = plugin; - break; - } - } - - return result; - } - - /// - /// Returns an instance of for the given format. - /// - /// The format of the Plugin. - /// An instance of . - public static FreeImagePlugin PluginFromFormat(string format) - { - return Plugin(FreeImage.GetFIFFromFormat(format)); - } - - /// - /// Returns an instance of for the given filename. - /// - /// The valid filename for the plugin. - /// An instance of . - public static FreeImagePlugin PluginFromFilename(string filename) - { - return Plugin(FreeImage.GetFIFFromFilename(filename)); - } - - /// - /// Returns an instance of for the given mime. - /// - /// The valid mime for the plugin. - /// An instance of . - public static FreeImagePlugin PluginFromMime(string mime) - { - return Plugin(FreeImage.GetFIFFromMime(mime)); - } - - /// - /// Gets the number of registered plugins. - /// - public static int FIFCount - { - get - { - return FreeImage.GetFIFCount(); - } - } - - /// - /// Gets a readonly collection of all plugins. - /// - public static ReadOnlyCollection PluginList - { - get - { - return plugins.AsReadOnly(); - } - } - - /// - /// Gets a list of plugins that are only able to - /// read but not to write. - /// - public static List ReadOnlyPlugins - { - get - { - List list = new List(); - foreach (FreeImagePlugin p in plugins) - { - if (p.SupportsReading && !p.SupportsWriting) - { - list.Add(p); - } - } - return list; - } - } - - /// - /// Gets a list of plugins that are only able to - /// write but not to read. - /// - public static List WriteOnlyPlugins - { - get - { - List list = new List(); - foreach (FreeImagePlugin p in plugins) - { - if (!p.SupportsReading && p.SupportsWriting) - { - list.Add(p); - } - } - return list; - } - } - - /// - /// Gets a list of plugins that are not able to - /// read or write. - /// - public static List StupidPlugins - { - get - { - List list = new List(); - foreach (FreeImagePlugin p in plugins) - { - if (!p.SupportsReading && !p.SupportsWriting) - { - list.Add(p); - } - } - return list; - } - } - - /// - /// Gets a list of plugins that are able to read. - /// - public static List ReadablePlugins - { - get - { - List list = new List(); - foreach (FreeImagePlugin p in plugins) - { - if (p.SupportsReading) - { - list.Add(p); - } - } - return list; - } - } - - /// - /// Gets a list of plugins that are able to write. - /// - public static List WriteablePlugins - { - get - { - List list = new List(); - foreach (FreeImagePlugin p in plugins) - { - if (p.SupportsWriting) - { - list.Add(p); - } - } - return list; - } - } - - /// - /// Gets a list of local plugins. - /// - public static ReadOnlyCollection LocalPlugins - { - get - { - return localPlugins.AsReadOnly(); - } - } - - /// - /// Gets a list of built-in plugins. - /// - public static List BuiltInPlugins - { - get - { - List list = new List(); - foreach (FreeImagePlugin p in plugins) - { - if (!localPlugins.Contains(p)) - { - list.Add(p); - } - } - return list; - } - } - - /// - /// Windows or OS/2 Bitmap File (*.BMP) - /// - public static FreeImagePlugin BMP { get { return plugins[0]; } } - - /// - /// Independent JPEG Group (*.JPG, *.JIF, *.JPEG, *.JPE) - /// - public static FreeImagePlugin ICO { get { return plugins[1]; } } - - /// - /// Independent JPEG Group (*.JPG, *.JIF, *.JPEG, *.JPE) - /// - public static FreeImagePlugin JPEG { get { return plugins[2]; } } - - /// - /// JPEG Network Graphics (*.JNG) - /// - public static FreeImagePlugin JNG { get { return plugins[3]; } } - - /// - /// Commodore 64 Koala format (*.KOA) - /// - public static FreeImagePlugin KOALA { get { return plugins[4]; } } - - /// - /// Amiga IFF (*.IFF, *.LBM) - /// - public static FreeImagePlugin LBM { get { return plugins[5]; } } - - /// - /// Amiga IFF (*.IFF, *.LBM) - /// - public static FreeImagePlugin IFF { get { return plugins[5]; } } - - /// - /// Multiple Network Graphics (*.MNG) - /// - public static FreeImagePlugin MNG { get { return plugins[6]; } } - - /// - /// Portable Bitmap (ASCII) (*.PBM) - /// - public static FreeImagePlugin PBM { get { return plugins[7]; } } - - /// - /// Portable Bitmap (BINARY) (*.PBM) - /// - public static FreeImagePlugin PBMRAW { get { return plugins[8]; } } - - /// - /// Kodak PhotoCD (*.PCD) - /// - public static FreeImagePlugin PCD { get { return plugins[9]; } } - - /// - /// Zsoft Paintbrush PCX bitmap format (*.PCX) - /// - public static FreeImagePlugin PCX { get { return plugins[10]; } } - - /// - /// Portable Graymap (ASCII) (*.PGM) - /// - public static FreeImagePlugin PGM { get { return plugins[11]; } } - - /// - /// Portable Graymap (BINARY) (*.PGM) - /// - public static FreeImagePlugin PGMRAW { get { return plugins[12]; } } - - /// - /// Portable Network Graphics (*.PNG) - /// - public static FreeImagePlugin PNG { get { return plugins[13]; } } - - /// - /// Portable Pixelmap (ASCII) (*.PPM) - /// - public static FreeImagePlugin PPM { get { return plugins[14]; } } - - /// - /// Portable Pixelmap (BINARY) (*.PPM) - /// - public static FreeImagePlugin PPMRAW { get { return plugins[15]; } } - - /// - /// Sun Rasterfile (*.RAS) - /// - public static FreeImagePlugin RAS { get { return plugins[16]; } } - - /// - /// truevision Targa files (*.TGA, *.TARGA) - /// - public static FreeImagePlugin TARGA { get { return plugins[17]; } } - - /// - /// Tagged Image File Format (*.TIF, *.TIFF) - /// - public static FreeImagePlugin TIFF { get { return plugins[18]; } } - - /// - /// Wireless Bitmap (*.WBMP) - /// - public static FreeImagePlugin WBMP { get { return plugins[19]; } } - - /// - /// Adobe Photoshop (*.PSD) - /// - public static FreeImagePlugin PSD { get { return plugins[20]; } } - - /// - /// Dr. Halo (*.CUT) - /// - public static FreeImagePlugin CUT { get { return plugins[21]; } } - - /// - /// X11 Bitmap Format (*.XBM) - /// - public static FreeImagePlugin XBM { get { return plugins[22]; } } - - /// - /// X11 Pixmap Format (*.XPM) - /// - public static FreeImagePlugin XPM { get { return plugins[23]; } } - - /// - /// DirectDraw Surface (*.DDS) - /// - public static FreeImagePlugin DDS { get { return plugins[24]; } } - - /// - /// Graphics Interchange Format (*.GIF) - /// - public static FreeImagePlugin GIF { get { return plugins[25]; } } - - /// - /// High Dynamic Range (*.HDR) - /// - public static FreeImagePlugin HDR { get { return plugins[26]; } } - - /// - /// Raw Fax format CCITT G3 (*.G3) - /// - public static FreeImagePlugin FAXG3 { get { return plugins[27]; } } - - /// - /// Silicon Graphics SGI image format (*.SGI) - /// - public static FreeImagePlugin SGI { get { return plugins[28]; } } - - /// - /// OpenEXR format (*.EXR) - /// - public static FreeImagePlugin EXR { get { return plugins[29]; } } - - /// - /// JPEG-2000 format (*.J2K, *.J2C) - /// - public static FreeImagePlugin J2K { get { return plugins[30]; } } - - /// - /// JPEG-2000 format (*.JP2) - /// - public static FreeImagePlugin JP2 { get { return plugins[31]; } } - - /// - /// Portable FloatMap (*.PFM) - /// - public static FreeImagePlugin PFM { get { return plugins[32]; } } - - /// - /// Macintosh PICT (*.PICT) - /// - public static FreeImagePlugin PICT { get { return plugins[33]; } } - - /// - /// RAW camera image (*.*) - /// - public static FreeImagePlugin RAW { get { return plugins[34]; } } - } -} - -namespace FreeImageAPI -{ - /// - /// Provides methods for working with generic bitmap scanlines. - /// - /// Type of the bitmaps' scanlines. - public sealed class Scanline : MemoryArray where T : struct - { - /// - /// Initializes a new instance based on the specified FreeImage bitmap. - /// - /// Handle to a FreeImage bitmap. - public Scanline(FIBITMAP dib) - : this(dib, 0) - { - } - - /// - /// Initializes a new instance based on the specified FreeImage bitmap. - /// - /// Handle to a FreeImage bitmap. - /// Index of the zero based scanline. - public Scanline(FIBITMAP dib, int scanline) - : this(dib, scanline, (int)(typeof(T) == typeof(FI1BIT) ? - FreeImage.GetBPP(dib) * FreeImage.GetWidth(dib) : - typeof(T) == typeof(FI4BIT) ? - FreeImage.GetBPP(dib) * FreeImage.GetWidth(dib) / 4 : - (FreeImage.GetBPP(dib) * FreeImage.GetWidth(dib)) / (Marshal.SizeOf(typeof(T)) * 8))) - { - } - - internal Scanline(FIBITMAP dib, int scanline, int length) - : base(FreeImage.GetScanLine(dib, scanline), length) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - if ((scanline < 0) || (scanline >= FreeImage.GetHeight(dib))) - { - throw new ArgumentOutOfRangeException("scanline"); - } - } - } -} - -namespace FreeImageAPI.IO -{ - /// - /// Class wrapping streams, implementing a buffer for read data, - /// so that seek operations can be made. - /// - /// - /// FreeImage can load bitmaps from arbitrary sources. - /// .NET works with different streams like File- or NetConnection-strams. - /// NetConnection streams, which are used to load files from web servers, - /// for example cannot seek. - /// But FreeImage frequently uses the seek operation when loading bitmaps. - /// StreamWrapper wrapps a stream and makes it seekable by caching all read - /// data into an internal MemoryStream to jump back- and forward. - /// StreamWapper is for internal use and only for loading from streams. - /// - internal class StreamWrapper : Stream - { - /// - /// The stream to wrap - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private readonly Stream stream; - - /// - /// The caching stream - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private MemoryStream memoryStream = new MemoryStream(); - - /// - /// Indicates if the wrapped stream reached its end - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private bool eos = false; - - /// - /// Tells the wrapper to block readings or not - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private bool blocking = false; - - /// - /// Indicates if the wrapped stream is disposed or not - /// - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private bool disposed = false; - - /// - /// Initializes a new instance based on the specified . - /// - /// The stream to wrap. - /// When true the wrapper always tries to read the requested - /// amount of data from the wrapped stream. - public StreamWrapper(Stream stream, bool blocking) - { - if (!stream.CanRead) - { - throw new ArgumentException("stream is not capable of reading."); - } - this.stream = stream; - this.blocking = blocking; - } - - /// - /// Releases all resources used by the instance. - /// - ~StreamWrapper() - { - Dispose(false); - } - - // The wrapper only accepts readable streams - public override bool CanRead - { - get { checkDisposed(); return true; } - } - - // We implement that feature - public override bool CanSeek - { - get { checkDisposed(); return true; } - } - - // The wrapper is readonly - public override bool CanWrite - { - get { checkDisposed(); return false; } - } - - // Just forward it - public override void Flush() - { - checkDisposed(); - stream.Flush(); - } - - // Calling this property will cause the wrapper to read the stream - // to its end and cache it completely. - public override long Length - { - get - { - checkDisposed(); - if (!eos) - { - Fill(); - } - return memoryStream.Length; - } - } - - // Gets or sets the current position - public override long Position - { - get - { - checkDisposed(); - return memoryStream.Position; - } - set - { - checkDisposed(); - Seek(value, SeekOrigin.Begin); - } - } - - // Implements the reading feature - public override int Read(byte[] buffer, int offset, int count) - { - checkDisposed(); - // total bytes read from memory-stream - int memoryBytes = 0; - // total bytes read from the original stream - int streamBytes = 0; - memoryBytes = memoryStream.Read(buffer, offset, count); - if ((count > memoryBytes) && (!eos)) - { - // read the rest from the original stream (can be 0 bytes) - do - { - int read = stream.Read( - buffer, - offset + memoryBytes + streamBytes, - count - memoryBytes - streamBytes); - streamBytes += read; - if (read == 0) - { - eos = true; - break; - } - if (!blocking) - { - break; - } - } while ((memoryBytes + streamBytes) < count); - // copy the bytes from the original stream into the memory stream - // if 0 bytes were read we write 0 so the memory-stream is not changed - memoryStream.Write(buffer, offset + memoryBytes, streamBytes); - } - return memoryBytes + streamBytes; - } - - // Implements the seeking feature - public override long Seek(long offset, SeekOrigin origin) - { - checkDisposed(); - long newPosition = 0L; - // get new position - switch (origin) - { - case SeekOrigin.Begin: - newPosition = offset; - break; - case SeekOrigin.Current: - newPosition = memoryStream.Position + offset; - break; - case SeekOrigin.End: - // to seek from the end have have to read to the end first - if (!eos) - { - Fill(); - } - newPosition = memoryStream.Length + offset; - break; - default: - throw new ArgumentOutOfRangeException("origin"); - } - // in case the new position is beyond the memory-streams end - // and the original streams end hasn't been reached - // the original stream is read until either the stream ends or - // enough bytes have been read - if ((newPosition > memoryStream.Length) && (!eos)) - { - memoryStream.Position = memoryStream.Length; - int bytesToRead = (int)(newPosition - memoryStream.Length); - byte[] buffer = new byte[1024]; - do - { - bytesToRead -= Read(buffer, 0, (bytesToRead >= buffer.Length) ? buffer.Length : bytesToRead); - } while ((bytesToRead > 0) && (!eos)); - } - memoryStream.Position = (newPosition <= memoryStream.Length) ? newPosition : memoryStream.Length; - return 0; - } - - // No write-support - public override void SetLength(long value) - { - throw new Exception("The method or operation is not implemented."); - } - - // No write-support - public override void Write(byte[] buffer, int offset, int count) - { - throw new Exception("The method or operation is not implemented."); - } - - public void Reset() - { - checkDisposed(); - Position = 0; - } - - // Reads the wrapped stream until its end. - private void Fill() - { - if (!eos) - { - memoryStream.Position = memoryStream.Length; - int bytesRead = 0; - byte[] buffer = new byte[1024]; - do - { - bytesRead = stream.Read(buffer, 0, buffer.Length); - memoryStream.Write(buffer, 0, bytesRead); - } while (bytesRead != 0); - eos = true; - } - } - - public new void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - private new void Dispose(bool disposing) - { - if (!disposed) - { - disposed = true; - if (disposing) - { - if (memoryStream != null) - { - memoryStream.Dispose(); - } - } - } - } - - public bool Disposed - { - get { return disposed; } - } - - private void checkDisposed() - { - if (disposed) throw new ObjectDisposedException("StreamWrapper"); - } - } -} - - #endregion - - #region Enums - -namespace FreeImageAPI -{ - /// - /// Enumeration used for color conversions. - /// FREE_IMAGE_COLOR_DEPTH contains several colors to convert to. - /// The default value 'FICD_AUTO'. - /// - [System.Flags] - public enum FREE_IMAGE_COLOR_DEPTH - { - /// - /// Unknown. - /// - FICD_UNKNOWN = 0, - /// - /// Auto selected by the used algorithm. - /// - FICD_AUTO = FICD_UNKNOWN, - /// - /// 1-bit. - /// - FICD_01_BPP = 1, - /// - /// 1-bit using dithering. - /// - FICD_01_BPP_DITHER = FICD_01_BPP, - /// - /// 1-bit using threshold. - /// - FICD_01_BPP_THRESHOLD = FICD_01_BPP | 2, - /// - /// 4-bit. - /// - FICD_04_BPP = 4, - /// - /// 8-bit. - /// - FICD_08_BPP = 8, - /// - /// 16-bit 555 (1 bit remains unused). - /// - FICD_16_BPP_555 = FICD_16_BPP | 2, - /// - /// 16-bit 565 (all bits are used). - /// - FICD_16_BPP = 16, - /// - /// 24-bit. - /// - FICD_24_BPP = 24, - /// - /// 32-bit. - /// - FICD_32_BPP = 32, - /// - /// Reorder palette (make it linear). Only affects 1-, 4- and 8-bit images. - /// The palette is only reordered in case the image is greyscale - /// (all palette entries have the same red, green and blue value). - /// - FICD_REORDER_PALETTE = 1024, - /// - /// Converts the image to greyscale. - /// - FICD_FORCE_GREYSCALE = 2048, - /// - /// Flag to mask out all non color depth flags. - /// - FICD_COLOR_MASK = FICD_01_BPP | FICD_04_BPP | FICD_08_BPP | FICD_16_BPP | FICD_24_BPP | FICD_32_BPP - } -} - -namespace FreeImageAPI -{ - /// - /// List of combinable compare modes. - /// - [System.Flags] - public enum FREE_IMAGE_COMPARE_FLAGS - { - /// - /// Compare headers. - /// - HEADER = 0x1, - /// - /// Compare palettes. - /// - PALETTE = 0x2, - /// - /// Compare pixel data. - /// - DATA = 0x4, - /// - /// Compare meta data. - /// - METADATA = 0x8, - /// - /// Compare everything. - /// - COMPLETE = (HEADER | PALETTE | DATA | METADATA) - } -} - -namespace FreeImageAPI -{ - /// - /// Flags for copying data from a bitmap to another. - /// - public enum FREE_IMAGE_METADATA_COPY - { - /// - /// Exisiting metadata will remain unchanged. - /// - KEEP_EXISITNG = 0x0, - /// - /// Existing metadata will be cleared. - /// - CLEAR_EXISTING = 0x1, - /// - /// Existing metadata will be overwritten. - /// - REPLACE_EXISTING = 0x2 - } -} - -namespace FreeImageAPI -{ - /// - /// List different search modes. - /// - [System.Flags] - public enum MD_SEARCH_FLAGS - { - /// - /// The key of the metadata. - /// - KEY = 0x1, - /// - /// The description of the metadata - /// - DESCRIPTION = 0x2, - /// - /// The ToString value of the metadata - /// - TOSTRING = 0x4, - } -} - - #endregion - -namespace FreeImageAPI -{ - /// - /// Static class importing functions from the FreeImage library - /// and providing additional functions. - /// - public static partial class FreeImage - { - #region Constants - - /// - /// Array containing all 'FREE_IMAGE_MDMODEL's. - /// - public static readonly FREE_IMAGE_MDMODEL[] FREE_IMAGE_MDMODELS = - (FREE_IMAGE_MDMODEL[])Enum.GetValues(typeof(FREE_IMAGE_MDMODEL)); - - /// - /// Stores handles used to read from streams. - /// - private static Dictionary streamHandles = - new Dictionary(); - - /// - /// Version of the wrapper library. - /// - private static Version WrapperVersion; - - private const int DIB_RGB_COLORS = 0; - private const int DIB_PAL_COLORS = 1; - private const int CBM_INIT = 0x4; - - /// - /// An uncompressed format. - /// - public const int BI_RGB = 0; - - /// - /// A run-length encoded (RLE) format for bitmaps with 8 bpp. The compression format is a 2-byte - /// format consisting of a count byte followed by a byte containing a color index. - /// - public const int BI_RLE8 = 1; - - /// - /// An RLE format for bitmaps with 4 bpp. The compression format is a 2-byte format consisting - /// of a count byte followed by two word-length color indexes. - /// - public const int BI_RLE4 = 2; - - /// - /// Specifies that the bitmap is not compressed and that the color table consists of three - /// DWORD color masks that specify the red, green, and blue components, respectively, - /// of each pixel. This is valid when used with 16- and 32-bpp bitmaps. - /// - public const int BI_BITFIELDS = 3; - - /// - /// Windows 98/Me, Windows 2000/XP: Indicates that the image is a JPEG image. - /// - public const int BI_JPEG = 4; - - /// - /// Windows 98/Me, Windows 2000/XP: Indicates that the image is a PNG image. - /// - public const int BI_PNG = 5; - - #endregion - - #region General functions - - /// - /// Returns the internal version of this FreeImage .NET wrapper. - /// - /// The internal version of this FreeImage .NET wrapper. - public static Version GetWrapperVersion() - { - if (WrapperVersion == null) - { - try - { - object[] attributes = Assembly.GetAssembly(typeof(FreeImage)) - .GetCustomAttributes(typeof(AssemblyFileVersionAttribute), false); - if ((attributes != null) && (attributes.Length != 0)) - { - AssemblyFileVersionAttribute attribute = - attributes[0] as AssemblyFileVersionAttribute; - if ((attribute != null) && (attribute.Version != null)) - { - return (WrapperVersion = new Version(attribute.Version)); - } - } - } - catch - { - - } - - WrapperVersion = new Version(); - } - - return WrapperVersion; - } - - /// - /// Returns the version of the native FreeImage library. - /// - /// The version of the native FreeImage library. - public static Version GetNativeVersion() - { - return new Version(GetVersion()); - } - - /// - /// Returns a value indicating if the FreeImage library is available or not. - /// See remarks for further details. - /// - /// false if the file is not available or out of date; - /// true, otherwise. - /// - /// The FreeImage.NET library is a wrapper for the native C++ library - /// (FreeImage.dll ... dont mix ist up with this library FreeImageNet.dll). - /// The native library must be either in the same folder as the program's - /// executable or in a folder contained in the envirent variable PATH - /// (for example %WINDIR%\System32). - /// Further more must both libraries, including the program itself, - /// be the same architecture (x86 or x64). - /// - public static bool IsAvailable() - { - try - { - // Call a static fast executing function - Version nativeVersion = new Version(GetVersion()); - Version wrapperVersion = GetWrapperVersion(); - // No exception thrown, the library seems to be present - return - (nativeVersion.Major >= wrapperVersion.Major) && - (nativeVersion.Minor >= wrapperVersion.Minor) && - (nativeVersion.Build >= wrapperVersion.Build); - } - catch (DllNotFoundException) - { - return false; - } - catch (EntryPointNotFoundException) - { - return false; - } - catch (BadImageFormatException) - { - return false; - } - } - - #endregion - - #region Bitmap management functions - - /// - /// Creates a new bitmap in memory. - /// - /// Width of the new bitmap. - /// Height of the new bitmap. - /// Bit depth of the new Bitmap. - /// Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmap - /// Handle to a FreeImage bitmap. - public static FIBITMAP Allocate(int width, int height, int bpp) - { - return Allocate(width, height, bpp, 0, 0, 0); - } - - /// - /// Creates a new bitmap in memory. - /// - /// Type of the image. - /// Width of the new bitmap. - /// Height of the new bitmap. - /// Bit depth of the new Bitmap. - /// Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmap - /// Handle to a FreeImage bitmap. - public static FIBITMAP AllocateT(FREE_IMAGE_TYPE type, int width, int height, int bpp) - { - return AllocateT(type, width, height, bpp, 0, 0, 0); - } - - /// - /// Allocates a new image of the specified width, height and bit depth and optionally - /// fills it with the specified color. See remarks for further details. - /// - /// Width of the new bitmap. - /// Height of the new bitmap. - /// Bit depth of the new bitmap. - /// Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmaps. - /// The color to fill the bitmap with or null. - /// Options to enable or disable function-features. - /// The palette of the bitmap or null. - /// Handle to a FreeImage bitmap. - /// - /// This function is an extension to , which additionally supports - /// specifying a palette to be set for the newly create image, as well as specifying a - /// background color, the newly created image should initially be filled with. - /// - /// Basically, this function internally relies on function , followed by a - /// call to . This is why both parameters - /// and behave the same as it is - /// documented for function . - /// So, please refer to the documentation of to - /// learn more about parameters and . - /// - /// The palette specified through parameter is only copied to the - /// newly created image, if the desired bit depth is smaller than or equal to 8 bits per pixel. - /// In other words, the parameter is only taken into account for - /// palletized images. So, for an 8-bit image, the length is 256, for an 4-bit image it is 16 - /// and it is 2 for a 1-bit image. In other words, this function does not support partial palettes. - /// - /// However, specifying a palette is not necesarily needed, even for palletized images. This - /// function is capable of implicitly creating a palette, if is null. - /// If the specified background color is a greyscale value (red = green = blue) or if option - /// is specified, a greyscale palette - /// is created. For a 1-bit image, only if the specified background color is either black or white, - /// a monochrome palette, consisting of black and white only is created. In any case, the darker - /// colors are stored at the smaller palette indices. - /// - /// If the specified background color is not a greyscale value, or is neither black nor white - /// for a 1-bit image, solely this specified color is injected into the otherwise black-initialized - /// palette. For this operation, option - /// is implicit, so the specified is applied to the palette entry, - /// specified by the background color's field. - /// The image is then filled with this palette index. - /// - /// This function returns a newly created image as function does, if both - /// parameters and are null. - /// If only is null, the palette pointed to by - /// parameter is initially set for the new image, if a palletized - /// image of type is created. - /// However, in the latter case, this function returns an image, whose - /// pixels are all initialized with zeros so, the image will be filled with the color of the - /// first palette entry. - /// - public static FIBITMAP AllocateEx(int width, int height, int bpp, - RGBQUAD? color, FREE_IMAGE_COLOR_OPTIONS options, RGBQUAD[] palette) - { - return AllocateEx(width, height, bpp, color, options, palette, 0, 0, 0); - } - - /// - /// Allocates a new image of the specified width, height and bit depth and optionally - /// fills it with the specified color. See remarks for further details. - /// - /// Width of the new bitmap. - /// Height of the new bitmap. - /// Bit depth of the new bitmap. - /// Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmaps. - /// The color to fill the bitmap with or null. - /// Options to enable or disable function-features. - /// The palette of the bitmap or null. - /// Red part of the color layout. - /// eg: 0xFF0000 - /// Green part of the color layout. - /// eg: 0x00FF00 - /// Blue part of the color layout. - /// eg: 0x0000FF - /// Handle to a FreeImage bitmap. - /// - /// This function is an extension to , which additionally supports - /// specifying a palette to be set for the newly create image, as well as specifying a - /// background color, the newly created image should initially be filled with. - /// - /// Basically, this function internally relies on function , followed by a - /// call to . This is why both parameters - /// and behave the same as it is - /// documented for function . - /// So, please refer to the documentation of to - /// learn more about parameters and . - /// - /// The palette specified through parameter is only copied to the - /// newly created image, if the desired bit depth is smaller than or equal to 8 bits per pixel. - /// In other words, the parameter is only taken into account for - /// palletized images. So, for an 8-bit image, the length is 256, for an 4-bit image it is 16 - /// and it is 2 for a 1-bit image. In other words, this function does not support partial palettes. - /// - /// However, specifying a palette is not necesarily needed, even for palletized images. This - /// function is capable of implicitly creating a palette, if is null. - /// If the specified background color is a greyscale value (red = green = blue) or if option - /// is specified, a greyscale palette - /// is created. For a 1-bit image, only if the specified background color is either black or white, - /// a monochrome palette, consisting of black and white only is created. In any case, the darker - /// colors are stored at the smaller palette indices. - /// - /// If the specified background color is not a greyscale value, or is neither black nor white - /// for a 1-bit image, solely this specified color is injected into the otherwise black-initialized - /// palette. For this operation, option - /// is implicit, so the specified is applied to the palette entry, - /// specified by the background color's field. - /// The image is then filled with this palette index. - /// - /// This function returns a newly created image as function does, if both - /// parameters and are null. - /// If only is null, the palette pointed to by - /// parameter is initially set for the new image, if a palletized - /// image of type is created. - /// However, in the latter case, this function returns an image, whose - /// pixels are all initialized with zeros so, the image will be filled with the color of the - /// first palette entry. - /// - public static FIBITMAP AllocateEx(int width, int height, int bpp, - RGBQUAD? color, FREE_IMAGE_COLOR_OPTIONS options, RGBQUAD[] palette, - uint red_mask, uint green_mask, uint blue_mask) - { - if ((palette != null) && (bpp <= 8) && (palette.Length < (1 << bpp))) - return FIBITMAP.Zero; - - if (color.HasValue) - { - GCHandle handle = new GCHandle(); - try - { - RGBQUAD[] buffer = new RGBQUAD[] { color.Value }; - handle = GCHandle.Alloc(buffer, GCHandleType.Pinned); - return AllocateEx(width, height, bpp, handle.AddrOfPinnedObject(), - options, palette, red_mask, green_mask, blue_mask); - } - finally - { - if (handle.IsAllocated) - handle.Free(); - } - } - else - { - return AllocateEx(width, height, bpp, IntPtr.Zero, - options, palette, red_mask, green_mask, blue_mask); - } - } - - /// - /// Allocates a new image of the specified type, width, height and bit depth and optionally - /// fills it with the specified color. See remarks for further details. - /// - /// The type of the specified color. - /// Type of the image. - /// Width of the new bitmap. - /// Height of the new bitmap. - /// Bit depth of the new bitmap. - /// Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmap - /// The color to fill the bitmap with or null. - /// Options to enable or disable function-features. - /// The palette of the bitmap or null. - /// Handle to a FreeImage bitmap. - /// - /// This function is an extension to , which additionally supports - /// specifying a palette to be set for the newly create image, as well as specifying a - /// background color, the newly created image should initially be filled with. - /// - /// Basically, this function internally relies on function , followed by a - /// call to . This is why both parameters - /// and behave the same as it is - /// documented for function . So, please refer to the - /// documentation of to learn more about parameters color and options. - /// - /// The palette specified through parameter palette is only copied to the newly created - /// image, if its image type is and the desired bit - /// depth is smaller than or equal to 8 bits per pixel. In other words, the - /// palette is only taken into account for palletized images. However, if the preceding conditions - /// match and if is not null, the palette is assumed to be at - /// least as large as the size of a fully populated palette for the desired bit depth. - /// So, for an 8-bit image, this length is 256, for an 4-bit image it is 16 and it is - /// 2 for a 1-bit image. In other words, this function does not support partial palettes. - /// - /// However, specifying a palette is not necesarily needed, even for palletized images. This - /// function is capable of implicitly creating a palette, if is null. - /// If the specified background color is a greyscale value (red = green = blue) or if option - /// is specified, a greyscale palette - /// is created. For a 1-bit image, only if the specified background color is either black or white, - /// a monochrome palette, consisting of black and white only is created. In any case, the darker - /// colors are stored at the smaller palette indices. - /// - /// If the specified background color is not a greyscale value, or is neither black nor white - /// for a 1-bit image, solely this specified color is injected into the otherwise black-initialized - /// palette. For this operation, option - /// is implicit, so the specified color is applied to the palette entry, specified by the - /// background color's field. The image is then filled with - /// this palette index. - /// - /// This function returns a newly created image as function does, if both - /// parameters and are null. - /// If only is null, the palette pointed to by - /// parameter is initially set for the new image, if a palletized - /// image of type is created. - /// However, in the latter case, this function returns an image, whose - /// pixels are all initialized with zeros so, the image will be filled with the color of the - /// first palette entry. - /// - public static FIBITMAP AllocateExT(FREE_IMAGE_TYPE type, int width, int height, int bpp, - T? color, FREE_IMAGE_COLOR_OPTIONS options, RGBQUAD[] palette) where T : struct - { - return AllocateExT(type, width, height, bpp, color, options, palette, 0, 0, 0); - } - - /// - /// Allocates a new image of the specified type, width, height and bit depth and optionally - /// fills it with the specified color. See remarks for further details. - /// - /// The type of the specified color. - /// Type of the image. - /// Width of the new bitmap. - /// Height of the new bitmap. - /// Bit depth of the new bitmap. - /// Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmap - /// The color to fill the bitmap with or null. - /// Options to enable or disable function-features. - /// The palette of the bitmap or null. - /// Red part of the color layout. - /// eg: 0xFF0000 - /// Green part of the color layout. - /// eg: 0x00FF00 - /// Blue part of the color layout. - /// eg: 0x0000FF - /// Handle to a FreeImage bitmap. - /// - /// This function is an extension to , which additionally supports - /// specifying a palette to be set for the newly create image, as well as specifying a - /// background color, the newly created image should initially be filled with. - /// - /// Basically, this function internally relies on function , followed by a - /// call to . This is why both parameters - /// and behave the same as it is - /// documented for function . So, please refer to the - /// documentation of to learn more about parameters color and options. - /// - /// The palette specified through parameter palette is only copied to the newly created - /// image, if its image type is and the desired bit - /// depth is smaller than or equal to 8 bits per pixel. In other words, the - /// palette is only taken into account for palletized images. However, if the preceding conditions - /// match and if is not null, the palette is assumed to be at - /// least as large as the size of a fully populated palette for the desired bit depth. - /// So, for an 8-bit image, this length is 256, for an 4-bit image it is 16 and it is - /// 2 for a 1-bit image. In other words, this function does not support partial palettes. - /// - /// However, specifying a palette is not necesarily needed, even for palletized images. This - /// function is capable of implicitly creating a palette, if is null. - /// If the specified background color is a greyscale value (red = green = blue) or if option - /// is specified, a greyscale palette - /// is created. For a 1-bit image, only if the specified background color is either black or white, - /// a monochrome palette, consisting of black and white only is created. In any case, the darker - /// colors are stored at the smaller palette indices. - /// - /// If the specified background color is not a greyscale value, or is neither black nor white - /// for a 1-bit image, solely this specified color is injected into the otherwise black-initialized - /// palette. For this operation, option - /// is implicit, so the specified color is applied to the palette entry, specified by the - /// background color's field. The image is then filled with - /// this palette index. - /// - /// This function returns a newly created image as function does, if both - /// parameters and are null. - /// If only is null, the palette pointed to by - /// parameter is initially set for the new image, if a palletized - /// image of type is created. - /// However, in the latter case, this function returns an image, whose - /// pixels are all initialized with zeros so, the image will be filled with the color of the - /// first palette entry. - /// - public static FIBITMAP AllocateExT(FREE_IMAGE_TYPE type, int width, int height, int bpp, - T? color, FREE_IMAGE_COLOR_OPTIONS options, RGBQUAD[] palette, - uint red_mask, uint green_mask, uint blue_mask) where T : struct - { - if ((palette != null) && (bpp <= 8) && (palette.Length < (1 << bpp))) - return FIBITMAP.Zero; - - if (!CheckColorType(type, color)) - return FIBITMAP.Zero; - - if (color.HasValue) - { - GCHandle handle = new GCHandle(); - try - { - T[] buffer = new T[] { color.Value }; - handle = GCHandle.Alloc(buffer, GCHandleType.Pinned); - return AllocateExT(type, width, height, bpp, handle.AddrOfPinnedObject(), - options, palette, red_mask, green_mask, blue_mask); - } - finally - { - if (handle.IsAllocated) - handle.Free(); - } - } - else - { - return AllocateExT(type, width, height, bpp, IntPtr.Zero, - options, palette, red_mask, green_mask, blue_mask); - } - } - - /// - /// Converts a FreeImage bitmap to a .NET . - /// - /// Handle to a FreeImage bitmap. - /// The converted .NET . - /// Copying metadata has been disabled until a proper way - /// of reading and storing metadata in a .NET bitmap is found. - /// - /// is null. - /// - /// The image type of is not FIT_BITMAP. - public static Bitmap GetBitmap(FIBITMAP dib) - { - return GetBitmap(dib, true); - } - - /// - /// Converts a FreeImage bitmap to a .NET . - /// - /// Handle to a FreeImage bitmap. - /// When true existing metadata will be copied. - /// The converted .NET . - /// Copying metadata has been disabled until a proper way - /// of reading and storing metadata in a .NET bitmap is found. - /// - /// is null. - /// - /// The image type of is not FIT_BITMAP. - internal static Bitmap GetBitmap(FIBITMAP dib, bool copyMetadata) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - if (GetImageType(dib) != FREE_IMAGE_TYPE.FIT_BITMAP) - { - throw new ArgumentException("Only bitmaps with type of FIT_BITMAP can be converted."); - } - - PixelFormat format = GetPixelFormat(dib); - - if ((format == PixelFormat.Undefined) && (GetBPP(dib) == 16u)) - { - throw new ArgumentException("Only 16bit 555 and 565 are supported."); - } - - int height = (int)GetHeight(dib); - int width = (int)GetWidth(dib); - int pitch = (int)GetPitch(dib); - - Bitmap result = new Bitmap(width, height, format); - BitmapData data; - // Locking the complete bitmap in writeonly mode - data = result.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, format); - // Writing the bitmap data directly into the new created .NET bitmap. - ConvertToRawBits(data.Scan0, dib, pitch, GetBPP(dib), - GetRedMask(dib), GetGreenMask(dib), GetBlueMask(dib), true); - // Unlock the bitmap - result.UnlockBits(data); - // Apply the bitmaps resolution - result.SetResolution(GetResolutionX(dib), GetResolutionY(dib)); - // Check whether the bitmap has a palette - if (GetPalette(dib) != IntPtr.Zero) - { - // Get the bitmaps palette to apply changes - ColorPalette palette = result.Palette; - // Get the orgininal palette - Color[] colorPalette = new Palette(dib).ColorData; - // Get the maximum number of palette entries to copy - int entriesToCopy = Math.Min(colorPalette.Length, palette.Entries.Length); - - // Check whether the bitmap is transparent - if (IsTransparent(dib)) - { - byte[] transTable = GetTransparencyTableEx(dib); - int i = 0; - int maxEntriesWithTrans = Math.Min(entriesToCopy, transTable.Length); - // Copy palette entries and include transparency - for (; i < maxEntriesWithTrans; i++) - { - palette.Entries[i] = Color.FromArgb(transTable[i], colorPalette[i]); - } - // Copy palette entries and that have no transparancy - for (; i < entriesToCopy; i++) - { - palette.Entries[i] = Color.FromArgb(0xFF, colorPalette[i]); - } - } - else - { - for (int i = 0; i < entriesToCopy; i++) - { - palette.Entries[i] = colorPalette[i]; - } - } - - // Set the bitmaps palette - result.Palette = palette; - } - // Copy metadata - if (copyMetadata) - { - try - { - List list = new List(); - // Get a list of all types - FITAG tag; - FIMETADATA mData; - foreach (FREE_IMAGE_MDMODEL model in FREE_IMAGE_MDMODELS) - { - // Get a unique search handle - mData = FindFirstMetadata(model, dib, out tag); - // Check if metadata exists for this type - if (mData.IsNull) continue; - do - { - PropertyItem propItem = CreatePropertyItem(); - propItem.Len = (int)GetTagLength(tag); - propItem.Id = (int)GetTagID(tag); - propItem.Type = (short)GetTagType(tag); - byte[] buffer = new byte[propItem.Len]; - - unsafe - { - byte* src = (byte*)GetTagValue(tag); - fixed (byte* dst = buffer) - { - CopyMemory(dst, src, (uint)propItem.Len); - } - } - - propItem.Value = buffer; - list.Add(propItem); - } - while (FindNextMetadata(mData, out tag)); - FindCloseMetadata(mData); - } - foreach (PropertyItem propItem in list) - { - result.SetPropertyItem(propItem); - } - } - catch - { - } - } - return result; - } - - /// - /// Converts an .NET into a FreeImage bitmap. - /// - /// The to convert. - /// Handle to a FreeImage bitmap. - /// Copying metadata has been disabled until a proper way - /// of reading and storing metadata in a .NET bitmap is found. - /// - /// is null. - /// - /// The bitmaps pixelformat is invalid. - public static FIBITMAP CreateFromBitmap(Bitmap bitmap) - { - return CreateFromBitmap(bitmap, false); - } - - /// - /// Converts an .NET into a FreeImage bitmap. - /// - /// The to convert. - /// When true existing metadata will be copied. - /// Handle to a FreeImage bitmap. - /// Copying metadata has been disabled until a proper way - /// of reading and storing metadata in a .NET bitmap is found. - /// - /// is null. - /// - /// The bitmaps pixelformat is invalid. - internal static FIBITMAP CreateFromBitmap(Bitmap bitmap, bool copyMetadata) - { - if (bitmap == null) - { - throw new ArgumentNullException("bitmap"); - } - uint bpp, red_mask, green_mask, blue_mask; - FREE_IMAGE_TYPE type; - if (!GetFormatParameters(bitmap.PixelFormat, out type, out bpp, out red_mask, out green_mask, out blue_mask)) - { - throw new ArgumentException("The bitmaps pixelformat is invalid."); - } - - // Locking the complete bitmap in readonly mode - BitmapData data = bitmap.LockBits( - new Rectangle(0, 0, bitmap.Width, bitmap.Height), ImageLockMode.ReadOnly, bitmap.PixelFormat); - // Copying the bitmap data directly from the .NET bitmap - FIBITMAP result = ConvertFromRawBits( - data.Scan0, - type, - data.Width, - data.Height, - data.Stride, - bpp, - red_mask, - green_mask, - blue_mask, - true); - bitmap.UnlockBits(data); - // Handle palette - if (GetPalette(result) != IntPtr.Zero) - { - Palette palette = new Palette(result); - Color[] colors = bitmap.Palette.Entries; - // Only copy available palette entries - int entriesToCopy = Math.Min(palette.Length, colors.Length); - byte[] transTable = new byte[entriesToCopy]; - for (int i = 0; i < entriesToCopy; i++) - { - RGBQUAD color = (RGBQUAD)colors[i]; - color.rgbReserved = 0x00; - palette[i] = color; - transTable[i] = colors[i].A; - } - if ((bitmap.Flags & (int)ImageFlags.HasAlpha) != 0) - { - FreeImage.SetTransparencyTable(result, transTable); - } - } - // Handle meta data - // Disabled - //if (copyMetadata) - //{ - // foreach (PropertyItem propItem in bitmap.PropertyItems) - // { - // FITAG tag = CreateTag(); - // SetTagLength(tag, (uint)propItem.Len); - // SetTagID(tag, (ushort)propItem.Id); - // SetTagType(tag, (FREE_IMAGE_MDTYPE)propItem.Type); - // SetTagValue(tag, propItem.Value); - // SetMetadata(FREE_IMAGE_MDMODEL.FIMD_EXIF_EXIF, result, "", tag); - // } - //} - return result; - } - - /// - /// Converts a raw bitmap to a FreeImage bitmap. - /// - /// Array of bytes containing the raw bitmap. - /// The type of the raw bitmap. - /// The width in pixels of the raw bitmap. - /// The height in pixels of the raw bitmap. - /// Defines the total width of a scanline in the raw bitmap, - /// including padding bytes. - /// The bit depth (bits per pixel) of the raw bitmap. - /// The bit mask describing the bits used to store a single - /// pixel's red component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// The bit mask describing the bits used to store a single - /// pixel's green component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// The bit mask describing the bits used to store a single - /// pixel's blue component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// If true, the raw bitmap is stored in top-down order (top-left pixel first) - /// and in bottom-up order (bottom-left pixel first) otherwise. - /// Handle to a FreeImage bitmap. - public static unsafe FIBITMAP ConvertFromRawBits( - byte[] bits, - FREE_IMAGE_TYPE type, - int width, - int height, - int pitch, - uint bpp, - uint red_mask, - uint green_mask, - uint blue_mask, - bool topdown) - { - fixed (byte* ptr = bits) - { - return ConvertFromRawBits( - (IntPtr)ptr, - type, - width, - height, - pitch, - bpp, - red_mask, - green_mask, - blue_mask, - topdown); - } - } - - /// - /// Converts a raw bitmap to a FreeImage bitmap. - /// - /// Pointer to the memory block containing the raw bitmap. - /// The type of the raw bitmap. - /// The width in pixels of the raw bitmap. - /// The height in pixels of the raw bitmap. - /// Defines the total width of a scanline in the raw bitmap, - /// including padding bytes. - /// The bit depth (bits per pixel) of the raw bitmap. - /// The bit mask describing the bits used to store a single - /// pixel's red component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// The bit mask describing the bits used to store a single - /// pixel's green component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// The bit mask describing the bits used to store a single - /// pixel's blue component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - /// If true, the raw bitmap is stored in top-down order (top-left pixel first) - /// and in bottom-up order (bottom-left pixel first) otherwise. - /// Handle to a FreeImage bitmap. - public static unsafe FIBITMAP ConvertFromRawBits( - IntPtr bits, - FREE_IMAGE_TYPE type, - int width, - int height, - int pitch, - uint bpp, - uint red_mask, - uint green_mask, - uint blue_mask, - bool topdown) - { - byte* addr = (byte*)bits; - if ((addr == null) || (width <= 0) || (height <= 0)) - { - return FIBITMAP.Zero; - } - - FIBITMAP dib = AllocateT(type, width, height, (int)bpp, red_mask, green_mask, blue_mask); - if (dib != FIBITMAP.Zero) - { - if (topdown) - { - for (int i = height - 1; i >= 0; --i) - { - CopyMemory((byte*)GetScanLine(dib, i), addr, (int)GetLine(dib)); - addr += pitch; - } - } - else - { - for (int i = 0; i < height; ++i) - { - CopyMemory((byte*)GetScanLine(dib, i), addr, (int)GetLine(dib)); - addr += pitch; - } - } - } - return dib; - } - - /// - /// Saves a .NET to a file. - /// - /// The .NET to save. - /// Name of the file to save to. - /// Returns true on success, false on failure. - /// - /// or is null. - /// - /// The bitmaps pixelformat is invalid. - public static bool SaveBitmap(Bitmap bitmap, string filename) - { - return SaveBitmap( - bitmap, - filename, - FREE_IMAGE_FORMAT.FIF_UNKNOWN, - FREE_IMAGE_SAVE_FLAGS.DEFAULT); - } - - /// - /// Saves a .NET to a file. - /// - /// The .NET to save. - /// Name of the file to save to. - /// Flags to enable or disable plugin-features. - /// Returns true on success, false on failure. - /// - /// or is null. - /// - /// The bitmaps pixelformat is invalid. - public static bool SaveBitmap(Bitmap bitmap, string filename, FREE_IMAGE_SAVE_FLAGS flags) - { - return SaveBitmap( - bitmap, - filename, - FREE_IMAGE_FORMAT.FIF_UNKNOWN, - flags); - } - - /// - /// Saves a .NET to a file. - /// - /// The .NET to save. - /// Name of the file to save to. - /// Format of the bitmap. If the format should be taken from the - /// filename use . - /// Flags to enable or disable plugin-features. - /// Returns true on success, false on failure. - /// - /// or is null. - /// - /// The bitmaps pixelformat is invalid. - public static bool SaveBitmap( - Bitmap bitmap, - string filename, - FREE_IMAGE_FORMAT format, - FREE_IMAGE_SAVE_FLAGS flags) - { - FIBITMAP dib = CreateFromBitmap(bitmap); - bool result = SaveEx(dib, filename, format, flags); - Unload(dib); - return result; - } - - /// - /// Loads a FreeImage bitmap. - /// The file will be loaded with default loading flags. - /// - /// The complete name of the file to load. - /// Handle to a FreeImage bitmap. - /// - /// does not exists. - public static FIBITMAP LoadEx(string filename) - { - FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_UNKNOWN; - return LoadEx(filename, FREE_IMAGE_LOAD_FLAGS.DEFAULT, ref format); - } - - /// - /// Loads a FreeImage bitmap. - /// Load flags can be provided by the flags parameter. - /// - /// The complete name of the file to load. - /// Flags to enable or disable plugin-features. - /// Handle to a FreeImage bitmap. - /// - /// does not exists. - public static FIBITMAP LoadEx(string filename, FREE_IMAGE_LOAD_FLAGS flags) - { - FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_UNKNOWN; - return LoadEx(filename, flags, ref format); - } - - /// - /// Loads a FreeImage bitmap. - /// In case the loading format is the files - /// real format is being analysed. If no plugin can read the file, format remains - /// and 0 is returned. - /// The file will be loaded with default loading flags. - /// - /// The complete name of the file to load. - /// Format of the image. If the format is unknown use - /// . - /// In case a suitable format was found by LoadEx it will be returned in format. - /// Handle to a FreeImage bitmap. - /// - /// does not exists. - public static FIBITMAP LoadEx(string filename, ref FREE_IMAGE_FORMAT format) - { - return LoadEx(filename, FREE_IMAGE_LOAD_FLAGS.DEFAULT, ref format); - } - - /// - /// Loads a FreeImage bitmap. - /// In case the loading format is the files - /// real format is being analysed. If no plugin can read the file, format remains - /// and 0 is returned. - /// Load flags can be provided by the flags parameter. - /// - /// The complete name of the file to load. - /// Flags to enable or disable plugin-features. - /// Format of the image. If the format is unknown use - /// . - /// In case a suitable format was found by LoadEx it will be returned in format. - /// - /// Handle to a FreeImage bitmap. - /// - /// does not exists. - public static FIBITMAP LoadEx(string filename, FREE_IMAGE_LOAD_FLAGS flags, ref FREE_IMAGE_FORMAT format) - { - // check if file exists - if (!File.Exists(filename)) - { - throw new FileNotFoundException(filename + " could not be found."); - } - FIBITMAP dib = new FIBITMAP(); - if (format == FREE_IMAGE_FORMAT.FIF_UNKNOWN) - { - // query all plugins to see if one can read the file - format = GetFileType(filename, 0); - } - // check if the plugin is capable of loading files - if (FIFSupportsReading(format)) - { - dib = Load(format, filename, flags); - } - return dib; - } - - /// - /// Loads a .NET from a file. - /// - /// Name of the file to be loaded. - /// Format of the image. If the format should be taken from the - /// filename use . - /// Flags to enable or disable plugin-features. - /// The loaded .NET . - /// - /// does not exists. - /// - /// The image type of the image is not . - public static Bitmap LoadBitmap(string filename, FREE_IMAGE_LOAD_FLAGS flags, ref FREE_IMAGE_FORMAT format) - { - FIBITMAP dib = LoadEx(filename, flags, ref format); - Bitmap result = GetBitmap(dib, true); - Unload(dib); - return result; - } - - /// - /// Deletes a previously loaded FreeImage bitmap from memory and resets the handle to 0. - /// - /// Handle to a FreeImage bitmap. - public static void UnloadEx(ref FIBITMAP dib) - { - if (!dib.IsNull) - { - Unload(dib); - dib.SetNull(); - } - } - - /// - /// Saves a previously loaded FreeImage bitmap to a file. - /// The format is taken off the filename. - /// If no suitable format was found false will be returned. - /// - /// Handle to a FreeImage bitmap. - /// The complete name of the file to save to. - /// The extension will be corrected if it is no valid extension for the - /// selected format or if no extension was specified. - /// Returns true on success, false on failure. - /// - /// or is null. - public static bool SaveEx(FIBITMAP dib, string filename) - { - return SaveEx( - ref dib, - filename, - FREE_IMAGE_FORMAT.FIF_UNKNOWN, - FREE_IMAGE_SAVE_FLAGS.DEFAULT, - FREE_IMAGE_COLOR_DEPTH.FICD_AUTO, - false); - } - - /// - /// Saves a previously loaded FreeImage bitmap to a file. - /// In case the loading format is - /// the format is taken off the filename. - /// If no suitable format was found false will be returned. - /// - /// Handle to a FreeImage bitmap. - /// The complete name of the file to save to. - /// The extension will be corrected if it is no valid extension for the - /// selected format or if no extension was specified. - /// Format of the image. If the format should be taken from the - /// filename use . - /// Returns true on success, false on failure. - /// - /// or is null. - public static bool SaveEx( - FIBITMAP dib, - string filename, - FREE_IMAGE_FORMAT format) - { - return SaveEx( - ref dib, - filename, - format, - FREE_IMAGE_SAVE_FLAGS.DEFAULT, - FREE_IMAGE_COLOR_DEPTH.FICD_AUTO, - false); - } - - /// - /// Saves a previously loaded FreeImage bitmap to a file. - /// The format is taken off the filename. - /// If no suitable format was found false will be returned. - /// - /// Handle to a FreeImage bitmap. - /// The complete name of the file to save to. - /// The extension will be corrected if it is no valid extension for the - /// selected format or if no extension was specified. - /// When true the structure will be unloaded on success. - /// If the function failed and returned false, the bitmap was not unloaded. - /// Returns true on success, false on failure. - /// - /// or is null. - public static bool SaveEx( - ref FIBITMAP dib, - string filename, - bool unloadSource) - { - return SaveEx( - ref dib, - filename, - FREE_IMAGE_FORMAT.FIF_UNKNOWN, - FREE_IMAGE_SAVE_FLAGS.DEFAULT, - FREE_IMAGE_COLOR_DEPTH.FICD_AUTO, - unloadSource); - } - - /// - /// Saves a previously loaded FreeImage bitmap to a file. - /// The format is taken off the filename. - /// If no suitable format was found false will be returned. - /// Save flags can be provided by the flags parameter. - /// - /// Handle to a FreeImage bitmap. - /// The complete name of the file to save to. - /// The extension will be corrected if it is no valid extension for the - /// selected format or if no extension was specified - /// Flags to enable or disable plugin-features. - /// Returns true on success, false on failure. - /// - /// or is null. - public static bool SaveEx( - FIBITMAP dib, - string filename, - FREE_IMAGE_SAVE_FLAGS flags) - { - return SaveEx( - ref dib, - filename, - FREE_IMAGE_FORMAT.FIF_UNKNOWN, - flags, - FREE_IMAGE_COLOR_DEPTH.FICD_AUTO, - false); - } - - /// - /// Saves a previously loaded FreeImage bitmap to a file. - /// The format is taken off the filename. - /// If no suitable format was found false will be returned. - /// Save flags can be provided by the flags parameter. - /// - /// Handle to a FreeImage bitmap. - /// The complete name of the file to save to. - /// The extension will be corrected if it is no valid extension for the - /// selected format or if no extension was specified. - /// Flags to enable or disable plugin-features. - /// When true the structure will be unloaded on success. - /// If the function failed and returned false, the bitmap was not unloaded. - /// Returns true on success, false on failure. - /// - /// or is null. - public static bool SaveEx( - ref FIBITMAP dib, - string filename, - FREE_IMAGE_SAVE_FLAGS flags, - bool unloadSource) - { - return SaveEx( - ref dib, - filename, - FREE_IMAGE_FORMAT.FIF_UNKNOWN, - flags, - FREE_IMAGE_COLOR_DEPTH.FICD_AUTO, - unloadSource); - } - - /// - /// Saves a previously loaded FreeImage bitmap to a file. - /// In case the loading format is - /// the format is taken off the filename. - /// If no suitable format was found false will be returned. - /// - /// Handle to a FreeImage bitmap. - /// The complete name of the file to save to. - /// The extension will be corrected if it is no valid extension for the - /// selected format or if no extension was specified. - /// Format of the image. If the format should be taken from the - /// filename use . - /// When true the structure will be unloaded on success. - /// If the function failed and returned false, the bitmap was not unloaded. - /// Returns true on success, false on failure. - /// - /// or is null. - public static bool SaveEx( - ref FIBITMAP dib, - string filename, - FREE_IMAGE_FORMAT format, - bool unloadSource) - { - return SaveEx( - ref dib, - filename, - format, - FREE_IMAGE_SAVE_FLAGS.DEFAULT, - FREE_IMAGE_COLOR_DEPTH.FICD_AUTO, - unloadSource); - } - - /// - /// Saves a previously loaded FreeImage bitmap to a file. - /// In case the loading format is - /// the format is taken off the filename. - /// If no suitable format was found false will be returned. - /// Save flags can be provided by the flags parameter. - /// - /// Handle to a FreeImage bitmap. - /// The complete name of the file to save to. - /// The extension will be corrected if it is no valid extension for the - /// selected format or if no extension was specified. - /// Format of the image. If the format should be taken from the - /// filename use . - /// Flags to enable or disable plugin-features. - /// Returns true on success, false on failure. - /// - /// or is null. - public static bool SaveEx( - FIBITMAP dib, - string filename, - FREE_IMAGE_FORMAT format, - FREE_IMAGE_SAVE_FLAGS flags) - { - return SaveEx( - ref dib, - filename, - format, - flags, - FREE_IMAGE_COLOR_DEPTH.FICD_AUTO, - false); - } - - /// - /// Saves a previously loaded FreeImage bitmap to a file. - /// In case the loading format is - /// the format is taken off the filename. - /// If no suitable format was found false will be returned. - /// Save flags can be provided by the flags parameter. - /// The bitmaps color depth can be set by 'colorDepth'. - /// If set to a suitable color depth - /// will be taken if available. - /// - /// Handle to a FreeImage bitmap. - /// The complete name of the file to save to. - /// The extension will be corrected if it is no valid extension for the - /// selected format or if no extension was specified. - /// Format of the image. If the format should be taken from the - /// filename use . - /// Flags to enable or disable plugin-features. - /// The new color depth of the bitmap. - /// Set to if Save should take the - /// best suitable color depth. - /// If a color depth is selected that the provided format cannot write an - /// error-message will be thrown. - /// When true the structure will be unloaded on success. - /// If the function failed and returned false, the bitmap was not unloaded. - /// Returns true on success, false on failure. - /// - /// A direct color conversion failed. - /// - /// or is null. - public static bool SaveEx( - ref FIBITMAP dib, - string filename, - FREE_IMAGE_FORMAT format, - FREE_IMAGE_SAVE_FLAGS flags, - FREE_IMAGE_COLOR_DEPTH colorDepth, - bool unloadSource) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - if (filename == null) - { - throw new ArgumentNullException("filename"); - } - bool result = false; - // Gets format from filename if the format is unknown - if (format == FREE_IMAGE_FORMAT.FIF_UNKNOWN) - { - format = GetFIFFromFilename(filename); - } - if (format != FREE_IMAGE_FORMAT.FIF_UNKNOWN) - { - // Checks writing support - if (FIFSupportsWriting(format) && FIFSupportsExportType(format, GetImageType(dib))) - { - // Check valid filename and correct it if needed - if (!IsFilenameValidForFIF(format, filename)) - { - string extension = GetPrimaryExtensionFromFIF(format); - filename = Path.ChangeExtension(filename, extension); - } - - FIBITMAP dibToSave = PrepareBitmapColorDepth(dib, format, colorDepth); - try - { - result = Save(format, dibToSave, filename, flags); - } - finally - { - // Always unload a temporary created bitmap. - if (dibToSave != dib) - { - UnloadEx(ref dibToSave); - } - // On success unload the bitmap - if (result && unloadSource) - { - UnloadEx(ref dib); - } - } - } - } - return result; - } - - /// - /// Loads a FreeImage bitmap. - /// The stream must be set to the correct position before calling LoadFromStream. - /// - /// The stream to read from. - /// Handle to a FreeImage bitmap. - /// - /// is null. - /// - /// is not capable of reading. - public static FIBITMAP LoadFromStream(Stream stream) - { - FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_UNKNOWN; - return LoadFromStream(stream, FREE_IMAGE_LOAD_FLAGS.DEFAULT, ref format); - } - - /// - /// Loads a FreeImage bitmap. - /// The stream must be set to the correct position before calling LoadFromStream. - /// - /// The stream to read from. - /// Flags to enable or disable plugin-features. - /// Handle to a FreeImage bitmap. - /// - /// is null. - /// - /// is not capable of reading. - public static FIBITMAP LoadFromStream(Stream stream, FREE_IMAGE_LOAD_FLAGS flags) - { - FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_UNKNOWN; - return LoadFromStream(stream, flags, ref format); - } - - /// - /// Loads a FreeImage bitmap. - /// In case the loading format is the - /// bitmaps real format is being analysed. - /// The stream must be set to the correct position before calling LoadFromStream. - /// - /// The stream to read from. - /// Format of the image. If the format is unknown use - /// . - /// In case a suitable format was found by LoadFromStream it will be returned in format. - /// Handle to a FreeImage bitmap. - /// - /// is null. - /// - /// is not capable of reading. - public static FIBITMAP LoadFromStream(Stream stream, ref FREE_IMAGE_FORMAT format) - { - return LoadFromStream(stream, FREE_IMAGE_LOAD_FLAGS.DEFAULT, ref format); - } - - /// - /// Loads a FreeImage bitmap. - /// In case the loading format is - /// the bitmaps real format is being analysed. - /// The stream must be set to the correct position before calling LoadFromStream. - /// - /// The stream to read from. - /// Flags to enable or disable plugin-features. - /// Format of the image. If the format is unknown use - /// . - /// In case a suitable format was found by LoadFromStream it will be returned in format. - /// Handle to a FreeImage bitmap. - /// - /// is null. - /// - /// is not capable of reading. - public static FIBITMAP LoadFromStream( - Stream stream, - FREE_IMAGE_LOAD_FLAGS flags, - ref FREE_IMAGE_FORMAT format) - { - if (stream == null) - { - throw new ArgumentNullException("stream"); - } - if (!stream.CanRead) - { - throw new ArgumentException("stream is not capable of reading."); - } - // Wrap the source stream if it is unable to seek (which is required by FreeImage) - stream = (stream.CanSeek) ? stream : new StreamWrapper(stream, true); - - stream.Position = 0L; - if (format == FREE_IMAGE_FORMAT.FIF_UNKNOWN) - { - // Get the format of the bitmap - format = GetFileTypeFromStream(stream); - // Restore the streams position - stream.Position = 0L; - } - if (!FIFSupportsReading(format)) - { - return FIBITMAP.Zero; - } - // Create a 'FreeImageIO' structure for calling 'LoadFromHandle' - // using the internal structure 'FreeImageStreamIO'. - FreeImageIO io = FreeImageStreamIO.io; - using (fi_handle handle = new fi_handle(stream)) - { - return LoadFromHandle(format, ref io, handle, flags); - } - } - - /// - /// Saves a previously loaded FreeImage bitmap to a stream. - /// The stream must be set to the correct position before calling SaveToStream. - /// - /// Handle to a FreeImage bitmap. - /// The stream to write to. - /// Format of the image. - /// Returns true on success, false on failure. - /// - /// or is null. - /// - /// cannot write. - public static bool SaveToStream( - FIBITMAP dib, - Stream stream, - FREE_IMAGE_FORMAT format) - { - return SaveToStream( - ref dib, - stream, - format, - FREE_IMAGE_SAVE_FLAGS.DEFAULT, - FREE_IMAGE_COLOR_DEPTH.FICD_AUTO, - false); - } - - /// - /// Saves a previously loaded FreeImage bitmap to a stream. - /// The stream must be set to the correct position before calling SaveToStream. - /// - /// Handle to a FreeImage bitmap. - /// The stream to write to. - /// Format of the image. - /// When true the structure will be unloaded on success. - /// Returns true on success, false on failure. - /// - /// or is null. - /// - /// cannot write. - public static bool SaveToStream( - ref FIBITMAP dib, - Stream stream, - FREE_IMAGE_FORMAT format, - bool unloadSource) - { - return SaveToStream( - ref dib, - stream, - format, - FREE_IMAGE_SAVE_FLAGS.DEFAULT, - FREE_IMAGE_COLOR_DEPTH.FICD_AUTO, - unloadSource); - } - - /// - /// Saves a previously loaded FreeImage bitmap to a stream. - /// The stream must be set to the correct position before calling SaveToStream. - /// - /// Handle to a FreeImage bitmap. - /// The stream to write to. - /// Format of the image. - /// Flags to enable or disable plugin-features. - /// Returns true on success, false on failure. - /// - /// or is null. - /// - /// cannot write. - public static bool SaveToStream( - FIBITMAP dib, - Stream stream, - FREE_IMAGE_FORMAT format, - FREE_IMAGE_SAVE_FLAGS flags) - { - return SaveToStream( - ref dib, - stream, - format, - flags, - FREE_IMAGE_COLOR_DEPTH.FICD_AUTO, - false); - } - - /// - /// Saves a previously loaded FreeImage bitmap to a stream. - /// The stream must be set to the correct position before calling SaveToStream. - /// - /// Handle to a FreeImage bitmap. - /// The stream to write to. - /// Format of the image. - /// Flags to enable or disable plugin-features. - /// When true the structure will be unloaded on success. - /// Returns true on success, false on failure. - /// - /// or is null. - /// - /// cannot write. - public static bool SaveToStream( - ref FIBITMAP dib, - Stream stream, - FREE_IMAGE_FORMAT format, - FREE_IMAGE_SAVE_FLAGS flags, - bool unloadSource) - { - return SaveToStream( - ref dib, stream, - format, - flags, - FREE_IMAGE_COLOR_DEPTH.FICD_AUTO, - unloadSource); - } - - /// - /// Saves a previously loaded FreeImage bitmap to a stream. - /// The stream must be set to the correct position before calling SaveToStream. - /// - /// Handle to a FreeImage bitmap. - /// The stream to write to. - /// Format of the image. - /// Flags to enable or disable plugin-features. - /// The new color depth of the bitmap. - /// Set to if SaveToStream should - /// take the best suitable color depth. - /// If a color depth is selected that the provided format cannot write an - /// error-message will be thrown. - /// Returns true on success, false on failure. - /// - /// or is null. - /// - /// cannot write. - public static bool SaveToStream( - FIBITMAP dib, - Stream stream, - FREE_IMAGE_FORMAT format, - FREE_IMAGE_SAVE_FLAGS flags, - FREE_IMAGE_COLOR_DEPTH colorDepth) - { - return SaveToStream( - ref dib, - stream, - format, - flags, - colorDepth, - false); - } - - /// - /// Saves a previously loaded FreeImage bitmap to a stream. - /// The stream must be set to the correct position before calling SaveToStream. - /// - /// Handle to a FreeImage bitmap. - /// The stream to write to. - /// Format of the image. - /// Flags to enable or disable plugin-features. - /// The new color depth of the bitmap. - /// Set to if SaveToStream should - /// take the best suitable color depth. - /// If a color depth is selected that the provided format cannot write an - /// error-message will be thrown. - /// When true the structure will be unloaded on success. - /// Returns true on success, false on failure. - /// - /// or is null. - /// - /// cannot write. - public static bool SaveToStream( - ref FIBITMAP dib, - Stream stream, - FREE_IMAGE_FORMAT format, - FREE_IMAGE_SAVE_FLAGS flags, - FREE_IMAGE_COLOR_DEPTH colorDepth, - bool unloadSource) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - if (stream == null) - { - throw new ArgumentNullException("stream"); - } - if (!stream.CanWrite) - { - throw new ArgumentException("stream is not capable of writing."); - } - if ((!FIFSupportsWriting(format)) || (!FIFSupportsExportType(format, GetImageType(dib)))) - { - return false; - } - - FIBITMAP dibToSave = PrepareBitmapColorDepth(dib, format, colorDepth); - bool result = false; - - try - { - // Create a 'FreeImageIO' structure for calling 'SaveToHandle' - FreeImageIO io = FreeImageStreamIO.io; - - using (fi_handle handle = new fi_handle(stream)) - { - result = SaveToHandle(format, dibToSave, ref io, handle, flags); - } - } - finally - { - // Always unload a temporary created bitmap. - if (dibToSave != dib) - { - UnloadEx(ref dibToSave); - } - // On success unload the bitmap - if (result && unloadSource) - { - UnloadEx(ref dib); - } - } - - return result; - } - - #endregion - - #region Plugin functions - - /// - /// Checks if an extension is valid for a certain format. - /// - /// The desired format. - /// The desired extension. - /// True if the extension is valid for the given format, false otherwise. - /// - /// is null. - public static bool IsExtensionValidForFIF(FREE_IMAGE_FORMAT fif, string extension) - { - return IsExtensionValidForFIF(fif, extension, StringComparison.CurrentCultureIgnoreCase); - } - - /// - /// Checks if an extension is valid for a certain format. - /// - /// The desired format. - /// The desired extension. - /// The string comparison type. - /// True if the extension is valid for the given format, false otherwise. - /// - /// is null. - public static bool IsExtensionValidForFIF(FREE_IMAGE_FORMAT fif, string extension, StringComparison comparisonType) - { - if (extension == null) - { - throw new ArgumentNullException("extension"); - } - bool result = false; - // Split up the string and compare each with the given extension - string tempList = GetFIFExtensionList(fif); - if (tempList != null) - { - string[] extensionList = tempList.Split(','); - foreach (string ext in extensionList) - { - if (extension.Equals(ext, comparisonType)) - { - result = true; - break; - } - } - } - return result; - } - - /// - /// Checks if a filename is valid for a certain format. - /// - /// The desired format. - /// The desired filename. - /// True if the filename is valid for the given format, false otherwise. - /// - /// is null. - public static bool IsFilenameValidForFIF(FREE_IMAGE_FORMAT fif, string filename) - { - return IsFilenameValidForFIF(fif, filename, StringComparison.CurrentCultureIgnoreCase); - } - - /// - /// Checks if a filename is valid for a certain format. - /// - /// The desired format. - /// The desired filename. - /// The string comparison type. - /// True if the filename is valid for the given format, false otherwise. - /// - /// is null. - public static bool IsFilenameValidForFIF(FREE_IMAGE_FORMAT fif, string filename, StringComparison comparisonType) - { - if (filename == null) - { - throw new ArgumentNullException("filename"); - } - bool result = false; - // Extract the filenames extension if it exists - string extension = Path.GetExtension(filename); - if (extension.Length != 0) - { - extension = extension.Remove(0, 1); - result = IsExtensionValidForFIF(fif, extension, comparisonType); - } - return result; - } - - /// - /// This function returns the primary (main or most commonly used?) extension of a certain - /// image format (fif). This is done by returning the first of all possible extensions - /// returned by GetFIFExtensionList(). - /// That assumes, that the plugin returns the extensions in ordered form. - /// The image format to obtain the primary extension for. - /// The primary extension of the specified image format. - public static string GetPrimaryExtensionFromFIF(FREE_IMAGE_FORMAT fif) - { - string result = null; - string extensions = GetFIFExtensionList(fif); - if (extensions != null) - { - int position = extensions.IndexOf(','); - if (position < 0) - { - result = extensions; - } - else - { - result = extensions.Substring(0, position); - } - } - return result; - } - - #endregion - - #region Multipage functions - - /// - /// Loads a FreeImage multi-paged bitmap. - /// - /// The complete name of the file to load. - /// Handle to a FreeImage multi-paged bitmap. - /// - /// does not exists while opening. - public static FIMULTIBITMAP OpenMultiBitmapEx(string filename) - { - FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_UNKNOWN; - return OpenMultiBitmapEx( - filename, - ref format, - FREE_IMAGE_LOAD_FLAGS.DEFAULT, - false, - false, - false); - } - - /// - /// Loads a FreeImage multi-paged bitmap. - /// - /// The complete name of the file to load. - /// When true performance is increased at the cost of memory. - /// Handle to a FreeImage multi-paged bitmap. - /// - /// does not exists while opening. - public static FIMULTIBITMAP OpenMultiBitmapEx(string filename, bool keep_cache_in_memory) - { - FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_UNKNOWN; - return OpenMultiBitmapEx( - filename, - ref format, - FREE_IMAGE_LOAD_FLAGS.DEFAULT, - false, - false, - keep_cache_in_memory); - } - - /// - /// Loads a FreeImage multi-paged bitmap. - /// - /// The complete name of the file to load. - /// When true the bitmap will be loaded read only. - /// When true performance is increased at the cost of memory. - /// Handle to a FreeImage multi-paged bitmap. - /// - /// does not exists while opening. - public static FIMULTIBITMAP OpenMultiBitmapEx( - string filename, - bool read_only, - bool keep_cache_in_memory) - { - FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_UNKNOWN; - return OpenMultiBitmapEx( - filename, - ref format, - FREE_IMAGE_LOAD_FLAGS.DEFAULT, - false, - read_only, - keep_cache_in_memory); - } - - /// - /// Loads a FreeImage multi-paged bitmap. - /// - /// The complete name of the file to load. - /// When true a new bitmap is created. - /// When true the bitmap will be loaded read only. - /// When true performance is increased at the cost of memory. - /// Handle to a FreeImage multi-paged bitmap. - /// - /// does not exists while opening. - public static FIMULTIBITMAP OpenMultiBitmapEx( - string filename, - bool create_new, - bool read_only, - bool keep_cache_in_memory) - { - FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_UNKNOWN; - return OpenMultiBitmapEx( - filename, - ref format, - FREE_IMAGE_LOAD_FLAGS.DEFAULT, - create_new, - read_only, - keep_cache_in_memory); - } - - /// - /// Loads a FreeImage multi-paged bitmap. - /// In case the loading format is the files real - /// format is being analysed. If no plugin can read the file, format remains - /// and 0 is returned. - /// - /// The complete name of the file to load. - /// Format of the image. If the format is unknown use - /// . - /// In case a suitable format was found by LoadEx it will be returned in format. - /// When true a new bitmap is created. - /// When true the bitmap will be loaded read only. - /// When true performance is increased at the cost of memory. - /// Handle to a FreeImage multi-paged bitmap. - /// - /// does not exists while opening. - public static FIMULTIBITMAP OpenMultiBitmapEx( - string filename, - ref FREE_IMAGE_FORMAT format, - bool create_new, - bool read_only, - bool keep_cache_in_memory) - { - return OpenMultiBitmapEx( - filename, - ref format, - FREE_IMAGE_LOAD_FLAGS.DEFAULT, - create_new, - read_only, - keep_cache_in_memory); - } - - /// - /// Loads a FreeImage multi-paged bitmap. - /// In case the loading format is the files - /// real format is being analysed. If no plugin can read the file, format remains - /// and 0 is returned. - /// Load flags can be provided by the flags parameter. - /// - /// The complete name of the file to load. - /// Format of the image. If the format is unknown use - /// . - /// In case a suitable format was found by LoadEx it will be returned in format. - /// Flags to enable or disable plugin-features. - /// When true a new bitmap is created. - /// When true the bitmap will be loaded read only. - /// When true performance is increased at the cost of memory. - /// Handle to a FreeImage multi-paged bitmap. - /// - /// does not exists while opening. - public static FIMULTIBITMAP OpenMultiBitmapEx( - string filename, - ref FREE_IMAGE_FORMAT format, - FREE_IMAGE_LOAD_FLAGS flags, - bool create_new, - bool read_only, - bool keep_cache_in_memory) - { - if (!File.Exists(filename) && !create_new) - { - throw new FileNotFoundException(filename + " could not be found."); - } - if (format == FREE_IMAGE_FORMAT.FIF_UNKNOWN) - { - // Check if a plugin can read the data - format = GetFileType(filename, 0); - } - FIMULTIBITMAP dib = new FIMULTIBITMAP(); - if (FIFSupportsReading(format)) - { - dib = OpenMultiBitmap(format, filename, create_new, read_only, keep_cache_in_memory, flags); - } - return dib; - } - - /// - /// Loads a FreeImage multi-paged bitmap. - /// - /// The stream to load the bitmap from. - /// Handle to a FreeImage multi-paged bitmap. - public static FIMULTIBITMAP OpenMultiBitmapFromStream(Stream stream) - { - FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_UNKNOWN; - return OpenMultiBitmapFromStream(stream, ref format, FREE_IMAGE_LOAD_FLAGS.DEFAULT); - } - - /// - /// Loads a FreeImage multi-paged bitmap. - /// In case the loading format is the files - /// real format is being analysed. If no plugin can read the file, format remains - /// and 0 is returned. - /// Load flags can be provided by the flags parameter. - /// - /// The stream to load the bitmap from. - /// Format of the image. If the format is unknown use - /// . - /// Flags to enable or disable plugin-features. - /// Handle to a FreeImage multi-paged bitmap. - public static FIMULTIBITMAP OpenMultiBitmapFromStream(Stream stream, ref FREE_IMAGE_FORMAT format, FREE_IMAGE_LOAD_FLAGS flags) - { - if (stream == null) - return FIMULTIBITMAP.Zero; - - if (!stream.CanSeek) - stream = new StreamWrapper(stream, true); - - FIMULTIBITMAP mdib = FIMULTIBITMAP.Zero; - FreeImageIO io = FreeImageStreamIO.io; - fi_handle handle = new fi_handle(stream); - - try - { - if (format == FREE_IMAGE_FORMAT.FIF_UNKNOWN) - { - format = GetFileTypeFromHandle(ref io, handle, checked((int)stream.Length)); - } - - mdib = OpenMultiBitmapFromHandle(format, ref io, handle, flags); - - if (mdib.IsNull) - { - handle.Dispose(); - } - else - { - lock (streamHandles) - { - streamHandles.Add(mdib, handle); - } - } - - return mdib; - } - catch - { - if (!mdib.IsNull) - CloseMultiBitmap(mdib, FREE_IMAGE_SAVE_FLAGS.DEFAULT); - - if (handle != null) - handle.Dispose(); - - throw; - } - } - - /// - /// Closes a previously opened multi-page bitmap and, when the bitmap was not opened read-only, applies any changes made to it. - /// - /// Handle to a FreeImage multi-paged bitmap. - /// Flags to enable or disable plugin-features. - /// Returns true on success, false on failure. - public static bool CloseMultiBitmap(FIMULTIBITMAP bitmap, FREE_IMAGE_SAVE_FLAGS flags) - { - if (CloseMultiBitmap_(bitmap, flags)) - { - fi_handle handle; - lock (streamHandles) - { - if (streamHandles.TryGetValue(bitmap, out handle)) - { - streamHandles.Remove(bitmap); - handle.Dispose(); - } - } - return true; - } - return false; - } - - /// - /// Closes a previously opened multi-page bitmap and, when the bitmap was not opened read-only, - /// applies any changes made to it. - /// On success the handle will be reset to null. - /// - /// Handle to a FreeImage multi-paged bitmap. - /// Returns true on success, false on failure. - public static bool CloseMultiBitmapEx(ref FIMULTIBITMAP bitmap) - { - return CloseMultiBitmapEx(ref bitmap, FREE_IMAGE_SAVE_FLAGS.DEFAULT); - } - - /// - /// Closes a previously opened multi-page bitmap and, when the bitmap was not opened read-only, - /// applies any changes made to it. - /// On success the handle will be reset to null. - /// - /// Handle to a FreeImage multi-paged bitmap. - /// Flags to enable or disable plugin-features. - /// Returns true on success, false on failure. - public static bool CloseMultiBitmapEx(ref FIMULTIBITMAP bitmap, FREE_IMAGE_SAVE_FLAGS flags) - { - bool result = false; - if (!bitmap.IsNull) - { - if (CloseMultiBitmap(bitmap, flags)) - { - bitmap.SetNull(); - result = true; - } - } - return result; - } - - /// - /// Retrieves the number of pages that are locked in a multi-paged bitmap. - /// - /// Handle to a FreeImage multi-paged bitmap. - /// Number of locked pages. - /// - /// is null. - public static int GetLockedPageCount(FIMULTIBITMAP dib) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - int result = 0; - GetLockedPageNumbers(dib, null, ref result); - return result; - } - - /// - /// Retrieves a list locked pages of a multi-paged bitmap. - /// - /// Handle to a FreeImage multi-paged bitmap. - /// List containing the indexes of the locked pages. - /// - /// is null. - public static int[] GetLockedPages(FIMULTIBITMAP dib) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - // Get the number of pages and create an array to save the information - int count = 0; - int[] result = null; - // Get count - if (GetLockedPageNumbers(dib, result, ref count)) - { - result = new int[count]; - // Fill array - if (!GetLockedPageNumbers(dib, result, ref count)) - { - result = null; - } - } - return result; - } - - /// - /// Loads a FreeImage multi-paged bitmap from a stream and returns the - /// FreeImage memory stream used as temporary buffer. - /// The bitmap can not be modified by calling - /// , - /// , - /// or - /// . - /// - /// The stream to read from. - /// Format of the image. - /// Flags to enable or disable plugin-features. - /// The temporary memory buffer used to load the bitmap. - /// Handle to a FreeImage multi-paged bitmap. - /// - /// is null. - /// - /// can not read. - public static FIMULTIBITMAP LoadMultiBitmapFromStream( - Stream stream, - FREE_IMAGE_FORMAT format, - FREE_IMAGE_LOAD_FLAGS flags, - out FIMEMORY memory) - { - if (stream == null) - { - throw new ArgumentNullException("stream"); - } - if (!stream.CanRead) - { - throw new ArgumentException("stream"); - } - const int blockSize = 1024; - int bytesRead; - byte[] buffer = new byte[blockSize]; - - stream = stream.CanSeek ? stream : new StreamWrapper(stream, true); - memory = OpenMemory(IntPtr.Zero, 0); - - do - { - bytesRead = stream.Read(buffer, 0, blockSize); - WriteMemory(buffer, (uint)blockSize, (uint)1, memory); - } - while (bytesRead == blockSize); - - return LoadMultiBitmapFromMemory(format, memory, flags); - } - - #endregion - - #region Filetype functions - - /// - /// Orders FreeImage to analyze the bitmap signature. - /// In case the stream is not seekable, the stream will have been used - /// and must be recreated for loading. - /// - /// Name of the stream to analyze. - /// Type of the bitmap. - /// - /// is null. - /// - /// can not read. - public static FREE_IMAGE_FORMAT GetFileTypeFromStream(Stream stream) - { - if (stream == null) - { - throw new ArgumentNullException("stream"); - } - if (!stream.CanRead) - { - throw new ArgumentException("stream is not capable of reading."); - } - // Wrap the stream if it cannot seek - stream = (stream.CanSeek) ? stream : new StreamWrapper(stream, true); - // Create a 'FreeImageIO' structure for the stream - FreeImageIO io = FreeImageStreamIO.io; - using (fi_handle handle = new fi_handle(stream)) - { - return GetFileTypeFromHandle(ref io, handle, 0); - } - } - - #endregion - - #region Pixel access functions - - /// - /// Retrieves an hBitmap for a FreeImage bitmap. - /// Call FreeHbitmap(IntPtr) to free the handle. - /// - /// Handle to a FreeImage bitmap. - /// A reference device context. - /// Use IntPtr.Zero if no reference is available. - /// When true dib will be unloaded if the function succeeded. - /// The hBitmap for the FreeImage bitmap. - /// - /// is null. - public static unsafe IntPtr GetHbitmap(FIBITMAP dib, IntPtr hdc, bool unload) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - IntPtr hBitmap = IntPtr.Zero; - bool release = false; - IntPtr ppvBits = IntPtr.Zero; - // Check if we have destination - if (release = (hdc == IntPtr.Zero)) - { - // We don't so request dc - hdc = GetDC(IntPtr.Zero); - } - if (hdc != IntPtr.Zero) - { - // Get pointer to the infoheader of the bitmap - IntPtr info = GetInfo(dib); - // Create a bitmap in the dc - hBitmap = CreateDIBSection(hdc, info, DIB_RGB_COLORS, out ppvBits, IntPtr.Zero, 0); - if (hBitmap != IntPtr.Zero && ppvBits != IntPtr.Zero) - { - // Copy the data into the dc - CopyMemory(ppvBits, GetBits(dib), (GetHeight(dib) * GetPitch(dib))); - // Success: we unload the bitmap - if (unload) - { - Unload(dib); - } - } - // We have to release the dc - if (release) - { - ReleaseDC(IntPtr.Zero, hdc); - } - } - return hBitmap; - } - - /// - /// Returns an HBITMAP created by the CreateDIBitmap() function which in turn - /// has always the same color depth as the reference DC, which may be provided - /// through . The desktop DC will be used, - /// if IntPtr.Zero DC is specified. - /// Call to free the handle. - /// - /// Handle to a FreeImage bitmap. - /// Handle to a device context. - /// When true the structure will be unloaded on success. - /// If the function failed and returned false, the bitmap was not unloaded. - /// If the function succeeds, the return value is a handle to the - /// compatible bitmap. If the function fails, the return value is . - /// - /// is null. - public static IntPtr GetBitmapForDevice(FIBITMAP dib, IntPtr hdc, bool unload) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - IntPtr hbitmap = IntPtr.Zero; - bool release = false; - if (release = (hdc == IntPtr.Zero)) - { - hdc = GetDC(IntPtr.Zero); - } - if (hdc != IntPtr.Zero) - { - hbitmap = CreateDIBitmap( - hdc, - GetInfoHeader(dib), - CBM_INIT, - GetBits(dib), - GetInfo(dib), - DIB_RGB_COLORS); - if (unload) - { - Unload(dib); - } - if (release) - { - ReleaseDC(IntPtr.Zero, hdc); - } - } - return hbitmap; - } - - /// - /// Creates a FreeImage DIB from a Device Context/Compatible Bitmap. - /// - /// Handle to the bitmap. - /// Handle to a device context. - /// Handle to a FreeImage bitmap. - /// - /// is null. - public unsafe static FIBITMAP CreateFromHbitmap(IntPtr hbitmap, IntPtr hdc) - { - if (hbitmap == IntPtr.Zero) - { - throw new ArgumentNullException("hbitmap"); - } - - FIBITMAP dib = new FIBITMAP(); - BITMAP bm; - uint colors; - bool release; - - if (GetObject(hbitmap, sizeof(BITMAP), (IntPtr)(&bm)) != 0) - { - dib = Allocate(bm.bmWidth, bm.bmHeight, bm.bmBitsPixel, 0, 0, 0); - if (!dib.IsNull) - { - colors = GetColorsUsed(dib); - if (release = (hdc == IntPtr.Zero)) - { - hdc = GetDC(IntPtr.Zero); - } - if (GetDIBits( - hdc, - hbitmap, - 0, - (uint)bm.bmHeight, - GetBits(dib), - GetInfo(dib), - DIB_RGB_COLORS) != 0) - { - if (colors != 0) - { - BITMAPINFOHEADER* bmih = (BITMAPINFOHEADER*)GetInfo(dib); - bmih[0].biClrImportant = bmih[0].biClrUsed = colors; - } - } - else - { - UnloadEx(ref dib); - } - if (release) - { - ReleaseDC(IntPtr.Zero, hdc); - } - } - } - - return dib; - } - - /// - /// Frees a bitmap handle. - /// - /// Handle to a bitmap. - /// True on success, false on failure. - public static bool FreeHbitmap(IntPtr hbitmap) - { - return DeleteObject(hbitmap); - } - - #endregion - - #region Bitmap information functions - - /// - /// Retrieves a DIB's resolution in X-direction measured in 'dots per inch' (DPI) and not in - /// 'dots per meter'. - /// - /// Handle to a FreeImage bitmap. - /// The resolution in 'dots per inch'. - /// - /// is null. - public static uint GetResolutionX(FIBITMAP dib) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - return (uint)(0.5d + 0.0254d * GetDotsPerMeterX(dib)); - } - - /// - /// Retrieves a DIB's resolution in Y-direction measured in 'dots per inch' (DPI) and not in - /// 'dots per meter'. - /// - /// Handle to a FreeImage bitmap. - /// The resolution in 'dots per inch'. - /// - /// is null. - public static uint GetResolutionY(FIBITMAP dib) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - return (uint)(0.5d + 0.0254d * GetDotsPerMeterY(dib)); - } - - /// - /// Sets a DIB's resolution in X-direction measured in 'dots per inch' (DPI) and not in - /// 'dots per meter'. - /// - /// Handle to a FreeImage bitmap. - /// The new resolution in 'dots per inch'. - /// - /// is null. - public static void SetResolutionX(FIBITMAP dib, uint res) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - SetDotsPerMeterX(dib, (uint)((double)res / 0.0254d + 0.5d)); - } - - /// - /// Sets a DIB's resolution in Y-direction measured in 'dots per inch' (DPI) and not in - /// 'dots per meter'. - /// - /// Handle to a FreeImage bitmap. - /// The new resolution in 'dots per inch'. - /// - /// is null. - public static void SetResolutionY(FIBITMAP dib, uint res) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - SetDotsPerMeterY(dib, (uint)((double)res / 0.0254d + 0.5d)); - } - - /// - /// Returns whether the image is a greyscale image or not. - /// The function scans all colors in the bitmaps palette for entries where - /// red, green and blue are not all the same (not a grey color). - /// Supports 1-, 4- and 8-bit bitmaps. - /// - /// Handle to a FreeImage bitmap. - /// True if the image is a greyscale image, else false. - /// - /// is null. - public static unsafe bool IsGreyscaleImage(FIBITMAP dib) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - bool result = true; - uint bpp = GetBPP(dib); - switch (bpp) - { - case 1: - case 4: - case 8: - RGBQUAD* palette = (RGBQUAD*)GetPalette(dib); - uint paletteLength = GetColorsUsed(dib); - for (int i = 0; i < paletteLength; i++) - { - if (palette[i].rgbRed != palette[i].rgbGreen || - palette[i].rgbRed != palette[i].rgbBlue) - { - result = false; - break; - } - } - break; - default: - result = false; - break; - } - return result; - } - - /// - /// Returns a structure that represents the palette of a FreeImage bitmap. - /// - /// Handle to a FreeImage bitmap. - /// A structure representing the bitmaps palette. - /// - /// is null. - public static Palette GetPaletteEx(FIBITMAP dib) - { - return new Palette(dib); - } - - /// - /// Returns the structure of a FreeImage bitmap. - /// The structure is a copy, so changes will have no effect on - /// the bitmap itself. - /// - /// Handle to a FreeImage bitmap. - /// structure of the bitmap. - /// - /// is null. - public static unsafe BITMAPINFOHEADER GetInfoHeaderEx(FIBITMAP dib) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - return *(BITMAPINFOHEADER*)GetInfoHeader(dib); - } - - /// - /// Returns the structure of a FreeImage bitmap. - /// The structure is a copy, so changes will have no effect on - /// the bitmap itself. - /// - /// Handle to a FreeImage bitmap. - /// structure of the bitmap. - /// - /// is null. - public static BITMAPINFO GetInfoEx(FIBITMAP dib) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - BITMAPINFO result = new BITMAPINFO(); - result.bmiHeader = GetInfoHeaderEx(dib); - IntPtr ptr = GetPalette(dib); - if (ptr == IntPtr.Zero) - { - result.bmiColors = new RGBQUAD[0]; - } - else - { - result.bmiColors = new MemoryArray(ptr, (int)result.bmiHeader.biClrUsed).Data; - } - return result; - } - - /// - /// Returns the pixelformat of the bitmap. - /// - /// Handle to a FreeImage bitmap. - /// of the bitmap. - /// - /// is null. - public static PixelFormat GetPixelFormat(FIBITMAP dib) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - - PixelFormat result = PixelFormat.Undefined; - - if (GetImageType(dib) == FREE_IMAGE_TYPE.FIT_BITMAP) - { - switch (GetBPP(dib)) - { - case 1: - result = PixelFormat.Format1bppIndexed; - break; - case 4: - result = PixelFormat.Format4bppIndexed; - break; - case 8: - result = PixelFormat.Format8bppIndexed; - break; - case 16: - if ((GetBlueMask(dib) == FI16_565_BLUE_MASK) && - (GetGreenMask(dib) == FI16_565_GREEN_MASK) && - (GetRedMask(dib) == FI16_565_RED_MASK)) - { - result = PixelFormat.Format16bppRgb565; - } - if ((GetBlueMask(dib) == FI16_555_BLUE_MASK) && - (GetGreenMask(dib) == FI16_555_GREEN_MASK) && - (GetRedMask(dib) == FI16_555_RED_MASK)) - { - result = PixelFormat.Format16bppRgb555; - } - break; - case 24: - result = PixelFormat.Format24bppRgb; - break; - case 32: - result = PixelFormat.Format32bppArgb; - break; - } - } - return result; - } - - /// - /// Retrieves all parameters needed to create a new FreeImage bitmap from - /// the format of a .NET . - /// - /// The - /// of the .NET . - /// Returns the type used for the new bitmap. - /// Returns the color depth for the new bitmap. - /// Returns the red_mask for the new bitmap. - /// Returns the green_mask for the new bitmap. - /// Returns the blue_mask for the new bitmap. - /// True in case a matching conversion exists; else false. - /// - public static bool GetFormatParameters( - PixelFormat format, - out FREE_IMAGE_TYPE type, - out uint bpp, - out uint red_mask, - out uint green_mask, - out uint blue_mask) - { - bool result = false; - type = FREE_IMAGE_TYPE.FIT_UNKNOWN; - bpp = 0; - red_mask = 0; - green_mask = 0; - blue_mask = 0; - switch (format) - { - case PixelFormat.Format1bppIndexed: - type = FREE_IMAGE_TYPE.FIT_BITMAP; - bpp = 1; - result = true; - break; - case PixelFormat.Format4bppIndexed: - type = FREE_IMAGE_TYPE.FIT_BITMAP; - bpp = 4; - result = true; - break; - case PixelFormat.Format8bppIndexed: - type = FREE_IMAGE_TYPE.FIT_BITMAP; - bpp = 8; - result = true; - break; - case PixelFormat.Format16bppRgb565: - type = FREE_IMAGE_TYPE.FIT_BITMAP; - bpp = 16; - red_mask = FI16_565_RED_MASK; - green_mask = FI16_565_GREEN_MASK; - blue_mask = FI16_565_BLUE_MASK; - result = true; - break; - case PixelFormat.Format16bppRgb555: - case PixelFormat.Format16bppArgb1555: - type = FREE_IMAGE_TYPE.FIT_BITMAP; - bpp = 16; - red_mask = FI16_555_RED_MASK; - green_mask = FI16_555_GREEN_MASK; - blue_mask = FI16_555_BLUE_MASK; - result = true; - break; - case PixelFormat.Format24bppRgb: - type = FREE_IMAGE_TYPE.FIT_BITMAP; - bpp = 24; - red_mask = FI_RGBA_RED_MASK; - green_mask = FI_RGBA_GREEN_MASK; - blue_mask = FI_RGBA_BLUE_MASK; - result = true; - break; - case PixelFormat.Format32bppRgb: - case PixelFormat.Format32bppArgb: - case PixelFormat.Format32bppPArgb: - type = FREE_IMAGE_TYPE.FIT_BITMAP; - bpp = 32; - red_mask = FI_RGBA_RED_MASK; - green_mask = FI_RGBA_GREEN_MASK; - blue_mask = FI_RGBA_BLUE_MASK; - result = true; - break; - case PixelFormat.Format16bppGrayScale: - type = FREE_IMAGE_TYPE.FIT_UINT16; - bpp = 16; - result = true; - break; - case PixelFormat.Format48bppRgb: - type = FREE_IMAGE_TYPE.FIT_RGB16; - bpp = 48; - result = true; - break; - case PixelFormat.Format64bppArgb: - case PixelFormat.Format64bppPArgb: - type = FREE_IMAGE_TYPE.FIT_RGBA16; - bpp = 64; - result = true; - break; - } - return result; - } - - /// - /// Returns the for the specified - /// . - /// - /// The - /// for which to return the corresponding . - /// The for the specified - /// - public static FREE_IMAGE_FORMAT GetFormat(ImageFormat imageFormat) - { - if (imageFormat != null) - { - if (imageFormat.Equals(ImageFormat.Bmp)) - return FREE_IMAGE_FORMAT.FIF_BMP; - if (imageFormat.Equals(ImageFormat.Gif)) - return FREE_IMAGE_FORMAT.FIF_GIF; - if (imageFormat.Equals(ImageFormat.Icon)) - return FREE_IMAGE_FORMAT.FIF_ICO; - if (imageFormat.Equals(ImageFormat.Jpeg)) - return FREE_IMAGE_FORMAT.FIF_JPEG; - if (imageFormat.Equals(ImageFormat.Png)) - return FREE_IMAGE_FORMAT.FIF_PNG; - if (imageFormat.Equals(ImageFormat.Tiff)) - return FREE_IMAGE_FORMAT.FIF_TIFF; - } - return FREE_IMAGE_FORMAT.FIF_UNKNOWN; - } - - /// - /// Retrieves all parameters needed to create a new FreeImage bitmap from - /// raw bits . - /// - /// The - /// of the data in memory. - /// The color depth for the data. - /// Returns the red_mask for the data. - /// Returns the green_mask for the data. - /// Returns the blue_mask for the data. - /// True in case a matching conversion exists; else false. - /// - public static bool GetTypeParameters( - FREE_IMAGE_TYPE type, - int bpp, - out uint red_mask, - out uint green_mask, - out uint blue_mask) - { - bool result = false; - red_mask = 0; - green_mask = 0; - blue_mask = 0; - switch (type) - { - case FREE_IMAGE_TYPE.FIT_BITMAP: - switch (bpp) - { - case 1: - case 4: - case 8: - result = true; - break; - case 16: - result = true; - red_mask = FI16_555_RED_MASK; - green_mask = FI16_555_GREEN_MASK; - blue_mask = FI16_555_BLUE_MASK; - break; - case 24: - case 32: - result = true; - red_mask = FI_RGBA_RED_MASK; - green_mask = FI_RGBA_GREEN_MASK; - blue_mask = FI_RGBA_BLUE_MASK; - break; - } - break; - case FREE_IMAGE_TYPE.FIT_UNKNOWN: - break; - default: - result = true; - break; - } - return result; - } - - /// - /// Compares two FreeImage bitmaps. - /// - /// The first bitmap to compare. - /// The second bitmap to compare. - /// Determines which components of the bitmaps will be compared. - /// True in case both bitmaps match the compare conditions, false otherwise. - public static bool Compare(FIBITMAP dib1, FIBITMAP dib2, FREE_IMAGE_COMPARE_FLAGS flags) - { - // Check whether one bitmap is null - if (dib1.IsNull ^ dib2.IsNull) - { - return false; - } - // Check whether both pointers are the same - if (dib1 == dib2) - { - return true; - } - if (((flags & FREE_IMAGE_COMPARE_FLAGS.HEADER) > 0) && (!CompareHeader(dib1, dib2))) - { - return false; - } - if (((flags & FREE_IMAGE_COMPARE_FLAGS.PALETTE) > 0) && (!ComparePalette(dib1, dib2))) - { - return false; - } - if (((flags & FREE_IMAGE_COMPARE_FLAGS.DATA) > 0) && (!CompareData(dib1, dib2))) - { - return false; - } - if (((flags & FREE_IMAGE_COMPARE_FLAGS.METADATA) > 0) && (!CompareMetadata(dib1, dib2))) - { - return false; - } - return true; - } - - private static unsafe bool CompareHeader(FIBITMAP dib1, FIBITMAP dib2) - { - IntPtr i1 = GetInfoHeader(dib1); - IntPtr i2 = GetInfoHeader(dib2); - return CompareMemory((void*)i1, (void*)i2, sizeof(BITMAPINFOHEADER)); - } - - private static unsafe bool ComparePalette(FIBITMAP dib1, FIBITMAP dib2) - { - IntPtr pal1 = GetPalette(dib1), pal2 = GetPalette(dib2); - bool hasPalette1 = pal1 != IntPtr.Zero; - bool hasPalette2 = pal2 != IntPtr.Zero; - if (hasPalette1 ^ hasPalette2) - { - return false; - } - if (!hasPalette1) - { - return true; - } - uint colors = GetColorsUsed(dib1); - if (colors != GetColorsUsed(dib2)) - { - return false; - } - return CompareMemory((void*)pal1, (void*)pal2, sizeof(RGBQUAD) * colors); - } - - private static unsafe bool CompareData(FIBITMAP dib1, FIBITMAP dib2) - { - uint width = GetWidth(dib1); - if (width != GetWidth(dib2)) - { - return false; - } - uint height = GetHeight(dib1); - if (height != GetHeight(dib2)) - { - return false; - } - uint bpp = GetBPP(dib1); - if (bpp != GetBPP(dib2)) - { - return false; - } - if (GetColorType(dib1) != GetColorType(dib2)) - { - return false; - } - FREE_IMAGE_TYPE type = GetImageType(dib1); - if (type != GetImageType(dib2)) - { - return false; - } - if (GetRedMask(dib1) != GetRedMask(dib2)) - { - return false; - } - if (GetGreenMask(dib1) != GetGreenMask(dib2)) - { - return false; - } - if (GetBlueMask(dib1) != GetBlueMask(dib2)) - { - return false; - } - - byte* ptr1, ptr2; - int fullBytes; - int shift; - uint line = GetLine(dib1); - - if (type == FREE_IMAGE_TYPE.FIT_BITMAP) - { - switch (bpp) - { - case 32: - for (int i = 0; i < height; i++) - { - ptr1 = (byte*)GetScanLine(dib1, i); - ptr2 = (byte*)GetScanLine(dib2, i); - if (!CompareMemory(ptr1, ptr2, line)) - { - return false; - } - } - break; - case 24: - for (int i = 0; i < height; i++) - { - ptr1 = (byte*)GetScanLine(dib1, i); - ptr2 = (byte*)GetScanLine(dib2, i); - if (!CompareMemory(ptr1, ptr2, line)) - { - return false; - } - } - break; - case 16: - short* sPtr1, sPtr2; - short mask = (short)(GetRedMask(dib1) | GetGreenMask(dib1) | GetBlueMask(dib1)); - if (mask == -1) - { - for (int i = 0; i < height; i++) - { - sPtr1 = (short*)GetScanLine(dib1, i); - sPtr2 = (short*)GetScanLine(dib2, i); - if (!CompareMemory(sPtr1, sPtr1, line)) - { - return false; - } - } - } - else - { - for (int i = 0; i < height; i++) - { - sPtr1 = (short*)GetScanLine(dib1, i); - sPtr2 = (short*)GetScanLine(dib2, i); - for (int x = 0; x < width; x++) - { - if ((sPtr1[x] & mask) != (sPtr2[x] & mask)) - { - return false; - } - } - } - } - break; - case 8: - for (int i = 0; i < height; i++) - { - ptr1 = (byte*)GetScanLine(dib1, i); - ptr2 = (byte*)GetScanLine(dib2, i); - if (!CompareMemory(ptr1, ptr2, line)) - { - return false; - } - } - break; - case 4: - fullBytes = (int)width / 2; - shift = (width % 2) == 0 ? 8 : 4; - for (int i = 0; i < height; i++) - { - ptr1 = (byte*)GetScanLine(dib1, i); - ptr2 = (byte*)GetScanLine(dib2, i); - if (fullBytes != 0) - { - if (!CompareMemory(ptr1, ptr2, fullBytes)) - { - return false; - } - ptr1 += fullBytes; - ptr2 += fullBytes; - } - if (shift != 8) - { - if ((ptr1[0] >> shift) != (ptr2[0] >> shift)) - { - return false; - } - } - } - break; - case 1: - fullBytes = (int)width / 8; - shift = 8 - ((int)width % 8); - for (int i = 0; i < height; i++) - { - ptr1 = (byte*)GetScanLine(dib1, i); - ptr2 = (byte*)GetScanLine(dib2, i); - if (fullBytes != 0) - { - if (!CompareMemory(ptr1, ptr2, fullBytes)) - { - return false; - } - ptr1 += fullBytes; - ptr2 += fullBytes; - } - if (shift != 8) - { - if ((ptr1[0] >> shift) != (ptr2[0] >> shift)) - { - return false; - } - } - } - break; - default: - throw new NotSupportedException("Only 1, 4, 8, 16, 24 and 32 bpp bitmaps are supported."); - } - } - else - { - for (int i = 0; i < height; i++) - { - ptr1 = (byte*)GetScanLine(dib1, i); - ptr2 = (byte*)GetScanLine(dib2, i); - if (!CompareMemory(ptr1, ptr2, line)) - { - return false; - } - } - } - return true; - } - - private static bool CompareMetadata(FIBITMAP dib1, FIBITMAP dib2) - { - MetadataTag tag1, tag2; - - foreach (FREE_IMAGE_MDMODEL metadataModel in FREE_IMAGE_MDMODELS) - { - if (GetMetadataCount(metadataModel, dib1) != - GetMetadataCount(metadataModel, dib2)) - { - return false; - } - if (GetMetadataCount(metadataModel, dib1) == 0) - { - continue; - } - - FIMETADATA mdHandle = FindFirstMetadata(metadataModel, dib1, out tag1); - if (mdHandle.IsNull) - { - continue; - } - do - { - if ((!GetMetadata(metadataModel, dib2, tag1.Key, out tag2)) || (tag1 != tag2)) - { - FindCloseMetadata(mdHandle); - return false; - } - } - while (FindNextMetadata(mdHandle, out tag1)); - FindCloseMetadata(mdHandle); - } - - return true; - } - - /// - /// Returns the FreeImage bitmap's transparency table. - /// The array is empty in case the bitmap has no transparency table. - /// - /// Handle to a FreeImage bitmap. - /// The FreeImage bitmap's transparency table. - /// - /// is null. - public static unsafe byte[] GetTransparencyTableEx(FIBITMAP dib) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - uint count = GetTransparencyCount(dib); - byte[] result = new byte[count]; - byte* ptr = (byte*)GetTransparencyTable(dib); - fixed (byte* dst = result) - { - CopyMemory(dst, ptr, count); - } - return result; - } - - /// - /// Set the FreeImage bitmap's transparency table. Only affects palletised bitmaps. - /// - /// Handle to a FreeImage bitmap. - /// The FreeImage bitmap's new transparency table. - /// - /// or is null. - public static void SetTransparencyTable(FIBITMAP dib, byte[] table) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - if (table == null) - { - throw new ArgumentNullException("table"); - } - SetTransparencyTable(dib, table, table.Length); - } - - /// - /// This function returns the number of unique colors actually used by the - /// specified 1-, 4-, 8-, 16-, 24- or 32-bit image. This might be different from - /// what function FreeImage_GetColorsUsed() returns, which actually returns the - /// palette size for palletised images. Works for - /// type images only. - /// - /// Handle to a FreeImage bitmap. - /// Returns the number of unique colors used by the image specified or - /// zero, if the image type cannot be handled. - /// - /// is null. - public static unsafe int GetUniqueColors(FIBITMAP dib) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - - int result = 0; - - if (GetImageType(dib) == FREE_IMAGE_TYPE.FIT_BITMAP) - { - BitArray bitArray; - int uniquePalEnts; - int hashcode; - byte[] lut; - int width = (int)GetWidth(dib); - int height = (int)GetHeight(dib); - - switch (GetBPP(dib)) - { - case 1: - - result = 1; - lut = CreateShrunkenPaletteLUT(dib, out uniquePalEnts); - if (uniquePalEnts == 1) - { - break; - } - - if ((*(byte*)GetScanLine(dib, 0) & 0x80) == 0) - { - for (int y = 0; y < height; y++) - { - byte* scanline = (byte*)GetScanLine(dib, y); - int mask = 0x80; - for (int x = 0; x < width; x++) - { - if ((scanline[x / 8] & mask) > 0) - { - return 2; - } - mask = (mask == 0x1) ? 0x80 : (mask >> 1); - } - } - } - else - { - for (int y = 0; y < height; y++) - { - byte* scanline = (byte*)GetScanLine(dib, y); - int mask = 0x80; - for (int x = 0; x < width; x++) - { - if ((scanline[x / 8] & mask) == 0) - { - return 2; - } - mask = (mask == 0x1) ? 0x80 : (mask >> 1); - } - } - } - break; - - case 4: - - bitArray = new BitArray(0x10); - lut = CreateShrunkenPaletteLUT(dib, out uniquePalEnts); - if (uniquePalEnts == 1) - { - result = 1; - break; - } - - for (int y = 0; (y < height) && (result < uniquePalEnts); y++) - { - byte* scanline = (byte*)GetScanLine(dib, y); - bool top = true; - for (int x = 0; (x < width) && (result < uniquePalEnts); x++) - { - if (top) - { - hashcode = lut[scanline[x / 2] >> 4]; - } - else - { - hashcode = lut[scanline[x / 2] & 0xF]; - } - top = !top; - if (!bitArray[hashcode]) - { - bitArray[hashcode] = true; - result++; - } - } - } - break; - - case 8: - - bitArray = new BitArray(0x100); - lut = CreateShrunkenPaletteLUT(dib, out uniquePalEnts); - if (uniquePalEnts == 1) - { - result = 1; - break; - } - - for (int y = 0; (y < height) && (result < uniquePalEnts); y++) - { - byte* scanline = (byte*)GetScanLine(dib, y); - for (int x = 0; (x < width) && (result < uniquePalEnts); x++) - { - hashcode = lut[scanline[x]]; - if (!bitArray[hashcode]) - { - bitArray[hashcode] = true; - result++; - } - } - } - break; - - case 16: - - bitArray = new BitArray(0x10000); - - for (int y = 0; y < height; y++) - { - short* scanline = (short*)GetScanLine(dib, y); - for (int x = 0; x < width; x++, scanline++) - { - hashcode = *scanline; - if (!bitArray[hashcode]) - { - bitArray[hashcode] = true; - result++; - } - } - } - break; - - case 24: - - bitArray = new BitArray(0x1000000); - - for (int y = 0; y < height; y++) - { - byte* scanline = (byte*)GetScanLine(dib, y); - for (int x = 0; x < width; x++, scanline += 3) - { - hashcode = *((int*)scanline) & 0x00FFFFFF; - if (!bitArray[hashcode]) - { - bitArray[hashcode] = true; - result++; - } - } - } - break; - - case 32: - - bitArray = new BitArray(0x1000000); - - for (int y = 0; y < height; y++) - { - int* scanline = (int*)GetScanLine(dib, y); - for (int x = 0; x < width; x++, scanline++) - { - hashcode = *scanline & 0x00FFFFFF; - if (!bitArray[hashcode]) - { - bitArray[hashcode] = true; - result++; - } - } - } - break; - } - } - return result; - } - - /// - /// Verifies whether the FreeImage bitmap is 16bit 555. - /// - /// The FreeImage bitmap to verify. - /// true if the bitmap is RGB16-555; otherwise false. - public static bool IsRGB555(FIBITMAP dib) - { - return ((GetRedMask(dib) == FI16_555_RED_MASK) && - (GetGreenMask(dib) == FI16_555_GREEN_MASK) && - (GetBlueMask(dib) == FI16_555_BLUE_MASK)); - } - - /// - /// Verifies whether the FreeImage bitmap is 16bit 565. - /// - /// The FreeImage bitmap to verify. - /// true if the bitmap is RGB16-565; otherwise false. - public static bool IsRGB565(FIBITMAP dib) - { - return ((GetRedMask(dib) == FI16_565_RED_MASK) && - (GetGreenMask(dib) == FI16_565_GREEN_MASK) && - (GetBlueMask(dib) == FI16_565_BLUE_MASK)); - } - - #endregion - - #region ICC profile functions - - /// - /// Creates a new ICC-Profile for a FreeImage bitmap. - /// - /// Handle to a FreeImage bitmap. - /// The data of the new ICC-Profile. - /// The new ICC-Profile of the bitmap. - /// - /// is null. - public static FIICCPROFILE CreateICCProfileEx(FIBITMAP dib, byte[] data) - { - return new FIICCPROFILE(dib, data); - } - - /// - /// Creates a new ICC-Profile for a FreeImage bitmap. - /// - /// Handle to a FreeImage bitmap. - /// The data of the new ICC-Profile. - /// The number of bytes of to use. - /// The new ICC-Profile of the FreeImage bitmap. - /// - /// is null. - public static FIICCPROFILE CreateICCProfileEx(FIBITMAP dib, byte[] data, int size) - { - return new FIICCPROFILE(dib, data, size); - } - - #endregion - - #region Conversion functions - - /// - /// Converts a FreeImage bitmap from one color depth to another. - /// If the conversion fails the original FreeImage bitmap is returned. - /// - /// Handle to a FreeImage bitmap. - /// The desired output format. - /// Handle to a FreeImage bitmap. - /// - /// is null. - public static FIBITMAP ConvertColorDepth( - FIBITMAP dib, - FREE_IMAGE_COLOR_DEPTH conversion) - { - return ConvertColorDepth( - dib, - conversion, - 128, - FREE_IMAGE_DITHER.FID_FS, - FREE_IMAGE_QUANTIZE.FIQ_WUQUANT, - false); - } - - /// - /// Converts a FreeImage bitmap from one color depth to another. - /// If the conversion fails the original FreeImage bitmap is returned. - /// - /// Handle to a FreeImage bitmap. - /// The desired output format. - /// When true the structure will be unloaded on success. - /// Handle to a FreeImage bitmap. - /// - /// is null. - public static FIBITMAP ConvertColorDepth( - FIBITMAP dib, - FREE_IMAGE_COLOR_DEPTH conversion, - bool unloadSource) - { - return ConvertColorDepth( - dib, - conversion, - 128, - FREE_IMAGE_DITHER.FID_FS, - FREE_IMAGE_QUANTIZE.FIQ_WUQUANT, - unloadSource); - } - - /// - /// Converts a FreeImage bitmap from one color depth to another. - /// If the conversion fails the original FreeImage bitmap is returned. - /// - /// Handle to a FreeImage bitmap. - /// The desired output format. - /// Threshold value when converting with - /// . - /// Handle to a FreeImage bitmap. - /// - /// is null. - public static FIBITMAP ConvertColorDepth( - FIBITMAP dib, - FREE_IMAGE_COLOR_DEPTH conversion, - byte threshold) - { - return ConvertColorDepth( - dib, - conversion, - threshold, - FREE_IMAGE_DITHER.FID_FS, - FREE_IMAGE_QUANTIZE.FIQ_WUQUANT, - false); - } - - /// - /// Converts a FreeImage bitmap from one color depth to another. - /// If the conversion fails the original FreeImage bitmap is returned. - /// - /// Handle to a FreeImage bitmap. - /// The desired output format. - /// Dither algorithm when converting - /// with . - /// Handle to a FreeImage bitmap. - /// - /// is null. - public static FIBITMAP ConvertColorDepth( - FIBITMAP dib, - FREE_IMAGE_COLOR_DEPTH conversion, - FREE_IMAGE_DITHER ditherMethod) - { - return ConvertColorDepth( - dib, - conversion, - 128, - ditherMethod, - FREE_IMAGE_QUANTIZE.FIQ_WUQUANT, - false); - } - - - /// - /// Converts a FreeImage bitmap from one color depth to another. - /// If the conversion fails the original FreeImage bitmap is returned. - /// - /// Handle to a FreeImage bitmap. - /// The desired output format. - /// The quantization algorithm for conversion to 8-bit color depth. - /// Handle to a FreeImage bitmap. - /// - /// is null. - public static FIBITMAP ConvertColorDepth( - FIBITMAP dib, - FREE_IMAGE_COLOR_DEPTH conversion, - FREE_IMAGE_QUANTIZE quantizationMethod) - { - return ConvertColorDepth( - dib, - conversion, - 128, - FREE_IMAGE_DITHER.FID_FS, - quantizationMethod, - false); - } - - /// - /// Converts a FreeImage bitmap from one color depth to another. - /// If the conversion fails the original FreeImage bitmap is returned. - /// - /// Handle to a FreeImage bitmap. - /// The desired output format. - /// Threshold value when converting with - /// . - /// When true the structure will be unloaded on success. - /// Handle to a FreeImage bitmap. - /// - /// is null. - public static FIBITMAP ConvertColorDepth( - FIBITMAP dib, - FREE_IMAGE_COLOR_DEPTH conversion, - byte threshold, - bool unloadSource) - { - return ConvertColorDepth( - dib, - conversion, - threshold, - FREE_IMAGE_DITHER.FID_FS, - FREE_IMAGE_QUANTIZE.FIQ_WUQUANT, - unloadSource); - } - - /// - /// Converts a FreeImage bitmap from one color depth to another. - /// If the conversion fails the original FreeImage bitmap is returned. - /// - /// Handle to a FreeImage bitmap. - /// The desired output format. - /// Dither algorithm when converting with - /// . - /// When true the structure will be unloaded on success. - /// Handle to a FreeImage bitmap. - /// - /// is null. - public static FIBITMAP ConvertColorDepth( - FIBITMAP dib, - FREE_IMAGE_COLOR_DEPTH conversion, - FREE_IMAGE_DITHER ditherMethod, - bool unloadSource) - { - return ConvertColorDepth( - dib, - conversion, - 128, - ditherMethod, - FREE_IMAGE_QUANTIZE.FIQ_WUQUANT, - unloadSource); - } - - - /// - /// Converts a FreeImage bitmap from one color depth to another. - /// If the conversion fails the original FreeImage bitmap is returned. - /// - /// Handle to a FreeImage bitmap. - /// The desired output format. - /// The quantization algorithm for conversion to 8-bit color depth. - /// When true the structure will be unloaded on success. - /// Handle to a FreeImage bitmap. - /// - /// is null. - public static FIBITMAP ConvertColorDepth( - FIBITMAP dib, - FREE_IMAGE_COLOR_DEPTH conversion, - FREE_IMAGE_QUANTIZE quantizationMethod, - bool unloadSource) - { - return ConvertColorDepth( - dib, - conversion, - 128, - FREE_IMAGE_DITHER.FID_FS, - quantizationMethod, - unloadSource); - } - - /// - /// Converts a FreeImage bitmap from one color depth to another. - /// If the conversion fails the original FreeImage bitmap is returned. - /// - /// Handle to a FreeImage bitmap. - /// The desired output format. - /// Threshold value when converting with - /// . - /// Dither algorithm when converting with - /// . - /// The quantization algorithm for conversion to 8-bit color depth. - /// When true the structure will be unloaded on success. - /// Handle to a FreeImage bitmap. - /// - /// is null. - internal static FIBITMAP ConvertColorDepth( - FIBITMAP dib, - FREE_IMAGE_COLOR_DEPTH conversion, - byte threshold, - FREE_IMAGE_DITHER ditherMethod, - FREE_IMAGE_QUANTIZE quantizationMethod, - bool unloadSource) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - - FIBITMAP result = new FIBITMAP(); - FIBITMAP dibTemp = new FIBITMAP(); - uint bpp = GetBPP(dib); - bool reorderPalette = ((conversion & FREE_IMAGE_COLOR_DEPTH.FICD_REORDER_PALETTE) > 0); - bool forceGreyscale = ((conversion & FREE_IMAGE_COLOR_DEPTH.FICD_FORCE_GREYSCALE) > 0); - - if (GetImageType(dib) == FREE_IMAGE_TYPE.FIT_BITMAP) - { - switch (conversion & (FREE_IMAGE_COLOR_DEPTH)0xFF) - { - case FREE_IMAGE_COLOR_DEPTH.FICD_01_BPP_THRESHOLD: - - if (bpp != 1) - { - if (forceGreyscale) - { - result = Threshold(dib, threshold); - } - else - { - dibTemp = ConvertTo24Bits(dib); - result = ColorQuantizeEx(dibTemp, quantizationMethod, 2, null, 1); - Unload(dibTemp); - } - } - else - { - bool isGreyscale = IsGreyscaleImage(dib); - if ((forceGreyscale && (!isGreyscale)) || - (reorderPalette && isGreyscale)) - { - result = Threshold(dib, threshold); - } - } - break; - - case FREE_IMAGE_COLOR_DEPTH.FICD_01_BPP_DITHER: - - if (bpp != 1) - { - if (forceGreyscale) - { - result = Dither(dib, ditherMethod); - } - else - { - dibTemp = ConvertTo24Bits(dib); - result = ColorQuantizeEx(dibTemp, quantizationMethod, 2, null, 1); - Unload(dibTemp); - } - } - else - { - bool isGreyscale = IsGreyscaleImage(dib); - if ((forceGreyscale && (!isGreyscale)) || - (reorderPalette && isGreyscale)) - { - result = Dither(dib, ditherMethod); - } - } - break; - - case FREE_IMAGE_COLOR_DEPTH.FICD_04_BPP: - - if (bpp != 4) - { - // Special case when 1bpp and FIC_PALETTE - if (forceGreyscale || - ((bpp == 1) && (GetColorType(dib) == FREE_IMAGE_COLOR_TYPE.FIC_PALETTE))) - { - dibTemp = ConvertToGreyscale(dib); - result = ConvertTo4Bits(dibTemp); - Unload(dibTemp); - } - else - { - dibTemp = ConvertTo24Bits(dib); - result = ColorQuantizeEx(dibTemp, quantizationMethod, 16, null, 4); - Unload(dibTemp); - } - } - else - { - bool isGreyscale = IsGreyscaleImage(dib); - if ((forceGreyscale && (!isGreyscale)) || - (reorderPalette && isGreyscale)) - { - dibTemp = ConvertToGreyscale(dib); - result = ConvertTo4Bits(dibTemp); - Unload(dibTemp); - } - } - - break; - - case FREE_IMAGE_COLOR_DEPTH.FICD_08_BPP: - - if (bpp != 8) - { - if (forceGreyscale) - { - result = ConvertToGreyscale(dib); - } - else - { - dibTemp = ConvertTo24Bits(dib); - result = ColorQuantize(dibTemp, quantizationMethod); - Unload(dibTemp); - } - } - else - { - bool isGreyscale = IsGreyscaleImage(dib); - if ((forceGreyscale && (!isGreyscale)) || (reorderPalette && isGreyscale)) - { - result = ConvertToGreyscale(dib); - } - } - break; - - case FREE_IMAGE_COLOR_DEPTH.FICD_16_BPP_555: - - if (forceGreyscale) - { - dibTemp = ConvertToGreyscale(dib); - result = ConvertTo16Bits555(dibTemp); - Unload(dibTemp); - } - else if (bpp != 16 || GetRedMask(dib) != FI16_555_RED_MASK || GetGreenMask(dib) != FI16_555_GREEN_MASK || GetBlueMask(dib) != FI16_555_BLUE_MASK) - { - result = ConvertTo16Bits555(dib); - } - break; - - case FREE_IMAGE_COLOR_DEPTH.FICD_16_BPP: - - if (forceGreyscale) - { - dibTemp = ConvertToGreyscale(dib); - result = ConvertTo16Bits565(dibTemp); - Unload(dibTemp); - } - else if (bpp != 16 || GetRedMask(dib) != FI16_565_RED_MASK || GetGreenMask(dib) != FI16_565_GREEN_MASK || GetBlueMask(dib) != FI16_565_BLUE_MASK) - { - result = ConvertTo16Bits565(dib); - } - break; - - case FREE_IMAGE_COLOR_DEPTH.FICD_24_BPP: - - if (forceGreyscale) - { - dibTemp = ConvertToGreyscale(dib); - result = ConvertTo24Bits(dibTemp); - Unload(dibTemp); - } - else if (bpp != 24) - { - result = ConvertTo24Bits(dib); - } - break; - - case FREE_IMAGE_COLOR_DEPTH.FICD_32_BPP: - - if (forceGreyscale) - { - dibTemp = ConvertToGreyscale(dib); - result = ConvertTo32Bits(dibTemp); - Unload(dibTemp); - } - else if (bpp != 32) - { - result = ConvertTo32Bits(dib); - } - break; - } - } - - if (result.IsNull) - { - return dib; - } - if (unloadSource) - { - Unload(dib); - } - - return result; - } - - /// - /// ColorQuantizeEx is an extension to the - /// method that provides additional options used to quantize a 24-bit image to any - /// number of colors (up to 256), as well as quantize a 24-bit image using a - /// provided palette. - /// - /// Handle to a FreeImage bitmap. - /// Specifies the color reduction algorithm to be used. - /// Size of the desired output palette. - /// The provided palette. - /// true to create a bitmap with the smallest possible - /// color depth for the specified . - /// Handle to a FreeImage bitmap. - public static FIBITMAP ColorQuantizeEx(FIBITMAP dib, FREE_IMAGE_QUANTIZE quantize, int PaletteSize, RGBQUAD[] ReservePalette, bool minColorDepth) - { - FIBITMAP result; - if (minColorDepth) - { - int bpp; - if (PaletteSize >= 256) - bpp = 8; - else if (PaletteSize > 2) - bpp = 4; - else - bpp = 1; - result = ColorQuantizeEx(dib, quantize, PaletteSize, ReservePalette, bpp); - } - else - { - result = ColorQuantizeEx(dib, quantize, PaletteSize, ReservePalette, 8); - } - return result; - } - - /// - /// ColorQuantizeEx is an extension to the - /// method that provides additional options used to quantize a 24-bit image to any - /// number of colors (up to 256), as well as quantize a 24-bit image using a - /// partial or full provided palette. - /// - /// Handle to a FreeImage bitmap. - /// Specifies the color reduction algorithm to be used. - /// Size of the desired output palette. - /// The provided palette. - /// The desired color depth of the created image. - /// Handle to a FreeImage bitmap. - public static FIBITMAP ColorQuantizeEx(FIBITMAP dib, FREE_IMAGE_QUANTIZE quantize, int PaletteSize, RGBQUAD[] ReservePalette, int bpp) - { - unsafe - { - FIBITMAP result = FIBITMAP.Zero; - FIBITMAP temp = FIBITMAP.Zero; - int reservedSize = (ReservePalette == null) ? 0 : ReservePalette.Length; - - if (bpp == 8) - { - result = ColorQuantizeEx(dib, quantize, PaletteSize, reservedSize, ReservePalette); - } - else if (bpp == 4) - { - temp = ColorQuantizeEx(dib, quantize, Math.Min(16, PaletteSize), reservedSize, ReservePalette); - if (!temp.IsNull) - { - result = Allocate((int)GetWidth(temp), (int)GetHeight(temp), 4, 0, 0, 0); - CloneMetadata(result, temp); - CopyMemory(GetPalette(result), GetPalette(temp), sizeof(RGBQUAD) * 16); - - for (int y = (int)GetHeight(temp) - 1; y >= 0; y--) - { - Scanline srcScanline = new Scanline(temp, y); - Scanline dstScanline = new Scanline(result, y); - - for (int x = (int)GetWidth(temp) - 1; x >= 0; x--) - { - dstScanline[x] = srcScanline[x]; - } - } - } - } - else if (bpp == 1) - { - temp = ColorQuantizeEx(dib, quantize, 2, reservedSize, ReservePalette); - if (!temp.IsNull) - { - result = Allocate((int)GetWidth(temp), (int)GetHeight(temp), 1, 0, 0, 0); - CloneMetadata(result, temp); - CopyMemory(GetPalette(result), GetPalette(temp), sizeof(RGBQUAD) * 2); - - for (int y = (int)GetHeight(temp) - 1; y >= 0; y--) - { - Scanline srcScanline = new Scanline(temp, y); - Scanline dstScanline = new Scanline(result, y); - - for (int x = (int)GetWidth(temp) - 1; x >= 0; x--) - { - dstScanline[x] = srcScanline[x]; - } - } - } - } - - UnloadEx(ref temp); - return result; - } - } - - #endregion - - #region Metadata - - /// - /// Copies metadata from one FreeImage bitmap to another. - /// - /// Source FreeImage bitmap containing the metadata. - /// FreeImage bitmap to copy the metadata to. - /// Flags to switch different copy modes. - /// Returns -1 on failure else the number of copied tags. - /// - /// or is null. - public static int CloneMetadataEx(FIBITMAP src, FIBITMAP dst, FREE_IMAGE_METADATA_COPY flags) - { - if (src.IsNull) - { - throw new ArgumentNullException("src"); - } - if (dst.IsNull) - { - throw new ArgumentNullException("dst"); - } - - FITAG tag = new FITAG(), tag2 = new FITAG(); - int copied = 0; - - // Clear all existing metadata - if ((flags & FREE_IMAGE_METADATA_COPY.CLEAR_EXISTING) > 0) - { - foreach (FREE_IMAGE_MDMODEL model in FREE_IMAGE_MDMODELS) - { - if (!SetMetadata(model, dst, null, tag)) - { - return -1; - } - } - } - - bool keep = !((flags & FREE_IMAGE_METADATA_COPY.REPLACE_EXISTING) > 0); - - foreach (FREE_IMAGE_MDMODEL model in FREE_IMAGE_MDMODELS) - { - FIMETADATA mData = FindFirstMetadata(model, src, out tag); - if (mData.IsNull) continue; - do - { - string key = GetTagKey(tag); - if (!(keep && GetMetadata(model, dst, key, out tag2))) - { - if (SetMetadata(model, dst, key, tag)) - { - copied++; - } - } - } - while (FindNextMetadata(mData, out tag)); - FindCloseMetadata(mData); - } - - return copied; - } - - /// - /// Returns the comment of a JPEG, PNG or GIF image. - /// - /// Handle to a FreeImage bitmap. - /// Comment of the FreeImage bitmp, or null in case no comment exists. - /// - /// is null. - public static string GetImageComment(FIBITMAP dib) - { - string result = null; - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - FITAG tag; - if (GetMetadata(FREE_IMAGE_MDMODEL.FIMD_COMMENTS, dib, "Comment", out tag)) - { - MetadataTag metadataTag = new MetadataTag(tag, FREE_IMAGE_MDMODEL.FIMD_COMMENTS); - result = metadataTag.Value as string; - } - return result; - } - - /// - /// Sets the comment of a JPEG, PNG or GIF image. - /// - /// Handle to a FreeImage bitmap. - /// New comment of the FreeImage bitmap. - /// Use null to remove the comment. - /// Returns true on success, false on failure. - /// - /// is null. - public static bool SetImageComment(FIBITMAP dib, string comment) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - bool result; - if (comment != null) - { - FITAG tag = CreateTag(); - MetadataTag metadataTag = new MetadataTag(tag, FREE_IMAGE_MDMODEL.FIMD_COMMENTS); - metadataTag.Value = comment; - result = SetMetadata(FREE_IMAGE_MDMODEL.FIMD_COMMENTS, dib, "Comment", tag); - DeleteTag(tag); - } - else - { - result = SetMetadata(FREE_IMAGE_MDMODEL.FIMD_COMMENTS, dib, "Comment", FITAG.Zero); - } - return result; - } - - /// - /// Retrieve a metadata attached to a FreeImage bitmap. - /// - /// The metadata model to look for. - /// Handle to a FreeImage bitmap. - /// The metadata field name. - /// A structure returned by the function. - /// Returns true on success, false on failure. - /// - /// is null. - public static bool GetMetadata( - FREE_IMAGE_MDMODEL model, - FIBITMAP dib, - string key, - out MetadataTag tag) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - - FITAG _tag; - bool result; - if (GetMetadata(model, dib, key, out _tag)) - { - tag = new MetadataTag(_tag, model); - result = true; - } - else - { - tag = null; - result = false; - } - return result; - } - - /// - /// Attach a new metadata tag to a FreeImage bitmap. - /// - /// The metadata model used to store the tag. - /// Handle to a FreeImage bitmap. - /// The tag field name. - /// The to be attached. - /// Returns true on success, false on failure. - /// - /// is null. - public static bool SetMetadata( - FREE_IMAGE_MDMODEL model, - FIBITMAP dib, - string key, - MetadataTag tag) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - return SetMetadata(model, dib, key, tag.tag); - } - - /// - /// Provides information about the first instance of a tag that matches the metadata model. - /// - /// The model to match. - /// Handle to a FreeImage bitmap. - /// Tag that matches the metadata model. - /// Unique search handle that can be used to call FindNextMetadata or FindCloseMetadata. - /// Null if the metadata model does not exist. - /// - /// is null. - public static FIMETADATA FindFirstMetadata( - FREE_IMAGE_MDMODEL model, - FIBITMAP dib, - out MetadataTag tag) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - FITAG _tag; - FIMETADATA result = FindFirstMetadata(model, dib, out _tag); - if (result.IsNull) - { - tag = null; - return result; - } - tag = new MetadataTag(_tag, model); - if (metaDataSearchHandler.ContainsKey(result)) - { - metaDataSearchHandler[result] = model; - } - else - { - metaDataSearchHandler.Add(result, model); - } - return result; - } - - /// - /// Find the next tag, if any, that matches the metadata model argument in a previous call - /// to FindFirstMetadata, and then alters the tag object contents accordingly. - /// - /// Unique search handle provided by FindFirstMetadata. - /// Tag that matches the metadata model. - /// Returns true on success, false on failure. - public static bool FindNextMetadata(FIMETADATA mdhandle, out MetadataTag tag) - { - FITAG _tag; - bool result; - if (FindNextMetadata(mdhandle, out _tag)) - { - tag = new MetadataTag(_tag, metaDataSearchHandler[mdhandle]); - result = true; - } - else - { - tag = null; - result = false; - } - return result; - } - - /// - /// Closes the specified metadata search handle and releases associated resources. - /// - /// The handle to close. - public static void FindCloseMetadata(FIMETADATA mdhandle) - { - if (metaDataSearchHandler.ContainsKey(mdhandle)) - { - metaDataSearchHandler.Remove(mdhandle); - } - FindCloseMetadata_(mdhandle); - } - - /// - /// This dictionary links FIMETADATA handles and FREE_IMAGE_MDMODEL models. - /// - private static Dictionary metaDataSearchHandler - = new Dictionary(1); - - #endregion - - #region Rotation and Flipping - - /// - /// This function rotates a 1-, 8-bit greyscale or a 24-, 32-bit color image by means of 3 shears. - /// 1-bit images rotation is limited to integer multiple of 90ďż˝. - /// null is returned for other values. - /// - /// Handle to a FreeImage bitmap. - /// The angle of rotation. - /// Handle to a FreeImage bitmap. - public static FIBITMAP Rotate(FIBITMAP dib, double angle) - { - return Rotate(dib, angle, IntPtr.Zero); - } - - /// - /// This function rotates a 1-, 8-bit greyscale or a 24-, 32-bit color image by means of 3 shears. - /// 1-bit images rotation is limited to integer multiple of 90ďż˝. - /// null is returned for other values. - /// - /// The type of the color to use as background. - /// Handle to a FreeImage bitmap. - /// The angle of rotation. - /// The color used used to fill the bitmap's background. - /// Handle to a FreeImage bitmap. - public static FIBITMAP Rotate(FIBITMAP dib, double angle, T? backgroundColor) where T : struct - { - if (backgroundColor.HasValue) - { - GCHandle handle = new GCHandle(); - try - { - T[] buffer = new T[] { backgroundColor.Value }; - handle = GCHandle.Alloc(buffer, GCHandleType.Pinned); - return Rotate(dib, angle, handle.AddrOfPinnedObject()); - } - finally - { - if (handle.IsAllocated) - handle.Free(); - } - } - else - { - return Rotate(dib, angle, IntPtr.Zero); - } - } - - /// - /// Rotates a 4-bit color FreeImage bitmap. - /// Allowed values for are 90, 180 and 270. - /// In case is 0 or 360 a clone is returned. - /// 0 is returned for other values or in case the rotation fails. - /// - /// Handle to a FreeImage bitmap. - /// The angle of rotation. - /// Handle to a FreeImage bitmap. - /// - /// This function is kind of temporary due to FreeImage's lack of - /// rotating 4-bit images. It's particularly used by 's - /// method RotateFlip. This function will be removed as soon as FreeImage - /// supports rotating 4-bit images. - /// - /// - /// is null. - public static unsafe FIBITMAP Rotate4bit(FIBITMAP dib, double angle) - { - if (dib.IsNull) - { - throw new ArgumentNullException("dib"); - } - - FIBITMAP result = new FIBITMAP(); - int ang = (int)angle; - - if ((GetImageType(dib) == FREE_IMAGE_TYPE.FIT_BITMAP) && - (GetBPP(dib) == 4) && - ((ang % 90) == 0)) - { - int width, height, xOrg, yOrg; - Scanline[] src, dst; - width = (int)GetWidth(dib); - height = (int)GetHeight(dib); - byte index = 0; - switch (ang) - { - case 90: - result = Allocate(height, width, 4, 0, 0, 0); - if (result.IsNull) - { - break; - } - CopyPalette(dib, result); - src = Get04BitScanlines(dib); - dst = Get04BitScanlines(result); - for (int y = 0; y < width; y++) - { - yOrg = height - 1; - for (int x = 0; x < height; x++, yOrg--) - { - index = src[yOrg][y]; - dst[y][x] = index; - } - } - break; - case 180: - result = Allocate(width, height, 4, 0, 0, 0); - if (result.IsNull) - { - break; - } - CopyPalette(dib, result); - src = Get04BitScanlines(dib); - dst = Get04BitScanlines(result); - - yOrg = height - 1; - for (int y = 0; y < height; y++, yOrg--) - { - xOrg = width - 1; - for (int x = 0; x < width; x++, xOrg--) - { - index = src[yOrg][xOrg]; - dst[y][x] = index; - } - } - break; - case 270: - result = Allocate(height, width, 4, 0, 0, 0); - if (result.IsNull) - { - break; - } - CopyPalette(dib, result); - src = Get04BitScanlines(dib); - dst = Get04BitScanlines(result); - xOrg = width - 1; - for (int y = 0; y < width; y++, xOrg--) - { - for (int x = 0; x < height; x++) - { - index = src[x][xOrg]; - dst[y][x] = index; - } - } - break; - case 0: - case 360: - result = Clone(dib); - break; - } - } - return result; - } - - #endregion - - #region Upsampling / downsampling - - /// - /// Enlarges or shrinks the FreeImage bitmap selectively per side and fills newly added areas - /// with the specified background color. See remarks for further details. - /// - /// The type of the specified color. - /// Handle to a FreeImage bitmap. - /// The number of pixels, the image should be enlarged on its left side. - /// Negative values shrink the image on its left side. - /// The number of pixels, the image should be enlarged on its top side. - /// Negative values shrink the image on its top side. - /// The number of pixels, the image should be enlarged on its right side. - /// Negative values shrink the image on its right side. - /// The number of pixels, the image should be enlarged on its bottom side. - /// Negative values shrink the image on its bottom side. - /// The color, the enlarged sides of the image should be filled with. - /// Options that affect the color search process for palletized images. - /// Handle to a FreeImage bitmap. - /// - /// This function enlarges or shrinks an image selectively per side. - /// The main purpose of this function is to add borders to an image. - /// To add a border to any of the image's sides, a positive integer value must be passed in - /// any of the parameters , , - /// or . This value represents the border's - /// width in pixels. Newly created parts of the image (the border areas) are filled with the - /// specified . - /// Specifying a negative integer value for a certain side, will shrink or crop the image on - /// this side. Consequently, specifying zero for a certain side will not change the image's - /// extension on that side. - /// - /// So, calling this function with all parameters , , - /// and set to zero, is - /// effectively the same as calling function ; setting all parameters - /// , , and - /// to value equal to or smaller than zero, my easily be substituted - /// by a call to function . Both these cases produce a new image, which is - /// guaranteed not to be larger than the input image. Thus, since the specified - /// is not needed in these cases, - /// may be null. - /// - /// Both parameters and work according to - /// function . So, please refer to the documentation of - /// to learn more about parameters - /// and . For palletized images, the palette of the input image is - /// transparently copied to the newly created enlarged or shrunken image, so any color look-ups - /// are performed on this palette. - /// - /// - /// // create a white color
- /// RGBQUAD c;
- /// c.rgbRed = 0xFF;
- /// c.rgbGreen = 0xFF;
- /// c.rgbBlue = 0xFF;
- /// c.rgbReserved = 0x00;
- ///
- /// // add a white, symmetric 10 pixel wide border to the image
- /// dib2 = FreeImage_EnlargeCanvas(dib, 10, 10, 10, 10, c, FREE_IMAGE_COLOR_OPTIONS.FICO_RGB);
- ///
- /// // add white, 20 pixel wide stripes to the top and bottom side of the image
- /// dib3 = FreeImage_EnlargeCanvas(dib, 0, 20, 0, 20, c, FREE_IMAGE_COLOR_OPTIONS.FICO_RGB);
- ///
- /// // add white, 30 pixel wide stripes to the right side of the image and
- /// // cut off the 40 leftmost pixel columns
- /// dib3 = FreeImage_EnlargeCanvas(dib, -40, 0, 30, 0, c, FREE_IMAGE_COLOR_OPTIONS.FICO_RGB);
- ///
- public static FIBITMAP EnlargeCanvas(FIBITMAP dib, int left, int top, int right, int bottom, - T? color, FREE_IMAGE_COLOR_OPTIONS options) where T : struct - { - if (dib.IsNull) - return FIBITMAP.Zero; - - if (!CheckColorType(GetImageType(dib), color)) - return FIBITMAP.Zero; - - if (color.HasValue) - { - GCHandle handle = new GCHandle(); - try - { - T[] buffer = new T[] { color.Value }; - handle = GCHandle.Alloc(buffer, GCHandleType.Pinned); - return EnlargeCanvas(dib, left, top, right, bottom, handle.AddrOfPinnedObject(), options); - } - finally - { - if (handle.IsAllocated) - handle.Free(); - } - } - else - { - return EnlargeCanvas(dib, left, top, right, bottom, IntPtr.Zero, options); - } - } - - #endregion - - #region Color - - /// - /// Sets all pixels of the specified image to the color provided through the - /// parameter. See remarks for further details. - /// - /// The type of the specified color. - /// Handle to a FreeImage bitmap. - /// The color to fill the bitmap with. See remarks for further details. - /// Options that affect the color search process for palletized images. - /// true on success, false on failure. - /// - /// This function sets all pixels of an image to the color provided through - /// the parameter. is used for standard type images. - /// For non standard type images the underlaying structure is used. - /// - /// So, must be of type , if the image to be filled is of type - /// and must be a structure if the - /// image is of type and so on. - /// - /// However, the fill color is always specified through a structure - /// for all images of type . - /// So, for 32- and 24-bit images, the red, green and blue members of the - /// structure are directly used for the image's red, green and blue channel respectively. - /// Although alpha transparent colors are - /// supported, the alpha channel of a 32-bit image never gets modified by this function. - /// A fill color with an alpha value smaller than 255 gets blended with the image's actual - /// background color, which is determined from the image's bottom-left pixel. - /// So, currently using alpha enabled colors, assumes the image to be unicolor before the - /// fill operation. However, the field is only taken into account, - /// if option has been specified. - /// - /// For 16-bit images, the red-, green- and blue components of the specified color are - /// transparently translated into either the 16-bit 555 or 565 representation. This depends - /// on the image's actual red- green- and blue masks. - /// - /// Special attention must be payed for palletized images. Generally, the RGB color specified - /// is looked up in the image's palette. The found palette index is then used to fill the image. - /// There are some option flags, that affect this lookup process: - /// - /// - /// Value - /// Meaning - /// - /// - /// - /// - /// Uses the color, that is nearest to the specified color. - /// This is the default behavior and should always find a - /// color in the palette. However, the visual result may - /// far from what was expected and mainly depends on the - /// image's palette. - /// - /// - /// - /// - /// - /// Searches the image's palette for the specified color - /// but only uses the returned palette index, if the specified - /// color exactly matches the palette entry. Of course, - /// depending on the image's actual palette entries, this - /// operation may fail. In this case, the function falls back - /// to option - /// and uses the RGBQUAD's rgbReserved member (or its low nibble for 4-bit images - /// or its least significant bit (LSB) for 1-bit images) as - /// the palette index used for the fill operation. - /// - /// - /// - /// - /// - /// Does not perform any color lookup from the palette, but - /// uses the RGBQUAD's alpha channel member rgbReserved as - /// the palette index to be used for the fill operation. - /// However, for 4-bit images, only the low nibble of the - /// rgbReserved member are used and for 1-bit images, only - /// the least significant bit (LSB) is used. - /// - /// - /// - /// - public static bool FillBackground(FIBITMAP dib, T color, FREE_IMAGE_COLOR_OPTIONS options) - where T : struct - { - if (dib.IsNull) - return false; - - if (!CheckColorType(GetImageType(dib), color)) - return false; - - GCHandle handle = new GCHandle(); - try - { - T[] buffer = new T[] { color }; - handle = GCHandle.Alloc(buffer, GCHandleType.Pinned); - return FillBackground(dib, handle.AddrOfPinnedObject(), options); - } - finally - { - if (handle.IsAllocated) - handle.Free(); - } - } - - #endregion - - #region Wrapper functions - - /// - /// Returns the next higher possible color depth. - /// - /// Color depth to increase. - /// The next higher color depth or 0 if there is no valid color depth. - internal static int GetNextColorDepth(int bpp) - { - int result = 0; - switch (bpp) - { - case 1: - result = 4; - break; - case 4: - result = 8; - break; - case 8: - result = 16; - break; - case 16: - result = 24; - break; - case 24: - result = 32; - break; - } - return result; - } - - /// - /// Returns the next lower possible color depth. - /// - /// Color depth to decrease. - /// The next lower color depth or 0 if there is no valid color depth. - internal static int GetPrevousColorDepth(int bpp) - { - int result = 0; - switch (bpp) - { - case 32: - result = 24; - break; - case 24: - result = 16; - break; - case 16: - result = 8; - break; - case 8: - result = 4; - break; - case 4: - result = 1; - break; - } - return result; - } - - /// - /// Reads a null-terminated c-string. - /// - /// Pointer to the first char of the string. - /// The converted string. - internal static unsafe string PtrToStr(byte* ptr) - { - string result = null; - if (ptr != null) - { - System.Text.StringBuilder sb = new System.Text.StringBuilder(); - - while (*ptr != 0) - { - sb.Append((char)(*(ptr++))); - } - result = sb.ToString(); - } - return result; - } - - internal static unsafe byte[] CreateShrunkenPaletteLUT(FIBITMAP dib, out int uniqueColors) - { - byte[] result = null; - uniqueColors = 0; - - if ((!dib.IsNull) && (GetImageType(dib) == FREE_IMAGE_TYPE.FIT_BITMAP) && (GetBPP(dib) <= 8)) - { - int size = (int)GetColorsUsed(dib); - List newPalette = new List(size); - List lut = new List(size); - RGBQUAD* palette = (RGBQUAD*)GetPalette(dib); - RGBQUAD color; - int index; - - for (int i = 0; i < size; i++) - { - color = palette[i]; - color.rgbReserved = 255; // ignore alpha - - index = newPalette.IndexOf(color); - if (index < 0) - { - newPalette.Add(color); - lut.Add((byte)(newPalette.Count - 1)); - } - else - { - lut.Add((byte)index); - } - } - result = lut.ToArray(); - uniqueColors = newPalette.Count; - } - return result; - } - - internal static PropertyItem CreatePropertyItem() - { - return (PropertyItem)Activator.CreateInstance(typeof(PropertyItem), true); - } - - private static unsafe void CopyPalette(FIBITMAP src, FIBITMAP dst) - { - RGBQUAD* orgPal = (RGBQUAD*)GetPalette(src); - RGBQUAD* newPal = (RGBQUAD*)GetPalette(dst); - uint size = (uint)(sizeof(RGBQUAD) * GetColorsUsed(src)); - CopyMemory(newPal, orgPal, size); - } - - private static unsafe Scanline[] Get04BitScanlines(FIBITMAP dib) - { - int height = (int)GetHeight(dib); - Scanline[] array = new Scanline[height]; - for (int i = 0; i < height; i++) - { - array[i] = new Scanline(dib, i); - } - return array; - } - - /// - /// Changes a bitmaps color depth. - /// Used by SaveEx and SaveToStream. - /// - private static FIBITMAP PrepareBitmapColorDepth(FIBITMAP dibToSave, FREE_IMAGE_FORMAT format, FREE_IMAGE_COLOR_DEPTH colorDepth) - { - FREE_IMAGE_TYPE type = GetImageType(dibToSave); - if (type == FREE_IMAGE_TYPE.FIT_BITMAP) - { - int bpp = (int)GetBPP(dibToSave); - int targetBpp = (int)(colorDepth & FREE_IMAGE_COLOR_DEPTH.FICD_COLOR_MASK); - - if (colorDepth != FREE_IMAGE_COLOR_DEPTH.FICD_AUTO) - { - // A fix colordepth was chosen - if (FIFSupportsExportBPP(format, targetBpp)) - { - dibToSave = ConvertColorDepth(dibToSave, colorDepth, false); - } - else - { - throw new ArgumentException("FreeImage\n\nFreeImage Library plugin " + - GetFormatFromFIF(format) + " is unable to write images with a color depth of " + - targetBpp + " bpp."); - } - } - else - { - // Auto selection was chosen - if (!FIFSupportsExportBPP(format, bpp)) - { - // The color depth is not supported - int bppUpper = bpp; - int bppLower = bpp; - // Check from the bitmaps current color depth in both directions - do - { - bppUpper = GetNextColorDepth(bppUpper); - if (FIFSupportsExportBPP(format, bppUpper)) - { - dibToSave = ConvertColorDepth(dibToSave, (FREE_IMAGE_COLOR_DEPTH)bppUpper, false); - break; - } - bppLower = GetPrevousColorDepth(bppLower); - if (FIFSupportsExportBPP(format, bppLower)) - { - dibToSave = ConvertColorDepth(dibToSave, (FREE_IMAGE_COLOR_DEPTH)bppLower, false); - break; - } - } while (!((bppLower == 0) && (bppUpper == 0))); - } - } - } - return dibToSave; - } - - /// - /// Compares blocks of memory. - /// - /// A pointer to a block of memory to compare. - /// A pointer to a block of memory to compare. - /// Specifies the number of bytes to be compared. - /// true, if all bytes compare as equal, false otherwise. - public static unsafe bool CompareMemory(void* buf1, void* buf2, uint length) - { - return (length == RtlCompareMemory(buf1, buf2, length)); - } - - /// - /// Compares blocks of memory. - /// - /// A pointer to a block of memory to compare. - /// A pointer to a block of memory to compare. - /// Specifies the number of bytes to be compared. - /// true, if all bytes compare as equal, false otherwise. - public static unsafe bool CompareMemory(void* buf1, void* buf2, long length) - { - return (length == RtlCompareMemory(buf1, buf2, checked((uint)length))); - } - - /// - /// Compares blocks of memory. - /// - /// A pointer to a block of memory to compare. - /// A pointer to a block of memory to compare. - /// Specifies the number of bytes to be compared. - /// true, if all bytes compare as equal, false otherwise. - public static unsafe bool CompareMemory(IntPtr buf1, IntPtr buf2, uint length) - { - return (length == RtlCompareMemory(buf1.ToPointer(), buf2.ToPointer(), length)); - } - - /// - /// Compares blocks of memory. - /// - /// A pointer to a block of memory to compare. - /// A pointer to a block of memory to compare. - /// Specifies the number of bytes to be compared. - /// true, if all bytes compare as equal, false otherwise. - public static unsafe bool CompareMemory(IntPtr buf1, IntPtr buf2, long length) - { - return (length == RtlCompareMemory(buf1.ToPointer(), buf2.ToPointer(), checked((uint)length))); - } - - /// - /// Moves a block of memory from one location to another. - /// - /// A pointer to the starting address of the move destination. - /// A pointer to the starting address of the block of memory to be moved. - /// The size of the block of memory to move, in bytes. - public static unsafe void MoveMemory(void* dst, void* src, long size) - { - MoveMemory(dst, src, checked((uint)size)); - } - - /// - /// Moves a block of memory from one location to another. - /// - /// A pointer to the starting address of the move destination. - /// A pointer to the starting address of the block of memory to be moved. - /// The size of the block of memory to move, in bytes. - public static unsafe void MoveMemory(IntPtr dst, IntPtr src, uint size) - { - MoveMemory(dst.ToPointer(), src.ToPointer(), size); - } - - /// - /// Moves a block of memory from one location to another. - /// - /// A pointer to the starting address of the move destination. - /// A pointer to the starting address of the block of memory to be moved. - /// The size of the block of memory to move, in bytes. - public static unsafe void MoveMemory(IntPtr dst, IntPtr src, long size) - { - MoveMemory(dst.ToPointer(), src.ToPointer(), checked((uint)size)); - } - - /// - /// Copies a block of memory from one location to another. - /// - /// A pointer to the starting address of the copied block's destination. - /// A pointer to the starting address of the block of memory to copy. - /// The size of the block of memory to copy, in bytes. - /// - /// CopyMemory runs faster than . - /// However, if both blocks overlap the result is undefined. - /// - public static unsafe void CopyMemory(byte* dest, byte* src, int len) - { - if (len >= 0x10) - { - do - { - *((int*)dest) = *((int*)src); - *((int*)(dest + 4)) = *((int*)(src + 4)); - *((int*)(dest + 8)) = *((int*)(src + 8)); - *((int*)(dest + 12)) = *((int*)(src + 12)); - dest += 0x10; - src += 0x10; - } - while ((len -= 0x10) >= 0x10); - } - if (len > 0) - { - if ((len & 8) != 0) - { - *((int*)dest) = *((int*)src); - *((int*)(dest + 4)) = *((int*)(src + 4)); - dest += 8; - src += 8; - } - if ((len & 4) != 0) - { - *((int*)dest) = *((int*)src); - dest += 4; - src += 4; - } - if ((len & 2) != 0) - { - *((short*)dest) = *((short*)src); - dest += 2; - src += 2; - } - if ((len & 1) != 0) - { - *dest = *src; - } - } - } - - /// - /// Copies a block of memory from one location to another. - /// - /// A pointer to the starting address of the copied block's destination. - /// A pointer to the starting address of the block of memory to copy. - /// The size of the block of memory to copy, in bytes. - /// - /// CopyMemory runs faster than . - /// However, if both blocks overlap the result is undefined. - /// - public static unsafe void CopyMemory(byte* dest, byte* src, long len) - { - CopyMemory(dest, src, checked((int)len)); - } - - /// - /// Copies a block of memory from one location to another. - /// - /// A pointer to the starting address of the copied block's destination. - /// A pointer to the starting address of the block of memory to copy. - /// The size of the block of memory to copy, in bytes. - /// - /// CopyMemory runs faster than . - /// However, if both blocks overlap the result is undefined. - /// - public static unsafe void CopyMemory(void* dest, void* src, long len) - { - CopyMemory((byte*)dest, (byte*)src, checked((int)len)); - } - - /// - /// Copies a block of memory from one location to another. - /// - /// A pointer to the starting address of the copied block's destination. - /// A pointer to the starting address of the block of memory to copy. - /// The size of the block of memory to copy, in bytes. - /// - /// CopyMemory runs faster than . - /// However, if both blocks overlap the result is undefined. - /// - public static unsafe void CopyMemory(void* dest, void* src, int len) - { - CopyMemory((byte*)dest, (byte*)src, len); - } - - /// - /// Copies a block of memory from one location to another. - /// - /// A pointer to the starting address of the copied block's destination. - /// A pointer to the starting address of the block of memory to copy. - /// The size of the block of memory to copy, in bytes. - /// - /// CopyMemory runs faster than . - /// However, if both blocks overlap the result is undefined. - /// - public static unsafe void CopyMemory(IntPtr dest, IntPtr src, int len) - { - CopyMemory((byte*)dest, (byte*)src, len); - } - - /// - /// Copies a block of memory from one location to another. - /// - /// A pointer to the starting address of the copied block's destination. - /// A pointer to the starting address of the block of memory to copy. - /// The size of the block of memory to copy, in bytes. - /// - /// CopyMemory runs faster than . - /// However, if both blocks overlap the result is undefined. - /// - public static unsafe void CopyMemory(IntPtr dest, IntPtr src, long len) - { - CopyMemory((byte*)dest, (byte*)src, checked((int)len)); - } - - /// - /// Copies a block of memory into an array. - /// - /// An array used as the destination of the copy process. - /// A pointer to the starting address of the block of memory to copy. - /// The size of the block of memory to copy, in bytes. - public static unsafe void CopyMemory(Array dest, void* src, int len) - { - GCHandle handle = GCHandle.Alloc(dest, GCHandleType.Pinned); - try - { - CopyMemory((byte*)handle.AddrOfPinnedObject(), (byte*)src, len); - } - finally - { - handle.Free(); - } - } - - /// - /// Copies a block of memory into an array. - /// - /// An array used as the destination of the copy process. - /// A pointer to the starting address of the block of memory to copy. - /// The size of the block of memory to copy, in bytes. - public static unsafe void CopyMemory(Array dest, void* src, long len) - { - CopyMemory(dest, (byte*)src, checked((int)len)); - } - - /// - /// Copies a block of memory into an array. - /// - /// An array used as the destination of the copy process. - /// A pointer to the starting address of the block of memory to copy. - /// The size of the block of memory to copy, in bytes. - public static unsafe void CopyMemory(Array dest, IntPtr src, int len) - { - CopyMemory(dest, (byte*)src, len); - } - - /// - /// Copies a block of memory into an array. - /// - /// An array used as the destination of the copy process. - /// A pointer to the starting address of the block of memory to copy. - /// The size of the block of memory to copy, in bytes. - public static unsafe void CopyMemory(Array dest, IntPtr src, long len) - { - CopyMemory(dest, (byte*)src, checked((int)len)); - } - - /// - /// Copies the content of an array to a memory location. - /// - /// A pointer to the starting address of the copied block's destination. - /// An array used as the source of the copy process. - /// The size of the block of memory to copy, in bytes. - public static unsafe void CopyMemory(void* dest, Array src, int len) - { - GCHandle handle = GCHandle.Alloc(src, GCHandleType.Pinned); - try - { - CopyMemory((byte*)dest, (byte*)handle.AddrOfPinnedObject(), len); - } - finally - { - handle.Free(); - } - } - - /// - /// Copies the content of an array to a memory location. - /// - /// A pointer to the starting address of the copied block's destination. - /// An array used as the source of the copy process. - /// The size of the block of memory to copy, in bytes. - public static unsafe void CopyMemory(void* dest, Array src, long len) - { - CopyMemory((byte*)dest, src, checked((int)len)); - } - - /// - /// Copies the content of an array to a memory location. - /// - /// A pointer to the starting address of the copied block's destination. - /// An array used as the source of the copy process. - /// The size of the block of memory to copy, in bytes. - public static unsafe void CopyMemory(IntPtr dest, Array src, int len) - { - CopyMemory((byte*)dest, src, len); - } - - /// - /// Copies the content of an array to a memory location. - /// - /// A pointer to the starting address of the copied block's destination. - /// An array used as the source of the copy process. - /// The size of the block of memory to copy, in bytes. - public static unsafe void CopyMemory(IntPtr dest, Array src, long len) - { - CopyMemory((byte*)dest, src, checked((int)len)); - } - - /// - /// Copies the content of one array into another array. - /// - /// An array used as the destination of the copy process. - /// An array used as the source of the copy process. - /// The size of the content to copy, in bytes. - public static unsafe void CopyMemory(Array dest, Array src, int len) - { - GCHandle dHandle = GCHandle.Alloc(dest, GCHandleType.Pinned); - try - { - GCHandle sHandle = GCHandle.Alloc(src, GCHandleType.Pinned); - try - { - CopyMemory((byte*)dHandle.AddrOfPinnedObject(), (byte*)sHandle.AddrOfPinnedObject(), len); - } - finally - { - sHandle.Free(); - } - } - finally - { - dHandle.Free(); - } - } - - /// - /// Copies the content of one array into another array. - /// - /// An array used as the destination of the copy process. - /// An array used as the source of the copy process. - /// The size of the content to copy, in bytes. - public static unsafe void CopyMemory(Array dest, Array src, long len) - { - CopyMemory(dest, src, checked((int)len)); - } - - internal static string ColorToString(Color color) - { - return string.Format( - System.Globalization.CultureInfo.CurrentCulture, - "{{Name={0}, ARGB=({1}, {2}, {3}, {4})}}", - new object[] { color.Name, color.A, color.R, color.G, color.B }); - } - - internal static void Resize(ref string str, int length) - { - if ((str != null) && (length >= 0) && (str.Length != length)) - { - char[] chars = str.ToCharArray(); - Array.Resize(ref chars, length); - str = new string(chars); - } - } - - internal static void Resize(ref string str, int min, int max) - { - if ((str != null) && (min >= 0) && (max >= 0) && (min <= max)) - { - if (str.Length < min) - { - char[] chars = str.ToCharArray(); - Array.Resize(ref chars, min); - str = new string(chars); - } - else if (str.Length > max) - { - char[] chars = str.ToCharArray(); - Array.Resize(ref chars, max); - str = new string(chars); - } - } - } - - internal static void Resize(ref T[] array, int length) - { - if ((array != null) && (length >= 0) && (array.Length != length)) - { - Array.Resize(ref array, length); - } - } - - internal static void Resize(ref T[] array, int min, int max) - { - if ((array != null) && (min >= 0) && (max >= 0) && (min <= max)) - { - if (array.Length < min) - { - Array.Resize(ref array, min); - } - else if (array.Length > max) - { - Array.Resize(ref array, max); - } - } - } - - internal static bool CheckColorType(FREE_IMAGE_TYPE imageType, T color) - { - Type type = typeof(T); - bool result; - switch (imageType) - { - case FREE_IMAGE_TYPE.FIT_BITMAP: - result = (type == typeof(RGBQUAD)); break; - case FREE_IMAGE_TYPE.FIT_COMPLEX: - result = (type == typeof(FICOMPLEX)); break; - case FREE_IMAGE_TYPE.FIT_DOUBLE: - result = (type == typeof(double)); break; - case FREE_IMAGE_TYPE.FIT_FLOAT: - result = (type == typeof(float)); break; - case FREE_IMAGE_TYPE.FIT_INT16: - result = (type == typeof(Int16)); break; - case FREE_IMAGE_TYPE.FIT_INT32: - result = (type == typeof(Int32)); break; - case FREE_IMAGE_TYPE.FIT_RGB16: - result = (type == typeof(FIRGB16)); break; - case FREE_IMAGE_TYPE.FIT_RGBA16: - result = (type == typeof(FIRGBA16)); break; - case FREE_IMAGE_TYPE.FIT_RGBAF: - result = (type == typeof(FIRGBAF)); break; - case FREE_IMAGE_TYPE.FIT_RGBF: - result = (type == typeof(FIRGBF)); break; - case FREE_IMAGE_TYPE.FIT_UINT16: - result = (type == typeof(UInt16)); break; - case FREE_IMAGE_TYPE.FIT_UINT32: - result = (type == typeof(UInt32)); break; - default: - result = false; break; - } - return result; - } - - #endregion - - #region Dll-Imports - - /// - /// Retrieves a handle to a display device context (DC) for the client area of a specified window - /// or for the entire screen. You can use the returned handle in subsequent GDI functions to draw in the DC. - /// - /// Handle to the window whose DC is to be retrieved. - /// If this value is IntPtr.Zero, GetDC retrieves the DC for the entire screen. - /// If the function succeeds, the return value is a handle to the DC for the specified window's client area. - /// If the function fails, the return value is NULL. - [DllImport("user32.dll")] - private static extern IntPtr GetDC(IntPtr hWnd); - - /// - /// Releases a device context (DC), freeing it for use by other applications. - /// The effect of the ReleaseDC function depends on the type of DC. It frees only common and window DCs. - /// It has no effect on class or private DCs. - /// - /// Handle to the window whose DC is to be released. - /// Handle to the DC to be released. - /// Returns true on success, false on failure. - [DllImport("user32.dll")] - private static extern bool ReleaseDC(IntPtr hWnd, IntPtr hDC); - - /// - /// Creates a DIB that applications can write to directly. - /// The function gives you a pointer to the location of the bitmap bit values. - /// You can supply a handle to a file-mapping object that the function will use to create the bitmap, - /// or you can let the system allocate the memory for the bitmap. - /// - /// Handle to a device context. - /// Pointer to a BITMAPINFO structure that specifies various attributes of the DIB, - /// including the bitmap dimensions and colors. - /// Specifies the type of data contained in the bmiColors array member of the BITMAPINFO structure - /// pointed to by pbmi (either logical palette indexes or literal RGB values). - /// Pointer to a variable that receives a pointer to the location of the DIB bit values. - /// Handle to a file-mapping object that the function will use to create the DIB. - /// This parameter can be NULL. - /// Specifies the offset from the beginning of the file-mapping object referenced by hSection - /// where storage for the bitmap bit values is to begin. This value is ignored if hSection is NULL. - /// If the function succeeds, the return value is a handle to the newly created DIB, - /// and *ppvBits points to the bitmap bit values. If the function fails, the return value is NULL, and *ppvBits is NULL. - [DllImport("gdi32.dll")] - private static extern IntPtr CreateDIBSection( - IntPtr hdc, - [In] IntPtr pbmi, - uint iUsage, - out IntPtr ppvBits, - IntPtr hSection, - uint dwOffset); - - /// - /// Deletes a logical pen, brush, font, bitmap, region, or palette, freeing all system resources associated with the object. - /// After the object is deleted, the specified handle is no longer valid. - /// - /// Handle to a logical pen, brush, font, bitmap, region, or palette. - /// Returns true on success, false on failure. - [DllImport("gdi32.dll")] - private static extern bool DeleteObject(IntPtr hObject); - - /// - /// Creates a compatible bitmap (DDB) from a DIB and, optionally, sets the bitmap bits. - /// - /// Handle to a device context. - /// Pointer to a bitmap information header structure. - /// Specifies how the system initializes the bitmap bits - (use 4). - /// Pointer to an array of bytes containing the initial bitmap data. - /// Pointer to a BITMAPINFO structure that describes the dimensions - /// and color format of the array pointed to by the lpbInit parameter. - /// Specifies whether the bmiColors member of the BITMAPINFO structure - /// was initialized - (use 0). - /// Handle to a DIB or null on failure. - [DllImport("gdi32.dll")] - private static extern IntPtr CreateDIBitmap( - IntPtr hdc, - IntPtr lpbmih, - uint fdwInit, - IntPtr lpbInit, - IntPtr lpbmi, - uint fuUsage); - - /// - /// Retrieves information for the specified graphics object. - /// - /// Handle to the graphics object of interest. - /// Specifies the number of bytes of information to - /// be written to the buffer. - /// Pointer to a buffer that receives the information - /// about the specified graphics object. - /// 0 on failure. - [DllImport("gdi32.dll")] - private static extern int GetObject(IntPtr hgdiobj, int cbBuffer, IntPtr lpvObject); - - /// - /// Retrieves the bits of the specified compatible bitmap and copies them into a buffer - /// as a DIB using the specified format. - /// - /// Handle to the device context. - /// Handle to the bitmap. This must be a compatible bitmap (DDB). - /// Specifies the first scan line to retrieve. - /// Specifies the number of scan lines to retrieve. - /// Pointer to a buffer to receive the bitmap data. - /// Pointer to a BITMAPINFO structure that specifies the desired - /// format for the DIB data. - /// Specifies the format of the bmiColors member of the - /// BITMAPINFO structure - (use 0). - /// 0 on failure. - [DllImport("gdi32.dll")] - private static extern unsafe int GetDIBits( - IntPtr hdc, - IntPtr hbmp, - uint uStartScan, - uint cScanLines, - IntPtr lpvBits, - IntPtr lpbmi, - uint uUsage); - - /// - /// Moves a block of memory from one location to another. - /// - /// Pointer to the starting address of the move destination. - /// Pointer to the starting address of the block of memory to be moved. - /// Size of the block of memory to move, in bytes. - [DllImport("Kernel32.dll", EntryPoint = "RtlMoveMemory", SetLastError = false)] - public static unsafe extern void MoveMemory(void* dst, void* src, uint size); - - /// - /// The RtlCompareMemory routine compares blocks of memory - /// and returns the number of bytes that are equivalent. - /// - /// A pointer to a block of memory to compare. - /// A pointer to a block of memory to compare. - /// Specifies the number of bytes to be compared. - /// RtlCompareMemory returns the number of bytes that compare as equal. - /// If all bytes compare as equal, the input Length is returned. - [DllImport("ntdll.dll", EntryPoint = "RtlCompareMemory", SetLastError = false)] - internal static unsafe extern uint RtlCompareMemory(void* buf1, void* buf2, uint count); - - #endregion - } -} diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/UnitTest/ImageManager.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/UnitTest/ImageManager.cs deleted file mode 100644 index 83f4be4..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/UnitTest/ImageManager.cs +++ /dev/null @@ -1,156 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; - -namespace FreeImageNETUnitTest -{ - internal enum ImageType : byte - { - Even, - Odd, - JPEG, - Metadata, - Multipaged - } - - internal enum ImageColorType : byte - { - Type_01_Dither, - Type_01_Threshold, - Type_04, - Type_04_Greyscale_MinIsBlack, - Type_04_Greyscale_Unordered, - Type_08, - Type_08_Greyscale_MinIsBlack, - Type_08_Greyscale_Unordered, - Type_16_555, - Type_16_565, - Type_24, - Type_32, - } - - internal class ImageManager - { - public readonly string baseDirectory = null; - - public ImageManager() - : this(new DirectoryInfo(Environment.CurrentDirectory).Parent.Parent.Parent.FullName + @"\UnitTestData\Images\") - { - } - - public ImageManager(string baseDirectory) - { - if (!Directory.Exists(baseDirectory)) - throw new DirectoryNotFoundException(); - this.baseDirectory = baseDirectory; - } - - public string GetBitmapPath(ImageType type, ImageColorType colorType) - { - string filename = null; - - switch (type) - { - case ImageType.Even: - switch (colorType) - { - case ImageColorType.Type_01_Dither: - filename = baseDirectory + @"Even\Image_01_dither.tif"; - break; - case ImageColorType.Type_01_Threshold: - filename = baseDirectory + @"Even\Image_01_threshold.tif"; - break; - case ImageColorType.Type_04: - filename = baseDirectory + @"Even\Image_04.tif"; - break; - case ImageColorType.Type_04_Greyscale_MinIsBlack: - filename = baseDirectory + @"Even\Image_04_gs_minisblack.tif"; - break; - case ImageColorType.Type_04_Greyscale_Unordered: - filename = baseDirectory + @"Even\Image_04_gs_unordered.tif"; - break; - case ImageColorType.Type_08: - filename = baseDirectory + @"Even\Image_08.tif"; - break; - case ImageColorType.Type_08_Greyscale_MinIsBlack: - filename = baseDirectory + @"Even\Image_08_gs_minisblack.tif"; - break; - case ImageColorType.Type_08_Greyscale_Unordered: - filename = baseDirectory + @"Even\Image_08_gs_unordered.tif"; - break; - case ImageColorType.Type_16_555: - filename = baseDirectory + @"Even\Image_16_555.bmp"; - break; - case ImageColorType.Type_16_565: - filename = baseDirectory + @"Even\Image_16_565.bmp"; - break; - case ImageColorType.Type_24: - filename = baseDirectory + @"Even\Image_24.tif"; - break; - case ImageColorType.Type_32: - filename = baseDirectory + @"Even\Image_32.tif"; - break; - } - break; - case ImageType.Odd: - switch (colorType) - { - case ImageColorType.Type_01_Dither: - filename = baseDirectory + @"Odd\Image_01_dither.tif"; - break; - case ImageColorType.Type_01_Threshold: - filename = baseDirectory + @"Odd\Image_01_threshold.tif"; - break; - case ImageColorType.Type_04: - filename = baseDirectory + @"Odd\Image_04.tif"; - break; - case ImageColorType.Type_04_Greyscale_MinIsBlack: - filename = baseDirectory + @"Odd\Image_04_gs_minisblack.tif"; - break; - case ImageColorType.Type_04_Greyscale_Unordered: - filename = baseDirectory + @"Odd\Image_04_gs_unordered.tif"; - break; - case ImageColorType.Type_08: - filename = baseDirectory + @"Odd\Image_08.tif"; - break; - case ImageColorType.Type_08_Greyscale_MinIsBlack: - filename = baseDirectory + @"Odd\Image_08_gs_minisblack.tif"; - break; - case ImageColorType.Type_08_Greyscale_Unordered: - filename = baseDirectory + @"Odd\Image_08_gs_unordered.tif"; - break; - case ImageColorType.Type_16_555: - filename = baseDirectory + @"Odd\Image_16_555.bmp"; - break; - case ImageColorType.Type_16_565: - filename = baseDirectory + @"Odd\Image_16_565.bmp"; - break; - case ImageColorType.Type_24: - filename = baseDirectory + @"Odd\Image_24.tif"; - break; - } - break; - case ImageType.JPEG: - filename = baseDirectory + @"JPEG\Image.jpg"; - break; - case ImageType.Metadata: - filename = baseDirectory + @"Metadata\exif.jpg"; - break; - case ImageType.Multipaged: - filename = baseDirectory + @"Multipaged\Image.tif"; - break; - } - return filename; - } - - public FreeImageAPI.FIBITMAP GetBitmap(ImageType type, ImageColorType colorType) - { - FreeImageAPI.FIBITMAP result = new FreeImageAPI.FIBITMAP(); - string filename = GetBitmapPath(type, colorType); - if (!String.IsNullOrEmpty(filename) && File.Exists(filename)) - result = FreeImageAPI.FreeImage.LoadEx(filename); - return result; - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/UnitTest/NUnit.txt b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/UnitTest/NUnit.txt deleted file mode 100644 index ce0d58e..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/UnitTest/NUnit.txt +++ /dev/null @@ -1,14 +0,0 @@ -NUnit 2.x is needed for FreeImage .NET wrapper unit tests. It can be -downloaded from http://www.nunit.org/ - -After installing NUnit, double click on the NUnit project file -FreeImage.NET.nunit located in the FreeImage .NET wrapper Source folder -to load the project. - -The FreeImage .NET wrapper unit test project UnitTest.csproj, located -under Source\UnitTest, must be compiled in 'Debug' mode prior to opening -the NUnit project. - -The FreeImage .NET wrapper unit test project UnitTest.csproj currently -relies on the FreeImage .NET wrapper single source file, created by the -Source File Merger, located in the Source\SourceFileMerger folder. \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/UnitTest/Properties/AssemblyInfo.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/UnitTest/Properties/AssemblyInfo.cs deleted file mode 100644 index 2d0f3fb..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/UnitTest/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("FreeImageAPI.Properties")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("DataGis")] -[assembly: AssemblyProduct("FreeImageAPI.Properties")] -[assembly: AssemblyCopyright("Copyright © DataGis 2007")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("51678252-9a4b-492d-96c9-37ebe08d1f29")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/UnitTest/UnitTest.2005.csproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/UnitTest/UnitTest.2005.csproj deleted file mode 100644 index 86c5b76..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/UnitTest/UnitTest.2005.csproj +++ /dev/null @@ -1,105 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {FC7B3A04-FACE-4F07-9CFD-8C6ED06E3CDC} - Exe - Properties - FreeImageAPI - UnitTest - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - true - 659,660,661 - false - - - none - true - bin\Release\ - TRACE - prompt - 4 - 659,660,661 - true - false - - - true - bin\Debug\ - DEBUG;TRACE - true - 659,660,661 - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - true - 659,660,661 - - - x86 - false - prompt - - - true - bin\Debug\ - DEBUG;TRACE - true - 659,660,661 - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - true - 659,660,661 - - - x64 - false - prompt - - - - False - ..\..\..\..\..\..\..\Programme\NUnit 2.4.8\bin\nunit.framework.dll - - - - - - - - - - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/UnitTest/UnitTest.cs b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/UnitTest/UnitTest.cs deleted file mode 100644 index 98fad61..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/UnitTest/UnitTest.cs +++ /dev/null @@ -1,5555 +0,0 @@ -using System; -using System.Drawing; -using System.Collections.Generic; -using System.Text; -using System.Runtime.InteropServices; -using System.IO; -using System.Drawing.Imaging; -using System.Net; -using FreeImageNETUnitTest; -using System.Reflection; -using System.Threading; -using System.Runtime.Serialization.Formatters.Binary; -using System.Collections; -using FreeImageAPI; -using FreeImageAPI.IO; -using FreeImageAPI.Metadata; -using FreeImageAPI.Plugins; -using NUnit.Framework; - -namespace FreeImageNETUnitTest -{ - [TestFixture] - public class ImportedFunctionsTest - { - ImageManager iManager = new ImageManager(); - FIBITMAP dib; - string freeImageCallback = null; - - [TestFixtureSetUp] - public void Init() - { - FreeImageEngine.Message += new OutputMessageFunction(FreeImage_Message); - } - - [TestFixtureTearDown] - public void DeInit() - { - FreeImageEngine.Message -= new OutputMessageFunction(FreeImage_Message); - } - - [SetUp] - public void InitEachTime() - { - } - - [TearDown] - public void DeInitEachTime() - { - } - - void FreeImage_Message(FREE_IMAGE_FORMAT fif, string message) - { - freeImageCallback = message; - } - - [Test] - public void FreeImage_GetVersion() - { - string version = FreeImage.GetVersion(); - Assert.IsNotEmpty(version); - } - - [Test] - public void FreeImage_GetCopyrightMessage() - { - string copyright = FreeImage.GetCopyrightMessage(); - Assert.IsNotEmpty(copyright); - } - - [Test] - public void FreeImage_OutputMessageProc_SetOutputMessage() - { - Assert.IsNull(freeImageCallback); - FreeImage.SetOutputMessage(new OutputMessageFunction(FreeImage_Message)); - FreeImage.OutputMessageProc(FREE_IMAGE_FORMAT.FIF_UNKNOWN, "unit test"); - FreeImage.SetOutputMessage(null); - Assert.IsNotNull(freeImageCallback); - freeImageCallback = null; - } - - [Test] - public void FreeImage_Allocate() - { - dib = FreeImage.Allocate( - 133, - 77, - 8, - FreeImage.FI_RGBA_RED_MASK, - FreeImage.FI_RGBA_GREEN_MASK, - FreeImage.FI_RGBA_BLUE_MASK); - - Assert.That(!dib.IsNull); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_AllocateT() - { - dib = FreeImage.AllocateT(FREE_IMAGE_TYPE.FIT_RGBA16, 31, 555, 64, 0, 0, 0); - - Assert.That(!dib.IsNull); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_Clone() - { - dib = FreeImage.Allocate(1, 1, 32, 0, 0, 0); - Assert.That(!dib.IsNull); - - FIBITMAP temp = FreeImage.Clone(dib); - Assert.AreNotEqual(0, temp); - - FreeImage.UnloadEx(ref temp); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_Load() - { - Assert.That(dib.IsNull); - dib = FreeImage.Load(FREE_IMAGE_FORMAT.FIF_JPEG, iManager.baseDirectory + @"JPEG\Image.jpg", FREE_IMAGE_LOAD_FLAGS.DEFAULT); - Assert.That(!dib.IsNull); - FreeImage.UnloadEx(ref dib); - Assert.That(dib.IsNull); - } - - [Test] - public void FreeImage_Unload() - { - Assert.That(dib.IsNull); - dib = FreeImage.Load(FREE_IMAGE_FORMAT.FIF_JPEG, iManager.baseDirectory + @"JPEG\Image.jpg", FREE_IMAGE_LOAD_FLAGS.DEFAULT); - Assert.IsNotNull(dib); - FreeImage.Unload(dib); - dib.SetNull(); - } - - [Test] - public void FreeImage_LoadFromHandle() - { - byte[] data = File.ReadAllBytes(iManager.GetBitmapPath(ImageType.Even, ImageColorType.Type_16_555)); - MemoryStream mStream = new MemoryStream(data); - FreeImageIO io = FreeImageStreamIO.io; - - using (fi_handle handle = new fi_handle(mStream)) - { - dib = FreeImage.LoadFromHandle(FREE_IMAGE_FORMAT.FIF_BMP, ref io, handle, FREE_IMAGE_LOAD_FLAGS.DEFAULT); - Assert.That(!dib.IsNull); - - FreeImage.UnloadEx(ref dib); - } - } - - [Test] - public void FreeImage_Save() - { - string filename = @"test.bmp"; - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_08); - Assert.That(!dib.IsNull); - - Assert.IsTrue(FreeImage.Save(FREE_IMAGE_FORMAT.FIF_BMP, dib, filename, FREE_IMAGE_SAVE_FLAGS.DEFAULT)); - Assert.IsTrue(File.Exists(filename)); - File.Delete(filename); - Assert.IsFalse(File.Exists(filename)); - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_SaveToHandle() - { - FreeImageIO io = new FreeImageIO(); - FreeImage.SaveToHandle(FREE_IMAGE_FORMAT.FIF_BMP, dib, ref io, new fi_handle(), FREE_IMAGE_SAVE_FLAGS.DEFAULT); - } - - [Test] - public void FreeImage_Memory() - { - dib = FreeImage.Allocate(1, 1, 1, 0, 0, 0); - Assert.That(!dib.IsNull); - FIMEMORY mem = FreeImage.OpenMemory(IntPtr.Zero, 0); - Assert.AreNotEqual(0, mem); - FreeImage.SaveToMemory(FREE_IMAGE_FORMAT.FIF_TIFF, dib, mem, FREE_IMAGE_SAVE_FLAGS.DEFAULT); - Assert.AreNotEqual(0, FreeImage.TellMemory(mem)); - Assert.IsTrue(FreeImage.SeekMemory(mem, 0, System.IO.SeekOrigin.Begin)); - - FIBITMAP temp = FreeImage.LoadFromMemory(FREE_IMAGE_FORMAT.FIF_TIFF, mem, FREE_IMAGE_LOAD_FLAGS.DEFAULT); - Assert.AreNotEqual(0, temp); - FreeImage.UnloadEx(ref temp); - - uint size = 0; - byte[] ptr = new byte[1]; - IntPtr buffer = IntPtr.Zero; - Assert.IsTrue(FreeImage.AcquireMemory(mem, ref buffer, ref size)); - Assert.AreNotEqual(IntPtr.Zero, ptr); - Assert.AreNotEqual(0, size); - - Assert.AreEqual(1, FreeImage.WriteMemory(ptr, 1, 1, mem)); - FreeImage.SeekMemory(mem, 1, System.IO.SeekOrigin.Begin); - Assert.AreEqual(1, FreeImage.TellMemory(mem)); - Assert.AreEqual(2, FreeImage.ReadMemory(ptr, 1, 2, mem)); - FreeImage.CloseMemory(mem); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_RegisterLocalPlugin() - { - InitProc proc = null; - Assert.AreEqual(FREE_IMAGE_FORMAT.FIF_UNKNOWN, FreeImage.RegisterLocalPlugin(proc, "", "", "", "")); - } - - [Test] - public void FreeImage_RegisterExternalPlugin() - { - Assert.AreEqual(FREE_IMAGE_FORMAT.FIF_UNKNOWN, FreeImage.RegisterExternalPlugin("", "", "", "", "")); - } - - [Test] - public void FreeImage_GetFIFCount() - { - Assert.AreNotEqual(0, FreeImage.GetFIFCount()); - } - - [Test] - public void FreeImage_SetPluginEnabled_IsPluginEnabled() - { - FreeImage.SetPluginEnabled(FREE_IMAGE_FORMAT.FIF_PNG, false); - Assert.AreEqual(0, FreeImage.IsPluginEnabled(FREE_IMAGE_FORMAT.FIF_PNG)); - FreeImage.SetPluginEnabled(FREE_IMAGE_FORMAT.FIF_PNG, true); - Assert.AreEqual(1, FreeImage.IsPluginEnabled(FREE_IMAGE_FORMAT.FIF_PNG)); - } - - [Test] - public void FreeImage_GetFIFFromFormat() - { - Assert.AreEqual(FREE_IMAGE_FORMAT.FIF_UNKNOWN, FreeImage.GetFIFFromFormat("")); - Assert.AreNotEqual(FREE_IMAGE_FORMAT.FIF_UNKNOWN, FreeImage.GetFIFFromFormat("TIFF")); - } - - [Test] - public void FreeImage_GetFIFFromMime() - { - Assert.AreEqual(FREE_IMAGE_FORMAT.FIF_UNKNOWN, FreeImage.GetFIFFromMime("")); - Assert.AreNotEqual(FREE_IMAGE_FORMAT.FIF_UNKNOWN, FreeImage.GetFIFFromMime("image/jpeg")); - } - - [Test] - public void FreeImage_GetFormatFromFIF() - { - Assert.IsNotEmpty(FreeImage.GetFormatFromFIF(FREE_IMAGE_FORMAT.FIF_JNG)); - } - - [Test] - public void FreeImage_GetFIFExtensionList() - { - Assert.IsNotEmpty(FreeImage.GetFIFExtensionList(FREE_IMAGE_FORMAT.FIF_PGM)); - } - - [Test] - public void FreeImage_GetFIFDescription() - { - Assert.IsNotEmpty(FreeImage.GetFIFDescription(FREE_IMAGE_FORMAT.FIF_PBM)); - } - - [Test] - public void FreeImage_GetFIFRegExpr() - { - Assert.IsNotEmpty(FreeImage.GetFIFRegExpr(FREE_IMAGE_FORMAT.FIF_JPEG)); - } - - [Test] - public void FreeImage_GetFIFMimeType() - { - Assert.IsNotEmpty(FreeImage.GetFIFMimeType(FREE_IMAGE_FORMAT.FIF_ICO)); - } - - [Test] - public void FreeImage_GetFIFFromFilename() - { - Assert.AreNotEqual(FREE_IMAGE_FORMAT.FIF_UNKNOWN, FreeImage.GetFIFFromFilename("test.bmp")); - Assert.AreEqual(FREE_IMAGE_FORMAT.FIF_UNKNOWN, FreeImage.GetFIFFromFilename("test.000")); - } - - [Test] - public void FreeImage_FIFSupportsReading() - { - Assert.IsTrue(FreeImage.FIFSupportsReading(FREE_IMAGE_FORMAT.FIF_TIFF)); - } - - [Test] - public void FreeImage_FIFSupportsWriting() - { - Assert.IsTrue(FreeImage.FIFSupportsWriting(FREE_IMAGE_FORMAT.FIF_GIF)); - } - - [Test] - public void FreeImage_FIFSupportsExportBPP() - { - Assert.IsTrue(FreeImage.FIFSupportsExportBPP(FREE_IMAGE_FORMAT.FIF_BMP, 32)); - Assert.IsFalse(FreeImage.FIFSupportsExportBPP(FREE_IMAGE_FORMAT.FIF_GIF, 32)); - } - - [Test] - public void FreeImage_FIFSupportsExportType() - { - Assert.IsTrue(FreeImage.FIFSupportsExportType(FREE_IMAGE_FORMAT.FIF_BMP, FREE_IMAGE_TYPE.FIT_BITMAP)); - Assert.IsFalse(FreeImage.FIFSupportsExportType(FREE_IMAGE_FORMAT.FIF_BMP, FREE_IMAGE_TYPE.FIT_COMPLEX)); - } - - [Test] - public void FreeImage_FIFSupportsICCProfiles() - { - Assert.IsTrue(FreeImage.FIFSupportsICCProfiles(FREE_IMAGE_FORMAT.FIF_JPEG)); - Assert.IsFalse(FreeImage.FIFSupportsICCProfiles(FREE_IMAGE_FORMAT.FIF_BMP)); - } - - [Test] - public void FreeImage_MultiBitmap() - { - FIBITMAP temp; - FIMULTIBITMAP mdib = FreeImage.OpenMultiBitmap( - FREE_IMAGE_FORMAT.FIF_TIFF, - @"test.tif", - true, - false, - true, - FREE_IMAGE_LOAD_FLAGS.DEFAULT); - Assert.AreNotEqual(0, mdib); - Assert.AreEqual(0, FreeImage.GetPageCount(mdib)); - dib = FreeImage.Allocate(10, 10, 8, 0, 0, 0); - FreeImage.AppendPage(mdib, dib); - Assert.AreEqual(1, FreeImage.GetPageCount(mdib)); - FreeImage.AppendPage(mdib, dib); - Assert.AreEqual(2, FreeImage.GetPageCount(mdib)); - FreeImage.AppendPage(mdib, dib); - Assert.AreEqual(3, FreeImage.GetPageCount(mdib)); - FreeImage.CloseMultiBitmapEx(ref mdib); - FreeImage.UnloadEx(ref dib); - mdib.SetNull(); - mdib = FreeImage.OpenMultiBitmap(FREE_IMAGE_FORMAT.FIF_TIFF, @"test.tif", false, false, true, FREE_IMAGE_LOAD_FLAGS.DEFAULT); - Assert.AreNotEqual(0, mdib); - Assert.AreEqual(3, FreeImage.GetPageCount(mdib)); - dib = FreeImage.LockPage(mdib, 1); - temp = FreeImage.LockPage(mdib, 2); - - int[] pages = null; - int count = 0; - FreeImage.GetLockedPageNumbers(mdib, pages, ref count); - Assert.AreEqual(2, count); - pages = new int[count]; - FreeImage.GetLockedPageNumbers(mdib, pages, ref count); - Assert.AreEqual(2, pages.Length); - FreeImage.UnlockPage(mdib, dib, false); - FreeImage.UnlockPage(mdib, temp, true); - dib.SetNull(); - Assert.IsTrue(FreeImage.MovePage(mdib, 0, 1)); - FreeImage.CloseMultiBitmapEx(ref mdib); - Assert.IsTrue(System.IO.File.Exists("test.tif")); - System.IO.File.Delete("test.tif"); - } - - [Test] - public void FreeImage_GetFileType() - { - Assert.AreNotEqual(FREE_IMAGE_FORMAT.FIF_UNKNOWN, FreeImage.GetFileType(iManager.GetBitmapPath(ImageType.Even, ImageColorType.Type_08_Greyscale_Unordered), 0)); - } - - [Test] - public void FreeImage_GetFileTypeFromHandle() - { - FreeImageIO io = FreeImageStreamIO.io; - Assert.AreEqual(FREE_IMAGE_FORMAT.FIF_UNKNOWN, FreeImage.GetFileTypeFromHandle(ref io, new fi_handle(), 0)); - } - - [Test] - public void FreeImage_GetFileTypeFromMemory() - { - Assert.AreEqual(FREE_IMAGE_FORMAT.FIF_UNKNOWN, FreeImage.GetFileTypeFromMemory(new FIMEMORY(), 0)); - } - - [Test] - public void FreeImage_IsLittleEndian() - { - Assert.IsTrue(FreeImage.IsLittleEndian()); - } - - [Test] - public void FreeImage_LookupX11Color() - { - byte red, green, blue; - FreeImage.LookupX11Color("lawngreen", out red, out green, out blue); - Assert.AreEqual(124, red); - Assert.AreEqual(252, green); - Assert.AreEqual(0, blue); - } - - [Test] - public void FreeImage_LookupSVGColor() - { - byte red, green, blue; - FreeImage.LookupX11Color("orchid", out red, out green, out blue); - Assert.AreEqual(218, red); - Assert.AreEqual(112, green); - Assert.AreEqual(214, blue); - } - - [Test] - public void FreeImage_GetBits() - { - dib = iManager.GetBitmap(ImageType.Odd, ImageColorType.Type_01_Threshold); - Assert.That(!dib.IsNull); - Assert.AreNotEqual(IntPtr.Zero, FreeImage.GetBits(dib)); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_GetScanLine() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_04_Greyscale_MinIsBlack); - Assert.That(!dib.IsNull); - Assert.AreNotEqual(IntPtr.Zero, FreeImage.GetScanLine(dib, 0)); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_GetPixelIndex_SetPixelIndex() - { - dib = iManager.GetBitmap(ImageType.Odd, ImageColorType.Type_04_Greyscale_Unordered); - Assert.That(!dib.IsNull); - byte index_old, index_new; - Assert.IsTrue(FreeImage.GetPixelIndex(dib, 31, 10, out index_old)); - index_new = index_old == byte.MaxValue ? (byte)0 : (byte)(index_old + 1); - Assert.IsTrue(FreeImage.SetPixelIndex(dib, 31, 10, ref index_new)); - Assert.IsTrue(FreeImage.GetPixelIndex(dib, 31, 10, out index_old)); - Assert.AreEqual(index_new, index_old); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_GetPixelColor_SetPixelColor() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_32); - Assert.That(!dib.IsNull); - RGBQUAD value_old, value_new; - Assert.IsTrue(FreeImage.GetPixelColor(dib, 77, 61, out value_old)); - value_new = (value_old == (RGBQUAD)Color.White) ? Color.Black : Color.White; - Assert.IsTrue(FreeImage.SetPixelColor(dib, 77, 61, ref value_new)); - Assert.IsTrue(FreeImage.GetPixelColor(dib, 77, 61, out value_old)); - Assert.AreEqual(value_new, value_old); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_Bitmap_information_functions() - { - dib = iManager.GetBitmap(ImageType.Odd, ImageColorType.Type_08_Greyscale_MinIsBlack); - Assert.That(!dib.IsNull); - Assert.AreEqual(FREE_IMAGE_TYPE.FIT_BITMAP, FreeImage.GetImageType(dib)); - Assert.AreNotEqual(0, FreeImage.GetColorsUsed(dib)); - Assert.AreEqual(8, FreeImage.GetBPP(dib)); - Assert.AreNotEqual(0, FreeImage.GetWidth(dib)); - Assert.AreNotEqual(0, FreeImage.GetHeight(dib)); - Assert.AreNotEqual(0, FreeImage.GetLine(dib)); - Assert.AreNotEqual(0, FreeImage.GetPitch(dib)); - Assert.AreNotEqual(0, FreeImage.GetDIBSize(dib)); - Assert.AreNotEqual(IntPtr.Zero, FreeImage.GetPalette(dib)); - FreeImage.SetDotsPerMeterX(dib, 1234); - FreeImage.SetDotsPerMeterY(dib, 4321); - Assert.AreEqual(1234, FreeImage.GetDotsPerMeterX(dib)); - Assert.AreEqual(4321, FreeImage.GetDotsPerMeterY(dib)); - Assert.AreNotEqual(IntPtr.Zero, FreeImage.GetInfoHeader(dib)); - Assert.AreNotEqual(IntPtr.Zero, FreeImage.GetInfo(dib)); - Assert.AreEqual(FREE_IMAGE_COLOR_TYPE.FIC_MINISBLACK, FreeImage.GetColorType(dib)); - Assert.AreEqual(0, FreeImage.GetRedMask(dib)); - Assert.AreEqual(0, FreeImage.GetGreenMask(dib)); - Assert.AreEqual(0, FreeImage.GetBlueMask(dib)); - Assert.AreEqual(0, FreeImage.GetTransparencyCount(dib)); - Assert.AreNotEqual(IntPtr.Zero, FreeImage.GetTransparencyTable(dib)); - FreeImage.SetTransparent(dib, false); - FreeImage.SetTransparencyTable(dib, new byte[] { }); - Assert.IsTrue(FreeImage.IsTransparent(dib)); - Assert.IsFalse(FreeImage.HasBackgroundColor(dib)); - RGBQUAD rgb = Color.Teal; - Assert.IsTrue(FreeImage.SetBackgroundColor(dib, ref rgb)); - Assert.IsTrue(FreeImage.GetBackgroundColor(dib, out rgb)); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_GetICCProfile() - { - dib = iManager.GetBitmap(ImageType.Metadata, ImageColorType.Type_01_Dither); - Assert.That(!dib.IsNull); - new FIICCPROFILE(dib, new byte[] { 0xFF, 0xAA, 0x00, 0x33 }); - FIICCPROFILE p = FreeImage.GetICCProfileEx(dib); - Assert.AreEqual(4, p.Size); - Assert.AreEqual(0xAA, p.Data[1]); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_CreateICCProfile() - { - dib = iManager.GetBitmap(ImageType.Metadata, ImageColorType.Type_01_Dither); - Assert.That(!dib.IsNull); - byte[] data = new byte[256]; - Assert.AreNotEqual(IntPtr.Zero, FreeImage.CreateICCProfile(dib, data, 256)); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_DestroyICCProfile() - { - dib = iManager.GetBitmap(ImageType.Metadata, ImageColorType.Type_01_Dither); - Assert.That(!dib.IsNull); - FreeImage.DestroyICCProfile(dib); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_ConvertTo4Bits() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_32); - Assert.That(!dib.IsNull); - FIBITMAP temp = FreeImage.ConvertTo4Bits(dib); - Assert.AreNotEqual(0, temp); - Assert.AreEqual(4, FreeImage.GetBPP(temp)); - FreeImage.UnloadEx(ref temp); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_ConvertTo8Bits() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_32); - Assert.That(!dib.IsNull); - FIBITMAP temp = FreeImage.ConvertTo8Bits(dib); - Assert.AreNotEqual(0, temp); - Assert.AreEqual(8, FreeImage.GetBPP(temp)); - FreeImage.UnloadEx(ref temp); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_ConvertToGreyscale() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_32); - Assert.That(!dib.IsNull); - FIBITMAP temp = FreeImage.ConvertToGreyscale(dib); - Assert.AreNotEqual(0, temp); - Assert.AreEqual(8, FreeImage.GetBPP(temp)); - FreeImage.UnloadEx(ref temp); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_ConvertTo16Bits555() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_32); - Assert.That(!dib.IsNull); - FIBITMAP temp = FreeImage.ConvertTo16Bits555(dib); - Assert.AreNotEqual(0, temp); - Assert.AreEqual(16, FreeImage.GetBPP(temp)); - FreeImage.UnloadEx(ref temp); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_ConvertTo16Bits565() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_32); - Assert.That(!dib.IsNull); - FIBITMAP temp = FreeImage.ConvertTo16Bits565(dib); - Assert.AreNotEqual(0, temp); - Assert.AreEqual(16, FreeImage.GetBPP(temp)); - FreeImage.UnloadEx(ref temp); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_ConvertTo24Bits() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_32); - Assert.That(!dib.IsNull); - FIBITMAP temp = FreeImage.ConvertTo24Bits(dib); - Assert.AreNotEqual(0, temp); - Assert.AreEqual(24, FreeImage.GetBPP(temp)); - FreeImage.UnloadEx(ref temp); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_ConvertTo32Bits() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_24); - Assert.That(!dib.IsNull); - FIBITMAP temp = FreeImage.ConvertTo32Bits(dib); - Assert.AreNotEqual(0, temp); - Assert.AreEqual(32, FreeImage.GetBPP(temp)); - FreeImage.UnloadEx(ref temp); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_ColorQuantize() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_24); - Assert.That(!dib.IsNull); - FIBITMAP temp = FreeImage.ColorQuantize(dib, FREE_IMAGE_QUANTIZE.FIQ_WUQUANT); - Assert.AreNotEqual(0, temp); - Assert.AreEqual(8, FreeImage.GetBPP(temp)); - FreeImage.UnloadEx(ref temp); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_ColorQuantizeEx() - { - FIBITMAP paletteDib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_08); - Assert.IsFalse(paletteDib.IsNull); - Palette palette = FreeImage.GetPaletteEx(paletteDib); - RGBQUAD[] table = palette.Data; - - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_24); - Assert.That(!dib.IsNull); - - FIBITMAP temp = FreeImage.ColorQuantizeEx(dib, FREE_IMAGE_QUANTIZE.FIQ_WUQUANT, (int)palette.Length, (int)palette.Length, table); - Assert.AreNotEqual(0, temp); - Assert.AreEqual(8, FreeImage.GetBPP(temp)); - - FreeImage.UnloadEx(ref paletteDib); - FreeImage.UnloadEx(ref temp); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_Threshold() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_32); - Assert.That(!dib.IsNull); - FIBITMAP temp = FreeImage.Threshold(dib, 128); - Assert.AreNotEqual(0, temp); - Assert.AreEqual(1, FreeImage.GetBPP(temp)); - FreeImage.UnloadEx(ref temp); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_Dither() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_32); - Assert.That(!dib.IsNull); - FIBITMAP temp = FreeImage.Dither(dib, FREE_IMAGE_DITHER.FID_FS); - Assert.AreNotEqual(0, temp); - Assert.AreEqual(1, FreeImage.GetBPP(temp)); - FreeImage.UnloadEx(ref temp); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_RawBits() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_32); - Assert.That(!dib.IsNull); - IntPtr buffer = Marshal.AllocHGlobal((int)FreeImage.GetDIBSize(dib)); - FreeImage.ConvertToRawBits( - buffer, - dib, - (int)FreeImage.GetPitch(dib), - FreeImage.GetBPP(dib), - FreeImage.GetRedMask(dib), - FreeImage.GetGreenMask(dib), - FreeImage.GetBlueMask(dib), - true); - FIBITMAP temp = FreeImage.ConvertFromRawBits( - buffer, - (int)FreeImage.GetWidth(dib), - (int)FreeImage.GetHeight(dib), - (int)FreeImage.GetPitch(dib), - FreeImage.GetBPP(dib), - FreeImage.GetRedMask(dib), - FreeImage.GetGreenMask(dib), - FreeImage.GetBlueMask(dib), - true); - - Assert.AreNotEqual(0, temp); - - Marshal.FreeHGlobal(buffer); - FreeImage.UnloadEx(ref temp); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_ConvertToRGBF() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_32); - Assert.That(!dib.IsNull); - FIBITMAP temp = FreeImage.ConvertToRGBF(dib); - Assert.AreNotEqual(0, temp); - Assert.AreEqual(FREE_IMAGE_TYPE.FIT_RGBF, FreeImage.GetImageType(temp)); - FreeImage.UnloadEx(ref temp); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_ConvertToStandardType() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_04_Greyscale_MinIsBlack); - Assert.That(!dib.IsNull); - FIBITMAP temp = FreeImage.ConvertToStandardType(dib, true); - Assert.AreNotEqual(0, temp); - Assert.AreEqual(FREE_IMAGE_COLOR_TYPE.FIC_PALETTE, FreeImage.GetColorType(temp)); - FreeImage.UnloadEx(ref temp); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_ConvertToType() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_08_Greyscale_Unordered); - Assert.That(!dib.IsNull); - FIBITMAP temp = FreeImage.ConvertToType(dib, FREE_IMAGE_TYPE.FIT_UINT32, true); - Assert.AreNotEqual(0, temp); - Assert.AreEqual(FREE_IMAGE_TYPE.FIT_UINT32, FreeImage.GetImageType(temp)); - FreeImage.UnloadEx(ref temp); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_ToneMapping() - { - FIBITMAP temp; - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_24); - Assert.That(!dib.IsNull); - - FIBITMAP rgbf = FreeImage.ConvertToRGBF(dib); - Assert.AreNotEqual(0, rgbf); - Assert.AreEqual(FREE_IMAGE_TYPE.FIT_RGBF, FreeImage.GetImageType(rgbf)); - Assert.AreEqual(96, FreeImage.GetBPP(rgbf)); - - temp = FreeImage.ToneMapping(rgbf, FREE_IMAGE_TMO.FITMO_REINHARD05, 1f, 1.1f); - Assert.AreNotEqual(0, temp); - Assert.AreEqual(24, FreeImage.GetBPP(temp)); - FreeImage.UnloadEx(ref temp); - - FreeImage.UnloadEx(ref rgbf); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_TmoDrago03() - { - FIBITMAP temp; - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_24); - Assert.That(!dib.IsNull); - - FIBITMAP rgbf = FreeImage.ConvertToRGBF(dib); - Assert.AreNotEqual(0, rgbf); - Assert.AreEqual(FREE_IMAGE_TYPE.FIT_RGBF, FreeImage.GetImageType(rgbf)); - Assert.AreEqual(96, FreeImage.GetBPP(rgbf)); - - temp = FreeImage.TmoDrago03(rgbf, 1f, 1.2f); - Assert.AreNotEqual(0, temp); - Assert.AreEqual(24, FreeImage.GetBPP(temp)); - FreeImage.UnloadEx(ref temp); - - FreeImage.UnloadEx(ref rgbf); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_TmoReinhard05() - { - FIBITMAP temp; - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_24); - Assert.That(!dib.IsNull); - - FIBITMAP rgbf = FreeImage.ConvertToRGBF(dib); - Assert.AreNotEqual(0, rgbf); - Assert.AreEqual(FREE_IMAGE_TYPE.FIT_RGBF, FreeImage.GetImageType(rgbf)); - Assert.AreEqual(96, FreeImage.GetBPP(rgbf)); - - temp = FreeImage.TmoReinhard05(rgbf, 0f, 0.25f); - Assert.AreNotEqual(0, temp); - Assert.AreEqual(24, FreeImage.GetBPP(temp)); - FreeImage.UnloadEx(ref temp); - - FreeImage.UnloadEx(ref rgbf); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_TmoFattal02() - { - FIBITMAP temp; - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_24); - Assert.That(!dib.IsNull); - - FIBITMAP rgbf = FreeImage.ConvertToRGBF(dib); - Assert.AreNotEqual(0, rgbf); - Assert.AreEqual(FREE_IMAGE_TYPE.FIT_RGBF, FreeImage.GetImageType(rgbf)); - Assert.AreEqual(96, FreeImage.GetBPP(rgbf)); - - temp = FreeImage.TmoFattal02(rgbf, 1f, 0.79f); - Assert.AreNotEqual(0, temp); - Assert.AreEqual(24, FreeImage.GetBPP(temp)); - FreeImage.UnloadEx(ref temp); - - FreeImage.UnloadEx(ref rgbf); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_ZLibCompress_ZLibUncompress() - { - Random rand = new Random(DateTime.Now.Millisecond); - byte[] source = new byte[10240]; - byte[] compressed = new byte[(int)(10355f * 1.01 + 12f)]; - byte[] uncompressed = new byte[10240]; - rand.NextBytes(source); - Assert.AreNotEqual(0, FreeImage.ZLibCompress(compressed, (uint)compressed.Length, source, (uint)source.Length)); - Assert.AreNotEqual(0, FreeImage.ZLibUncompress(uncompressed, (uint)source.Length, compressed, (uint)compressed.Length)); - for (int i = 0; i < source.Length; i++) - if (source[i] != uncompressed[i]) - Assert.Fail(); - } - - [Test] - public void FreeImage_ZLibGZip_ZLibGUnzip() - { - Random rand = new Random(DateTime.Now.Millisecond); - byte[] source = new byte[10240]; - byte[] compressed = new byte[(int)(10355f * 1.01 + 24f)]; - byte[] uncompressed = new byte[10240]; - rand.NextBytes(source); - Assert.AreNotEqual(0, FreeImage.ZLibGZip(compressed, (uint)compressed.Length, source, (uint)source.Length)); - Assert.AreNotEqual(0, FreeImage.ZLibGUnzip(uncompressed, (uint)source.Length, compressed, (uint)compressed.Length)); - for (int i = 0; i < source.Length; i++) - if (source[i] != uncompressed[i]) - Assert.Fail(); - } - - [Test] - public void FreeImage_ZLibCRC32() - { - byte[] buffer = new byte[0]; - Assert.AreEqual(0xFEBCA008, FreeImage.ZLibCRC32(0xFEBCA008, buffer, 0)); - } - - [Test] - public void FreeImage_CreateTag() - { - FITAG tag = FreeImage.CreateTag(); - Assert.AreNotEqual(0, tag); - FITAG tag_clone = FreeImage.CloneTag(tag); - Assert.AreNotEqual(0, tag_clone); - FreeImage.DeleteTag(tag); - FreeImage.DeleteTag(tag_clone); - } - - [Test] - public void FreeImage_Tag_accessors() - { - dib = iManager.GetBitmap(ImageType.Metadata, ImageColorType.Type_01_Dither); - Assert.That(!dib.IsNull); - - FITAG tag; - FIMETADATA mData = FreeImage.FindFirstMetadata(FREE_IMAGE_MDMODEL.FIMD_EXIF_EXIF, dib, out tag); - Assert.AreNotEqual(0, mData); - Assert.AreNotEqual(0, tag); - - Assert.IsTrue(FreeImage.FindNextMetadata(mData, out tag)); - Assert.AreNotEqual(0, tag); - - FreeImage.FindCloseMetadata(mData); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_GetTagKey() - { - dib = iManager.GetBitmap(ImageType.Metadata, ImageColorType.Type_01_Dither); - Assert.That(!dib.IsNull); - - FITAG tag; - FIMETADATA mData = FreeImage.FindFirstMetadata(FREE_IMAGE_MDMODEL.FIMD_EXIF_EXIF, dib, out tag); - Assert.AreNotEqual(0, mData); - Assert.AreNotEqual(0, tag); - - FreeImage.GetTagKey(tag); - - FreeImage.FindCloseMetadata(mData); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_GetTagDescription() - { - dib = iManager.GetBitmap(ImageType.Metadata, ImageColorType.Type_01_Dither); - Assert.That(!dib.IsNull); - - FITAG tag; - FIMETADATA mData = FreeImage.FindFirstMetadata(FREE_IMAGE_MDMODEL.FIMD_EXIF_EXIF, dib, out tag); - Assert.AreNotEqual(0, mData); - Assert.AreNotEqual(0, tag); - - FreeImage.GetTagDescription(tag); - - FreeImage.FindCloseMetadata(mData); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_GetTagID() - { - dib = iManager.GetBitmap(ImageType.Metadata, ImageColorType.Type_01_Dither); - Assert.That(!dib.IsNull); - - FITAG tag; - FIMETADATA mData = FreeImage.FindFirstMetadata(FREE_IMAGE_MDMODEL.FIMD_EXIF_EXIF, dib, out tag); - Assert.AreNotEqual(0, mData); - Assert.AreNotEqual(0, tag); - - FreeImage.GetTagID(tag); - - FreeImage.FindCloseMetadata(mData); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_GetTagType() - { - dib = iManager.GetBitmap(ImageType.Metadata, ImageColorType.Type_01_Dither); - Assert.That(!dib.IsNull); - - FITAG tag; - FIMETADATA mData = FreeImage.FindFirstMetadata(FREE_IMAGE_MDMODEL.FIMD_EXIF_EXIF, dib, out tag); - Assert.AreNotEqual(0, mData); - Assert.AreNotEqual(0, tag); - - FreeImage.GetTagType(tag); - - FreeImage.FindCloseMetadata(mData); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_GetTagCount() - { - dib = iManager.GetBitmap(ImageType.Metadata, ImageColorType.Type_01_Dither); - Assert.That(!dib.IsNull); - - FITAG tag; - FIMETADATA mData = FreeImage.FindFirstMetadata(FREE_IMAGE_MDMODEL.FIMD_EXIF_EXIF, dib, out tag); - Assert.AreNotEqual(0, mData); - Assert.AreNotEqual(0, tag); - - FreeImage.GetTagCount(tag); - - FreeImage.FindCloseMetadata(mData); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_GetTagLength() - { - dib = iManager.GetBitmap(ImageType.Metadata, ImageColorType.Type_01_Dither); - Assert.That(!dib.IsNull); - - FITAG tag; - FIMETADATA mData = FreeImage.FindFirstMetadata(FREE_IMAGE_MDMODEL.FIMD_EXIF_EXIF, dib, out tag); - Assert.AreNotEqual(0, mData); - Assert.AreNotEqual(0, tag); - - FreeImage.GetTagLength(tag); - - FreeImage.FindCloseMetadata(mData); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_GetTagValue() - { - dib = iManager.GetBitmap(ImageType.Metadata, ImageColorType.Type_01_Dither); - Assert.That(!dib.IsNull); - - FITAG tag; - FIMETADATA mData = FreeImage.FindFirstMetadata(FREE_IMAGE_MDMODEL.FIMD_EXIF_EXIF, dib, out tag); - Assert.AreNotEqual(0, mData); - Assert.AreNotEqual(0, tag); - - FreeImage.GetTagValue(tag); - - FreeImage.FindCloseMetadata(mData); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_SetTagKey() - { - dib = iManager.GetBitmap(ImageType.Metadata, ImageColorType.Type_01_Dither); - Assert.That(!dib.IsNull); - - FITAG tag; - FIMETADATA mData = FreeImage.FindFirstMetadata(FREE_IMAGE_MDMODEL.FIMD_EXIF_EXIF, dib, out tag); - Assert.AreNotEqual(0, mData); - Assert.AreNotEqual(0, tag); - - FreeImage.SetTagKey(tag, ""); - - FreeImage.FindCloseMetadata(mData); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_SetTagDescription() - { - dib = iManager.GetBitmap(ImageType.Metadata, ImageColorType.Type_01_Dither); - Assert.That(!dib.IsNull); - - FITAG tag; - FIMETADATA mData = FreeImage.FindFirstMetadata(FREE_IMAGE_MDMODEL.FIMD_EXIF_EXIF, dib, out tag); - Assert.AreNotEqual(0, mData); - Assert.AreNotEqual(0, tag); - - FreeImage.SetTagDescription(tag, ""); - - FreeImage.FindCloseMetadata(mData); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_SetTagID() - { - dib = iManager.GetBitmap(ImageType.Metadata, ImageColorType.Type_01_Dither); - Assert.That(!dib.IsNull); - - FITAG tag; - FIMETADATA mData = FreeImage.FindFirstMetadata(FREE_IMAGE_MDMODEL.FIMD_EXIF_EXIF, dib, out tag); - Assert.AreNotEqual(0, mData); - Assert.AreNotEqual(0, tag); - - FreeImage.SetTagID(tag, 44); - - FreeImage.FindCloseMetadata(mData); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_SetTagType() - { - dib = iManager.GetBitmap(ImageType.Metadata, ImageColorType.Type_01_Dither); - Assert.That(!dib.IsNull); - - FITAG tag; - FIMETADATA mData = FreeImage.FindFirstMetadata(FREE_IMAGE_MDMODEL.FIMD_EXIF_EXIF, dib, out tag); - Assert.AreNotEqual(0, mData); - Assert.AreNotEqual(0, tag); - - FreeImage.SetTagType(tag, FREE_IMAGE_MDTYPE.FIDT_ASCII); - - FreeImage.FindCloseMetadata(mData); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_SetTagCount() - { - dib = iManager.GetBitmap(ImageType.Metadata, ImageColorType.Type_01_Dither); - Assert.That(!dib.IsNull); - - FITAG tag; - FIMETADATA mData = FreeImage.FindFirstMetadata(FREE_IMAGE_MDMODEL.FIMD_EXIF_EXIF, dib, out tag); - Assert.AreNotEqual(0, mData); - Assert.AreNotEqual(0, tag); - - FreeImage.SetTagCount(tag, 3); - - FreeImage.FindCloseMetadata(mData); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_SetTagLength() - { - dib = iManager.GetBitmap(ImageType.Metadata, ImageColorType.Type_01_Dither); - Assert.That(!dib.IsNull); - - FITAG tag; - FIMETADATA mData = FreeImage.FindFirstMetadata(FREE_IMAGE_MDMODEL.FIMD_EXIF_EXIF, dib, out tag); - Assert.AreNotEqual(0, mData); - Assert.AreNotEqual(0, tag); - - FreeImage.SetTagLength(tag, 6); - - FreeImage.FindCloseMetadata(mData); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_SetTagValue() - { - dib = iManager.GetBitmap(ImageType.Metadata, ImageColorType.Type_01_Dither); - Assert.That(!dib.IsNull); - - FITAG tag; - FIMETADATA mData = FreeImage.FindFirstMetadata(FREE_IMAGE_MDMODEL.FIMD_EXIF_EXIF, dib, out tag); - Assert.AreNotEqual(0, mData); - Assert.AreNotEqual(0, tag); - - int length = (int)FreeImage.GetTagLength(tag); - FREE_IMAGE_MDTYPE type = FreeImage.GetTagType(tag); - int count = (int)FreeImage.GetTagCount(tag); - - byte[] buffer = new byte[length * count]; - - FreeImage.SetTagValue(tag, buffer); - - FreeImage.FindCloseMetadata(mData); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_GetMetadataCount() - { - dib = iManager.GetBitmap(ImageType.Metadata, ImageColorType.Type_01_Dither); - Assert.That(!dib.IsNull); - - Assert.AreNotEqual(0, FreeImage.GetMetadataCount(FREE_IMAGE_MDMODEL.FIMD_EXIF_EXIF, dib)); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_TagToString() - { - dib = iManager.GetBitmap(ImageType.Metadata, ImageColorType.Type_01_Dither); - Assert.That(!dib.IsNull); - - FITAG tag; - FIMETADATA mData = FreeImage.FindFirstMetadata(FREE_IMAGE_MDMODEL.FIMD_EXIF_EXIF, dib, out tag); - Assert.AreNotEqual(0, mData); - Assert.AreNotEqual(0, tag); - - Assert.IsNotEmpty(FreeImage.TagToString(FREE_IMAGE_MDMODEL.FIMD_EXIF_EXIF, tag, 0)); - - FreeImage.FindCloseMetadata(mData); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_RotateClassic() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_24); - Assert.That(!dib.IsNull); - - FIBITMAP temp = FreeImage.RotateClassic(dib, 45d); - Assert.AreNotEqual(0, temp); - - FreeImage.UnloadEx(ref temp); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_RotateEx() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_24); - Assert.That(!dib.IsNull); - - FIBITMAP temp = FreeImage.RotateEx(dib, 261d, 0d, 33d, 51d, 9d, true); - Assert.AreNotEqual(0, temp); - - FreeImage.UnloadEx(ref temp); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_FlipHorizontal() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_24); - Assert.That(!dib.IsNull); - - Assert.IsTrue(FreeImage.FlipHorizontal(dib)); - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_FlipVertical() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_24); - Assert.That(!dib.IsNull); - - Assert.IsTrue(FreeImage.FlipVertical(dib)); - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_JPEGTransform() - { - string filename = iManager.GetBitmapPath(ImageType.JPEG, ImageColorType.Type_24); - string filenameOut = filename + ".out.jpg"; - Assert.IsTrue(File.Exists(filename)); - - Assert.IsTrue(FreeImage.JPEGTransform(filename, filenameOut, FREE_IMAGE_JPEG_OPERATION.FIJPEG_OP_FLIP_V, false)); - Assert.IsTrue(File.Exists(filenameOut)); - - FIBITMAP temp = FreeImage.Load(FREE_IMAGE_FORMAT.FIF_JPEG, filenameOut, FREE_IMAGE_LOAD_FLAGS.JPEG_ACCURATE); - Assert.AreNotEqual(0, temp); - - File.Delete(filenameOut); - Assert.IsFalse(File.Exists(filenameOut)); - - FreeImage.UnloadEx(ref temp); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_Rescale() - { - dib = iManager.GetBitmap(ImageType.Odd, ImageColorType.Type_16_555); - Assert.That(!dib.IsNull); - - FIBITMAP temp = FreeImage.Rescale(dib, 100, 100, FREE_IMAGE_FILTER.FILTER_BICUBIC); - Assert.AreNotEqual(0, temp); - - FreeImage.UnloadEx(ref temp); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_MakeThumbnail() - { - dib = iManager.GetBitmap(ImageType.Odd, ImageColorType.Type_16_555); - Assert.That(!dib.IsNull); - - FIBITMAP temp = FreeImage.MakeThumbnail(dib, 50, false); - Assert.AreNotEqual(0, temp); - - FreeImage.UnloadEx(ref temp); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_AdjustCurve() - { - dib = iManager.GetBitmap(ImageType.Odd, ImageColorType.Type_24); - Assert.That(!dib.IsNull); - - byte[] lut = new byte[256]; - Assert.IsTrue(FreeImage.AdjustCurve(dib, lut, FREE_IMAGE_COLOR_CHANNEL.FICC_GREEN)); - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_AdjustGamma() - { - dib = iManager.GetBitmap(ImageType.Odd, ImageColorType.Type_24); - Assert.That(!dib.IsNull); - - Assert.IsTrue(FreeImage.AdjustGamma(dib, 1.3d)); - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_AdjustBrightness() - { - dib = iManager.GetBitmap(ImageType.Odd, ImageColorType.Type_24); - Assert.That(!dib.IsNull); - - Assert.IsTrue(FreeImage.AdjustBrightness(dib, 1.3d)); - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_AdjustContrast() - { - dib = iManager.GetBitmap(ImageType.Odd, ImageColorType.Type_24); - Assert.That(!dib.IsNull); - - Assert.IsTrue(FreeImage.AdjustContrast(dib, 1.3d)); - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_Invert() - { - dib = iManager.GetBitmap(ImageType.Odd, ImageColorType.Type_16_555); - Assert.That(!dib.IsNull); - - Assert.IsTrue(FreeImage.Invert(dib)); - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_GetHistogram() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_24); - Assert.That(!dib.IsNull); - - int[] histo = new int[256]; - Assert.IsTrue(FreeImage.GetHistogram(dib, histo, FREE_IMAGE_COLOR_CHANNEL.FICC_RED)); - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_GetChannel() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_24); - Assert.That(!dib.IsNull); - - FIBITMAP temp = FreeImage.GetChannel(dib, FREE_IMAGE_COLOR_CHANNEL.FICC_GREEN); - Assert.AreNotEqual(0, temp); - - FreeImage.UnloadEx(ref temp); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_SetChannel() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_32); - Assert.That(!dib.IsNull); - FIBITMAP dib8 = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_08_Greyscale_MinIsBlack); - Assert.AreNotEqual(0, dib8); - Assert.AreEqual(FreeImage.GetWidth(dib), FreeImage.GetWidth(dib8)); - Assert.AreEqual(FreeImage.GetHeight(dib), FreeImage.GetHeight(dib8)); - - Assert.IsTrue(FreeImage.SetChannel(dib, dib8, FREE_IMAGE_COLOR_CHANNEL.FICC_BLUE)); - - FreeImage.UnloadEx(ref dib8); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_GetComplexChannel() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_08); - Assert.That(!dib.IsNull); - - FIBITMAP temp = FreeImage.ConvertToType(dib, FREE_IMAGE_TYPE.FIT_COMPLEX, true); - Assert.AreNotEqual(0, temp); - - FIBITMAP temp2 = FreeImage.GetComplexChannel(temp, FREE_IMAGE_COLOR_CHANNEL.FICC_IMAG); - Assert.AreNotEqual(0, temp2); - - FreeImage.UnloadEx(ref temp); - FreeImage.UnloadEx(ref temp2); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_SetComplexChannel() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_08_Greyscale_Unordered); - Assert.That(!dib.IsNull); - - FIBITMAP temp = FreeImage.ConvertToType(dib, FREE_IMAGE_TYPE.FIT_COMPLEX, true); - Assert.AreNotEqual(0, temp); - - FIBITMAP temp2 = FreeImage.GetComplexChannel(temp, FREE_IMAGE_COLOR_CHANNEL.FICC_IMAG); - Assert.AreNotEqual(0, temp2); - - Assert.IsTrue(FreeImage.SetComplexChannel(temp, temp2, FREE_IMAGE_COLOR_CHANNEL.FICC_IMAG)); - - FreeImage.UnloadEx(ref temp); - FreeImage.UnloadEx(ref temp2); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_Copy() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_08_Greyscale_MinIsBlack); - Assert.That(!dib.IsNull); - - FIBITMAP temp = FreeImage.Copy(dib, 5, 9, 44, 2); - Assert.AreNotEqual(0, temp); - - FreeImage.UnloadEx(ref temp); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_Paste() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_08_Greyscale_MinIsBlack); - Assert.That(!dib.IsNull); - - FIBITMAP temp = FreeImage.Allocate(3, 3, 8, 0, 0, 0); - Assert.IsTrue(FreeImage.Paste(dib, temp, 31, 3, 256)); - - FreeImage.UnloadEx(ref temp); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_Composite() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_08_Greyscale_MinIsBlack); - Assert.That(!dib.IsNull); - RGBQUAD rgbq = new RGBQUAD(); - - FIBITMAP temp = FreeImage.Composite(dib, false, ref rgbq, new FIBITMAP()); - Assert.AreNotEqual(0, temp); - - FreeImage.UnloadEx(ref temp); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_JPEGCrop() - { - string filename = iManager.GetBitmapPath(ImageType.JPEG, ImageColorType.Type_01_Dither); - Assert.IsTrue(File.Exists(filename)); - string filenameOut = filename + ".out.jpg"; - - Assert.IsTrue(FreeImage.JPEGCrop(filename, filenameOut, 3, 2, 1, 5)); - Assert.IsTrue(File.Exists(filenameOut)); - - FIBITMAP temp = FreeImage.Load(FREE_IMAGE_FORMAT.FIF_JPEG, filenameOut, FREE_IMAGE_LOAD_FLAGS.JPEG_ACCURATE); - Assert.AreNotEqual(0, temp); - - File.Delete(filenameOut); - Assert.IsFalse(File.Exists(filenameOut)); - - FreeImage.UnloadEx(ref temp); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_PreMultiplyWithAlpha() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_32); - Assert.IsFalse(dib.IsNull); - - Assert.IsTrue(FreeImage.PreMultiplyWithAlpha(dib)); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_MultigridPoissonSolver() - { - dib = FreeImage.AllocateT(FREE_IMAGE_TYPE.FIT_FLOAT, 10, 10, 32, 0, 0, 0); - Assert.IsFalse(dib.IsNull); - - FIBITMAP dib2 = FreeImage.MultigridPoissonSolver(dib, 2); - - FreeImage.UnloadEx(ref dib); - FreeImage.UnloadEx(ref dib2); - } - - [Test] - public void FreeImage_GetAdjustColorsLookupTable() - { - dib = iManager.GetBitmap(ImageType.Odd, ImageColorType.Type_24); - Assert.IsFalse(dib.IsNull); - - byte[] lut = new byte[256]; - FreeImage.GetAdjustColorsLookupTable(lut, 55d, 0d, 2.1d, false); - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_AdjustColors() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_24); - Assert.IsFalse(dib.IsNull); - - Assert.IsTrue(FreeImage.AdjustColors(dib, -4d, 22d, 1.1d, false)); - - FreeImage.UnloadEx(ref dib); - } - - [Ignore] - public void FreeImage_ApplyColorMapping() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_32); - FreeImage_ApplyColorMapping2(dib); - - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_32); - FreeImage_ApplyColorMapping2(dib); - - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_32); - FreeImage_ApplyColorMapping2(dib); - - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_32); - FreeImage_ApplyColorMapping2(dib); - - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_32); - FreeImage_ApplyColorMapping2(dib); - - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_32); - FreeImage_ApplyColorMapping2(dib); - - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_32); - FreeImage_ApplyColorMapping2(dib); - - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_32); - FreeImage_ApplyColorMapping2(dib); - - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_32); - FreeImage_ApplyColorMapping2(dib); - } - - private void FreeImage_ApplyColorMapping2(FIBITMAP dib) - { - Assert.IsFalse(dib.IsNull); - - Scanline rgbqa = new Scanline(dib, 0); - - RGBQUAD[] src = new RGBQUAD[1]; - RGBQUAD[] dst = new RGBQUAD[1]; - src[0] = rgbqa[0]; - dst[0].Color = src[0].Color == Color.White ? Color.Thistle : Color.White; - - uint count = FreeImage.ApplyColorMapping(dib, src, dst, 1, true, false); // Memory - Assert.That(count > 0); - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_SwapColors() - { - dib = iManager.GetBitmap(ImageType.Odd, ImageColorType.Type_08); - Assert.IsFalse(dib.IsNull); - - RGBQUAD src = new RGBQUAD(Color.FromArgb(93, 119, 170)); - RGBQUAD dst = new RGBQUAD(Color.FromArgb(90, 130, 148)); - - uint count = FreeImage.SwapColors(dib, ref src, ref dst, true); - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_ApplyPaletteIndexMapping() - { - // alle farbtiefen - - dib = iManager.GetBitmap(ImageType.Odd, ImageColorType.Type_04); - Assert.IsFalse(dib.IsNull); - - byte[] src = { 0, 3, 1 }; - byte[] dst = { 3, 1, 0 }; - - uint count = FreeImage.ApplyPaletteIndexMapping(dib, src, dst, 3, false); - Assert.That(count > 0); - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_SwapPaletteIndices() - { - dib = iManager.GetBitmap(ImageType.Odd, ImageColorType.Type_04); - Assert.IsFalse(dib.IsNull); - - byte src = 0; - byte dst = 3; - - uint count = FreeImage.SwapPaletteIndices(dib, ref src, ref dst); - Assert.That(count > 0); - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_SetTransparentIndex() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_04); - Assert.IsFalse(dib.IsNull); - - FreeImage.SetTransparentIndex(dib, 0); - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_GetTransparentIndex() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_04); - Assert.IsFalse(dib.IsNull); - - int i = FreeImage.GetTransparentIndex(dib); - - FreeImage.UnloadEx(ref dib); - } - } - - [TestFixture] - public class ImportedStructsTest - { - ImageManager iManager = new ImageManager(); - FIBITMAP dib = new FIBITMAP(); - string freeImageCallback = null; - - [TestFixtureSetUp] - public void Init() - { - FreeImageEngine.Message += new OutputMessageFunction(FreeImage_Message); - } - - [TestFixtureTearDown] - public void DeInit() - { - FreeImageEngine.Message -= new OutputMessageFunction(FreeImage_Message); - } - - [SetUp] - public void InitEachTime() - { - } - - [TearDown] - public void DeInitEachTime() - { - } - - void FreeImage_Message(FREE_IMAGE_FORMAT fif, string message) - { - freeImageCallback = message; - } - - public bool EqualColors(Color color1, Color color2) - { - if (color1.A != color2.A) return false; - if (color1.R != color2.R) return false; - if (color1.G != color2.G) return false; - if (color1.B != color2.B) return false; - return true; - } - - [Test] - public void RGBQUAD() - { - RGBQUAD rgbq = new RGBQUAD(); - Assert.AreEqual(0, rgbq.rgbBlue); - Assert.AreEqual(0, rgbq.rgbGreen); - Assert.AreEqual(0, rgbq.rgbRed); - Assert.AreEqual(0, rgbq.rgbReserved); - - rgbq = new RGBQUAD(Color.Chartreuse); - Assert.That(EqualColors(Color.Chartreuse, rgbq.Color)); - - rgbq = new RGBQUAD(Color.FromArgb(133, 83, 95, 173)); - Assert.AreEqual(173, rgbq.rgbBlue); - Assert.AreEqual(95, rgbq.rgbGreen); - Assert.AreEqual(83, rgbq.rgbRed); - Assert.AreEqual(133, rgbq.rgbReserved); - - rgbq.Color = Color.Crimson; - Assert.That(EqualColors(Color.Crimson, rgbq.Color)); - - rgbq.Color = Color.MidnightBlue; - Assert.That(EqualColors(Color.MidnightBlue, rgbq.Color)); - - rgbq.Color = Color.White; - Assert.AreEqual(255, rgbq.rgbBlue); - Assert.AreEqual(255, rgbq.rgbGreen); - Assert.AreEqual(255, rgbq.rgbRed); - Assert.AreEqual(255, rgbq.rgbReserved); - - rgbq.Color = Color.Black; - Assert.AreEqual(0, rgbq.rgbBlue); - Assert.AreEqual(0, rgbq.rgbGreen); - Assert.AreEqual(0, rgbq.rgbRed); - Assert.AreEqual(255, rgbq.rgbReserved); - - rgbq = Color.DarkGoldenrod; - Color color = rgbq; - Assert.That(EqualColors(Color.DarkGoldenrod, color)); - } - - [Test] - public void RGBTRIPLE() - { - RGBTRIPLE rgbt = new RGBTRIPLE(); - Assert.AreEqual(0, rgbt.rgbtBlue); - Assert.AreEqual(0, rgbt.rgbtGreen); - Assert.AreEqual(0, rgbt.rgbtRed); - - rgbt = new RGBTRIPLE(Color.Chartreuse); - Assert.That(EqualColors(Color.Chartreuse, rgbt.Color)); - - rgbt = new RGBTRIPLE(Color.FromArgb(133, 83, 95, 173)); - Assert.AreEqual(173, rgbt.rgbtBlue); - Assert.AreEqual(95, rgbt.rgbtGreen); - Assert.AreEqual(83, rgbt.rgbtRed); - - rgbt.Color = Color.Crimson; - Assert.That(EqualColors(Color.Crimson, rgbt.Color)); - - rgbt.Color = Color.MidnightBlue; - Assert.That(EqualColors(Color.MidnightBlue, rgbt.Color)); - - rgbt.Color = Color.White; - Assert.AreEqual(255, rgbt.rgbtBlue); - Assert.AreEqual(255, rgbt.rgbtGreen); - Assert.AreEqual(255, rgbt.rgbtRed); - - rgbt.Color = Color.Black; - Assert.AreEqual(0, rgbt.rgbtBlue); - Assert.AreEqual(0, rgbt.rgbtGreen); - Assert.AreEqual(0, rgbt.rgbtRed); - - rgbt = Color.DarkGoldenrod; - Color color = rgbt; - Assert.That(EqualColors(Color.DarkGoldenrod, color)); - } - - [Test] - public void FIRGB16() - { - FIRGB16 rgb = new FIRGB16(); - Assert.AreEqual(0 * 256, rgb.blue); - Assert.AreEqual(0 * 256, rgb.green); - Assert.AreEqual(0 * 256, rgb.red); - - rgb = new FIRGB16(Color.Chartreuse); - Assert.That(EqualColors(Color.Chartreuse, rgb.Color)); - - rgb = new FIRGB16(Color.FromArgb(133, 83, 95, 173)); - Assert.AreEqual(173 * 256, rgb.blue); - Assert.AreEqual(95 * 256, rgb.green); - Assert.AreEqual(83 * 256, rgb.red); - - rgb.Color = Color.Crimson; - Assert.That(EqualColors(Color.Crimson, rgb.Color)); - - rgb.Color = Color.MidnightBlue; - Assert.That(EqualColors(Color.MidnightBlue, rgb.Color)); - - rgb.Color = Color.White; - Assert.AreEqual(255 * 256, rgb.blue); - Assert.AreEqual(255 * 256, rgb.green); - Assert.AreEqual(255 * 256, rgb.red); - - rgb.Color = Color.Black; - Assert.AreEqual(0 * 256, rgb.blue); - Assert.AreEqual(0 * 256, rgb.green); - Assert.AreEqual(0 * 256, rgb.red); - - rgb = Color.DarkGoldenrod; - Color color = rgb; - Assert.That(EqualColors(Color.DarkGoldenrod, color)); - } - - [Test] - public void FIRGBA16() - { - FIRGBA16 rgb = new FIRGBA16(); - Assert.AreEqual(0 * 256, rgb.blue); - Assert.AreEqual(0 * 256, rgb.green); - Assert.AreEqual(0 * 256, rgb.red); - Assert.AreEqual(0 * 256, rgb.alpha); - - rgb = new FIRGBA16(Color.Chartreuse); - Assert.That(EqualColors(Color.Chartreuse, rgb.Color)); - - rgb = new FIRGBA16(Color.FromArgb(133, 83, 95, 173)); - Assert.AreEqual(173 * 256, rgb.blue); - Assert.AreEqual(95 * 256, rgb.green); - Assert.AreEqual(83 * 256, rgb.red); - Assert.AreEqual(133 * 256, rgb.alpha); - - rgb.Color = Color.Crimson; - Assert.That(EqualColors(Color.Crimson, rgb.Color)); - - rgb.Color = Color.MidnightBlue; - Assert.That(EqualColors(Color.MidnightBlue, rgb.Color)); - - rgb.Color = Color.White; - Assert.AreEqual(255 * 256, rgb.blue); - Assert.AreEqual(255 * 256, rgb.green); - Assert.AreEqual(255 * 256, rgb.red); - Assert.AreEqual(255 * 256, rgb.alpha); - - rgb.Color = Color.Black; - Assert.AreEqual(0 * 256, rgb.blue); - Assert.AreEqual(0 * 256, rgb.green); - Assert.AreEqual(0 * 256, rgb.red); - Assert.AreEqual(255 * 256, rgb.alpha); - - rgb = Color.DarkGoldenrod; - Color color = rgb; - Assert.That(EqualColors(Color.DarkGoldenrod, color)); - } - - [Test] - public void FIRGBF() - { - FIRGBF rgb = new FIRGBF(); - Assert.AreEqual(0 / 255f, rgb.blue); - Assert.AreEqual(0 / 255f, rgb.green); - Assert.AreEqual(0 / 255f, rgb.red); - - rgb = new FIRGBF(Color.Chartreuse); - Assert.That(EqualColors(Color.Chartreuse, rgb.Color)); - - rgb = new FIRGBF(Color.FromArgb(133, 83, 95, 173)); - Assert.AreEqual(173 / 255f, rgb.blue); - Assert.AreEqual(95 / 255f, rgb.green); - Assert.AreEqual(83 / 255f, rgb.red); - - rgb.Color = Color.Crimson; - Assert.That(EqualColors(Color.Crimson, rgb.Color)); - - rgb.Color = Color.MidnightBlue; - Assert.That(EqualColors(Color.MidnightBlue, rgb.Color)); - - rgb.Color = Color.White; - Assert.AreEqual(255 / 255f, rgb.blue); - Assert.AreEqual(255 / 255f, rgb.green); - Assert.AreEqual(255 / 255f, rgb.red); - - rgb.Color = Color.Black; - Assert.AreEqual(0 / 255f, rgb.blue); - Assert.AreEqual(0 / 255f, rgb.green); - Assert.AreEqual(0 / 255f, rgb.red); - - rgb = Color.DarkGoldenrod; - Color color = rgb; - Assert.That(EqualColors(Color.DarkGoldenrod, color)); - } - - [Test] - public void FIRGBAF() - { - FIRGBAF rgb = new FIRGBAF(); - Assert.AreEqual(0 / 255f, rgb.blue); - Assert.AreEqual(0 / 255f, rgb.green); - Assert.AreEqual(0 / 255f, rgb.red); - Assert.AreEqual(0 / 255f, rgb.alpha); - - rgb = new FIRGBAF(Color.Chartreuse); - Assert.That(EqualColors(Color.Chartreuse, rgb.Color)); - - rgb = new FIRGBAF(Color.FromArgb(133, 83, 95, 173)); - Assert.AreEqual(173 / 255f, rgb.blue); - Assert.AreEqual(95 / 255f, rgb.green); - Assert.AreEqual(83 / 255f, rgb.red); - Assert.AreEqual(133 / 255f, rgb.alpha); - - rgb.Color = Color.Crimson; - Assert.That(EqualColors(Color.Crimson, rgb.Color)); - - rgb.Color = Color.MidnightBlue; - Assert.That(EqualColors(Color.MidnightBlue, rgb.Color)); - - rgb.Color = Color.White; - Assert.AreEqual(255 / 255f, rgb.blue); - Assert.AreEqual(255 / 255f, rgb.green); - Assert.AreEqual(255 / 255f, rgb.red); - Assert.AreEqual(255 / 255f, rgb.alpha); - - rgb.Color = Color.Black; - Assert.AreEqual(0 / 255f, rgb.blue); - Assert.AreEqual(0 / 255f, rgb.green); - Assert.AreEqual(0 / 255f, rgb.red); - Assert.AreEqual(255 / 255f, rgb.alpha); - - rgb = Color.DarkGoldenrod; - Color color = rgb; - Assert.That(EqualColors(Color.DarkGoldenrod, color)); - } - - [Ignore] - public void FICOMPLEX() - { - } - - [Test] - public void FIBITMAP() - { - FIBITMAP var = new FIBITMAP(); - Assert.IsTrue(var.IsNull); - } - - [Test] - public void fi_handle() - { - fi_handle var = new fi_handle(); - Assert.IsTrue(var.IsNull); - - string test = "hello word!"; - using (var = new fi_handle(test)) - { - Assert.IsFalse(var.IsNull); - - object obj = var.GetObject(); - Assert.That(obj is string); - Assert.AreSame(obj, test); - } - } - - [Test] - public void FIICCPROFILE() - { - Random rand = new Random(DateTime.Now.Millisecond); - FIICCPROFILE var = new FIICCPROFILE(); - Assert.AreEqual(0, var.Data.Length); - Assert.AreEqual(IntPtr.Zero, var.DataPointer); - Assert.AreEqual(0, var.Size); - - dib = iManager.GetBitmap(ImageType.Odd, ImageColorType.Type_24); - Assert.That(!dib.IsNull); - - byte[] data = new byte[512]; - rand.NextBytes(data); - - var = FreeImage.GetICCProfileEx(dib); - Assert.AreEqual(0, var.Size); - - var = new FIICCPROFILE(dib, data, 256); - Assert.AreEqual(256, var.Data.Length); - Assert.AreNotEqual(IntPtr.Zero, var.DataPointer); - Assert.AreEqual(256, var.Size); - byte[] dataComp = var.Data; - for (int i = 0; i < data.Length && i < dataComp.Length; i++) - if (data[i] != dataComp[i]) - Assert.Fail(); - - FreeImage.DestroyICCProfile(dib); - var = FreeImage.GetICCProfileEx(dib); - Assert.AreEqual(0, var.Size); - - var = new FIICCPROFILE(dib, data); - Assert.AreEqual(512, var.Data.Length); - Assert.AreNotEqual(IntPtr.Zero, var.DataPointer); - Assert.AreEqual(512, var.Size); - dataComp = var.Data; - for (int i = 0; i < data.Length && i < dataComp.Length; i++) - if (data[i] != dataComp[i]) - Assert.Fail(); - - var = FreeImage.GetICCProfileEx(dib); - Assert.AreEqual(512, var.Data.Length); - Assert.AreNotEqual(IntPtr.Zero, var.DataPointer); - Assert.AreEqual(512, var.Size); - - FreeImage.DestroyICCProfile(dib); - var = FreeImage.GetICCProfileEx(dib); - Assert.AreEqual(0, var.Size); - - FreeImage.UnloadEx(ref dib); - } - } - - [TestFixture] - public class WrapperStructsTest - { - ImageManager iManager = new ImageManager(); - FIBITMAP dib = new FIBITMAP(); - string freeImageCallback = null; - - [TestFixtureSetUp] - public void Init() - { - FreeImageEngine.Message += new OutputMessageFunction(FreeImage_Message); - } - - [TestFixtureTearDown] - public void DeInit() - { - FreeImageEngine.Message -= new OutputMessageFunction(FreeImage_Message); - } - - [SetUp] - public void InitEachTime() - { - } - - [TearDown] - public void DeInitEachTime() - { - } - - void FreeImage_Message(FREE_IMAGE_FORMAT fif, string message) - { - freeImageCallback = message; - } - - public bool EqualColors(Color color1, Color color2) - { - if (color1.A != color2.A) return false; - if (color1.R != color2.R) return false; - if (color1.G != color2.G) return false; - if (color1.B != color2.B) return false; - return true; - } - - [Test] - public void FIRational() - { - FIRational rational1 = new FIRational(); - FIRational rational2 = new FIRational(); - FIRational rational3 = new FIRational(); - - // - // Constructors - // - - Assert.That(rational1.Numerator == 0); - Assert.That(rational1.Denominator == 0); - - rational1 = new FIRational(412, 33); - Assert.That(rational1.Numerator == 412); - Assert.That(rational1.Denominator == 33); - - rational2 = new FIRational(rational1); - Assert.That(rational2.Numerator == 412); - Assert.That(rational2.Denominator == 33); - - rational3 = new FIRational(5.75m); - Assert.That(rational3.Numerator == 23); - Assert.That(rational3.Denominator == 4); - - // - // == != - // - - rational1 = new FIRational(421, 51); - rational2 = rational1; - Assert.That(rational1 == rational2); - Assert.That(!(rational1 != rational2)); - - rational2 = new FIRational(1, 7); - Assert.That(rational1 != rational2); - Assert.That(!(rational1 == rational2)); - - // - // > >= < <= - // - - rational1 = new FIRational(51, 4); - rational2 = new FIRational(27, 9); - Assert.That(rational1 != rational2); - Assert.That(rational1 > rational2); - Assert.That(rational1 >= rational2); - - rational1 = new FIRational(-412, 4); - Assert.That(rational1 != rational2); - Assert.That(rational1 < rational2); - Assert.That(rational1 <= rational2); - - // - // + / - - // - - rational1 = new FIRational(41, 3); - rational2 = new FIRational(612, 412); - rational3 = rational1 - rational2; - Assert.That((rational3 + rational2) == rational1); - - rational1 = new FIRational(-7852, 63); - rational2 = new FIRational(666111, -7654); - rational3 = rational1 - rational2; - Assert.That((rational3 + rational2) == rational1); - - rational1 = new FIRational(-513, 88); - rational2 = new FIRational(413, 5); - rational3 = rational1 - rational2; - Assert.That((rational3 + rational2) == rational1); - - rational1 = new FIRational(-513, 88); - rational2 = new FIRational(413, 5); - rational3 = rational1 - rational2; - Assert.That((rational3 + rational2) == rational1); - - rational1 = new FIRational(7531, 23144); - rational2 = new FIRational(-412, 78777); - rational3 = rational1 - rational2; - Assert.That((rational3 + rational2) == rational1); - - rational1 = new FIRational(513, -42123); - rational2 = new FIRational(-42, 77); - rational3 = rational1 - rational2; - Assert.That((rational3 + rational2) == rational1); - - rational1 = new FIRational(44, 11); - rational1 = -rational1; - Assert.That(rational1.Numerator == -4 && rational1.Denominator == 1); - - // - // % - // - - rational1 = new FIRational(23, 8); - rational2 = new FIRational(77, 777); - Assert.That((rational1 % rational2) == 0); - - rational2 = -rational2; - Assert.That((rational1 % rational2) == 0); - - rational2 = new FIRational(7, 4); - rational3 = new FIRational(9, 8); - Assert.That((rational1 % rational2) == rational3); - - rational2 = -rational2; - Assert.That((rational1 % rational2) == rational3); - - // - // ~ - // - - rational1 = new FIRational(41, 77); - rational1 = ~rational1; - Assert.That(rational1.Numerator == 77 && rational1.Denominator == 41); - - // - // - - // - - rational1 = new FIRational(52, 4); - rational1 = -rational1; - Assert.That(rational1 < 0); - - // - // ++ -- - // - - rational1 = new FIRational(5, 3); - rational1++; - rational2 = new FIRational(8, 3); - Assert.That(rational1 == rational2); - - rational1 = new FIRational(41, -43); - rational1++; - Assert.That(rational1 > 0.0f); - - rational1--; - Assert.That(rational1 == new FIRational(41, -43)); - - rational1 = new FIRational(8134, 312); - Assert.That(rational1 != 26); - - // - // Direct assigns - // - - rational1 = (FIRational)0.75m; - Assert.That(rational1.Numerator == 3 && rational1.Denominator == 4); - rational1 = (FIRational)0.33; - Assert.That(rational1.Numerator == 33 && rational1.Denominator == 100); - rational1 = (FIRational)62.975m; - Assert.That(((decimal)rational1.Numerator / (decimal)rational1.Denominator) == 62.975m); - rational1 = (FIRational)(-73.0975m); - Assert.That(((decimal)rational1.Numerator / (decimal)rational1.Denominator) == -73.0975m); - rational1 = (FIRational)(7m / 9m); - Assert.That(rational1.Numerator == 7 && rational1.Denominator == 9); - rational1 = (FIRational)(-15m / 9m); - Assert.That(rational1.Numerator == -5 && rational1.Denominator == 3); - rational1 = (FIRational)(0.7777m); - Assert.That(rational1.Denominator != 9); - - // - // Properties - // - - rational1 = new FIRational(515, 5); - Assert.That(rational1.IsInteger); - - rational1 = new FIRational(876, 77); - Assert.That(rational1.Truncate() == (876 / 77)); - - // - // Special cases - // - - rational1 = new FIRational(0, 10000); - Assert.That(rational1 == 0m); - - rational1 = new FIRational(10000, 0); - Assert.That(rational1 == 0f); - - rational1 = new FIRational(0, 0); - Assert.That(rational1 == 0d); - - rational1 = new FIRational(-1, 0); - Assert.That(rational1 == 0); - - rational1 = new FIRational(0, -1); - Assert.That(rational1 == 0); - } - - [Ignore] - public void StreamWrapper() - { - string url = @"http://freeimage.sourceforge.net/images/logo.jpg"; - - // - // Non blocking - // - - HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url); - Assert.IsNotNull(req); - - req.Timeout = 1000; - HttpWebResponse resp; - try - { - resp = (HttpWebResponse)req.GetResponse(); - } - catch - { - return; - } - Assert.IsNotNull(resp); - - Stream stream = resp.GetResponseStream(); - Assert.IsNotNull(stream); - - StreamWrapper wrapper = new StreamWrapper(stream, false); - Assert.IsNotNull(wrapper); - Assert.IsTrue(wrapper.CanRead && wrapper.CanSeek && !wrapper.CanWrite); - - byte[] buffer = new byte[1024 * 100]; - int read; - int count = 0; - - do - { - read = wrapper.Read(buffer, count, buffer.Length - count); - count += read; - } while (read != 0); - - Assert.AreEqual(7972, count); - Assert.AreEqual(7972, wrapper.Length); - - wrapper.Position = 0; - Assert.AreEqual(0, wrapper.Position); - - byte[] test = new byte[buffer.Length]; - int countTest = 0; - - do - { - read = wrapper.Read(test, countTest, test.Length - countTest); - countTest += read; - } while (read != 0); - - Assert.AreEqual(count, countTest); - - for (int i = 0; i < countTest; i++) - if (buffer[i] != test[i]) - Assert.Fail(); - - resp.Close(); - wrapper.Dispose(); - stream.Dispose(); - - // - // Blocking - // - - req = (HttpWebRequest)HttpWebRequest.Create(url); - Assert.IsNotNull(req); - - resp = (HttpWebResponse)req.GetResponse(); - Assert.IsNotNull(resp); - - stream = resp.GetResponseStream(); - Assert.IsNotNull(stream); - - wrapper = new StreamWrapper(stream, true); - Assert.IsNotNull(wrapper); - Assert.IsTrue(wrapper.CanRead && wrapper.CanSeek && !wrapper.CanWrite); - - buffer = new byte[1024 * 100]; - count = 0; - - count = wrapper.Read(buffer, 0, buffer.Length); - Assert.AreEqual(7972, count); - - resp.Close(); - stream.Dispose(); - wrapper.Dispose(); - - // - // Position & Read byte - // - - buffer = new byte[] { 0x00, 0x01, 0x02, 0xFF, 0xFE, 0xFD }; - stream = new MemoryStream(buffer); - wrapper = new StreamWrapper(stream, false); - - Assert.That(0x00 == wrapper.ReadByte()); - Assert.That(0x01 == wrapper.ReadByte()); - Assert.That(0x02 == wrapper.ReadByte()); - Assert.That(0xFF == wrapper.ReadByte()); - Assert.That(0xFE == wrapper.ReadByte()); - Assert.That(0xFD == wrapper.ReadByte()); - Assert.That(-1 == wrapper.ReadByte()); - - Assert.That(wrapper.Length == buffer.Length); - - wrapper.Seek(0, SeekOrigin.Begin); - Assert.That(0x00 == wrapper.ReadByte()); - wrapper.Seek(3, SeekOrigin.Begin); - Assert.That(0xFF == wrapper.ReadByte()); - wrapper.Seek(0, SeekOrigin.End); - Assert.That(-1 == wrapper.ReadByte()); - wrapper.Seek(-2, SeekOrigin.End); - Assert.That(0xFE == wrapper.ReadByte()); - wrapper.Seek(0, SeekOrigin.Begin); - Assert.That(0x00 == wrapper.ReadByte()); - wrapper.Seek(2, SeekOrigin.Current); - Assert.That(0xFF == wrapper.ReadByte()); - wrapper.Seek(1, SeekOrigin.Current); - Assert.That(0xFD == wrapper.ReadByte()); - Assert.That(wrapper.Position != 0); - wrapper.Reset(); - Assert.That(wrapper.Position == 0); - - wrapper.Dispose(); - stream.Position = 0; - wrapper = new StreamWrapper(stream, false); - - wrapper.Seek(10, SeekOrigin.Begin); - Assert.That(wrapper.Position == buffer.Length); - - wrapper.Dispose(); - stream.Dispose(); - } - - [Ignore] - public void LocalPlugin() - { - } - - [Test] - public void FreeImageStreamIO() - { - Random rand = new Random(); - byte[] bBuffer = new byte[256]; - IntPtr buffer = Marshal.AllocHGlobal(256); - - MemoryStream stream = new MemoryStream(); - Assert.IsNotNull(stream); - using (fi_handle handle = new fi_handle(stream)) - { - - FreeImageIO io = FreeImageAPI.IO.FreeImageStreamIO.io; - Assert.IsNotNull(io.readProc); - Assert.IsNotNull(io.writeProc); - Assert.IsNotNull(io.seekProc); - Assert.IsNotNull(io.tellProc); - - // - // Procs - // - - rand.NextBytes(bBuffer); - - stream.Write(bBuffer, 0, bBuffer.Length); - Assert.That(io.tellProc(handle) == stream.Position); - Assert.That(io.seekProc(handle, 0, SeekOrigin.Begin) == 0); - Assert.That(io.tellProc(handle) == 0); - Assert.That(io.tellProc(handle) == stream.Position); - - // Read one block - Assert.That(io.readProc(buffer, (uint)bBuffer.Length, 1, handle) == 1); - for (int i = 0; i < bBuffer.Length; i++) - Assert.That(Marshal.ReadByte(buffer, i) == bBuffer[i]); - - Assert.That(io.tellProc(handle) == stream.Position); - Assert.That(io.seekProc(handle, 0, SeekOrigin.Begin) == 0); - Assert.That(io.tellProc(handle) == stream.Position); - - // Read 1 byte block - Assert.That(io.readProc(buffer, 1, (uint)bBuffer.Length, handle) == bBuffer.Length); - for (int i = 0; i < bBuffer.Length; i++) - Assert.That(Marshal.ReadByte(buffer, i) == bBuffer[i]); - - Assert.That(io.tellProc(handle) == stream.Position); - Assert.That(io.seekProc(handle, 0, SeekOrigin.Begin) == 0); - Assert.That(io.tellProc(handle) == stream.Position); - - rand.NextBytes(bBuffer); - for (int i = 0; i < bBuffer.Length; i++) - Marshal.WriteByte(buffer, i, bBuffer[i]); - - // Write one block - - Assert.That(io.writeProc(buffer, (uint)bBuffer.Length, 1, handle) == 1); - for (int i = 0; i < bBuffer.Length; i++) - Assert.That(Marshal.ReadByte(buffer, i) == bBuffer[i]); - Assert.That(io.tellProc(handle) == stream.Position); - - Assert.That(io.seekProc(handle, 0, SeekOrigin.Begin) == 0); - Assert.That(io.tellProc(handle) == 0); - - // write 1 byte block - - Assert.That(io.writeProc(buffer, 1, (uint)bBuffer.Length, handle) == bBuffer.Length); - for (int i = 0; i < bBuffer.Length; i++) - Assert.That(Marshal.ReadByte(buffer, i) == bBuffer[i]); - Assert.That(io.tellProc(handle) == stream.Position); - - // Seek and tell - - Assert.That(io.seekProc(handle, 0, SeekOrigin.Begin) == 0); - Assert.That(io.tellProc(handle) == 0); - - Assert.That(io.seekProc(handle, 127, SeekOrigin.Current) == 0); - Assert.That(io.tellProc(handle) == 127); - - Assert.That(io.seekProc(handle, 0, SeekOrigin.End) == 0); - Assert.That(io.tellProc(handle) == 256); - - Marshal.FreeHGlobal(buffer); - stream.Dispose(); - } - } - - [Test] - public void MetadataTag() - { - FITAG tag; - MetadataTag metaTag; - - Random rand = new Random(); - dib = iManager.GetBitmap(ImageType.Metadata, ImageColorType.Type_01_Dither); - Assert.IsFalse(dib.IsNull); - - Assert.That(FreeImage.GetMetadataCount(FREE_IMAGE_MDMODEL.FIMD_EXIF_MAIN, dib) > 0); - - FIMETADATA mData = FreeImage.FindFirstMetadata(FREE_IMAGE_MDMODEL.FIMD_EXIF_MAIN, dib, out tag); - Assert.IsFalse(tag.IsNull); - Assert.IsFalse(mData.IsNull); - - // - // Constructors - // - - metaTag = new MetadataTag(tag, dib); - Assert.That(metaTag.Model == FREE_IMAGE_MDMODEL.FIMD_EXIF_MAIN); - - metaTag = new MetadataTag(tag, FREE_IMAGE_MDMODEL.FIMD_EXIF_MAIN); - Assert.That(metaTag.Model == FREE_IMAGE_MDMODEL.FIMD_EXIF_MAIN); - - // - // Properties - // - - metaTag.ID = ushort.MinValue; - Assert.That(metaTag.ID == ushort.MinValue); - - metaTag.ID = ushort.MaxValue; - Assert.That(metaTag.ID == ushort.MaxValue); - - metaTag.ID = ushort.MaxValue / 2; - Assert.That(metaTag.ID == ushort.MaxValue / 2); - - metaTag.Description = ""; - Assert.That(metaTag.Description == ""); - - metaTag.Description = "A"; - Assert.That(metaTag.Description == "A"); - - metaTag.Description = "ABCDEFG"; - Assert.That(metaTag.Description == "ABCDEFG"); - - metaTag.Key = ""; - Assert.That(metaTag.Key == ""); - - metaTag.Key = "A"; - Assert.That(metaTag.Key == "A"); - - metaTag.Key = "ABCDEFG"; - Assert.That(metaTag.Key == "ABCDEFG"); - - // - // SetValue - // - - try - { - metaTag.SetValue(null, FREE_IMAGE_MDTYPE.FIDT_ASCII); - Assert.Fail(); - } - catch - { - } - - // - // FREE_IMAGE_MDTYPE.FIDT_ASCII - // - - string testString = ""; - - Assert.IsTrue(metaTag.SetValue(testString, FREE_IMAGE_MDTYPE.FIDT_ASCII)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((string)metaTag.Value).Length == 0); - - testString = "X"; - - Assert.IsTrue(metaTag.SetValue(testString, FREE_IMAGE_MDTYPE.FIDT_ASCII)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((string)metaTag.Value).Length == testString.Length); - Assert.That(((string)metaTag.Value) == testString); - - testString = "TEST-STRING"; - - Assert.IsTrue(metaTag.SetValue(testString, FREE_IMAGE_MDTYPE.FIDT_ASCII)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((string)metaTag.Value).Length == testString.Length); - Assert.That(((string)metaTag.Value) == testString); - - // - // FREE_IMAGE_MDTYPE.FIDT_BYTE - // - - byte testByte; - byte[] testByteArray; - - Assert.IsTrue(metaTag.SetValue(byte.MinValue, FREE_IMAGE_MDTYPE.FIDT_BYTE)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((byte[])metaTag.Value).Length == 1); - Assert.That(((byte[])metaTag.Value)[0] == byte.MinValue); - - Assert.IsTrue(metaTag.SetValue(byte.MaxValue, FREE_IMAGE_MDTYPE.FIDT_BYTE)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((byte[])metaTag.Value).Length == 1); - Assert.That(((byte[])metaTag.Value)[0] == byte.MaxValue); - - for (int i = 0; i < 10; i++) - { - testByte = (byte)rand.Next(byte.MinValue, byte.MaxValue); - testByteArray = new byte[rand.Next(0, 31)]; - - for (int j = 0; j < testByteArray.Length; j++) - testByteArray[j] = (byte)rand.Next(); - - Assert.IsTrue(metaTag.SetValue(testByte, FREE_IMAGE_MDTYPE.FIDT_BYTE)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((byte[])metaTag.Value).Length == 1); - Assert.That(metaTag.Count == 1); - Assert.That(metaTag.Length == 1); - Assert.That(metaTag.Type == FREE_IMAGE_MDTYPE.FIDT_BYTE); - Assert.That(((byte[])metaTag.Value)[0] == testByte); - - Assert.IsTrue(metaTag.SetValue(testByteArray, FREE_IMAGE_MDTYPE.FIDT_BYTE)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((byte[])metaTag.Value).Length == testByteArray.Length); - Assert.That(metaTag.Count == testByteArray.Length); - Assert.That(metaTag.Length == testByteArray.Length * 1); - - byte[] value = (byte[])metaTag.Value; - - for (int j = 0; j < value.Length; j++) - Assert.That(testByteArray[j] == value[j]); - } - - // - // FREE_IMAGE_MDTYPE.FIDT_DOUBLE - // - - double testDouble; - double[] testDoubleArray; - - Assert.IsTrue(metaTag.SetValue(double.MinValue, FREE_IMAGE_MDTYPE.FIDT_DOUBLE)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((double[])metaTag.Value).Length == 1); - Assert.That(((double[])metaTag.Value)[0] == double.MinValue); - - Assert.IsTrue(metaTag.SetValue(double.MaxValue, FREE_IMAGE_MDTYPE.FIDT_DOUBLE)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((double[])metaTag.Value).Length == 1); - Assert.That(((double[])metaTag.Value)[0] == double.MaxValue); - - for (int i = 0; i < 10; i++) - { - testDouble = (double)rand.NextDouble(); - testDoubleArray = new double[rand.Next(0, 31)]; - - for (int j = 0; j < testDoubleArray.Length; j++) - testDoubleArray[j] = rand.NextDouble(); - - Assert.IsTrue(metaTag.SetValue(testDouble, FREE_IMAGE_MDTYPE.FIDT_DOUBLE)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((double[])metaTag.Value).Length == 1); - Assert.That(metaTag.Count == 1); - Assert.That(metaTag.Length == 8); - Assert.That(metaTag.Type == FREE_IMAGE_MDTYPE.FIDT_DOUBLE); - Assert.That(((double[])metaTag.Value)[0] == testDouble); - - Assert.IsTrue(metaTag.SetValue(testDoubleArray, FREE_IMAGE_MDTYPE.FIDT_DOUBLE)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((double[])metaTag.Value).Length == testDoubleArray.Length); - Assert.That(metaTag.Count == testDoubleArray.Length); - Assert.That(metaTag.Length == testDoubleArray.Length * 8); - - double[] value = (double[])metaTag.Value; - - for (int j = 0; j < value.Length; j++) - Assert.That(testDoubleArray[j] == value[j]); - } - - // - // FREE_IMAGE_MDTYPE.FIDT_FLOAT - // - - float testfloat; - float[] testFloatArray; - - Assert.IsTrue(metaTag.SetValue(float.MinValue, FREE_IMAGE_MDTYPE.FIDT_FLOAT)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((float[])metaTag.Value).Length == 1); - Assert.That(((float[])metaTag.Value)[0] == float.MinValue); - - Assert.IsTrue(metaTag.SetValue(float.MaxValue, FREE_IMAGE_MDTYPE.FIDT_FLOAT)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((float[])metaTag.Value).Length == 1); - Assert.That(((float[])metaTag.Value)[0] == float.MaxValue); - - for (int i = 0; i < 10; i++) - { - testfloat = (float)rand.NextDouble(); - testFloatArray = new float[rand.Next(0, 31)]; - - for (int j = 0; j < testFloatArray.Length; j++) - testFloatArray[j] = (float)rand.NextDouble(); - - Assert.IsTrue(metaTag.SetValue(testfloat, FREE_IMAGE_MDTYPE.FIDT_FLOAT)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((float[])metaTag.Value).Length == 1); - Assert.That(metaTag.Count == 1); - Assert.That(metaTag.Length == 4); - Assert.That(metaTag.Type == FREE_IMAGE_MDTYPE.FIDT_FLOAT); - Assert.That(((float[])metaTag.Value)[0] == testfloat); - - Assert.IsTrue(metaTag.SetValue(testFloatArray, FREE_IMAGE_MDTYPE.FIDT_FLOAT)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((float[])metaTag.Value).Length == testFloatArray.Length); - Assert.That(metaTag.Count == testFloatArray.Length); - Assert.That(metaTag.Length == testFloatArray.Length * 4); - - float[] value = (float[])metaTag.Value; - - for (int j = 0; j < value.Length; j++) - Assert.That(testFloatArray[j] == value[j]); - } - - // - // FREE_IMAGE_MDTYPE.FIDT_IFD - // - - uint testUint; - uint[] testUintArray; - - Assert.IsTrue(metaTag.SetValue(uint.MinValue, FREE_IMAGE_MDTYPE.FIDT_IFD)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((uint[])metaTag.Value).Length == 1); - Assert.That(((uint[])metaTag.Value)[0] == uint.MinValue); - - Assert.IsTrue(metaTag.SetValue(uint.MaxValue, FREE_IMAGE_MDTYPE.FIDT_IFD)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((uint[])metaTag.Value).Length == 1); - Assert.That(((uint[])metaTag.Value)[0] == uint.MaxValue); - - for (int i = 0; i < 10; i++) - { - testUint = (uint)rand.NextDouble(); - testUintArray = new uint[rand.Next(0, 31)]; - - for (int j = 0; j < testUintArray.Length; j++) - testUintArray[j] = (uint)rand.Next(); - - Assert.IsTrue(metaTag.SetValue(testUint, FREE_IMAGE_MDTYPE.FIDT_IFD)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((uint[])metaTag.Value).Length == 1); - Assert.That(metaTag.Count == 1); - Assert.That(metaTag.Length == 4); - Assert.That(metaTag.Type == FREE_IMAGE_MDTYPE.FIDT_IFD); - Assert.That(((uint[])metaTag.Value)[0] == testUint); - - Assert.IsTrue(metaTag.SetValue(testUintArray, FREE_IMAGE_MDTYPE.FIDT_IFD)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((uint[])metaTag.Value).Length == testUintArray.Length); - Assert.That(metaTag.Count == testUintArray.Length); - Assert.That(metaTag.Length == testUintArray.Length * 4); - - uint[] value = (uint[])metaTag.Value; - - for (int j = 0; j < value.Length; j++) - Assert.That(testUintArray[j] == value[j]); - } - - // - // FREE_IMAGE_MDTYPE.FIDT_LONG - // - - Assert.IsTrue(metaTag.SetValue(uint.MinValue, FREE_IMAGE_MDTYPE.FIDT_LONG)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((uint[])metaTag.Value).Length == 1); - Assert.That(((uint[])metaTag.Value)[0] == uint.MinValue); - - Assert.IsTrue(metaTag.SetValue(uint.MaxValue, FREE_IMAGE_MDTYPE.FIDT_LONG)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((uint[])metaTag.Value).Length == 1); - Assert.That(((uint[])metaTag.Value)[0] == uint.MaxValue); - - for (int i = 0; i < 10; i++) - { - testUint = (uint)rand.NextDouble(); - testUintArray = new uint[rand.Next(0, 31)]; - - for (int j = 0; j < testUintArray.Length; j++) - testUintArray[j] = (uint)rand.Next(); - - Assert.IsTrue(metaTag.SetValue(testUint, FREE_IMAGE_MDTYPE.FIDT_LONG)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((uint[])metaTag.Value).Length == 1); - Assert.That(metaTag.Count == 1); - Assert.That(metaTag.Length == 4); - Assert.That(metaTag.Type == FREE_IMAGE_MDTYPE.FIDT_LONG); - Assert.That(((uint[])metaTag.Value)[0] == testUint); - - Assert.IsTrue(metaTag.SetValue(testUintArray, FREE_IMAGE_MDTYPE.FIDT_LONG)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((uint[])metaTag.Value).Length == testUintArray.Length); - Assert.That(metaTag.Count == testUintArray.Length); - Assert.That(metaTag.Length == testUintArray.Length * 4); - - uint[] value = (uint[])metaTag.Value; - - for (int j = 0; j < value.Length; j++) - Assert.That(testUintArray[j] == value[j]); - } - - // - // FREE_IMAGE_MDTYPE.FIDT_NOTYPE - // - - try - { - metaTag.SetValue(new object(), FREE_IMAGE_MDTYPE.FIDT_NOTYPE); - Assert.Fail(); - } - catch (NotSupportedException) - { - } - - // - // FREE_IMAGE_MDTYPE.FIDT_PALETTE - // - - RGBQUAD testRGBQUAD; - RGBQUAD[] testRGBQUADArray; - - for (int i = 0; i < 10; i++) - { - testRGBQUAD = new RGBQUAD(Color.FromArgb(rand.Next())); - testRGBQUADArray = new RGBQUAD[rand.Next(0, 31)]; - - for (int j = 0; j < testRGBQUADArray.Length; j++) - testRGBQUADArray[j] = new RGBQUAD(Color.FromArgb(rand.Next())); - - Assert.IsTrue(metaTag.SetValue(testRGBQUAD, FREE_IMAGE_MDTYPE.FIDT_PALETTE)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((RGBQUAD[])metaTag.Value).Length == 1); - Assert.That(metaTag.Count == 1); - Assert.That(metaTag.Length == 4); - Assert.That(metaTag.Type == FREE_IMAGE_MDTYPE.FIDT_PALETTE); - Assert.That(((RGBQUAD[])metaTag.Value)[0] == testRGBQUAD); - - Assert.IsTrue(metaTag.SetValue(testRGBQUADArray, FREE_IMAGE_MDTYPE.FIDT_PALETTE)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((RGBQUAD[])metaTag.Value).Length == testRGBQUADArray.Length); - Assert.That(metaTag.Count == testRGBQUADArray.Length); - Assert.That(metaTag.Length == testRGBQUADArray.Length * 4); - - RGBQUAD[] value = (RGBQUAD[])metaTag.Value; - - for (int j = 0; j < value.Length; j++) - Assert.That(testRGBQUADArray[j] == value[j]); - } - - // - // FREE_IMAGE_MDTYPE.FIDT_RATIONAL - // - - FIURational testFIURational; - FIURational[] testFIURationalArray; - - for (int i = 0; i < 10; i++) - { - testFIURational = new FIURational((uint)rand.Next(), (uint)rand.Next()); - testFIURationalArray = new FIURational[rand.Next(0, 31)]; - - for (int j = 0; j < testFIURationalArray.Length; j++) - testFIURationalArray[j] = new FIURational((uint)rand.Next(), (uint)rand.Next()); - - Assert.IsTrue(metaTag.SetValue(testFIURational, FREE_IMAGE_MDTYPE.FIDT_RATIONAL)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((FIURational[])metaTag.Value).Length == 1); - Assert.That(metaTag.Count == 1); - Assert.That(metaTag.Length == 8); - Assert.That(metaTag.Type == FREE_IMAGE_MDTYPE.FIDT_RATIONAL); - Assert.That(((FIURational[])metaTag.Value)[0] == testFIURational); - - Assert.IsTrue(metaTag.SetValue(testFIURationalArray, FREE_IMAGE_MDTYPE.FIDT_RATIONAL)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((FIURational[])metaTag.Value).Length == testFIURationalArray.Length); - Assert.That(metaTag.Count == testFIURationalArray.Length); - Assert.That(metaTag.Length == testFIURationalArray.Length * 8); - - FIURational[] value = (FIURational[])metaTag.Value; - - for (int j = 0; j < value.Length; j++) - Assert.That(testFIURationalArray[j] == value[j]); - } - - // - // FREE_IMAGE_MDTYPE.FIDT_SBYTE - // - - sbyte testSByte; - sbyte[] testSByteArray; - - Assert.IsTrue(metaTag.SetValue(sbyte.MinValue, FREE_IMAGE_MDTYPE.FIDT_SBYTE)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((sbyte[])metaTag.Value).Length == 1); - Assert.That(((sbyte[])metaTag.Value)[0] == sbyte.MinValue); - - Assert.IsTrue(metaTag.SetValue(sbyte.MaxValue, FREE_IMAGE_MDTYPE.FIDT_SBYTE)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((sbyte[])metaTag.Value).Length == 1); - Assert.That(((sbyte[])metaTag.Value)[0] == sbyte.MaxValue); - - for (int i = 0; i < 10; i++) - { - testSByte = (sbyte)rand.Next(sbyte.MinValue, sbyte.MaxValue); - testSByteArray = new sbyte[rand.Next(0, 31)]; - - for (int j = 0; j < testSByteArray.Length; j++) - testSByteArray[j] = (sbyte)rand.Next(); - - Assert.IsTrue(metaTag.SetValue(testSByte, FREE_IMAGE_MDTYPE.FIDT_SBYTE)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((sbyte[])metaTag.Value).Length == 1); - Assert.That(metaTag.Count == 1); - Assert.That(metaTag.Length == 1); - Assert.That(metaTag.Type == FREE_IMAGE_MDTYPE.FIDT_SBYTE); - Assert.That(((sbyte[])metaTag.Value)[0] == testSByte); - - Assert.IsTrue(metaTag.SetValue(testSByteArray, FREE_IMAGE_MDTYPE.FIDT_SBYTE)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((sbyte[])metaTag.Value).Length == testSByteArray.Length); - Assert.That(metaTag.Count == testSByteArray.Length); - Assert.That(metaTag.Length == testSByteArray.Length * 1); - - sbyte[] value = (sbyte[])metaTag.Value; - - for (int j = 0; j < value.Length; j++) - Assert.That(testSByteArray[j] == value[j]); - } - - // - // FREE_IMAGE_MDTYPE.FIDT_SHORT - // - - ushort testUShort; - ushort[] testUShortArray; - - Assert.IsTrue(metaTag.SetValue(ushort.MinValue, FREE_IMAGE_MDTYPE.FIDT_SHORT)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((ushort[])metaTag.Value).Length == 1); - Assert.That(((ushort[])metaTag.Value)[0] == ushort.MinValue); - - Assert.IsTrue(metaTag.SetValue(ushort.MaxValue, FREE_IMAGE_MDTYPE.FIDT_SHORT)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((ushort[])metaTag.Value).Length == 1); - Assert.That(((ushort[])metaTag.Value)[0] == ushort.MaxValue); - - for (int i = 0; i < 10; i++) - { - testUShort = (ushort)rand.Next(ushort.MinValue, sbyte.MaxValue); - testUShortArray = new ushort[rand.Next(0, 31)]; - - for (int j = 0; j < testUShortArray.Length; j++) - testUShortArray[j] = (ushort)rand.Next(); - - Assert.IsTrue(metaTag.SetValue(testUShort, FREE_IMAGE_MDTYPE.FIDT_SHORT)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((ushort[])metaTag.Value).Length == 1); - Assert.That(metaTag.Count == 1); - Assert.That(metaTag.Length == 2); - Assert.That(metaTag.Type == FREE_IMAGE_MDTYPE.FIDT_SHORT); - Assert.That(((ushort[])metaTag.Value)[0] == testUShort); - - Assert.IsTrue(metaTag.SetValue(testUShortArray, FREE_IMAGE_MDTYPE.FIDT_SHORT)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((ushort[])metaTag.Value).Length == testUShortArray.Length); - Assert.That(metaTag.Count == testUShortArray.Length); - Assert.That(metaTag.Length == testUShortArray.Length * 2); - - ushort[] value = (ushort[])metaTag.Value; - - for (int j = 0; j < value.Length; j++) - Assert.That(testUShortArray[j] == value[j]); - } - - // - // FREE_IMAGE_MDTYPE.FIDT_SLONG - // - - int testInt; - int[] testIntArray; - - Assert.IsTrue(metaTag.SetValue(int.MinValue, FREE_IMAGE_MDTYPE.FIDT_SLONG)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((int[])metaTag.Value).Length == 1); - Assert.That(((int[])metaTag.Value)[0] == int.MinValue); - - Assert.IsTrue(metaTag.SetValue(int.MaxValue, FREE_IMAGE_MDTYPE.FIDT_SLONG)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((int[])metaTag.Value).Length == 1); - Assert.That(((int[])metaTag.Value)[0] == int.MaxValue); - - for (int i = 0; i < 10; i++) - { - testInt = (int)rand.NextDouble(); - testIntArray = new int[rand.Next(0, 31)]; - - for (int j = 0; j < testIntArray.Length; j++) - testIntArray[j] = rand.Next(); - - Assert.IsTrue(metaTag.SetValue(testInt, FREE_IMAGE_MDTYPE.FIDT_SLONG)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((int[])metaTag.Value).Length == 1); - Assert.That(metaTag.Count == 1); - Assert.That(metaTag.Length == 4); - Assert.That(metaTag.Type == FREE_IMAGE_MDTYPE.FIDT_SLONG); - Assert.That(((int[])metaTag.Value)[0] == testInt); - - Assert.IsTrue(metaTag.SetValue(testIntArray, FREE_IMAGE_MDTYPE.FIDT_SLONG)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((int[])metaTag.Value).Length == testIntArray.Length); - Assert.That(metaTag.Count == testIntArray.Length); - Assert.That(metaTag.Length == testIntArray.Length * 4); - - int[] value = (int[])metaTag.Value; - - for (int j = 0; j < value.Length; j++) - Assert.That(testIntArray[j] == value[j]); - } - - // - // FREE_IMAGE_MDTYPE.FIDT_SRATIONAL - // - - FIRational testFIRational; - FIRational[] testFIRationalArray; - - for (int i = 0; i < 10; i++) - { - testFIRational = new FIRational(rand.Next(), rand.Next()); - testFIRationalArray = new FIRational[rand.Next(0, 31)]; - - for (int j = 0; j < testFIRationalArray.Length; j++) - testFIRationalArray[j] = new FIRational(rand.Next(), rand.Next()); - - Assert.IsTrue(metaTag.SetValue(testFIRational, FREE_IMAGE_MDTYPE.FIDT_SRATIONAL)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((FIRational[])metaTag.Value).Length == 1); - Assert.That(metaTag.Count == 1); - Assert.That(metaTag.Length == 8); - Assert.That(metaTag.Type == FREE_IMAGE_MDTYPE.FIDT_SRATIONAL); - Assert.That(((FIRational[])metaTag.Value)[0] == testFIRational); - - Assert.IsTrue(metaTag.SetValue(testFIRationalArray, FREE_IMAGE_MDTYPE.FIDT_SRATIONAL)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((FIRational[])metaTag.Value).Length == testFIRationalArray.Length); - Assert.That(metaTag.Count == testFIRationalArray.Length); - Assert.That(metaTag.Length == testFIRationalArray.Length * 8); - - FIRational[] value = (FIRational[])metaTag.Value; - - for (int j = 0; j < value.Length; j++) - Assert.That(testFIRationalArray[j] == value[j]); - } - - // - // FREE_IMAGE_MDTYPE.FIDT_SSHORT - // - - short testShort; - short[] testShortArray; - - Assert.IsTrue(metaTag.SetValue(short.MinValue, FREE_IMAGE_MDTYPE.FIDT_SSHORT)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((short[])metaTag.Value).Length == 1); - Assert.That(((short[])metaTag.Value)[0] == short.MinValue); - - Assert.IsTrue(metaTag.SetValue(short.MaxValue, FREE_IMAGE_MDTYPE.FIDT_SSHORT)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((short[])metaTag.Value).Length == 1); - Assert.That(((short[])metaTag.Value)[0] == short.MaxValue); - - for (int i = 0; i < 10; i++) - { - testShort = (short)rand.Next(short.MinValue, short.MaxValue); - testShortArray = new short[rand.Next(0, 31)]; - - for (int j = 0; j < testShortArray.Length; j++) - testShortArray[j] = (short)rand.Next(); - - Assert.IsTrue(metaTag.SetValue(testShort, FREE_IMAGE_MDTYPE.FIDT_SSHORT)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((short[])metaTag.Value).Length == 1); - Assert.That(metaTag.Count == 1); - Assert.That(metaTag.Length == 2); - Assert.That(metaTag.Type == FREE_IMAGE_MDTYPE.FIDT_SSHORT); - Assert.That(((short[])metaTag.Value)[0] == testShort); - - Assert.IsTrue(metaTag.SetValue(testShortArray, FREE_IMAGE_MDTYPE.FIDT_SSHORT)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((short[])metaTag.Value).Length == testShortArray.Length); - Assert.That(metaTag.Count == testShortArray.Length); - Assert.That(metaTag.Length == testShortArray.Length * 2); - - short[] value = (short[])metaTag.Value; - - for (int j = 0; j < value.Length; j++) - Assert.That(testShortArray[j] == value[j]); - } - - // - // FREE_IMAGE_MDTYPE.FIDT_UNDEFINED - // - - Assert.IsTrue(metaTag.SetValue(byte.MinValue, FREE_IMAGE_MDTYPE.FIDT_UNDEFINED)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((byte[])metaTag.Value).Length == 1); - Assert.That(((byte[])metaTag.Value)[0] == byte.MinValue); - - Assert.IsTrue(metaTag.SetValue(byte.MaxValue, FREE_IMAGE_MDTYPE.FIDT_UNDEFINED)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((byte[])metaTag.Value).Length == 1); - Assert.That(((byte[])metaTag.Value)[0] == byte.MaxValue); - - for (int i = 0; i < 10; i++) - { - testByte = (byte)rand.Next(byte.MinValue, byte.MaxValue); - testByteArray = new byte[rand.Next(0, 31)]; - - for (int j = 0; j < testByteArray.Length; j++) - testByteArray[j] = (byte)rand.Next(); - - Assert.IsTrue(metaTag.SetValue(testByte, FREE_IMAGE_MDTYPE.FIDT_UNDEFINED)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((byte[])metaTag.Value).Length == 1); - Assert.That(metaTag.Count == 1); - Assert.That(metaTag.Length == 1); - Assert.That(metaTag.Type == FREE_IMAGE_MDTYPE.FIDT_UNDEFINED); - Assert.That(((byte[])metaTag.Value)[0] == testByte); - - Assert.IsTrue(metaTag.SetValue(testByteArray, FREE_IMAGE_MDTYPE.FIDT_UNDEFINED)); - Assert.IsNotNull(metaTag.Value); - Assert.That(((byte[])metaTag.Value).Length == testByteArray.Length); - Assert.That(metaTag.Count == testByteArray.Length); - Assert.That(metaTag.Length == testByteArray.Length * 1); - - byte[] value = (byte[])metaTag.Value; - - for (int j = 0; j < value.Length; j++) - Assert.That(testByteArray[j] == value[j]); - } - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void MetadataModel() - { - MetadataTag tag; - dib = FreeImage.Allocate(1, 1, 1, 0, 0, 0); - Assert.IsFalse(dib.IsNull); - - MetadataModel model = new MDM_GEOTIFF(dib); - Assert.AreEqual(0, model.Count); - Assert.IsFalse(model.Exists); - Assert.IsEmpty(model.List); - Assert.AreEqual(model.Model, FREE_IMAGE_MDMODEL.FIMD_GEOTIFF); - Assert.IsTrue(model.DestoryModel()); - foreach (MetadataTag m in model) Assert.Fail(); - - tag = new MetadataTag(FREE_IMAGE_MDMODEL.FIMD_GEOTIFF); - tag.Key = "KEY"; - tag.Value = 54321f; - Assert.IsTrue(model.AddTag(tag)); - - Assert.AreEqual(1, model.Count); - Assert.IsTrue(model.Exists); - Assert.IsNotEmpty(model.List); - Assert.AreEqual(model.Model, FREE_IMAGE_MDMODEL.FIMD_GEOTIFF); - - Assert.IsTrue(model.DestoryModel()); - Assert.AreEqual(0, model.Count); - Assert.IsFalse(model.Exists); - Assert.IsEmpty(model.List); - Assert.AreEqual(model.Model, FREE_IMAGE_MDMODEL.FIMD_GEOTIFF); - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void ImageMetadata() - { - ImageMetadata metadata; - List modelList; - MetadataTag tag = new MetadataTag(FREE_IMAGE_MDMODEL.FIMD_COMMENTS); - tag.Key = "KEY"; - tag.ID = 11; - tag.Value = new double[] { 0d, 41d, -523d, -0.41d }; - - dib = FreeImage.Allocate(1, 1, 1, 1, 0, 0); - Assert.IsFalse(dib.IsNull); - - metadata = new ImageMetadata(dib, true); - Assert.AreEqual(0, metadata.Count); - Assert.IsTrue(metadata.HideEmptyModels); - Assert.IsEmpty(metadata.List); - - metadata = new ImageMetadata(dib, false); - Assert.AreEqual(FreeImage.FREE_IMAGE_MDMODELS.Length, metadata.Count); - Assert.IsFalse(metadata.HideEmptyModels); - Assert.IsNotEmpty(metadata.List); - - metadata.HideEmptyModels = true; - metadata.AddTag(tag); - - Assert.AreEqual(1, metadata.Count); - Assert.IsNotEmpty(metadata.List); - - modelList = metadata.List; - Assert.AreEqual(FREE_IMAGE_MDMODEL.FIMD_COMMENTS, modelList[0].Model); - - System.Collections.IEnumerator enumerator = metadata.GetEnumerator(); - Assert.IsTrue(enumerator.MoveNext()); - Assert.IsNotNull((MetadataModel)enumerator.Current); - Assert.IsFalse(enumerator.MoveNext()); - - FreeImage.UnloadEx(ref dib); - } - } - - [TestFixture] - public class WrapperFunctionsTest - { - ImageManager iManager = new ImageManager(); - FIBITMAP dib = new FIBITMAP(); - string freeImageCallback = null; - - [TestFixtureSetUp] - public void Init() - { - FreeImageEngine.Message += new OutputMessageFunction(FreeImage_Message); - } - - [TestFixtureTearDown] - public void DeInit() - { - FreeImageEngine.Message -= new OutputMessageFunction(FreeImage_Message); - } - - [SetUp] - public void InitEachTime() - { - } - - [TearDown] - public void DeInitEachTime() - { - } - - void FreeImage_Message(FREE_IMAGE_FORMAT fif, string message) - { - freeImageCallback = message; - } - - public bool EqualColors(Color color1, Color color2) - { - if (color1.A != color2.A) return false; - if (color1.R != color2.R) return false; - if (color1.G != color2.G) return false; - if (color1.B != color2.B) return false; - return true; - } - - // - // Tests - // - - [Test] - public void FreeImage_GetWrapperVersion() - { - //Assert.That(FreeImage.GetWrapperVersion() == - // String.Format("{0}.{1}.{2}", - // FreeImage.FREEIMAGE_MAJOR_VERSION, - // FreeImage.FREEIMAGE_MINOR_VERSION, - // FreeImage.FREEIMAGE_RELEASE_SERIAL)); - } - - [Test] - public void FreeImage_IsAvailable() - { - Assert.IsTrue(FreeImage.IsAvailable()); - } - - [Test] - public void FreeImage_GetBitmap() - { - Bitmap bitmap = null; - - try - { - bitmap = FreeImage.GetBitmap(new FIBITMAP()); - } - catch - { - } - Assert.IsNull(bitmap); - - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_24); - Assert.That(!dib.IsNull); - - bitmap = FreeImage.GetBitmap(dib); - Assert.IsNotNull(bitmap); - Assert.AreEqual((int)FreeImage.GetHeight(dib), bitmap.Height); - Assert.AreEqual((int)FreeImage.GetWidth(dib), bitmap.Width); - - bitmap.Dispose(); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_CreateFromBitmap() - { - Bitmap bitmap = (Bitmap)Bitmap.FromFile(iManager.GetBitmapPath(ImageType.Odd, ImageColorType.Type_24)); - Assert.IsNotNull(bitmap); - - dib = FreeImage.CreateFromBitmap(bitmap); - Assert.That(!dib.IsNull); - - Assert.AreEqual((int)FreeImage.GetHeight(dib), bitmap.Height); - Assert.AreEqual((int)FreeImage.GetWidth(dib), bitmap.Width); - - bitmap.Dispose(); - FreeImage.UnloadEx(ref dib); - - try - { - dib = FreeImage.CreateFromBitmap(null); - Assert.Fail(); - } - catch - { - } - } - - [Test] - public void FreeImage_SaveBitmap() - { - Bitmap bitmap = (Bitmap)Bitmap.FromFile(iManager.GetBitmapPath(ImageType.Odd, ImageColorType.Type_24)); - Assert.IsNotNull(bitmap); - - Assert.IsTrue(FreeImage.SaveBitmap(bitmap, @"test.png", FREE_IMAGE_FORMAT.FIF_PNG, FREE_IMAGE_SAVE_FLAGS.DEFAULT)); - bitmap.Dispose(); - - Assert.IsTrue(File.Exists(@"test.png")); - - dib = FreeImage.Load(FREE_IMAGE_FORMAT.FIF_PNG, @"test.png", FREE_IMAGE_LOAD_FLAGS.DEFAULT); - Assert.That(!dib.IsNull); - - FreeImage.UnloadEx(ref dib); - - File.Delete(@"test.png"); - Assert.IsFalse(File.Exists(@"test.png")); - bitmap.Dispose(); - } - - [Test] - public void FreeImage_LoadEx() - { - dib = FreeImage.LoadEx(iManager.GetBitmapPath(ImageType.Odd, ImageColorType.Type_16_555)); - Assert.That(!dib.IsNull); - FreeImage.UnloadEx(ref dib); - - FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_TIFF; - - dib = FreeImage.LoadEx(iManager.GetBitmapPath(ImageType.Odd, ImageColorType.Type_16_565), ref format); - Assert.That(dib.IsNull); - Assert.AreEqual(FREE_IMAGE_FORMAT.FIF_TIFF, format); - FreeImage.UnloadEx(ref dib); - - format = FREE_IMAGE_FORMAT.FIF_UNKNOWN; - dib = FreeImage.LoadEx(iManager.GetBitmapPath(ImageType.JPEG, ImageColorType.Type_16_565), - FREE_IMAGE_LOAD_FLAGS.DEFAULT, ref format); - Assert.That(!dib.IsNull); - Assert.AreEqual(FREE_IMAGE_FORMAT.FIF_JPEG, format); - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_UnloadEx() - { - Assert.That(dib.IsNull); - FreeImage.UnloadEx(ref dib); - Assert.That(dib.IsNull); - - dib = iManager.GetBitmap(ImageType.Odd, ImageColorType.Type_16_555); - Assert.That(!dib.IsNull); - - FreeImage.UnloadEx(ref dib); - Assert.That(dib.IsNull); - } - - [Test] - public void FreeImage_SaveEx() - { - FREE_IMAGE_FORMAT format; - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_08); - Assert.That(!dib.IsNull); - - Assert.IsTrue(FreeImage.SaveEx(dib, @"test.png")); - Assert.IsTrue(File.Exists(@"test.png")); - format = FreeImage.GetFileType(@"test.png", 0); - Assert.AreEqual(FREE_IMAGE_FORMAT.FIF_PNG, format); - File.Delete(@"test.png"); - Assert.IsFalse(File.Exists(@"test.png")); - - Assert.IsTrue(FreeImage.SaveEx(ref dib, @"test.tiff", FREE_IMAGE_SAVE_FLAGS.DEFAULT, false)); - Assert.IsTrue(File.Exists(@"test.tiff")); - format = FreeImage.GetFileType(@"test.tiff", 0); - Assert.AreEqual(FREE_IMAGE_FORMAT.FIF_TIFF, format); - File.Delete(@"test.tiff"); - Assert.IsFalse(File.Exists(@"test.tiff")); - - Assert.IsTrue(FreeImage.SaveEx( - ref dib, - @"test.gif", - FREE_IMAGE_FORMAT.FIF_UNKNOWN, - FREE_IMAGE_SAVE_FLAGS.DEFAULT, - FREE_IMAGE_COLOR_DEPTH.FICD_08_BPP, - false)); - - Assert.IsTrue(File.Exists(@"test.gif")); - format = FreeImage.GetFileType(@"test.gif", 0); - Assert.AreEqual(FREE_IMAGE_FORMAT.FIF_GIF, format); - File.Delete(@"test.gif"); - Assert.IsFalse(File.Exists(@"test.gif")); - - Assert.IsFalse(FreeImage.SaveEx(dib, @"")); - Assert.IsFalse(FreeImage.SaveEx(dib, @"test.test")); - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_LoadFromStream() - { - FREE_IMAGE_FORMAT format; - FileStream fStream; - - fStream = new FileStream(iManager.GetBitmapPath(ImageType.Odd, ImageColorType.Type_16_565), FileMode.Open); - Assert.IsNotNull(fStream); - - dib = FreeImage.LoadFromStream(fStream); - Assert.That(!dib.IsNull); - Assert.That(FreeImage.GetBPP(dib) == 16); - Assert.That(FreeImage.GetGreenMask(dib) == FreeImage.FI16_565_GREEN_MASK); - - FreeImage.UnloadEx(ref dib); - fStream.Close(); - - fStream = new FileStream(iManager.GetBitmapPath(ImageType.Metadata, ImageColorType.Type_01_Dither), FileMode.Open); - Assert.IsNotNull(fStream); - - format = FREE_IMAGE_FORMAT.FIF_UNKNOWN; - dib = FreeImage.LoadFromStream(fStream, FREE_IMAGE_LOAD_FLAGS.DEFAULT, ref format); - Assert.That(!dib.IsNull); - Assert.That(FreeImage.GetBPP(dib) == 24); - Assert.That(format == FREE_IMAGE_FORMAT.FIF_JPEG); - FreeImage.UnloadEx(ref dib); - fStream.Close(); - - fStream = new FileStream(iManager.GetBitmapPath(ImageType.Even, ImageColorType.Type_32), FileMode.Open); - format = FREE_IMAGE_FORMAT.FIF_TIFF; - dib = FreeImage.LoadFromStream(fStream, FREE_IMAGE_LOAD_FLAGS.DEFAULT, ref format); - Assert.That(!dib.IsNull); - Assert.That(FreeImage.GetBPP(dib) == 32); - Assert.That(format == FREE_IMAGE_FORMAT.FIF_TIFF); - - FreeImage.UnloadEx(ref dib); - - Assert.That(dib.IsNull); - dib = FreeImage.LoadFromStream(new MemoryStream(new byte[] { })); - Assert.That(dib.IsNull); - - format = FREE_IMAGE_FORMAT.FIF_BMP; - fStream.Position = 0; - dib = FreeImage.LoadFromStream(fStream, ref format); - Assert.That(dib.IsNull); - Assert.AreEqual(FREE_IMAGE_FORMAT.FIF_BMP, format); - - fStream.Close(); - } - - [Test] - public void FreeImage_SaveToStream() - { - dib = iManager.GetBitmap(ImageType.Odd, ImageColorType.Type_08_Greyscale_MinIsBlack); - Assert.That(!dib.IsNull); - - Stream stream = new FileStream(@"out_stream.bmp", FileMode.Create); - Assert.IsNotNull(stream); - - Assert.IsTrue(FreeImage.SaveEx(ref dib, @"out_file.bmp", FREE_IMAGE_FORMAT.FIF_BMP, false)); - Assert.IsTrue(FreeImage.SaveToStream(dib, stream, FREE_IMAGE_FORMAT.FIF_BMP)); - stream.Flush(); - stream.Dispose(); - - Assert.IsTrue(File.Exists(@"out_stream.bmp")); - Assert.IsTrue(File.Exists(@"out_file.bmp")); - byte[] buffer1 = File.ReadAllBytes(@"out_stream.bmp"); - byte[] buffer2 = File.ReadAllBytes(@"out_file.bmp"); - Assert.AreEqual(buffer1.Length, buffer2.Length); - for (int i = 0; i < buffer1.Length; i++) - if (buffer1[i] != buffer2[i]) - Assert.Fail(); - - File.Delete(@"out_stream.bmp"); - File.Delete(@"out_file.bmp"); - Assert.IsFalse(File.Exists(@"out_stream.bmp")); - Assert.IsFalse(File.Exists(@"out_file.bmp")); - - stream = new MemoryStream(); - Assert.IsFalse(FreeImage.SaveToStream(dib, stream, FREE_IMAGE_FORMAT.FIF_FAXG3)); - stream.Dispose(); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_IsExtensionValidForFIF() - { - Assert.IsTrue(FreeImage.IsExtensionValidForFIF(FREE_IMAGE_FORMAT.FIF_BMP, "bmp", StringComparison.CurrentCultureIgnoreCase)); - Assert.IsTrue(FreeImage.IsExtensionValidForFIF(FREE_IMAGE_FORMAT.FIF_BMP, "BMP", StringComparison.CurrentCultureIgnoreCase)); - Assert.IsFalse(FreeImage.IsExtensionValidForFIF(FREE_IMAGE_FORMAT.FIF_BMP, "DUMMY", StringComparison.CurrentCultureIgnoreCase)); - Assert.IsTrue(FreeImage.IsExtensionValidForFIF(FREE_IMAGE_FORMAT.FIF_PCX, "pcx", StringComparison.CurrentCultureIgnoreCase)); - Assert.IsTrue(FreeImage.IsExtensionValidForFIF(FREE_IMAGE_FORMAT.FIF_TIFF, "tif", StringComparison.CurrentCultureIgnoreCase)); - Assert.IsTrue(FreeImage.IsExtensionValidForFIF(FREE_IMAGE_FORMAT.FIF_TIFF, "TIFF", StringComparison.CurrentCultureIgnoreCase)); - Assert.IsFalse(FreeImage.IsExtensionValidForFIF(FREE_IMAGE_FORMAT.FIF_ICO, "ICO", StringComparison.CurrentCulture)); - } - - [Test] - public void FreeImage_IsFilenameValidForFIF() - { - Assert.IsTrue(FreeImage.IsFilenameValidForFIF(FREE_IMAGE_FORMAT.FIF_JPEG, "file.jpg")); - Assert.IsTrue(FreeImage.IsFilenameValidForFIF(FREE_IMAGE_FORMAT.FIF_JPEG, "file.jpeg")); - Assert.IsFalse(FreeImage.IsFilenameValidForFIF(FREE_IMAGE_FORMAT.FIF_JPEG, "file.bmp")); - Assert.IsTrue(FreeImage.IsFilenameValidForFIF(FREE_IMAGE_FORMAT.FIF_GIF, "file.gif")); - Assert.IsTrue(FreeImage.IsFilenameValidForFIF(FREE_IMAGE_FORMAT.FIF_GIF, "file.GIF")); - Assert.IsTrue(FreeImage.IsFilenameValidForFIF(FREE_IMAGE_FORMAT.FIF_GIF, "file.GIF", StringComparison.CurrentCultureIgnoreCase)); - Assert.IsFalse(FreeImage.IsFilenameValidForFIF(FREE_IMAGE_FORMAT.FIF_GIF, "file.txt")); - Assert.IsFalse(FreeImage.IsFilenameValidForFIF(FREE_IMAGE_FORMAT.FIF_UNKNOWN, "file.jpg")); - Assert.IsFalse(FreeImage.IsFilenameValidForFIF(FREE_IMAGE_FORMAT.FIF_UNKNOWN, "file.bmp")); - Assert.IsFalse(FreeImage.IsFilenameValidForFIF(FREE_IMAGE_FORMAT.FIF_UNKNOWN, "file.tif")); - } - - [Test] - public void FreeImage_GetPrimaryExtensionFromFIF() - { - Assert.AreEqual("gif", FreeImage.GetPrimaryExtensionFromFIF(FREE_IMAGE_FORMAT.FIF_GIF)); - Assert.AreEqual("tif", FreeImage.GetPrimaryExtensionFromFIF(FREE_IMAGE_FORMAT.FIF_TIFF)); - Assert.AreNotEqual("tiff", FreeImage.GetPrimaryExtensionFromFIF(FREE_IMAGE_FORMAT.FIF_TIFF)); - Assert.AreEqual("psd", FreeImage.GetPrimaryExtensionFromFIF(FREE_IMAGE_FORMAT.FIF_PSD)); - Assert.AreEqual("iff", FreeImage.GetPrimaryExtensionFromFIF(FREE_IMAGE_FORMAT.FIF_IFF)); - Assert.IsNull(FreeImage.GetPrimaryExtensionFromFIF(FREE_IMAGE_FORMAT.FIF_UNKNOWN)); - } - - [Test] - public void FreeImage_OpenMultiBitmapEx() - { - FIMULTIBITMAP dib = FreeImage.OpenMultiBitmapEx(iManager.GetBitmapPath(ImageType.Multipaged, ImageColorType.Type_01_Dither)); - Assert.IsFalse(dib.IsNull); - Assert.AreEqual(4, FreeImage.GetPageCount(dib)); - FreeImage.CloseMultiBitmap(dib, FREE_IMAGE_SAVE_FLAGS.DEFAULT); - - FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_UNKNOWN; - dib = FreeImage.OpenMultiBitmapEx( - iManager.GetBitmapPath(ImageType.Multipaged, ImageColorType.Type_04), ref format, FREE_IMAGE_LOAD_FLAGS.DEFAULT, - false, true, true); - Assert.IsFalse(dib.IsNull); - Assert.AreEqual(FREE_IMAGE_FORMAT.FIF_TIFF, format); - FreeImage.CloseMultiBitmap(dib, FREE_IMAGE_SAVE_FLAGS.DEFAULT); - } - - [Test] - public void FreeImage_GetLockedPageCount() - { - FIMULTIBITMAP dib = FreeImage.OpenMultiBitmapEx(iManager.GetBitmapPath(ImageType.Multipaged, ImageColorType.Type_01_Dither)); - FIBITMAP page1, page2, page3; - Assert.IsFalse(dib.IsNull); - Assert.AreEqual(4, FreeImage.GetPageCount(dib)); - Assert.AreEqual(0, FreeImage.GetLockedPageCount(dib)); - - page1 = FreeImage.LockPage(dib, 0); - Assert.AreEqual(1, FreeImage.GetLockedPageCount(dib)); - - page2 = FreeImage.LockPage(dib, 1); - Assert.AreEqual(2, FreeImage.GetLockedPageCount(dib)); - - page3 = FreeImage.LockPage(dib, 2); - Assert.AreEqual(3, FreeImage.GetLockedPageCount(dib)); - - FreeImage.UnlockPage(dib, page3, true); - Assert.AreEqual(2, FreeImage.GetLockedPageCount(dib)); - - FreeImage.UnlockPage(dib, page2, true); - Assert.AreEqual(1, FreeImage.GetLockedPageCount(dib)); - - FreeImage.UnlockPage(dib, page1, true); - Assert.AreEqual(0, FreeImage.GetLockedPageCount(dib)); - - FreeImage.CloseMultiBitmapEx(ref dib); - } - - [Test] - public void FreeImage_GetLockedPages() - { - FIMULTIBITMAP dib = FreeImage.OpenMultiBitmapEx(iManager.GetBitmapPath(ImageType.Multipaged, ImageColorType.Type_01_Dither)); - FIBITMAP page1, page2, page3; - int[] lockedList; - Assert.IsFalse(dib.IsNull); - Assert.AreEqual(4, FreeImage.GetPageCount(dib)); - Assert.AreEqual(0, FreeImage.GetLockedPageCount(dib)); - - page1 = FreeImage.LockPage(dib, 0); - Assert.AreEqual(1, FreeImage.GetLockedPageCount(dib)); - lockedList = FreeImage.GetLockedPages(dib); - Assert.Contains(0, lockedList); - - page2 = FreeImage.LockPage(dib, 1); - Assert.AreEqual(2, FreeImage.GetLockedPageCount(dib)); - lockedList = FreeImage.GetLockedPages(dib); - Assert.Contains(0, lockedList); - Assert.Contains(1, lockedList); - - page3 = FreeImage.LockPage(dib, 3); - Assert.AreEqual(3, FreeImage.GetLockedPageCount(dib)); - lockedList = FreeImage.GetLockedPages(dib); - Assert.Contains(0, lockedList); - Assert.Contains(1, lockedList); - Assert.Contains(3, lockedList); - - FreeImage.UnlockPage(dib, page2, true); - Assert.AreEqual(2, FreeImage.GetLockedPageCount(dib)); - lockedList = FreeImage.GetLockedPages(dib); - Assert.Contains(0, lockedList); - Assert.Contains(3, lockedList); - - FreeImage.UnlockPage(dib, page1, true); - Assert.AreEqual(1, FreeImage.GetLockedPageCount(dib)); - lockedList = FreeImage.GetLockedPages(dib); - Assert.Contains(3, lockedList); - - FreeImage.UnlockPage(dib, page3, true); - Assert.AreEqual(0, FreeImage.GetLockedPageCount(dib)); - lockedList = FreeImage.GetLockedPages(dib); - Assert.AreEqual(0, lockedList.Length); - - FreeImage.CloseMultiBitmapEx(ref dib); - } - - [Test] - public void FreeImage_GetFileTypeFromStream() - { - FileStream fStream = new FileStream(iManager.GetBitmapPath(ImageType.JPEG, ImageColorType.Type_01_Dither), FileMode.Open); - Assert.IsNotNull(fStream); - - Assert.AreEqual(FREE_IMAGE_FORMAT.FIF_JPEG, FreeImage.GetFileTypeFromStream(fStream)); - fStream.Dispose(); - - fStream = new FileStream(iManager.GetBitmapPath(ImageType.Odd, ImageColorType.Type_16_565), FileMode.Open); - Assert.AreEqual(FREE_IMAGE_FORMAT.FIF_BMP, FreeImage.GetFileTypeFromStream(fStream)); - fStream.Close(); - } - - [Test] - public void FreeImage_GetHbitmap() - { - dib = iManager.GetBitmap(ImageType.Odd, ImageColorType.Type_24); - Assert.IsFalse(dib.IsNull); - - IntPtr hBitmap = FreeImage.GetHbitmap(dib, IntPtr.Zero, false); - Bitmap bitmap = Bitmap.FromHbitmap(hBitmap); - Assert.IsNotNull(bitmap); - Assert.AreEqual(FreeImage.GetWidth(dib), bitmap.Width); - Assert.AreEqual(FreeImage.GetHeight(dib), bitmap.Height); - - bitmap.Dispose(); - FreeImage.FreeHbitmap(hBitmap); - FreeImage.UnloadEx(ref dib); - - try - { - hBitmap = FreeImage.GetHbitmap(dib, IntPtr.Zero, false); - Assert.Fail(); - } - catch - { - } - } - - [Test] - public void FreeImage_GetResolutionX() - { - dib = iManager.GetBitmap(ImageType.Odd, ImageColorType.Type_24); - Assert.IsFalse(dib.IsNull); - - Assert.AreEqual(72, FreeImage.GetResolutionX(dib)); - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_GetResolutionY() - { - dib = iManager.GetBitmap(ImageType.Odd, ImageColorType.Type_24); - Assert.IsFalse(dib.IsNull); - - Assert.AreEqual(72, FreeImage.GetResolutionY(dib)); - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_SetResolutionX() - { - dib = iManager.GetBitmap(ImageType.Odd, ImageColorType.Type_24); - Assert.IsFalse(dib.IsNull); - - Assert.AreEqual(72, FreeImage.GetResolutionX(dib)); - - FreeImage.SetResolutionX(dib, 12u); - Assert.AreEqual(12, FreeImage.GetResolutionX(dib)); - - FreeImage.SetResolutionX(dib, 1u); - Assert.AreEqual(1, FreeImage.GetResolutionX(dib)); - - FreeImage.SetResolutionX(dib, 66u); - Assert.AreEqual(66, FreeImage.GetResolutionX(dib)); - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_SetResolutionY() - { - dib = iManager.GetBitmap(ImageType.Odd, ImageColorType.Type_24); - Assert.IsFalse(dib.IsNull); - - Assert.AreEqual(72, FreeImage.GetResolutionY(dib)); - - FreeImage.SetResolutionY(dib, 12u); - Assert.AreEqual(12, FreeImage.GetResolutionY(dib)); - - FreeImage.SetResolutionY(dib, 1u); - Assert.AreEqual(1, FreeImage.GetResolutionY(dib)); - - FreeImage.SetResolutionY(dib, 66u); - Assert.AreEqual(66, FreeImage.GetResolutionY(dib)); - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_IsGreyscaleImage() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_32); - Assert.IsFalse(FreeImage.IsGreyscaleImage(dib)); - FreeImage.UnloadEx(ref dib); - - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_04_Greyscale_Unordered); - Assert.IsTrue(FreeImage.IsGreyscaleImage(dib)); - FreeImage.UnloadEx(ref dib); - - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_04_Greyscale_MinIsBlack); - Assert.IsTrue(FreeImage.IsGreyscaleImage(dib)); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_GetPaletteEx() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_32); - Palette palette = null; - - try - { - palette = FreeImage.GetPaletteEx(dib); - Assert.Fail(); - } - catch - { - } - FreeImage.UnloadEx(ref dib); - - dib = iManager.GetBitmap(ImageType.Odd, ImageColorType.Type_08_Greyscale_MinIsBlack); - try - { - palette = FreeImage.GetPaletteEx(dib); - } - catch - { - Assert.Fail(); - } - Assert.AreEqual(256, palette.Length); - for (int index = 0; index < 256; index++) - { - Assert.AreEqual(index, palette[index].rgbRed); - Assert.AreEqual(index, palette[index].rgbGreen); - Assert.AreEqual(index, palette[index].rgbBlue); - } - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_GetInfoHeaderEx() - { - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_04); - Assert.IsFalse(dib.IsNull); - - BITMAPINFOHEADER iHeader = FreeImage.GetInfoHeaderEx(dib); - Assert.AreEqual(4, iHeader.biBitCount); - Assert.AreEqual(FreeImage.GetWidth(dib), iHeader.biWidth); - Assert.AreEqual(FreeImage.GetHeight(dib), iHeader.biHeight); - FreeImage.UnloadEx(ref dib); - - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_01_Dither); - Assert.IsFalse(dib.IsNull); - - iHeader = FreeImage.GetInfoHeaderEx(dib); - Assert.AreEqual(1, iHeader.biBitCount); - Assert.AreEqual(FreeImage.GetWidth(dib), iHeader.biWidth); - Assert.AreEqual(FreeImage.GetHeight(dib), iHeader.biHeight); - FreeImage.UnloadEx(ref dib); - - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_24); - Assert.IsFalse(dib.IsNull); - - iHeader = FreeImage.GetInfoHeaderEx(dib); - Assert.AreEqual(24, iHeader.biBitCount); - Assert.AreEqual(FreeImage.GetWidth(dib), iHeader.biWidth); - Assert.AreEqual(FreeImage.GetHeight(dib), iHeader.biHeight); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_GetInfoEx() - { - BITMAPINFO info; - - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_01_Dither); - Assert.That(!dib.IsNull); - info = FreeImage.GetInfoEx(dib); - Assert.AreEqual(FreeImage.GetBPP(dib), info.bmiHeader.biBitCount); - Assert.AreEqual(FreeImage.GetWidth(dib), info.bmiHeader.biWidth); - Assert.AreEqual(FreeImage.GetHeight(dib), info.bmiHeader.biHeight); - FreeImage.UnloadEx(ref dib); - - dib = iManager.GetBitmap(ImageType.Odd, ImageColorType.Type_04_Greyscale_MinIsBlack); - Assert.That(!dib.IsNull); - info = FreeImage.GetInfoEx(dib); - Assert.AreEqual(FreeImage.GetBPP(dib), info.bmiHeader.biBitCount); - Assert.AreEqual(FreeImage.GetWidth(dib), info.bmiHeader.biWidth); - Assert.AreEqual(FreeImage.GetHeight(dib), info.bmiHeader.biHeight); - FreeImage.UnloadEx(ref dib); - - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_08_Greyscale_Unordered); - Assert.That(!dib.IsNull); - info = FreeImage.GetInfoEx(dib); - Assert.AreEqual(FreeImage.GetBPP(dib), info.bmiHeader.biBitCount); - Assert.AreEqual(FreeImage.GetWidth(dib), info.bmiHeader.biWidth); - Assert.AreEqual(FreeImage.GetHeight(dib), info.bmiHeader.biHeight); - FreeImage.UnloadEx(ref dib); - - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_16_555); - Assert.That(!dib.IsNull); - info = FreeImage.GetInfoEx(dib); - Assert.AreEqual(FreeImage.GetBPP(dib), info.bmiHeader.biBitCount); - Assert.AreEqual(FreeImage.GetWidth(dib), info.bmiHeader.biWidth); - Assert.AreEqual(FreeImage.GetHeight(dib), info.bmiHeader.biHeight); - FreeImage.UnloadEx(ref dib); - - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_16_565); - Assert.That(!dib.IsNull); - info = FreeImage.GetInfoEx(dib); - Assert.AreEqual(FreeImage.GetBPP(dib), info.bmiHeader.biBitCount); - Assert.AreEqual(FreeImage.GetWidth(dib), info.bmiHeader.biWidth); - Assert.AreEqual(FreeImage.GetHeight(dib), info.bmiHeader.biHeight); - FreeImage.UnloadEx(ref dib); - - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_24); - Assert.That(!dib.IsNull); - info = FreeImage.GetInfoEx(dib); - Assert.AreEqual(FreeImage.GetBPP(dib), info.bmiHeader.biBitCount); - Assert.AreEqual(FreeImage.GetWidth(dib), info.bmiHeader.biWidth); - Assert.AreEqual(FreeImage.GetHeight(dib), info.bmiHeader.biHeight); - FreeImage.UnloadEx(ref dib); - - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_32); - Assert.That(!dib.IsNull); - info = FreeImage.GetInfoEx(dib); - Assert.AreEqual(FreeImage.GetBPP(dib), info.bmiHeader.biBitCount); - Assert.AreEqual(FreeImage.GetWidth(dib), info.bmiHeader.biWidth); - Assert.AreEqual(FreeImage.GetHeight(dib), info.bmiHeader.biHeight); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_GetPixelFormat() - { - dib = iManager.GetBitmap(ImageType.Odd, ImageColorType.Type_01_Threshold); - Assert.IsFalse(dib.IsNull); - - Assert.AreEqual(PixelFormat.Format1bppIndexed, FreeImage.GetPixelFormat(dib)); - FreeImage.UnloadEx(ref dib); - - dib = iManager.GetBitmap(ImageType.Odd, ImageColorType.Type_04_Greyscale_Unordered); - Assert.IsFalse(dib.IsNull); - - Assert.AreEqual(PixelFormat.Format4bppIndexed, FreeImage.GetPixelFormat(dib)); - FreeImage.UnloadEx(ref dib); - - dib = iManager.GetBitmap(ImageType.Odd, ImageColorType.Type_16_555); - Assert.IsFalse(dib.IsNull); - - Assert.AreEqual(PixelFormat.Format16bppRgb555, FreeImage.GetPixelFormat(dib)); - FreeImage.UnloadEx(ref dib); - - dib = iManager.GetBitmap(ImageType.Odd, ImageColorType.Type_16_565); - Assert.IsFalse(dib.IsNull); - - Assert.AreEqual(PixelFormat.Format16bppRgb565, FreeImage.GetPixelFormat(dib)); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_GetFormatParameters() - { - uint bpp, red, green, blue; - FREE_IMAGE_TYPE type; - - Assert.IsTrue(FreeImage.GetFormatParameters(PixelFormat.Format16bppArgb1555, out type, out bpp, out red, out green, out blue)); - Assert.AreEqual(16, bpp); - Assert.AreEqual(red, FreeImage.FI16_555_RED_MASK); - Assert.AreEqual(green, FreeImage.FI16_555_GREEN_MASK); - Assert.AreEqual(blue, FreeImage.FI16_555_BLUE_MASK); - Assert.AreEqual(type, FREE_IMAGE_TYPE.FIT_BITMAP); - - Assert.IsTrue(FreeImage.GetFormatParameters(PixelFormat.Format16bppGrayScale, out type, out bpp, out red, out green, out blue)); - Assert.AreEqual(16, bpp); - Assert.AreEqual(red, 0); - Assert.AreEqual(green, 0); - Assert.AreEqual(blue, 0); - Assert.AreEqual(type, FREE_IMAGE_TYPE.FIT_UINT16); - - Assert.IsTrue(FreeImage.GetFormatParameters(PixelFormat.Format16bppRgb555, out type, out bpp, out red, out green, out blue)); - Assert.AreEqual(16, bpp); - Assert.AreEqual(red, FreeImage.FI16_555_RED_MASK); - Assert.AreEqual(green, FreeImage.FI16_555_GREEN_MASK); - Assert.AreEqual(blue, FreeImage.FI16_555_BLUE_MASK); - Assert.AreEqual(type, FREE_IMAGE_TYPE.FIT_BITMAP); - - Assert.IsTrue(FreeImage.GetFormatParameters(PixelFormat.Format16bppRgb565, out type, out bpp, out red, out green, out blue)); - Assert.AreEqual(16, bpp); - Assert.AreEqual(red, FreeImage.FI16_565_RED_MASK); - Assert.AreEqual(green, FreeImage.FI16_565_GREEN_MASK); - Assert.AreEqual(blue, FreeImage.FI16_565_BLUE_MASK); - Assert.AreEqual(type, FREE_IMAGE_TYPE.FIT_BITMAP); - - Assert.IsTrue(FreeImage.GetFormatParameters(PixelFormat.Format1bppIndexed, out type, out bpp, out red, out green, out blue)); - Assert.AreEqual(1, bpp); - Assert.AreEqual(red, 0); - Assert.AreEqual(green, 0); - Assert.AreEqual(blue, 0); - Assert.AreEqual(type, FREE_IMAGE_TYPE.FIT_BITMAP); - - Assert.IsTrue(FreeImage.GetFormatParameters(PixelFormat.Format24bppRgb, out type, out bpp, out red, out green, out blue)); - Assert.AreEqual(24, bpp); - Assert.AreEqual(red, FreeImage.FI_RGBA_RED_MASK); - Assert.AreEqual(green, FreeImage.FI_RGBA_GREEN_MASK); - Assert.AreEqual(blue, FreeImage.FI_RGBA_BLUE_MASK); - Assert.AreEqual(type, FREE_IMAGE_TYPE.FIT_BITMAP); - - Assert.IsTrue(FreeImage.GetFormatParameters(PixelFormat.Format32bppArgb, out type, out bpp, out red, out green, out blue)); - Assert.AreEqual(32, bpp); - Assert.AreEqual(red, FreeImage.FI_RGBA_RED_MASK); - Assert.AreEqual(green, FreeImage.FI_RGBA_GREEN_MASK); - Assert.AreEqual(blue, FreeImage.FI_RGBA_BLUE_MASK); - Assert.AreEqual(type, FREE_IMAGE_TYPE.FIT_BITMAP); - - Assert.IsTrue(FreeImage.GetFormatParameters(PixelFormat.Format32bppPArgb, out type, out bpp, out red, out green, out blue)); - Assert.AreEqual(32, bpp); - Assert.AreEqual(red, FreeImage.FI_RGBA_RED_MASK); - Assert.AreEqual(green, FreeImage.FI_RGBA_GREEN_MASK); - Assert.AreEqual(blue, FreeImage.FI_RGBA_BLUE_MASK); - Assert.AreEqual(type, FREE_IMAGE_TYPE.FIT_BITMAP); - - Assert.IsTrue(FreeImage.GetFormatParameters(PixelFormat.Format32bppRgb, out type, out bpp, out red, out green, out blue)); - Assert.AreEqual(32, bpp); - Assert.AreEqual(red, FreeImage.FI_RGBA_RED_MASK); - Assert.AreEqual(green, FreeImage.FI_RGBA_GREEN_MASK); - Assert.AreEqual(blue, FreeImage.FI_RGBA_BLUE_MASK); - Assert.AreEqual(type, FREE_IMAGE_TYPE.FIT_BITMAP); - - Assert.IsTrue(FreeImage.GetFormatParameters(PixelFormat.Format48bppRgb, out type, out bpp, out red, out green, out blue)); - Assert.AreEqual(48, bpp); - Assert.AreEqual(red, 0); - Assert.AreEqual(green, 0); - Assert.AreEqual(blue, 0); - Assert.AreEqual(type, FREE_IMAGE_TYPE.FIT_RGB16); - - Assert.IsTrue(FreeImage.GetFormatParameters(PixelFormat.Format4bppIndexed, out type, out bpp, out red, out green, out blue)); - Assert.AreEqual(4, bpp); - Assert.AreEqual(red, 0); - Assert.AreEqual(green, 0); - Assert.AreEqual(blue, 0); - Assert.AreEqual(type, FREE_IMAGE_TYPE.FIT_BITMAP); - - Assert.IsTrue(FreeImage.GetFormatParameters(PixelFormat.Format64bppArgb, out type, out bpp, out red, out green, out blue)); - Assert.AreEqual(64, bpp); - Assert.AreEqual(red, 0); - Assert.AreEqual(green, 0); - Assert.AreEqual(blue, 0); - Assert.AreEqual(type, FREE_IMAGE_TYPE.FIT_RGBA16); - - Assert.IsTrue(FreeImage.GetFormatParameters(PixelFormat.Format64bppPArgb, out type, out bpp, out red, out green, out blue)); - Assert.AreEqual(64, bpp); - Assert.AreEqual(red, 0); - Assert.AreEqual(green, 0); - Assert.AreEqual(blue, 0); - Assert.AreEqual(type, FREE_IMAGE_TYPE.FIT_RGBA16); - - Assert.IsTrue(FreeImage.GetFormatParameters(PixelFormat.Format8bppIndexed, out type, out bpp, out red, out green, out blue)); - Assert.AreEqual(8, bpp); - Assert.AreEqual(red, 0); - Assert.AreEqual(green, 0); - Assert.AreEqual(blue, 0); - Assert.AreEqual(type, FREE_IMAGE_TYPE.FIT_BITMAP); - } - - [Test] - public void FreeImage_Compare() - { - FIBITMAP dib2; - - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_01_Dither); - Assert.IsFalse(dib.IsNull); - dib2 = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_01_Threshold); - Assert.IsFalse(dib2.IsNull); - - Assert.IsFalse(FreeImage.Compare(dib, dib2, FREE_IMAGE_COMPARE_FLAGS.COMPLETE)); - Assert.IsTrue(FreeImage.Compare(dib, dib2, FREE_IMAGE_COMPARE_FLAGS.HEADER)); - - FreeImage.UnloadEx(ref dib); - FreeImage.UnloadEx(ref dib2); - - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_04_Greyscale_MinIsBlack); - dib2 = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_04_Greyscale_Unordered); - - Assert.IsFalse(FreeImage.Compare(dib, dib2, FREE_IMAGE_COMPARE_FLAGS.COMPLETE)); - - FreeImage.UnloadEx(ref dib); - FreeImage.UnloadEx(ref dib2); - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_32); - dib2 = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_32); - Assert.IsTrue(FreeImage.Compare(dib, dib2, FREE_IMAGE_COMPARE_FLAGS.COMPLETE)); - - FreeImage.UnloadEx(ref dib); - FreeImage.UnloadEx(ref dib2); - - dib = iManager.GetBitmap(ImageType.Metadata, ImageColorType.Type_01_Dither); - Assert.IsFalse(dib.IsNull); - dib2 = iManager.GetBitmap(ImageType.Metadata, ImageColorType.Type_01_Dither); - Assert.IsFalse(dib2.IsNull); - - Assert.IsTrue(FreeImage.Compare(dib, dib2, FREE_IMAGE_COMPARE_FLAGS.COMPLETE)); - - FreeImage.UnloadEx(ref dib); - FreeImage.UnloadEx(ref dib2); - - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_16_555); - Assert.IsFalse(dib.IsNull); - dib2 = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_16_555); - Assert.IsFalse(dib2.IsNull); - - Assert.IsTrue(FreeImage.Compare(dib, dib2, FREE_IMAGE_COMPARE_FLAGS.COMPLETE)); - - FreeImage.UnloadEx(ref dib); - FreeImage.UnloadEx(ref dib2); - - dib = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_16_565); - Assert.IsFalse(dib.IsNull); - dib2 = iManager.GetBitmap(ImageType.Even, ImageColorType.Type_16_565); - Assert.IsFalse(dib2.IsNull); - - Assert.IsTrue(FreeImage.Compare(dib, dib2, FREE_IMAGE_COMPARE_FLAGS.COMPLETE)); - - FreeImage.UnloadEx(ref dib); - FreeImage.UnloadEx(ref dib2); - } - - [Test] - public void FreeImage_CreateICCProfileEx() - { - FIICCPROFILE prof; - byte[] data = new byte[173]; - Random rand = new Random(DateTime.Now.Millisecond); - dib = FreeImage.AllocateT(FREE_IMAGE_TYPE.FIT_BITMAP, 1, 1, 1, 0, 0, 0); - Assert.IsFalse(dib.IsNull); - - prof = FreeImage.GetICCProfileEx(dib); - Assert.That(prof.DataPointer == IntPtr.Zero); - - rand.NextBytes(data); - prof = FreeImage.CreateICCProfileEx(dib, data); - Assert.That(prof.Size == data.Length); - for (int i = 0; i < data.Length; i++) - if (prof.Data[i] != data[i]) - Assert.Fail(); - - FreeImage.DestroyICCProfile(dib); - prof = FreeImage.GetICCProfileEx(dib); - Assert.That(prof.DataPointer == IntPtr.Zero); - - FreeImage.CreateICCProfileEx(dib, new byte[0], 0); - prof = FreeImage.GetICCProfileEx(dib); - Assert.That(prof.DataPointer == IntPtr.Zero); - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_ConvertColorDepth() - { - int bpp = 1; - FIBITMAP dib2; - - dib = FreeImage.AllocateT(FREE_IMAGE_TYPE.FIT_BITMAP, 80, 80, 1, 0, 0, 0); - Assert.IsFalse(dib.IsNull); - - do - { - dib2 = FreeImage.ConvertColorDepth(dib, (FREE_IMAGE_COLOR_DEPTH)bpp); - Assert.IsFalse(dib2.IsNull); - Assert.AreEqual(bpp, FreeImage.GetBPP(dib2)); - if (dib != dib2) - FreeImage.UnloadEx(ref dib2); - } while (0 != (bpp = FreeImage.GetNextColorDepth(bpp))); - - FreeImage.UnloadEx(ref dib); - - dib = FreeImage.AllocateT(FREE_IMAGE_TYPE.FIT_BITMAP, 80, 80, 32, - FreeImage.FI_RGBA_RED_MASK, FreeImage.FI_RGBA_GREEN_MASK, FreeImage.FI_RGBA_BLUE_MASK); - Assert.IsFalse(dib.IsNull); - bpp = 32; - - do - { - dib2 = FreeImage.ConvertColorDepth(dib, (FREE_IMAGE_COLOR_DEPTH)bpp); - Assert.IsFalse(dib2.IsNull); - Assert.AreEqual(bpp, FreeImage.GetBPP(dib2)); - if (dib != dib2) - FreeImage.UnloadEx(ref dib2); - } while (0 != (bpp = FreeImage.GetPrevousColorDepth(bpp))); - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_GetNextColorDepth() - { - Assert.AreEqual(0, FreeImage.GetNextColorDepth(5)); - Assert.AreEqual(0, FreeImage.GetNextColorDepth(0)); - Assert.AreEqual(4, FreeImage.GetNextColorDepth(1)); - Assert.AreEqual(8, FreeImage.GetNextColorDepth(4)); - Assert.AreEqual(16, FreeImage.GetNextColorDepth(8)); - Assert.AreEqual(24, FreeImage.GetNextColorDepth(16)); - Assert.AreEqual(32, FreeImage.GetNextColorDepth(24)); - Assert.AreEqual(0, FreeImage.GetNextColorDepth(32)); - } - - [Test] - public void FreeImage_GetPrevousColorDepth() - { - Assert.AreEqual(0, FreeImage.GetNextColorDepth(5)); - Assert.AreEqual(0, FreeImage.GetNextColorDepth(0)); - Assert.AreEqual(4, FreeImage.GetNextColorDepth(1)); - Assert.AreEqual(8, FreeImage.GetNextColorDepth(4)); - Assert.AreEqual(16, FreeImage.GetNextColorDepth(8)); - Assert.AreEqual(24, FreeImage.GetNextColorDepth(16)); - Assert.AreEqual(32, FreeImage.GetNextColorDepth(24)); - Assert.AreEqual(0, FreeImage.GetNextColorDepth(32)); - } - - [Test] - public unsafe void FreeImage_PtrToStr() - { - string testString; - string resString; - IntPtr buffer; - int index; - - testString = "Test string"; - buffer = Marshal.AllocHGlobal(testString.Length + 1); - - for (index = 0; index < testString.Length; index++) - { - Marshal.WriteByte(buffer, index, (byte)testString[index]); - } - Marshal.WriteByte(buffer, index, (byte)0); - - resString = FreeImage.PtrToStr((byte*)buffer); - Assert.That(resString == testString); - - Marshal.FreeHGlobal(buffer); - - testString = @"äöü?=§%/!)§(%&)(§"; - buffer = Marshal.AllocHGlobal(testString.Length + 1); - - for (index = 0; index < testString.Length; index++) - { - Marshal.WriteByte(buffer, index, (byte)testString[index]); - } - Marshal.WriteByte(buffer, index, (byte)0); - - resString = FreeImage.PtrToStr((byte*)buffer); - Assert.That(resString == testString); - - Marshal.FreeHGlobal(buffer); - } - - [Test] - public void FreeImage_CopyMetadata() - { - dib = iManager.GetBitmap(ImageType.Metadata, ImageColorType.Type_01_Dither); - Assert.IsFalse(dib.IsNull); - int mdCount = 0; - - FIBITMAP dib2 = FreeImage.Allocate(1, 1, 1, 0, 0, 0); - Assert.IsFalse(dib2.IsNull); - - FREE_IMAGE_MDMODEL[] modelList = (FREE_IMAGE_MDMODEL[])Enum.GetValues(typeof(FREE_IMAGE_MDMODEL)); - FITAG tag, tag2; - FIMETADATA mdHandle; - - foreach (FREE_IMAGE_MDMODEL model in modelList) - { - mdHandle = FreeImage.FindFirstMetadata(model, dib2, out tag); - Assert.IsTrue(mdHandle.IsNull); - mdCount += (int)FreeImage.GetMetadataCount(model, dib); - } - - Assert.AreEqual(mdCount, FreeImage.CloneMetadataEx(dib, dib2, FREE_IMAGE_METADATA_COPY.CLEAR_EXISTING)); - - foreach (FREE_IMAGE_MDMODEL model in modelList) - { - mdHandle = FreeImage.FindFirstMetadata(model, dib, out tag); - if (!mdHandle.IsNull) - { - do - { - Assert.IsTrue(FreeImage.GetMetadata(model, dib2, FreeImage.GetTagKey(tag), out tag2)); - Assert.That(FreeImage.GetTagCount(tag) == FreeImage.GetTagCount(tag2)); - Assert.That(FreeImage.GetTagDescription(tag) == FreeImage.GetTagDescription(tag2)); - Assert.That(FreeImage.GetTagID(tag) == FreeImage.GetTagID(tag2)); - Assert.That(FreeImage.GetTagKey(tag) == FreeImage.GetTagKey(tag2)); - Assert.That(FreeImage.GetTagLength(tag) == FreeImage.GetTagLength(tag2)); - Assert.That(FreeImage.GetTagType(tag) == FreeImage.GetTagType(tag2)); - } - while (FreeImage.FindNextMetadata(mdHandle, out tag)); - FreeImage.FindCloseMetadata(mdHandle); - } - } - - Assert.AreEqual(0, FreeImage.CloneMetadataEx(dib, dib2, FREE_IMAGE_METADATA_COPY.KEEP_EXISITNG)); - - foreach (FREE_IMAGE_MDMODEL model in modelList) - { - mdHandle = FreeImage.FindFirstMetadata(model, dib, out tag); - if (!mdHandle.IsNull) - { - do - { - Assert.IsTrue(FreeImage.GetMetadata(model, dib2, FreeImage.GetTagKey(tag), out tag2)); - Assert.AreEqual(FreeImage.GetTagCount(tag), FreeImage.GetTagCount(tag2)); - Assert.AreEqual(FreeImage.GetTagDescription(tag), FreeImage.GetTagDescription(tag2)); - Assert.AreEqual(FreeImage.GetTagID(tag), FreeImage.GetTagID(tag2)); - Assert.AreEqual(FreeImage.GetTagKey(tag), FreeImage.GetTagKey(tag2)); - Assert.AreEqual(FreeImage.GetTagLength(tag), FreeImage.GetTagLength(tag2)); - Assert.AreEqual(FreeImage.GetTagType(tag), FreeImage.GetTagType(tag2)); - } - while (FreeImage.FindNextMetadata(mdHandle, out tag)); - FreeImage.FindCloseMetadata(mdHandle); - } - } - - const string newTagDescription = "NEW_TAG_DESCRIPTION"; - - Assert.IsTrue(FreeImage.GetMetadata(FREE_IMAGE_MDMODEL.FIMD_EXIF_MAIN, dib, "Copyright", out tag)); - Assert.IsTrue(FreeImage.SetTagDescription(tag, newTagDescription)); - Assert.AreEqual(mdCount, FreeImage.CloneMetadataEx(dib, dib2, FREE_IMAGE_METADATA_COPY.REPLACE_EXISTING)); - Assert.IsTrue(FreeImage.GetMetadata(FREE_IMAGE_MDMODEL.FIMD_EXIF_MAIN, dib2, "Copyright", out tag2)); - Assert.AreEqual(newTagDescription, FreeImage.GetTagDescription(tag2)); - - FreeImage.UnloadEx(ref dib2); - FreeImage.UnloadEx(ref dib); - - dib2 = FreeImage.Allocate(1, 1, 1, 0, 0, 0); - dib = FreeImage.Allocate(1, 1, 1, 0, 0, 0); - - Assert.AreEqual(0, FreeImage.CloneMetadataEx(dib, dib2, FREE_IMAGE_METADATA_COPY.CLEAR_EXISTING)); - - FreeImage.UnloadEx(ref dib2); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_GetImageComment() - { - dib = FreeImage.Allocate(1, 1, 1, 0, 0, 0); - Assert.IsFalse(dib.IsNull); - const string comment = "C O M M E N T"; - - Assert.IsNull(FreeImage.GetImageComment(dib)); - Assert.IsTrue(FreeImage.SetImageComment(dib, comment)); - Assert.AreEqual(comment, FreeImage.GetImageComment(dib)); - Assert.IsTrue(FreeImage.SetImageComment(dib, null)); - Assert.IsNull(FreeImage.GetImageComment(dib)); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_SetImageComment() - { - dib = FreeImage.Allocate(1, 1, 1, 0, 0, 0); - Assert.IsFalse(dib.IsNull); - const string comment = "C O M M E N T"; - - Assert.IsNull(FreeImage.GetImageComment(dib)); - Assert.IsTrue(FreeImage.SetImageComment(dib, comment)); - Assert.AreEqual(comment, FreeImage.GetImageComment(dib)); - Assert.IsTrue(FreeImage.SetImageComment(dib, null)); - Assert.IsNull(FreeImage.GetImageComment(dib)); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_GetMetadata() - { - MetadataTag tag; - - dib = iManager.GetBitmap(ImageType.Metadata, ImageColorType.Type_01_Dither); - Assert.IsFalse(dib.IsNull); - - Assert.IsFalse(FreeImage.GetMetadata(FREE_IMAGE_MDMODEL.FIMD_EXIF_MAIN, dib, "~~~~~", out tag)); - Assert.IsNull(tag); - - Assert.IsTrue(FreeImage.GetMetadata(FREE_IMAGE_MDMODEL.FIMD_EXIF_MAIN, dib, "Artist", out tag)); - Assert.IsFalse(tag.tag.IsNull); - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_SetMetadata() - { - MetadataTag tag; - Random rand = new Random(); - - dib = FreeImage.Allocate(1, 1, 1, 0, 0, 0); - Assert.IsFalse(dib.IsNull); - - ushort value = (ushort)rand.Next(); - - tag = new MetadataTag(FREE_IMAGE_MDMODEL.FIMD_CUSTOM); - tag.ID = value; - - Assert.IsTrue(FreeImage.SetMetadata(FREE_IMAGE_MDMODEL.FIMD_CUSTOM, dib, "~~~~~", tag)); - Assert.IsTrue(FreeImage.GetMetadata(FREE_IMAGE_MDMODEL.FIMD_CUSTOM, dib, "~~~~~", out tag)); - Assert.AreEqual(value, tag.ID); - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_FindFirstMetadata() - { - MetadataTag tag; - FIMETADATA mdHandle; - dib = FreeImage.Allocate(1, 1, 1, 0, 0, 0); - Assert.IsFalse(dib.IsNull); - - FREE_IMAGE_MDMODEL[] models = (FREE_IMAGE_MDMODEL[])Enum.GetValues(typeof(FREE_IMAGE_MDMODEL)); - foreach (FREE_IMAGE_MDMODEL model in models) - { - mdHandle = FreeImage.FindFirstMetadata(model, dib, out tag); - Assert.IsTrue(mdHandle.IsNull); - } - - tag = new MetadataTag(FREE_IMAGE_MDMODEL.FIMD_COMMENTS); - tag.Key = "KEY"; - tag.Value = 12345; - tag.AddToImage(dib); - - mdHandle = FreeImage.FindFirstMetadata(FREE_IMAGE_MDMODEL.FIMD_COMMENTS, dib, out tag); - Assert.IsFalse(mdHandle.IsNull); - - FreeImage.FindCloseMetadata(mdHandle); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_FindNextMetadata() - { - MetadataTag tag; - FIMETADATA mdHandle; - dib = FreeImage.Allocate(1, 1, 1, 0, 0, 0); - Assert.IsFalse(dib.IsNull); - - FREE_IMAGE_MDMODEL[] models = (FREE_IMAGE_MDMODEL[])Enum.GetValues(typeof(FREE_IMAGE_MDMODEL)); - foreach (FREE_IMAGE_MDMODEL model in models) - { - mdHandle = FreeImage.FindFirstMetadata(model, dib, out tag); - Assert.IsTrue(mdHandle.IsNull); - } - - tag = new MetadataTag(FREE_IMAGE_MDMODEL.FIMD_COMMENTS); - tag.Key = "KEY1"; - tag.Value = 12345; - tag.AddToImage(dib); - - tag = new MetadataTag(FREE_IMAGE_MDMODEL.FIMD_COMMENTS); - tag.Key = "KEY2"; - tag.Value = 54321; - tag.AddToImage(dib); - - mdHandle = FreeImage.FindFirstMetadata(FREE_IMAGE_MDMODEL.FIMD_COMMENTS, dib, out tag); - Assert.IsFalse(mdHandle.IsNull); - - Assert.IsTrue(FreeImage.FindNextMetadata(mdHandle, out tag)); - Assert.IsFalse(FreeImage.FindNextMetadata(mdHandle, out tag)); - - FreeImage.FindCloseMetadata(mdHandle); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_SetGetTransparencyTableEx() - { - dib = FreeImage.Allocate(10, 10, 6, 0, 0, 0); - Assert.IsFalse(dib.IsNull); - - byte[] transTable = FreeImage.GetTransparencyTableEx(dib); - Assert.That(transTable.Length == 0); - - Random rand = new Random(); - transTable = new byte[rand.Next(0, 255)]; - int length = transTable.Length; - - for (int i = 0; i < transTable.Length; i++) - transTable[i] = (byte)i; - - FreeImage.SetTransparencyTable(dib, transTable); - transTable = null; - transTable = FreeImage.GetTransparencyTableEx(dib); - Assert.That(transTable.Length == length); - for (int i = 0; i < transTable.Length; i++) - Assert.That(transTable[i] == i); - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_GetUniqueColors() - { - Palette palette; - - // - // 1bpp - // - - dib = FreeImage.Allocate(10, 1, 1, 0, 0, 0); - Assert.IsFalse(dib.IsNull); - - palette = new Palette(dib); - palette[0] = Color.FromArgb(43, 255, 255, 255); - palette[1] = Color.FromArgb(222, 0, 0, 0); - - Scanline sl1bit = new Scanline(dib, 0); - for (int x = 0; x < sl1bit.Length; x++) - { - sl1bit[x] = 0; - } - - Assert.AreEqual(1, FreeImage.GetUniqueColors(dib)); - - sl1bit[5] = 1; - Assert.AreEqual(2, FreeImage.GetUniqueColors(dib)); - - palette[1] = Color.FromArgb(222, 255, 255, 255); - Assert.AreEqual(1, FreeImage.GetUniqueColors(dib)); - - sl1bit[5] = 0; - Assert.AreEqual(1, FreeImage.GetUniqueColors(dib)); - - FreeImage.UnloadEx(ref dib); - - // - // 4bpp - // - - dib = FreeImage.Allocate(10, 1, 4, 0, 0, 0); - Assert.IsFalse(dib.IsNull); - - palette = new Palette(dib); - palette[0] = new RGBQUAD(Color.FromArgb(43, 255, 255, 255)); - palette[1] = new RGBQUAD(Color.FromArgb(222, 51, 2, 211)); - palette[2] = new RGBQUAD(Color.FromArgb(29, 25, 31, 52)); - palette[3] = new RGBQUAD(Color.FromArgb(173, 142, 61, 178)); - palette[4] = new RGBQUAD(Color.FromArgb(143, 41, 67, 199)); - palette[5] = new RGBQUAD(Color.FromArgb(2, 0, 2, 221)); - - Scanline sl4bit = new Scanline(dib, 0); - - for (int x = 0; x < sl4bit.Length; x++) - { - sl4bit[x] = 0; - } - - Assert.AreEqual(1, FreeImage.GetUniqueColors(dib)); - - sl4bit[1] = 1; - Assert.AreEqual(2, FreeImage.GetUniqueColors(dib)); - - sl4bit[2] = 1; - Assert.AreEqual(2, FreeImage.GetUniqueColors(dib)); - - sl4bit[3] = 2; - Assert.AreEqual(3, FreeImage.GetUniqueColors(dib)); - - sl4bit[4] = 3; - Assert.AreEqual(4, FreeImage.GetUniqueColors(dib)); - - sl4bit[5] = 4; - Assert.AreEqual(5, FreeImage.GetUniqueColors(dib)); - - sl4bit[6] = 5; - Assert.AreEqual(6, FreeImage.GetUniqueColors(dib)); - - sl4bit[7] = 6; - Assert.AreEqual(7, FreeImage.GetUniqueColors(dib)); - - sl4bit[8] = 7; - Assert.AreEqual(7, FreeImage.GetUniqueColors(dib)); - - sl4bit[9] = 7; - Assert.AreEqual(7, FreeImage.GetUniqueColors(dib)); - - FreeImage.UnloadEx(ref dib); - - // - // 8bpp - // - - dib = FreeImage.Allocate(10, 1, 8, 0, 0, 0); - Assert.IsFalse(dib.IsNull); - - palette = new Palette(dib); - palette[0] = new RGBQUAD(Color.FromArgb(43, 255, 255, 255)); - palette[1] = new RGBQUAD(Color.FromArgb(222, 51, 2, 211)); - palette[2] = new RGBQUAD(Color.FromArgb(29, 25, 31, 52)); - palette[3] = new RGBQUAD(Color.FromArgb(173, 142, 61, 178)); - palette[4] = new RGBQUAD(Color.FromArgb(143, 41, 67, 199)); - palette[5] = new RGBQUAD(Color.FromArgb(2, 0, 2, 221)); - - Scanline sl8bit = new Scanline(dib, 0); - - for (int x = 0; x < sl8bit.Length; x++) - { - sl8bit[x] = 0; - } - - Assert.AreEqual(1, FreeImage.GetUniqueColors(dib)); - - sl8bit[1] = 1; - Assert.AreEqual(2, FreeImage.GetUniqueColors(dib)); - - sl8bit[2] = 2; - Assert.AreEqual(3, FreeImage.GetUniqueColors(dib)); - - sl8bit[3] = 3; - Assert.AreEqual(4, FreeImage.GetUniqueColors(dib)); - - sl8bit[4] = 4; - Assert.AreEqual(5, FreeImage.GetUniqueColors(dib)); - - sl8bit[5] = 6; - Assert.AreEqual(6, FreeImage.GetUniqueColors(dib)); - - sl8bit[5] = 7; - Assert.AreEqual(6, FreeImage.GetUniqueColors(dib)); - - sl8bit[5] = 8; - Assert.AreEqual(6, FreeImage.GetUniqueColors(dib)); - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_CreateShrunkenPaletteLUT() - { - Random rand = new Random(); - dib = FreeImage.Allocate(1, 1, 8, 0, 0, 0); - Assert.IsFalse(dib.IsNull); - - Palette palette = new Palette(dib); - byte[] lut; - int colors; - - for (int x = 0; x < palette.Length; x++) - { - palette[x] = 0xFF000000; - } - - lut = FreeImage.CreateShrunkenPaletteLUT(dib, out colors); - Assert.AreEqual(1, colors); - - for (int x = 0; x < palette.Length; x++) - { - Assert.AreEqual(0, lut[x]); - } - - palette[1] = 0x00000001; - lut = FreeImage.CreateShrunkenPaletteLUT(dib, out colors); - Assert.AreEqual(2, colors); - - Assert.AreEqual(0, lut[0]); - Assert.AreEqual(1, lut[1]); - - for (int x = 2; x < palette.Length; x++) - { - Assert.AreEqual(0, lut[x]); - } - - for (int x = 0; x < palette.Length; x++) - { - palette[x] = (uint)x; - } - - lut = FreeImage.CreateShrunkenPaletteLUT(dib, out colors); - Assert.AreEqual(256, colors); - - for (int x = 0; x < palette.Length; x++) - { - Assert.AreEqual(x, lut[x]); - } - - uint[] testColors = new uint[] { 0xFF4F387C, 0xFF749178, 0xFF84D51A, 0xFF746B71, 0x74718163, 0x91648106 }; - palette[0] = testColors[0]; - palette[1] = testColors[1]; - palette[2] = testColors[2]; - palette[3] = testColors[3]; - palette[4] = testColors[4]; - palette[5] = testColors[5]; - - for (int x = testColors.Length; x < palette.Length; x++) - { - palette[x] = testColors[rand.Next(0, testColors.Length - 1)]; - } - - lut = FreeImage.CreateShrunkenPaletteLUT(dib, out colors); - Assert.AreEqual(testColors.Length, colors); - - FreeImage.UnloadEx(ref dib); - } - - [Test] - public void FreeImage_Rotate4bit() - { - Palette orgPal, rotPal; - FIBITMAP rotated; - byte index; - dib = FreeImage.Allocate(2, 3, 4, 0, 0, 0); - Assert.IsFalse(dib.IsNull); - - index = 1; if (!FreeImage.SetPixelIndex(dib, 0, 0, ref index)) throw new Exception(); - index = 2; if (!FreeImage.SetPixelIndex(dib, 1, 0, ref index)) throw new Exception(); - index = 3; if (!FreeImage.SetPixelIndex(dib, 0, 1, ref index)) throw new Exception(); - index = 4; if (!FreeImage.SetPixelIndex(dib, 1, 1, ref index)) throw new Exception(); - index = 5; if (!FreeImage.SetPixelIndex(dib, 0, 2, ref index)) throw new Exception(); - index = 6; if (!FreeImage.SetPixelIndex(dib, 1, 2, ref index)) throw new Exception(); - - // - // 90 deg - // - - rotated = FreeImage.Rotate4bit(dib, 90d); - Assert.IsFalse(rotated.IsNull); - Assert.AreEqual(3, FreeImage.GetWidth(rotated)); - Assert.AreEqual(2, FreeImage.GetHeight(rotated)); - Assert.AreEqual(FREE_IMAGE_TYPE.FIT_BITMAP, FreeImage.GetImageType(rotated)); - Assert.AreEqual(4, FreeImage.GetBPP(rotated)); - orgPal = new Palette(dib); - rotPal = new Palette(rotated); - Assert.IsNotNull(orgPal); - Assert.IsNotNull(rotPal); - Assert.AreEqual(orgPal.Length, rotPal.Length); - for (int i = 0; i < orgPal.Length; i++) - { - Assert.AreEqual(orgPal[i], rotPal[i]); - } - - FreeImage.GetPixelIndex(rotated, 0, 0, out index); - Assert.AreEqual(5, index); - FreeImage.GetPixelIndex(rotated, 1, 0, out index); - Assert.AreEqual(3, index); - FreeImage.GetPixelIndex(rotated, 2, 0, out index); - Assert.AreEqual(1, index); - FreeImage.GetPixelIndex(rotated, 0, 1, out index); - Assert.AreEqual(6, index); - FreeImage.GetPixelIndex(rotated, 1, 1, out index); - Assert.AreEqual(4, index); - FreeImage.GetPixelIndex(rotated, 2, 1, out index); - Assert.AreEqual(2, index); - FreeImage.UnloadEx(ref rotated); - - // - // 180 deg - // - - rotated = FreeImage.Rotate4bit(dib, 180d); - Assert.IsFalse(rotated.IsNull); - Assert.AreEqual(FreeImage.GetWidth(dib), FreeImage.GetWidth(rotated)); - Assert.AreEqual(FreeImage.GetHeight(dib), FreeImage.GetHeight(rotated)); - Assert.AreEqual(FREE_IMAGE_TYPE.FIT_BITMAP, FreeImage.GetImageType(rotated)); - Assert.AreEqual(4, FreeImage.GetBPP(rotated)); - orgPal = new Palette(dib); - rotPal = new Palette(rotated); - Assert.IsNotNull(orgPal); - Assert.IsNotNull(rotPal); - Assert.AreEqual(orgPal.Length, rotPal.Length); - for (int i = 0; i < orgPal.Length; i++) - { - Assert.AreEqual(orgPal[i], rotPal[i]); - } - - FreeImage.GetPixelIndex(rotated, 0, 0, out index); - Assert.AreEqual(6, index); - FreeImage.GetPixelIndex(rotated, 1, 0, out index); - Assert.AreEqual(5, index); - FreeImage.GetPixelIndex(rotated, 0, 1, out index); - Assert.AreEqual(4, index); - FreeImage.GetPixelIndex(rotated, 1, 1, out index); - Assert.AreEqual(3, index); - FreeImage.GetPixelIndex(rotated, 0, 2, out index); - Assert.AreEqual(2, index); - FreeImage.GetPixelIndex(rotated, 1, 2, out index); - Assert.AreEqual(1, index); - FreeImage.UnloadEx(ref rotated); - - // - // 270 deg - // - - rotated = FreeImage.Rotate4bit(dib, 270d); - Assert.IsFalse(rotated.IsNull); - Assert.AreEqual(3, FreeImage.GetWidth(rotated)); - Assert.AreEqual(2, FreeImage.GetHeight(rotated)); - Assert.AreEqual(FREE_IMAGE_TYPE.FIT_BITMAP, FreeImage.GetImageType(rotated)); - Assert.AreEqual(4, FreeImage.GetBPP(rotated)); - orgPal = new Palette(dib); - rotPal = new Palette(rotated); - Assert.IsNotNull(orgPal); - Assert.IsNotNull(rotPal); - Assert.AreEqual(orgPal.Length, rotPal.Length); - for (int i = 0; i < orgPal.Length; i++) - { - Assert.AreEqual(orgPal[i], rotPal[i]); - } - - FreeImage.GetPixelIndex(rotated, 0, 0, out index); - Assert.AreEqual(2, index); - FreeImage.GetPixelIndex(rotated, 1, 0, out index); - Assert.AreEqual(4, index); - FreeImage.GetPixelIndex(rotated, 2, 0, out index); - Assert.AreEqual(6, index); - FreeImage.GetPixelIndex(rotated, 0, 1, out index); - Assert.AreEqual(1, index); - FreeImage.GetPixelIndex(rotated, 1, 1, out index); - Assert.AreEqual(3, index); - FreeImage.GetPixelIndex(rotated, 2, 1, out index); - Assert.AreEqual(5, index); - FreeImage.UnloadEx(ref rotated); - - FreeImage.UnloadEx(ref dib); - } - } - - [TestFixture] - public class FreeImageBitmapTest - { - ImageManager iManager = new ImageManager(); - FIBITMAP dib = new FIBITMAP(); - string freeImageCallback = null; - - [TestFixtureSetUp] - public void Init() - { - FreeImageEngine.Message += new OutputMessageFunction(FreeImage_Message); - } - - [TestFixtureTearDown] - public void DeInit() - { - FreeImageEngine.Message -= new OutputMessageFunction(FreeImage_Message); - } - - [SetUp] - public void InitEachTime() - { - } - - [TearDown] - public void DeInitEachTime() - { - } - - void FreeImage_Message(FREE_IMAGE_FORMAT fif, string message) - { - freeImageCallback = message; - } - - [Test] - public void FreeImageBitmapConstructors() - { - Image bitmap; - FreeImageBitmap fib, fib2; - Stream stream; - Graphics g; - string filename = iManager.GetBitmapPath(ImageType.Odd, ImageColorType.Type_24); - Assert.IsNotNull(filename); - Assert.IsTrue(File.Exists(filename)); - - bitmap = new Bitmap(filename); - Assert.IsNotNull(bitmap); - - fib = new FreeImageBitmap(bitmap); - Assert.AreEqual(bitmap.Width, fib.Width); - Assert.AreEqual(bitmap.Height, fib.Height); - fib.Dispose(); - fib.Dispose(); - - fib = new FreeImageBitmap(bitmap, new Size(100, 100)); - Assert.AreEqual(100, fib.Width); - Assert.AreEqual(100, fib.Height); - fib.Dispose(); - bitmap.Dispose(); - - fib = new FreeImageBitmap(filename); - fib.Dispose(); - - fib = new FreeImageBitmap(filename, FREE_IMAGE_LOAD_FLAGS.DEFAULT); - fib.Dispose(); - - fib = new FreeImageBitmap(filename, FREE_IMAGE_FORMAT.FIF_UNKNOWN); - fib.Dispose(); - - fib = new FreeImageBitmap(filename, FREE_IMAGE_FORMAT.FIF_UNKNOWN, FREE_IMAGE_LOAD_FLAGS.DEFAULT); - fib.Dispose(); - - stream = new FileStream(filename, FileMode.Open); - Assert.IsNotNull(stream); - - fib = new FreeImageBitmap(stream); - fib.Dispose(); - stream.Seek(0, SeekOrigin.Begin); - - fib = new FreeImageBitmap(stream, FREE_IMAGE_FORMAT.FIF_UNKNOWN); - fib.Dispose(); - stream.Seek(0, SeekOrigin.Begin); - - fib = new FreeImageBitmap(stream, FREE_IMAGE_LOAD_FLAGS.DEFAULT); - fib.Dispose(); - stream.Seek(0, SeekOrigin.Begin); - - fib = new FreeImageBitmap(stream, FREE_IMAGE_FORMAT.FIF_UNKNOWN, FREE_IMAGE_LOAD_FLAGS.DEFAULT); - fib.Dispose(); - stream.Dispose(); - - fib = new FreeImageBitmap(100, 100); - Assert.AreEqual(24, fib.ColorDepth); - Assert.AreEqual(100, fib.Width); - Assert.AreEqual(100, fib.Height); - fib.Dispose(); - - using (bitmap = new Bitmap(filename)) - { - Assert.IsNotNull(bitmap); - using (g = Graphics.FromImage(bitmap)) - { - Assert.IsNotNull(g); - fib = new FreeImageBitmap(100, 100, g); - } - } - fib.Dispose(); - - fib = new FreeImageBitmap(100, 100, PixelFormat.Format1bppIndexed); - Assert.AreEqual(PixelFormat.Format1bppIndexed, fib.PixelFormat); - Assert.AreEqual(100, fib.Width); - Assert.AreEqual(100, fib.Height); - fib.Dispose(); - - fib = new FreeImageBitmap(100, 100, PixelFormat.Format4bppIndexed); - Assert.AreEqual(PixelFormat.Format4bppIndexed, fib.PixelFormat); - Assert.AreEqual(100, fib.Width); - Assert.AreEqual(100, fib.Height); - fib.Dispose(); - - fib = new FreeImageBitmap(100, 100, PixelFormat.Format8bppIndexed); - Assert.AreEqual(PixelFormat.Format8bppIndexed, fib.PixelFormat); - Assert.AreEqual(100, fib.Width); - Assert.AreEqual(100, fib.Height); - fib.Dispose(); - - fib = new FreeImageBitmap(100, 100, PixelFormat.Format16bppRgb555); - Assert.AreEqual(PixelFormat.Format16bppRgb555, fib.PixelFormat); - Assert.AreEqual(100, fib.Width); - Assert.AreEqual(100, fib.Height); - fib.Dispose(); - - fib = new FreeImageBitmap(100, 100, PixelFormat.Format16bppRgb565); - Assert.AreEqual(PixelFormat.Format16bppRgb565, fib.PixelFormat); - Assert.AreEqual(100, fib.Width); - Assert.AreEqual(100, fib.Height); - fib.Dispose(); - - fib = new FreeImageBitmap(100, 100, PixelFormat.Format24bppRgb); - Assert.AreEqual(PixelFormat.Format24bppRgb, fib.PixelFormat); - Assert.AreEqual(100, fib.Width); - Assert.AreEqual(100, fib.Height); - fib.Dispose(); - - fib = new FreeImageBitmap(100, 100, PixelFormat.Format32bppArgb); - Assert.AreEqual(PixelFormat.Format32bppArgb, fib.PixelFormat); - Assert.AreEqual(100, fib.Width); - Assert.AreEqual(100, fib.Height); - - stream = new MemoryStream(); - BinaryFormatter formatter = new BinaryFormatter(); - - formatter.Serialize(stream, fib); - Assert.Greater(stream.Length, 0); - stream.Position = 0; - - fib2 = formatter.Deserialize(stream) as FreeImageBitmap; - stream.Dispose(); - fib.Dispose(); - fib2.Dispose(); - - fib = new FreeImageBitmap(filename); - fib2 = new FreeImageBitmap(fib); - fib2.Dispose(); - - fib2 = new FreeImageBitmap(fib, new Size(31, 22)); - Assert.AreEqual(31, fib2.Width); - Assert.AreEqual(22, fib2.Height); - fib2.Dispose(); - fib.Dispose(); - - dib = FreeImage.Allocate(1000, 800, 24, 0xFF0000, 0xFF00, 0xFF); - Assert.IsFalse(dib.IsNull); - - fib = new FreeImageBitmap(1000, 800, -(int)FreeImage.GetPitch(dib), FreeImage.GetPixelFormat(dib), FreeImage.GetScanLine(dib, 0)); - fib.Dispose(); - FreeImage.UnloadEx(ref dib); - } - - [Test] - public unsafe void Properties() - { - string filename = iManager.GetBitmapPath(ImageType.Even, ImageColorType.Type_32); - Assert.IsNotNull(filename); - Assert.IsTrue(File.Exists(filename)); - - FreeImageBitmap fib = new FreeImageBitmap(filename); - Assert.IsFalse(fib.HasPalette); - - try - { - Palette palette = fib.Palette; - Assert.Fail(); - } - catch - { - } - - Assert.IsFalse(fib.HasBackgroundColor); - fib.BackgroundColor = Color.LightSeaGreen; - Assert.IsTrue(fib.HasBackgroundColor); - Assert.That( - Color.LightSeaGreen.B == fib.BackgroundColor.Value.B && - Color.LightSeaGreen.G == fib.BackgroundColor.Value.G && - Color.LightSeaGreen.R == fib.BackgroundColor.Value.R); - fib.BackgroundColor = null; - Assert.IsFalse(fib.HasBackgroundColor); - fib.Dispose(); - - fib = new FreeImageBitmap(100, 100, PixelFormat.Format1bppIndexed); - ImageFlags flags = (ImageFlags)fib.Flags; - Assert.That((flags & ImageFlags.ColorSpaceRgb) == ImageFlags.ColorSpaceRgb); - Assert.That((flags & ImageFlags.HasAlpha) != ImageFlags.HasAlpha); - Assert.That((flags & ImageFlags.HasRealDpi) != ImageFlags.HasRealDpi); - Assert.That((flags & ImageFlags.HasTranslucent) != ImageFlags.HasTranslucent); - fib.Dispose(); - - dib = FreeImage.Allocate(100, 100, 32, 0xFF0000, 0xFF00, 0xFF); - FIICCPROFILE* prof = (FIICCPROFILE*)FreeImage.CreateICCProfile(dib, new byte[] { 0, 1, 2, 3 }, 4); - fib = new FreeImageBitmap(dib); - Scanline sc = (Scanline)fib.GetScanline(0); - RGBQUAD rgbq = sc[0]; - rgbq.rgbReserved = 127; - sc[0] = rgbq; - flags = (ImageFlags)fib.Flags; - Assert.That((flags & ImageFlags.HasAlpha) == ImageFlags.HasAlpha); - Assert.That((flags & ImageFlags.HasRealDpi) != ImageFlags.HasRealDpi); - Assert.That((flags & ImageFlags.HasTranslucent) == ImageFlags.HasTranslucent); - fib.Dispose(); - fib = null; - GC.Collect(2, GCCollectionMode.Forced); - GC.WaitForPendingFinalizers(); - - fib = new FreeImageBitmap(iManager.GetBitmapPath(ImageType.Metadata, ImageColorType.Type_01_Dither)); - int[] propList = fib.PropertyIdList; - Assert.IsNotNull(propList); - Assert.Greater(propList.Length, 0); - PropertyItem[] propItemList = fib.PropertyItems; - Assert.IsNotNull(propItemList); - Assert.Greater(propItemList.Length, 0); - Assert.IsNotNull(fib.RawFormat); - fib.Dispose(); - - fib = new FreeImageBitmap(iManager.GetBitmapPath(ImageType.Multipaged, ImageColorType.Type_01_Dither)); - Assert.Greater(fib.FrameCount, 1); - fib.Dispose(); - } - - [Test] - public void GetBounds() - { - Random rand = new Random(); - int height = rand.Next(1, 100), width = rand.Next(1, 100); - FreeImageBitmap fib = new FreeImageBitmap(width, height, PixelFormat.Format24bppRgb); - - Assert.AreEqual(fib.VerticalResolution, fib.HorizontalResolution); - GraphicsUnit unit; - RectangleF rect; - - unit = GraphicsUnit.Display; - rect = fib.GetBounds(ref unit); - - Assert.AreEqual(GraphicsUnit.Pixel, unit); - Assert.AreEqual(width, (int)rect.Width); - Assert.AreEqual(height, (int)rect.Height); - fib.Dispose(); - } - - [Test] - public void GetPropertyItem() - { - FreeImageBitmap fib = new FreeImageBitmap(iManager.GetBitmapPath(ImageType.Metadata, ImageColorType.Type_01_Dither)); - int[] list = fib.PropertyIdList; - Assert.IsNotNull(list); - Assert.Greater(list.Length, 0); - - for (int i = 0; i < list.Length; i++) - { - PropertyItem item = fib.GetPropertyItem(list[i]); - Assert.IsNotNull(item); - } - fib.Dispose(); - } - - [Test] - public void RemovePropertyItem() - { - FreeImageBitmap fib = new FreeImageBitmap(iManager.GetBitmapPath(ImageType.Metadata, ImageColorType.Type_01_Dither)); - Random rand = new Random(); - int[] list = fib.PropertyIdList; - int length = list.Length; - Assert.Greater(list.Length, 0); - - int id = list[rand.Next(0, list.Length - 1)]; - Assert.IsNotNull(fib.GetPropertyItem(id)); - fib.RemovePropertyItem(id); - list = fib.PropertyIdList; - Assert.That((list.Length + 1) == length); - fib.Dispose(); - } - - [Test] - public unsafe void RotateFlip() - { - FreeImageBitmap fib = new FreeImageBitmap(2, 2, PixelFormat.Format32bppArgb); - - ResetRotateBitmap(fib); - fib.RotateFlip(RotateFlipType.RotateNoneFlipX); - Assert.AreEqual(0x00000002, ((int*)fib.GetScanlinePointer(0))[0]); - Assert.AreEqual(0x00000001, ((int*)fib.GetScanlinePointer(0))[1]); - Assert.AreEqual(0x00000004, ((int*)fib.GetScanlinePointer(1))[0]); - Assert.AreEqual(0x00000003, ((int*)fib.GetScanlinePointer(1))[1]); - - ResetRotateBitmap(fib); - fib.RotateFlip(RotateFlipType.RotateNoneFlipY); - Assert.AreEqual(0x00000003, ((int*)fib.GetScanlinePointer(0))[0]); - Assert.AreEqual(0x00000004, ((int*)fib.GetScanlinePointer(0))[1]); - Assert.AreEqual(0x00000001, ((int*)fib.GetScanlinePointer(1))[0]); - Assert.AreEqual(0x00000002, ((int*)fib.GetScanlinePointer(1))[1]); - - ResetRotateBitmap(fib); - fib.RotateFlip(RotateFlipType.RotateNoneFlipXY); - Assert.AreEqual(0x00000004, ((int*)fib.GetScanlinePointer(0))[0]); - Assert.AreEqual(0x00000003, ((int*)fib.GetScanlinePointer(0))[1]); - Assert.AreEqual(0x00000002, ((int*)fib.GetScanlinePointer(1))[0]); - Assert.AreEqual(0x00000001, ((int*)fib.GetScanlinePointer(1))[1]); - - ResetRotateBitmap(fib); - fib.RotateFlip(RotateFlipType.Rotate90FlipNone); - Assert.AreEqual(0x00000003, ((int*)fib.GetScanlinePointer(0))[0]); - Assert.AreEqual(0x00000001, ((int*)fib.GetScanlinePointer(0))[1]); - Assert.AreEqual(0x00000004, ((int*)fib.GetScanlinePointer(1))[0]); - Assert.AreEqual(0x00000002, ((int*)fib.GetScanlinePointer(1))[1]); - - ResetRotateBitmap(fib); - fib.RotateFlip(RotateFlipType.Rotate90FlipX); - Assert.AreEqual(0x00000001, ((int*)fib.GetScanlinePointer(0))[0]); - Assert.AreEqual(0x00000003, ((int*)fib.GetScanlinePointer(0))[1]); - Assert.AreEqual(0x00000002, ((int*)fib.GetScanlinePointer(1))[0]); - Assert.AreEqual(0x00000004, ((int*)fib.GetScanlinePointer(1))[1]); - - ResetRotateBitmap(fib); - fib.RotateFlip(RotateFlipType.Rotate90FlipY); - Assert.AreEqual(0x00000004, ((int*)fib.GetScanlinePointer(0))[0]); - Assert.AreEqual(0x00000002, ((int*)fib.GetScanlinePointer(0))[1]); - Assert.AreEqual(0x00000003, ((int*)fib.GetScanlinePointer(1))[0]); - Assert.AreEqual(0x00000001, ((int*)fib.GetScanlinePointer(1))[1]); - - fib.Dispose(); - } - - private unsafe void ResetRotateBitmap(FreeImageBitmap fib) - { - ((int*)fib.GetScanlinePointer(0))[0] = 0x00000001; - ((int*)fib.GetScanlinePointer(0))[1] = 0x00000002; - ((int*)fib.GetScanlinePointer(1))[0] = 0x00000003; - ((int*)fib.GetScanlinePointer(1))[1] = 0x00000004; - } - - [Test] - public unsafe void GetSetPixel() - { - Random rand = new Random(); - FreeImageBitmap fib = new FreeImageBitmap(2, 1, PixelFormat.Format1bppIndexed); - Palette palette = fib.Palette; - for (int i = 0; i < palette.Length; i++) - { - palette[i] = (uint)rand.Next(int.MinValue, int.MaxValue); - fib.SetPixel(i, 0, palette[i]); - } - for (int i = 0; i < palette.Length; i++) - { - Assert.AreEqual(fib.GetPixel(i, 0), palette[i].Color); - } - fib.Dispose(); - - fib = new FreeImageBitmap(16, 1, PixelFormat.Format4bppIndexed); - palette = fib.Palette; - for (int i = 0; i < palette.Length; i++) - { - palette[i] = (uint)rand.Next(int.MinValue, int.MaxValue); - fib.SetPixel(i, 0, palette[i]); - } - for (int i = 0; i < palette.Length; i++) - { - Assert.AreEqual(fib.GetPixel(i, 0), palette[i].Color); - } - fib.Dispose(); - - fib = new FreeImageBitmap(256, 1, PixelFormat.Format8bppIndexed); - palette = fib.Palette; - for (int i = 0; i < palette.Length; i++) - { - palette[i] = (uint)rand.Next(int.MinValue, int.MaxValue); - fib.SetPixel(i, 0, palette[i]); - } - for (int i = 0; i < palette.Length; i++) - { - Assert.AreEqual(fib.GetPixel(i, 0), palette[i].Color); - } - fib.Dispose(); - - fib = new FreeImageBitmap(1000, 1, PixelFormat.Format16bppRgb555); - for (int i = 0; i < 1000; i++) - { - Color orgColor = Color.FromArgb(rand.Next(int.MinValue, int.MaxValue)); - fib.SetPixel(i, 0, orgColor); - Color newColor = fib.GetPixel(i, 0); - Assert.That(Math.Abs(orgColor.B - newColor.B) <= 8); - Assert.That(Math.Abs(orgColor.G - newColor.G) <= 8); - Assert.That(Math.Abs(orgColor.R - newColor.R) <= 8); - } - fib.Dispose(); - - fib = new FreeImageBitmap(1000, 1, PixelFormat.Format24bppRgb); - for (int i = 0; i < 1000; i++) - { - Color orgColor = Color.FromArgb(rand.Next(int.MinValue, int.MaxValue)); - fib.SetPixel(i, 0, orgColor); - Color newColor = fib.GetPixel(i, 0); - Assert.AreEqual(orgColor.B, newColor.B); - Assert.AreEqual(orgColor.G, newColor.G); - Assert.AreEqual(orgColor.R, newColor.R); - } - fib.Dispose(); - - fib = new FreeImageBitmap(1000, 1, PixelFormat.Format32bppArgb); - for (int i = 0; i < 1000; i++) - { - Color orgColor = Color.FromArgb(rand.Next(int.MinValue, int.MaxValue)); - fib.SetPixel(i, 0, orgColor); - Color newColor = fib.GetPixel(i, 0); - Assert.AreEqual(orgColor.B, newColor.B); - Assert.AreEqual(orgColor.G, newColor.G); - Assert.AreEqual(orgColor.R, newColor.R); - Assert.AreEqual(orgColor.A, newColor.A); - } - fib.Dispose(); - } - - [Test] - public void SaveAdd() - { - string filename = @"saveadd.tif"; - FreeImageBitmap fib = new FreeImageBitmap(100, 100, PixelFormat.Format24bppRgb); - try - { - fib.SaveAdd(); - Assert.Fail(); - } - catch { } - Assert.IsFalse(File.Exists(filename)); - fib.Save(filename); - fib.AdjustBrightness(0.3d); - fib.SaveAdd(); - FreeImageBitmap other = new FreeImageBitmap(100, 100, PixelFormat.Format24bppRgb); - foreach (Scanline scanline in other) - { - for (int i = 0; i < scanline.Length; i++) - { - scanline[i] = new RGBTRIPLE(Color.FromArgb(0x339955)); - } - } - fib.SaveAdd(other); - other.SaveAdd(filename); - other.Dispose(); - fib.Dispose(); - - fib = new FreeImageBitmap(filename); - Assert.AreEqual(4, fib.FrameCount); - fib.Dispose(); - File.Delete(filename); - Assert.IsFalse(File.Exists(filename)); - } - - [Test] - public void Clone() - { - FreeImageBitmap fib = new FreeImageBitmap(iManager.GetBitmapPath(ImageType.Even, ImageColorType.Type_24)); - object obj = new object(); - fib.Tag = obj; - FreeImageBitmap clone = fib.Clone() as FreeImageBitmap; - Assert.IsNotNull(clone); - Assert.AreEqual(fib.Width, clone.Width); - Assert.AreEqual(fib.Height, clone.Height); - Assert.AreEqual(fib.ColorDepth, clone.ColorDepth); - Assert.AreSame(fib.Tag, clone.Tag); - Assert.AreEqual(fib.ImageFormat, clone.ImageFormat); - clone.Dispose(); - fib.Dispose(); - } - - [Ignore] - public void LockBits() - { - } - - [Ignore] - public void UnlockBits() - { - } - - [Test] - public void GetTypeConvertedInstance() - { - using (FreeImageBitmap fib = new FreeImageBitmap(10, 10, PixelFormat.Format8bppIndexed)) - { - Assert.AreEqual(FREE_IMAGE_TYPE.FIT_BITMAP, fib.ImageType); - using (FreeImageBitmap conv = fib.GetTypeConvertedInstance(FREE_IMAGE_TYPE.FIT_DOUBLE, true)) - { - Assert.IsNotNull(conv); - Assert.AreEqual(FREE_IMAGE_TYPE.FIT_DOUBLE, conv.ImageType); - } - } - } - - [Test] - public void GetColorConvertedInstance() - { - using (FreeImageBitmap fib = new FreeImageBitmap(10, 10, PixelFormat.Format32bppArgb)) - { - Assert.AreEqual(32, fib.ColorDepth); - using (FreeImageBitmap conv = fib.GetColorConvertedInstance(FREE_IMAGE_COLOR_DEPTH.FICD_24_BPP)) - { - Assert.IsNotNull(conv); - Assert.AreEqual(24, conv.ColorDepth); - } - } - } - - [Test] - public void GetScaledInstance() - { - using (FreeImageBitmap fib = new FreeImageBitmap(100, 80, PixelFormat.Format32bppArgb)) - { - Assert.AreEqual(100, fib.Width); - Assert.AreEqual(80, fib.Height); - using (FreeImageBitmap conv = fib.GetScaledInstance(80, 60, FREE_IMAGE_FILTER.FILTER_BICUBIC)) - { - Assert.IsNotNull(conv); - Assert.AreEqual(80, conv.Width); - Assert.AreEqual(60, conv.Height); - } - } - } - - [Test] - public unsafe void GetRotatedInstance() - { - using (FreeImageBitmap fib = new FreeImageBitmap(2, 2, PixelFormat.Format32bppArgb)) - { - ((int*)fib.GetScanlinePointer(0))[0] = 0x1; - ((int*)fib.GetScanlinePointer(0))[1] = 0x2; - ((int*)fib.GetScanlinePointer(1))[0] = 0x3; - ((int*)fib.GetScanlinePointer(1))[1] = 0x4; - using (FreeImageBitmap conv = fib.GetRotatedInstance(90d)) - { - Assert.IsNotNull(conv); - Assert.AreEqual(((int*)conv.GetScanlinePointer(0))[0], 0x3); - Assert.AreEqual(((int*)conv.GetScanlinePointer(0))[1], 0x1); - Assert.AreEqual(((int*)conv.GetScanlinePointer(1))[0], 0x4); - Assert.AreEqual(((int*)conv.GetScanlinePointer(1))[1], 0x2); - } - } - } - - [Test] - public void GetScanline() - { - FreeImageBitmap fib; - - fib = new FreeImageBitmap(10, 10, PixelFormat.Format1bppIndexed); - Scanline scanline1 = (Scanline)fib.GetScanline(0); - fib.Dispose(); - - fib = new FreeImageBitmap(10, 10, PixelFormat.Format4bppIndexed); - Scanline scanline2 = (Scanline)fib.GetScanline(0); - fib.Dispose(); - - fib = new FreeImageBitmap(10, 10, PixelFormat.Format8bppIndexed); - Scanline scanline3 = (Scanline)fib.GetScanline(0); - fib.Dispose(); - - fib = new FreeImageBitmap(10, 10, PixelFormat.Format16bppRgb555); - Scanline scanline4 = (Scanline)fib.GetScanline(0); - fib.Dispose(); - - fib = new FreeImageBitmap(10, 10, PixelFormat.Format16bppRgb565); - Scanline scanline5 = (Scanline)fib.GetScanline(0); - fib.Dispose(); - - fib = new FreeImageBitmap(10, 10, PixelFormat.Format24bppRgb); - Scanline scanline6 = (Scanline)fib.GetScanline(0); - fib.Dispose(); - - fib = new FreeImageBitmap(10, 10, PixelFormat.Format32bppArgb); - Scanline scanline7 = (Scanline)fib.GetScanline(0); - fib.Dispose(); - } - - [Test] - public void GetScanlines() - { - FreeImageBitmap fib; - - fib = new FreeImageBitmap(10, 10, PixelFormat.Format1bppIndexed); - IList> scanline01 = (IList>)fib.GetScanlines(); - fib.Dispose(); - - fib = new FreeImageBitmap(10, 10, PixelFormat.Format4bppIndexed); - IList> scanline02 = (IList>)fib.GetScanlines(); - fib.Dispose(); - - fib = new FreeImageBitmap(10, 10, PixelFormat.Format8bppIndexed); - IList> scanline03 = (IList>)fib.GetScanlines(); - fib.Dispose(); - - fib = new FreeImageBitmap(10, 10, PixelFormat.Format16bppRgb555); - IList> scanline04 = (IList>)fib.GetScanlines(); - fib.Dispose(); - - fib = new FreeImageBitmap(10, 10, PixelFormat.Format16bppRgb565); - IList> scanline05 = (IList>)fib.GetScanlines(); - fib.Dispose(); - - fib = new FreeImageBitmap(10, 10, PixelFormat.Format24bppRgb); - IList> scanline06 = (IList>)fib.GetScanlines(); - fib.Dispose(); - - fib = new FreeImageBitmap(10, 10, PixelFormat.Format32bppArgb); - IList> scanline07 = (IList>)fib.GetScanlines(); - fib.Dispose(); - - fib = new FreeImageBitmap(10, 10, FREE_IMAGE_TYPE.FIT_COMPLEX); - IList> scanline08 = (IList>)fib.GetScanlines(); - fib.Dispose(); - - fib = new FreeImageBitmap(10, 10, FREE_IMAGE_TYPE.FIT_DOUBLE); - IList> scanline09 = (IList>)fib.GetScanlines(); - fib.Dispose(); - - fib = new FreeImageBitmap(10, 10, FREE_IMAGE_TYPE.FIT_FLOAT); - IList> scanline10 = (IList>)fib.GetScanlines(); - fib.Dispose(); - - fib = new FreeImageBitmap(10, 10, FREE_IMAGE_TYPE.FIT_INT16); - IList> scanline11 = (IList>)fib.GetScanlines(); - fib.Dispose(); - - fib = new FreeImageBitmap(10, 10, FREE_IMAGE_TYPE.FIT_INT32); - IList> scanline12 = (IList>)fib.GetScanlines(); - fib.Dispose(); - - fib = new FreeImageBitmap(10, 10, FREE_IMAGE_TYPE.FIT_RGB16); - IList> scanline13 = (IList>)fib.GetScanlines(); - fib.Dispose(); - - fib = new FreeImageBitmap(10, 10, FREE_IMAGE_TYPE.FIT_RGBA16); - IList> scanline14 = (IList>)fib.GetScanlines(); - fib.Dispose(); - - fib = new FreeImageBitmap(10, 10, FREE_IMAGE_TYPE.FIT_RGBAF); - IList> scanline15 = (IList>)fib.GetScanlines(); - fib.Dispose(); - - fib = new FreeImageBitmap(10, 10, FREE_IMAGE_TYPE.FIT_RGBF); - IList> scanline16 = (IList>)fib.GetScanlines(); - fib.Dispose(); - - fib = new FreeImageBitmap(10, 10, FREE_IMAGE_TYPE.FIT_UINT16); - IList> scanline17 = (IList>)fib.GetScanlines(); - fib.Dispose(); - - fib = new FreeImageBitmap(10, 10, FREE_IMAGE_TYPE.FIT_UINT32); - IList> scanline18 = (IList>)fib.GetScanlines(); - fib.Dispose(); - } - - [Test] - public void Operators() - { - FreeImageBitmap fib1 = null, fib2 = null; - Assert.IsTrue(fib1 == fib2); - Assert.IsFalse(fib1 != fib2); - Assert.IsTrue(fib1 == null); - Assert.IsFalse(fib1 != null); - - fib1 = new FreeImageBitmap(10, 10, PixelFormat.Format24bppRgb); - Assert.IsFalse(fib1 == fib2); - Assert.IsTrue(fib1 != fib2); - - fib2 = fib1; - fib1 = null; - Assert.IsFalse(fib1 == fib2); - Assert.IsTrue(fib1 != fib2); - - fib1 = new FreeImageBitmap(10, 9, PixelFormat.Format24bppRgb); - Assert.IsFalse(fib1 == fib2); - Assert.IsTrue(fib1 != fib2); - - fib2.Dispose(); - fib2 = fib1; - - Assert.IsTrue(fib1 == fib2); - Assert.IsFalse(fib1 != fib2); - - fib2 = fib1.Clone() as FreeImageBitmap; - Assert.IsTrue(fib1 == fib2); - Assert.IsFalse(fib1 != fib2); - - fib1.Dispose(); - fib2.Dispose(); - } - } - - public class Program - { - static ImageManager iManager = new ImageManager(); - static ImportedFunctionsTest ift = new ImportedFunctionsTest(); - static ImportedStructsTest ist = new ImportedStructsTest(); - static WrapperStructsTest wst = new WrapperStructsTest(); - static WrapperFunctionsTest wft = new WrapperFunctionsTest(); - static FreeImageBitmapTest fib = new FreeImageBitmapTest(); - - public static void Main() - { - List classList = new List(5); - classList.Add(new TestClass(ift)); - classList.Add(new TestClass(ist)); - classList.Add(new TestClass(wst)); - classList.Add(new TestClass(wft)); - classList.Add(new TestClass(fib)); - - for (int i = 0; i < 10000; ) - { - for (int j = 0; j < classList.Count; j++) - classList[j].ExecuteTests(); - Console.WriteLine("Loop {0}", ++i); - //GC.Collect(); - } - } - } - - public class TestClass - { - private object classMember = null; - - private MethodInfo classSetUp = null; - private MethodInfo classTearDown = null; - - private MethodInfo testSetUp = null; - private MethodInfo testTearDown = null; - - private List methodList = null; - - private static object[] parameters = { }; - - public TestClass(object classMember) - { - this.classMember = classMember; - MethodInfo[] infos = classMember.GetType().GetMethods(System.Reflection.BindingFlags.Public | BindingFlags.Instance); - methodList = new List(infos.Length); - - foreach (MethodInfo info in infos) - { - object[] attributes = info.GetCustomAttributes(false); - foreach (Attribute attribute in attributes) - { - if (attribute.GetType() == typeof(TestAttribute)) - { - methodList.Add(info); - break; - } - else if (attribute.GetType() == typeof(TestFixtureSetUpAttribute)) - { - classSetUp = info; - break; - } - else if (attribute.GetType() == typeof(TestFixtureTearDownAttribute)) - { - classTearDown = info; - break; - } - else if (attribute.GetType() == typeof(SetUpAttribute)) - { - testSetUp = info; - break; - } - else if (attribute.GetType() == typeof(TearDownAttribute)) - { - testTearDown = info; - break; - } - } - } - } - - public void ExecuteTests() - { - if (classSetUp != null) - classSetUp.Invoke(classMember, parameters); - - foreach (MethodInfo method in methodList) - { - if (testSetUp != null) - testSetUp.Invoke(classMember, parameters); - - try - { - Console.WriteLine(method.ToString()); - method.Invoke(classMember, parameters); - } - catch (Exception ex) - { - while (ex.InnerException != null) - ex = ex.InnerException; - Console.WriteLine(ex.ToString()); - Environment.Exit(99); - } - - if (testTearDown != null) - testTearDown.Invoke(classMember, parameters); - } - - if (classTearDown != null) - classTearDown.Invoke(classMember, parameters); - } - } -} \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/UnitTest/UnitTest.csproj b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/UnitTest/UnitTest.csproj deleted file mode 100644 index bc1c58c..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/UnitTest/UnitTest.csproj +++ /dev/null @@ -1,110 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {FC7B3A04-FACE-4F07-9CFD-8C6ED06E3CDC} - Exe - Properties - FreeImageAPI - UnitTest - - - 2.0 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - true - 659,660,661 - false - - - none - true - bin\Release\ - TRACE - prompt - 4 - 659,660,661 - true - false - - - true - bin\Debug\ - DEBUG;TRACE - true - 659,660,661 - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - true - 659,660,661 - - - x86 - false - prompt - - - true - bin\Debug\ - DEBUG;TRACE - true - 659,660,661 - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - true - 659,660,661 - - - x64 - false - prompt - - - - False - ..\..\..\..\..\..\..\Programme\NUnit 2.4.8\bin\nunit.framework.dll - - - - - - - - - - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Whats_New.NET.txt b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Whats_New.NET.txt deleted file mode 100644 index e13ec6c..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/Whats_New.NET.txt +++ /dev/null @@ -1,124 +0,0 @@ -What's New for FreeImage.NET - -* : fixed -- : removed -! : changed -+ : added - -Month Day, 2011 - 3.15.2.0 -+ [Herve Drolon] added missing save flags JPEG_OPTIMIZE, JPEG_BASELINE -* [raburton] fixed FreeImageBitmap constructor with initialisation of X/Y resolution - -July 25th, 2011 - 3.15.1.0 -+ [Herve Drolon] added VS 2008 project files -* [Stefan Wetter] fixed FreeImage.IsAvailable method returning false in case the wrapper was out of date -* [Herve Drolon] fixed FreeImage.GetBitmap returning false with dib without resolution info -* [cclouston] fixed EnlargeCanvas returning always NULL - -December 21, 2009 - 3.13.1.1 -* [Carsten Klein] Fixed a threading bug in OpenMultiBitmapFromStream and CloseMultiBitmap. Access to the streamHandles Dictionary is now thread safe. - -September 15, 2009 - 3.13.0.1 -+ [Jean-Philippe Goerke] Added PFM, PICT and RAW file formats. -+ [Jean-Philippe Goerke] Added loading flag JPEG_EXIFROTATE. -+ [Jean-Philippe Goerke] Added method GetNativeVersion() to the FreeImage class. -! [Jean-Philippe Goerke] Changed FreeImage.IsAvailable() now returning false in case the native library is out of date or unusable. -- [Jean-Philippe Goerke] Removed FREEIMAGE_MAJOR_VERSION, FREEIMAGE_MINOR_VERSION and FREEIMAGE_RELEASE_SERIAL constants from class FreeImage. -+ [Jean-Philippe Goerke] Added enumeration FREE_IMAGE_COLOR_OPTIONS. -+ [Jean-Philippe Goerke] Added new overloads for FreeImage.Allocate() and FreeImage.AllocateT(). -+ [Jean-Philippe Goerke] Added methods AllocateEx(), AllocateExT(), FillBackground() and EnlargeCanvas() to class FreeImage. -+ [Jean-Philippe Goerke] Added methods FillBackground(), EnlargeCanvas() and GetEnlargedInstance() to class FreeImageBitmap. -- [Jean-Philippe Goerke] Removed unused ConvertLineXtoY() methods. -* [kruno13] Fixed a bug in the FreeImageBitmap constructors. -- [Jean-Philippe Goerke] Removed unneeded GCHandles used with delegates. -+ [Jean-Philippe Goerke] Added overloaded method OpenMultiBitmapFromStream to class FreeImage. -+ [Jean-Philippe Goerke] FreeImageBitmap now supports loading multipage bitmaps from streams. Warning: The stream must remain open for the bitmap's lifetime. -* [mshanke] Fixed some IPTC metadata incorrect namings. -! [Jean-Philippe Goerke] Method FreeImage.RotateClassic is now deprecated. -+ [Jean-Philippe Goerke] Added method Rotate() to the FreeImage class. -! [Jean-Philippe Goerke] FreeImageBitmap now uses the method Rotate instead of RotateClassic. - -April 20, 2009 - 1.10 -! [Jean-Philippe Goerke] Updated wrapper-version to 1.10 including some minor changes. - -February 27, 2009 - 1.09 -+ [Jean-Philippe Goerke] Help file creation now uses the Version Builder plugin of Sandcastle Help File Builder to generate an MSDN-like Version Information paragraph in the help file. -+ [Jean-Philippe Goerke] Added new metadata model class MDM_EXIF_MAIN to replace MDM_MAIN. Class MDM_MAIN still exists but is marked obsolete and will be removed in a future release. -+ [Jean-Philippe Goerke] Added various properties to access the value of metadata tags directly to all MDM_* classes expect MDM_CUSTOM, MDM_NODATA and MDM_MAKERNOTE. -! [Jean-Philippe Goerke] Now classes deriving from MetadataModel, expect obsoltete class MDM_MAIN, are no longer sealed. -! [Jean-Philippe Goerke] Class GifInformation now derives from MDM_ANIMATION. Moved properties into base class MDM_ANIMATION. -+ [Jean-Philippe Goerke] Added enumerations AltitudeType, DirectionReference, InteroperabilityMode, LatitudeType, LongitudeType, ImageOrientation and VelocityUnit to class MetadataModel. -* [Jean-Philippe Goerke] Fixed a bug in MetadataTag.Count, MetadataTag.Length and MetadataTag.Value. -+ [Jean-Philippe Goerke] Added attribute DebuggerBrowsable(DebuggerBrowsableState.Never) to some protected and private fields. - -February 23, 2009 - 1.08 -! [Jean-Philippe Goerke] FreeImage.NET now uses Sandcastle Help File Builder 1.8.0.1 -+ [Jean-Philippe Goerke] Added new Sandcastle Help File Builder project file FreeImage.NET.shfbproj. -* [headkaze] Fixed a bug in FreeImage.CreateFromBitmap, which now incorporates any transparency information from palletized .NET Bitmaps. -+ [Jean-Philippe Goerke] Added new overloaded method CreateGlobalPalette() to class GifInformation to create global palettes from local palettes. -! [Jean-Philippe Goerke] Renamed internal method FreeImage.SetTransparencyTable_ to FreeImage.SetTransparencyTable. -+ [Jean-Philippe Goerke] Added attribute DebuggerBrowsable(DebuggerBrowsableState.Never) to many protected and private fields. - -February 20, 2009 - 1.07 -* [Jean-Philippe Goerke] Fixed a bug in FreeImage.IsFilenameValidForFIF and FreeImage.IsExtensionValidForFIF. -* [Jean-Philippe Goerke] Fixed a bug in FreeImage.SaveEx that could prevent saving supported non-bitmap types. -* [Jean-Philippe Goerke] Fixed a small bug in FreeImage.CompareData. -+ [Jean-Philippe Goerke] Added two overloads of ColorQuantizeEx() in class FreeImage to return images with a color depth smaller than 8. -! [Jean-Philippe Goerke] Updated FreeImage.ConvertColorDepth to support 1- and 4-bpp color conversions (FreeImage_ConvertTo4Bits only creates grayscale results). -* [headkaze] Fixed a bug in FreeImage.GetBitmap, which now adds any transparency information to palletized .NET Bitmaps. -* [headkaze] Fixed a bug in FreeImage.GetBitmap and FreeImage.CreateFromBitmap to support palettes with sizes different from 2, 16 and 256 entries. -! [Jean-Philippe Goerke] Improved handling of multipage bitmaps in FreeImageBitmap class. -+ [Jean-Philippe Goerke] Added new overloads for FreeImageBitmap.SaveAdd() to allow inserting frames at a specified page index. -+ [Jean-Philippe Goerke] Added new class GifInformation which provides access to GIF format specific metadata (GlobalPalette, Animation, etc.). -+ [Jean-Philippe Goerke] Added enumeration DisposalMethodType. -! [Jean-Philippe Goerke] Updated class MemoryArray, which now is Disposable and has a new static constructor. -! [Jean-Philippe Goerke] Removed code using reflection from class ImageMetadata. -+ [Jean-Philippe Goerke] Added new ctor(FITAG) and ctor(MetadataTag) to class Palette to support palettes stored in metadata tags. -+ [Jean-Philippe Goerke] Added new ctor(RGBQUAD[]), ctor(Color[]) and ctor(int) to create new stand-alone palettes to class Palette. -+ [Jean-Philippe Goerke] Added overloaded CreateGrayscalePalette(), Reverse() and CopyFrom() to class Palette. -! [Jean-Philippe Goerke] Changed the behavior of MetadataTag.Value. byte and byte[] are now stored as FREE_IMAGE_MDTYPE.FIDT_BYTE instead of FREE_IMAGE_MDTYPE.FIDT_UNDEFINED. -+ [Jean-Philippe Goerke] Added a type check to MetadataTag.SetValue(object), MetadataTag.SetValue(object, FREE_IMAGE_MDTYPE) and the setter of MetadataTag.Value. - -November 18, 2008 - 1.06 -* [Jean-Philippe Goerke] Fixed a bug in FreeImage.SaveEx. -! [Jean-Philippe Goerke] Improved method FreeImage.IsFilenameValidForFIF. - -November 5, 2008 - 1.05 -! [Jean-Philippe Goerke] Updated documentation of FreeImage.ConvertFromRawBits and FreeImage.ConvertToRawBits. -+ [Jean-Philippe Goerke] Added new overload ConvertFromRawBits(byte[],int,int,int,uint,uint,uint,uint,bool) to the FreeImage class. -+ [Jean-Philippe Goerke] Added new overload ConvertFromRawBits(byte[],FREE_IMAGE_TYPE,int,int,int,uint,uint,uint,uint bool) to the FreeImage class. -+ [Jean-Philippe Goerke] Added new overload ConvertToRawBits(byte[],FIBITMAP,int,uint,uint,uint,uint,bool) to the FreeImage class. -! [Jean-Philippe Goerke] Improved method FreeImage.CreatePropertyItem. -+ [Jean-Philippe Goerke] Added overloads for CopyMemory to class FreeImage which support direct usage of arrays. -! [Jean-Philippe Goerke] Replaced calls to FreeImage.MoveMemory with FreeImage.CopyMemory. -! [Jean-Philippe Goerke] Class FreeImageBitmap now derives from MarshalByRefObject. -+ [Jean-Philippe Goerke] Added new ctor(int,int,int,PixelFormat,byte[]) and ctor(int,int,int,int,FREE_IMAGE_TYPE,byte[]) to the FreeImageBitmap class. - -August 29, 2008 - 1.04 -+ [Jean-Philippe Goerke] Added new target architectures x86 and x64 to the Visual Studio 2005 solution and project files. -+ [Jean-Philippe Goerke] Added static readonly field Zero to FIBITMAP, FIMEMORY, FIMETADATA, FIMULTIBITMAP and FITAG. -! [Jean-Philippe Goerke] Changed CreateFromBitmap to handle all formats contained by System.Drawing.Imaging.PixelFormat. -+ [Jean-Philippe Goerke] Added overload for ConvertFromRawBits to class FreeImage which supports creating images of any FREE_IMAGE_TYPE from raw bits. -+ [Jean-Philippe Goerke] Added method GetTypeParameters to class FreeImage. -! [Jean-Philippe Goerke] Both constructors FreeImageBitmap.ctor(int,int,PixelFormat) and FreeImageBitmap.ctor(int,int,int,PixelFormat,IntPtr) now work with all formats defined in PixelFormat. -+ [Jean-Philippe Goerke] Added new constructor FreeImageBitmap.ctor(int,int,int,int,FREE_IMAGE_TYPE,IntPtr) to FreeImageBitmap class. - -August 18, 2008 - 1.03 -* [Eric T. Wilson] Added GC.AddMemoryPressure and GC.RemoveMemoryPressure to FreeImageBitmap class. -+ [Eric T. Wilson] Added ToBitmap method to FreeImageBitmap class. -! [Eric T. Wilson] Changed implicit conversion operators to and from System.Drawing.Bitmap to explicit operators. -- [Eric T. Wilson] Removed Message event from FreeImage class. Use event FreeImageEngine.Message instead. -- [Eric T. Wilson] Removed contructors ctor(int) and ctor(IntPtr) from FIBITMAP, FIMULTIBITMAP, FIMEMORY, FIMETADATA and FITAG. -- [Eric T. Wilson] Removed implicit conversion operators from and to int and IntPtr from FIBITMAP, FIMULTIBITMAP, FIMEMORY, FIMETADATA and FITAG. -+ [Jean-Philippe Goerke] Added SetNull method to FIBITMAP, FIMULTIBITMAP, FIMEMORY, FIMETADATA and FITAG. -! [Jean-Philippe Goerke] Changed handling of multipage images in FreeImageBitmap: As with System.Drawing.Bitmap, any changes applied to an active frame are no longer written back to the multipage image loaded. -* [Jean-Philippe Goerke] Fixed a bug in FreeImage.SaveToStream(ref FIBITMAP, Stream, FREE_IMAGE_FORMAT, FREE_IMAGE_SAVE_FLAGS, FREE_IMAGE_COLOR_DEPTH, bool): changed catch block into a finally block. - -July 25, 2008 - 1.02 -+ [Jean-Philippe Goerke] Improved handling of XMP metadata in MetadataTag.cs: Key is now set to "XMLPacket" not changeable if Model is FREE_IMAGE_MDMODEL.FIMD_XMP. - -July 01, 2008 - 1.01 -+ [Jean-Philippe Goerke] Added methods Quantize and GetQuantizedInstance to the FreeImageBitmap class. - -November 12, 2007 - 1.00 -+ [Jean-Philippe Goerke] Initial release. diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/clean.bat b/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/clean.bat deleted file mode 100644 index e359a24..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImage.NET/cs/clean.bat +++ /dev/null @@ -1,48 +0,0 @@ -@ECHO OFF - -rd "Library\bin" /s /q -rd "Library\obj" /s /q - -rd "Samples\Sample 01 - Loading and saving\bin" /s /q -rd "Samples\Sample 01 - Loading and saving\obj" /s /q - -rd "Samples\Sample 02 - Multipaged bitmaps\bin" /s /q -rd "Samples\Sample 02 - Multipaged bitmaps\obj" /s /q - -rd "Samples\Sample 03 - Allocating\bin" /s /q -rd "Samples\Sample 03 - Allocating\obj" /s /q - -rd "Samples\Sample 04 - Getting bitmap informations\bin" /s /q -rd "Samples\Sample 04 - Getting bitmap informations\obj" /s /q - -rd "Samples\Sample 05 - Working with pixels\bin" /s /q -rd "Samples\Sample 05 - Working with pixels\obj" /s /q - -rd "Samples\Sample 06 - Converting\bin" /s /q -rd "Samples\Sample 06 - Converting\obj" /s /q - -rd "Samples\Sample 07 - ICC Profiles\bin" /s /q -rd "Samples\Sample 07 - ICC Profiles\obj" /s /q - -rd "Samples\Sample 08 - Creating a plugin\bin" /s /q -rd "Samples\Sample 08 - Creating a plugin\obj" /s /q - -rd "Samples\Sample 09 - Working with streams\bin" /s /q -rd "Samples\Sample 09 - Working with streams\obj" /s /q - -rd "Samples\Sample 10 - Metadata\bin" /s /q -rd "Samples\Sample 10 - Metadata\obj" /s /q - -rd "Samples\Sample 11 - Using the FreeImageBitmap class\bin" /s /q -rd "Samples\Sample 11 - Using the FreeImageBitmap class\obj" /s /q - -rd "SourceFileMerger\bin" /s /q -rd "SourceFileMerger\obj" /s /q - -rd "UnitTest\bin" /s /q -rd "UnitTest\obj" /s /q - -del "FreeImage.net.VisualState.xml" -del "TestResult.xml" -del *.suo /A:H /S /Q -del *.user /S /Q \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2005.sln b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2005.sln deleted file mode 100644 index ffcbff1..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2005.sln +++ /dev/null @@ -1,19 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeImagePlus", "FreeImagePlus.2005.vcproj", "{94F36908-A4E2-4533-939D-64FF6EADA5A1}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {94F36908-A4E2-4533-939D-64FF6EADA5A1}.Debug|Win32.ActiveCfg = Debug|Win32 - {94F36908-A4E2-4533-939D-64FF6EADA5A1}.Debug|Win32.Build.0 = Debug|Win32 - {94F36908-A4E2-4533-939D-64FF6EADA5A1}.Release|Win32.ActiveCfg = Release|Win32 - {94F36908-A4E2-4533-939D-64FF6EADA5A1}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2005.vcproj b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2005.vcproj deleted file mode 100644 index 538589b..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2005.vcproj +++ /dev/null @@ -1,480 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2008.sln b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2008.sln deleted file mode 100644 index 68c87e1..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2008.sln +++ /dev/null @@ -1,19 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeImagePlus", "FreeImagePlus.2008.vcproj", "{94F36908-A4E2-4533-939D-64FF6EADA5A1}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {94F36908-A4E2-4533-939D-64FF6EADA5A1}.Debug|Win32.ActiveCfg = Debug|Win32 - {94F36908-A4E2-4533-939D-64FF6EADA5A1}.Debug|Win32.Build.0 = Debug|Win32 - {94F36908-A4E2-4533-939D-64FF6EADA5A1}.Release|Win32.ActiveCfg = Release|Win32 - {94F36908-A4E2-4533-939D-64FF6EADA5A1}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2008.vcproj b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2008.vcproj deleted file mode 100644 index 7a7e6c2..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2008.vcproj +++ /dev/null @@ -1,478 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2013.sln b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2013.sln deleted file mode 100644 index 865555c..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2013.sln +++ /dev/null @@ -1,21 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Express 2013 for Windows Desktop -VisualStudioVersion = 12.0.21005.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeImagePlus", "FreeImagePlus.2013.vcxproj", "{94F36908-A4E2-4533-939D-64FF6EADA5A1}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {94F36908-A4E2-4533-939D-64FF6EADA5A1}.Debug|Win32.ActiveCfg = Debug|Win32 - {94F36908-A4E2-4533-939D-64FF6EADA5A1}.Debug|Win32.Build.0 = Debug|Win32 - {94F36908-A4E2-4533-939D-64FF6EADA5A1}.Release|Win32.ActiveCfg = Release|Win32 - {94F36908-A4E2-4533-939D-64FF6EADA5A1}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2013.vcxproj b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2013.vcxproj deleted file mode 100644 index ba9b5b9..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2013.vcxproj +++ /dev/null @@ -1,306 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - FreeImagePlus - {94F36908-A4E2-4533-939D-64FF6EADA5A1} - FreeImagePlus - - - - DynamicLibrary - v120 - false - MultiByte - - - DynamicLibrary - v120 - false - MultiByte - - - DynamicLibrary - v120 - false - MultiByte - - - DynamicLibrary - v120 - false - MultiByte - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>12.0.21005.1 - - - .\$(Platform)\$(Configuration)\ - .\$(Platform)\$(Configuration)\ - false - false - - - .\$(Platform)\$(Configuration)\ - .\$(Platform)\$(Configuration)\ - false - false - - - .\$(Platform)\$(Configuration)\ - .\$(Platform)\$(Configuration)\ - true - false - $(ProjectName)d - - - .\$(Platform)\$(Configuration)\ - .\$(Platform)\$(Configuration)\ - true - false - $(ProjectName)d - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - Win32 - .\Release/FreeImagePlus.tlb - - - - MaxSpeed - OnlyExplicitInline - true - Speed - true - true - .;../../Source;%(AdditionalIncludeDirectories) - NDEBUG;WIN32;_WINDOWS;_USRDLL;FIP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - true - MultiThreaded - false - true - NotUsing - Level3 - true - Default - false - None - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - true - false - - MachineX86 - true - true - UseLinkTimeCodeGeneration - - - mkdir dist\x32 -copy $(OutDir)$(TargetName).dll dist\x32 -copy $(OutDir)$(TargetName).lib dist\x32 -copy FreeImagePlus.h dist\x32 - - - - - - NDEBUG;%(PreprocessorDefinitions) - true - true - X64 - .\Release/FreeImagePlus.tlb - - - - Full - OnlyExplicitInline - true - Speed - true - .;../../Source;%(AdditionalIncludeDirectories) - NDEBUG;WIN32;_WINDOWS;_USRDLL;FIP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - true - MultiThreaded - false - true - NotUsing - Level3 - true - Default - false - None - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - true - false - - MachineX64 - true - true - UseLinkTimeCodeGeneration - - - mkdir dist\x64 -copy $(OutDir)$(TargetName).dll dist\x64 -copy $(OutDir)$(TargetName).lib dist\x64 -copy FreeImagePlus.h dist\x64 - - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - Win32 - .\Debug/FreeImagePlus.tlb - - - - Disabled - .;../../Source;%(AdditionalIncludeDirectories) - _DEBUG;WIN32;_WINDOWS;_USRDLL;FIP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - NotUsing - Level3 - true - Default - false - - - _DEBUG;%(PreprocessorDefinitions) - 0x040c - - - true - true - false - - MachineX86 - - - mkdir dist\x32 -copy $(OutDir)$(TargetName).dll dist\x32 -copy $(OutDir)$(TargetName).lib dist\x32 -copy FreeImagePlus.h dist\x32 - - - - - - _DEBUG;%(PreprocessorDefinitions) - true - true - X64 - .\Debug/FreeImagePlus.tlb - - - - Disabled - .;../../Source;%(AdditionalIncludeDirectories) - _DEBUG;WIN32;_WINDOWS;_USRDLL;FIP_EXPORTS;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - NotUsing - Level3 - true - Default - false - - - _DEBUG;%(PreprocessorDefinitions) - 0x040c - - - true - true - false - - MachineX64 - - - mkdir dist\x64 -copy $(OutDir)$(TargetName).dll dist\x64 -copy $(OutDir)$(TargetName).lib dist\x64 -copy FreeImagePlus.h dist\x64 - - - - - - - - - - - - - - - - - - - - - - - {b39ed2b3-d53a-4077-b957-930979a3577d} - false - - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2013.vcxproj.filters b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2013.vcxproj.filters deleted file mode 100644 index 670b45b..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2013.vcxproj.filters +++ /dev/null @@ -1,53 +0,0 @@ - - - - - {89854f66-f6c5-4c88-bcc7-6141f29b56a1} - cpp;c;cxx;rc;def;r;odl;idl;hpj;bat - - - {76efef1d-9bed-435d-b007-8156aca779dc} - h;hpp;hxx;hm;inl - - - {b0cfb0e2-0615-4c08-8674-2678f135b147} - ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Source Files - - - - - Header Files - - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.h b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.h deleted file mode 100644 index 571010f..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.h +++ /dev/null @@ -1,1713 +0,0 @@ -// ========================================================== -// FreeImagePlus 3 -// -// Design and implementation by -// - Hervé Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#ifndef FREEIMAGEPLUS_H -#define FREEIMAGEPLUS_H - -#ifdef _WIN32 -#include -#endif // _WIN32 -#include "FreeImage.h" - - -// Compiler options --------------------------------------------------------- - -#if defined(FREEIMAGE_LIB) - #define FIP_API - #define FIP_CALLCONV -#else - #if defined(_WIN32) || defined(__WIN32__) - #define WIN32_LEAN_AND_MEAN - #define FIP_CALLCONV __stdcall - // The following ifdef block is the standard way of creating macros which make exporting - // from a DLL simpler. All files within this DLL are compiled with the FIP_EXPORTS - // symbol defined on the command line. this symbol should not be defined on any project - // that uses this DLL. This way any other project whose source files include this file see - // FIP_API functions as being imported from a DLL, wheras this DLL sees symbols - // defined with this macro as being exported. - #ifdef FIP_EXPORTS - #define FIP_API __declspec(dllexport) - #else - #define FIP_API __declspec(dllimport) - #endif // FIP_EXPORTS - #else - // try the gcc visibility support (see http://gcc.gnu.org/wiki/Visibility) - #if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) - #ifndef GCC_HASCLASSVISIBILITY - #define GCC_HASCLASSVISIBILITY - #endif - #endif - #define FIP_CALLCONV - #if defined(GCC_HASCLASSVISIBILITY) - #define FIP_API __attribute__ ((visibility("default"))) - #else - #define FIP_API - #endif - #endif // WIN32 / !WIN32 -#endif // FREEIMAGE_LIB - -/////////////////////////////////////////////////////////////////////////////////////////// - -// ---------------------------------------------------------- - -/** Abstract base class for all objects used by the library. - @version FreeImage 3 - @author Hervé Drolon -*/ - -class FIP_API fipObject -{ -public: - /// Destructor - virtual ~fipObject(){}; - - /**@name Information functions */ - //@{ - /// Returns TRUE if the object is allocated, FALSE otherwise - virtual BOOL isValid() const = 0; - //@} -}; - -// ---------------------------------------------------------- - -class fipMemoryIO; -class fipMultiPage; -class fipTag; - -/** A class used to manage all photo related images and all image types used by the library. - - fipImage encapsulates the FIBITMAP format. It relies on the FreeImage library, especially for - loading / saving images and for bit depth conversion. - @version FreeImage 3 - @author Hervé Drolon -*/ - -class FIP_API fipImage : public fipObject -{ -protected: - /// DIB data - FIBITMAP *_dib; - /// Original (or last saved) fif format if available, FIF_UNKNOWN otherwise - FREE_IMAGE_FORMAT _fif; - /// TRUE whenever the display need to be refreshed - mutable BOOL _bHasChanged; - -public: - friend class fipMultiPage; - -public: - - /**@name Creation & Destruction */ - //@{ - /** - Constructor - @see FreeImage_AllocateT - */ - fipImage(FREE_IMAGE_TYPE image_type = FIT_BITMAP, unsigned width = 0, unsigned height = 0, unsigned bpp = 0); - /// Destructor - virtual ~fipImage(); - /** - Image allocator - @see FreeImage_AllocateT - */ - BOOL setSize(FREE_IMAGE_TYPE image_type, unsigned width, unsigned height, unsigned bpp, unsigned red_mask = 0, unsigned green_mask = 0, unsigned blue_mask = 0); - /// Destroy image data - virtual void clear(); - //@} - - /**@name Copying */ - //@{ - /** - Copy constructor - @see FreeImage_Clone - */ - fipImage(const fipImage& src); - /** - Copy constructor - @see FreeImage_Clone - */ - fipImage& operator=(const fipImage& src); - /** - Assignement operator
- Copy the input pointer and manage its destruction - @see operator FIBITMAP*() - */ - fipImage& operator=(FIBITMAP *dib); - - - /** - @brief Copy a sub part of the current image and returns it as a fipImage object. - - This method works with any bitmap type. - @param dst Output subimage - @param left Specifies the left position of the cropped rectangle. - @param top Specifies the top position of the cropped rectangle. - @param right Specifies the right position of the cropped rectangle. - @param bottom Specifies the bottom position of the cropped rectangle. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Copy - */ - BOOL copySubImage(fipImage& dst, int left, int top, int right, int bottom) const; - - /** - @brief Alpha blend or combine a sub part image with the current image. - - The bit depth of dst bitmap must be greater than or equal to the bit depth of src. - Upper promotion of src is done internally. Supported bit depth equals to 4, 8, 16, 24 or 32. - @param src Source subimage - @param left Specifies the left position of the sub image. - @param top Specifies the top position of the sub image. - @param alpha Alpha blend factor. The source and destination images are alpha blended if - alpha = 0..255. If alpha > 255, then the source image is combined to the destination image. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Paste - */ - BOOL pasteSubImage(fipImage& src, int left, int top, int alpha = 256); - - /** - @brief Crop a sub part of the current image and update it accordingly. - - This method works with any bitmap type. - @param left Specifies the left position of the cropped rectangle. - @param top Specifies the top position of the cropped rectangle. - @param right Specifies the right position of the cropped rectangle. - @param bottom Specifies the bottom position of the cropped rectangle. - @return Returns TRUE if successful, FALSE otherwise. - */ - BOOL crop(int left, int top, int right, int bottom); - - //@} - - /** @name File type identification - */ - //@{ - /** - @brief Identifies an image from disk, given its file name - @param lpszPathName Path and file name of the image to identify. - @return Returns the found FreeImage format if successful, returns FIF_UNKNOWN otherwise. - @see FreeImage_GetFileType, FreeImage_GetFIFFromFilename, FreeImage documentation - */ - static FREE_IMAGE_FORMAT identifyFIF(const char* lpszPathName); - - /** - UNICODE version of identifyFIF (this function only works under WIN32 and does nothing on other OS) - @see FreeImage_GetFileTypeU, FreeImage_GetFIFFromFilenameU, FreeImage documentation - */ - static FREE_IMAGE_FORMAT identifyFIFU(const wchar_t* lpszPathName); - - /** - @brief Identifies an image using the specified FreeImageIO struct and fi_handle. - @param io FreeImageIO structure - @param handle FreeImage fi_handle - @return Returns the found FreeImage format if successful, returns FIF_UNKNOWN otherwise. - @see FreeImage_GetFileTypeFromHandle, FreeImage documentation - */ - static FREE_IMAGE_FORMAT identifyFIFFromHandle(FreeImageIO *io, fi_handle handle); - - /** - @brief Identifies an image using the specified memory stream. - @param hmem FreeImage memory stream - @return Returns the found FreeImage format if successful, returns FIF_UNKNOWN otherwise. - @see FreeImage_GetFileTypeFromMemory, FreeImage documentation - */ - static FREE_IMAGE_FORMAT identifyFIFFromMemory(FIMEMORY *hmem); - - //@} - - - /** @name Loading & Saving - * Loading and saving is handled by the FreeImage library. - */ - //@{ - /** - @brief Loads an image from disk, given its file name and an optional flag. - @param lpszPathName Path and file name of the image to load. - @param flag The signification of this flag depends on the image to be read. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Load, FreeImage documentation - */ - BOOL load(const char* lpszPathName, int flag = 0); - - /** - UNICODE version of load (this function only works under WIN32 and does nothing on other OS) - @see load - */ - BOOL loadU(const wchar_t* lpszPathName, int flag = 0); - - /** - @brief Loads an image using the specified FreeImageIO struct and fi_handle, and an optional flag. - @param io FreeImageIO structure - @param handle FreeImage fi_handle - @param flag The signification of this flag depends on the image to be read. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_LoadFromHandle, FreeImage documentation - */ - BOOL loadFromHandle(FreeImageIO *io, fi_handle handle, int flag = 0); - - /** - @brief Loads an image using the specified memory stream and an optional flag. - @param memIO FreeImage memory stream - @param flag The signification of this flag depends on the image to be read. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_LoadFromMemory, FreeImage documentation - */ - BOOL loadFromMemory(fipMemoryIO& memIO, int flag = 0); - - /** - @brief Saves an image to disk, given its file name and an optional flag. - @param lpszPathName Path and file name of the image to save. - @param flag The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Save, FreeImage documentation - */ - BOOL save(const char* lpszPathName, int flag = 0) const; - - /** - UNICODE version of save (this function only works under WIN32 and does nothing on other OS) - @see save - */ - BOOL saveU(const wchar_t* lpszPathName, int flag = 0) const; - - /** - @brief Saves an image using the specified FreeImageIO struct and fi_handle, and an optional flag. - @param fif Format identifier (FreeImage format) - @param io FreeImageIO structure - @param handle FreeImage fi_handle - @param flag The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SaveToHandle, FreeImage documentation - */ - BOOL saveToHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flag = 0) const; - - /** - @brief Saves an image using the specified memory stream and an optional flag. - @param fif Format identifier (FreeImage format) - @param memIO FreeImage memory stream - @param flag The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SaveToMemory, FreeImage documentation - */ - BOOL saveToMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO& memIO, int flag = 0) const; - - //@} - - /** @name Information functions - * Accessors to the DIB BITMAPINFO structure. - */ - //@{ - - /** - Returns the data type of the image - @see FreeImage_GetImageType - */ - FREE_IMAGE_TYPE getImageType() const; - - /** - Returns the image width in pixels - @see FreeImage_GetWidth - */ - unsigned getWidth() const; - - /** - Returns the image height in pixels - @see FreeImage_GetHeight - */ - unsigned getHeight() const; - - /** - Returns the width of the bitmap in bytes rounded to the nearest DWORD. - @see FreeImage_GetPitch - */ - unsigned getScanWidth() const; - - /** - Returns a pointer to the FIBITMAP data. Used for direct access from FREEIMAGE functions - or from your own low level C functions.
- Sample use :
-
-	fipImage src, dst;
-	src.load("test.png");
-	dst = FreeImage_ConvertTo8Bits(src);
-	FreeImage_Save(FIF_TIFF, dst, "test.tif", 0);
-	
- @see operator=(FIBITMAP *dib) - */ - operator FIBITMAP*() { - return _dib; - } - - /// Returns TRUE if the image is allocated, FALSE otherwise - BOOL isValid() const; - - /** - Returns a pointer to the bitmap's BITMAPINFO header. - @see FreeImage_GetInfo - */ - BITMAPINFO* getInfo() const; - - /** - Returns a pointer to the bitmap's BITMAPINFOHEADER. - @see FreeImage_GetInfoHeader - */ - BITMAPINFOHEADER* getInfoHeader() const; - - /** - Returns the size of the bitmap in bytes. - The size of the bitmap is the BITMAPINFOHEADER + the size of the palette + the size of the bitmap data. - @see FreeImage_GetDIBSize - */ - unsigned getImageSize() const; - - /** - Returns the memory footprint of a bitmap, in bytes. - @see FreeImage_GetMemorySize - */ - unsigned getImageMemorySize() const; - - /** - Returns the bitdepth of the bitmap.
- When the image type is FIT_BITMAP, valid bitdepth can be 1, 4, 8, 16, 24 or 32. - @see FreeImage_GetBPP, getImageType - */ - unsigned getBitsPerPixel() const; - - /** - Returns the width of the bitmap in bytes.
- This is not the size of the scanline. - @see FreeImage_GetLine, getScanWidth - */ - unsigned getLine() const; - - /** - Returns the bitmap resolution along the X axis, in pixels / cm - @see FreeImage_GetDotsPerMeterX - */ - double getHorizontalResolution() const; - - /** - Returns the bitmap resolution along the Y axis, in pixels / cm - @see FreeImage_GetDotsPerMeterY - */ - double getVerticalResolution() const; - - /** - set the bitmap resolution along the X axis, in pixels / cm - @see FreeImage_GetInfoHeader - */ - void setHorizontalResolution(double value); - - /** - set the bitmap resolution along the Y axis, in pixels / cm - @see FreeImage_GetInfoHeader - */ - void setVerticalResolution(double value); - - //@} - - /**@name Palette operations */ - //@{ - /** - Returns a pointer to the bitmap's palette. If the bitmap doesn't have a palette, getPalette returns NULL. - @see FreeImage_GetPalette - */ - RGBQUAD* getPalette() const; - - /** - Returns the palette size in bytes. - @see FreeImage_GetColorsUsed - */ - unsigned getPaletteSize() const; - - /** - Retrieves the number of colours used in the bitmap. If the bitmap is non-palletised, 0 is returned. - @see FreeImage_GetColorsUsed - */ - unsigned getColorsUsed() const; - - /** - Investigates the colour type of the bitmap. - @see FreeImage_GetColorType, FREE_IMAGE_COLOR_TYPE - */ - FREE_IMAGE_COLOR_TYPE getColorType() const; - - /** - Returns TRUE if the bitmap is a 8-bit bitmap with a greyscale palette, FALSE otherwise - @see FreeImage_GetBPP, FreeImage_GetColorType - */ - BOOL isGrayscale() const; - //@} - - /**@name Thumbnail access */ - //@{ - - /** - Retrieves a copy the thumbnail possibly attached to the bitmap - @return Returns TRUE if the thumbnail is present in the bitmap and successfuly retrieved, returns FALSE otherwise - @see FreeImage_GetThumbnail - */ - BOOL getThumbnail(fipImage& image) const; - - /** - Attach a thumbnail to the bitmap - @return Returns TRUE if the thumbnail was successfuly set, returns FALSE otherwise - @see FreeImage_SetThumbnail - */ - BOOL setThumbnail(const fipImage& image); - - /** - Check if the image has an embedded thumbnail - @return Returns TRUE if a thumbnail is present in the bitmap, returns FALSE otherwise - @see FreeImage_GetThumbnail - */ - BOOL hasThumbnail() const; - - /** - Clear the thumbnail possibly attached to the bitmap - @return Returns TRUE if successful, returns FALSe otherwise - @see FreeImage_SetThumbnail - */ - BOOL clearThumbnail(); - - //@} - - /**@name Pixel access */ - //@{ - - /** @brief Returns a pointer to the bitmap bits. - - It is up to you to interpret these bytes correctly, - according to the results of FreeImage_GetBPP and - GetRedMask, FreeImage_GetGreenMask and FreeImage_GetBlueMask.
- Use this function with getScanWidth to iterates through the pixels. - @see FreeImage_GetBits - */ - BYTE* accessPixels() const; - - /** @brief Returns a pointer to the start of the given scanline in the bitmap’s data-bits. - This pointer can be cast according to the result returned by getImageType.
- Use this function with getScanWidth to iterates through the pixels. - @see FreeImage_GetScanLine, FreeImage documentation - */ - BYTE* getScanLine(unsigned scanline) const; - - /** - Get the pixel index of a 1-, 4- or 8-bit palettized image at position (x, y), including range check (slow access). - @param x Pixel position in horizontal direction - @param y Pixel position in vertical direction - @param value Pixel index (returned value) - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_GetPixelIndex - */ - BOOL getPixelIndex(unsigned x, unsigned y, BYTE *value) const; - - /** - Get the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow access). - @param x Pixel position in horizontal direction - @param y Pixel position in vertical direction - @param value Pixel color (returned value) - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_GetPixelColor - */ - BOOL getPixelColor(unsigned x, unsigned y, RGBQUAD *value) const; - - /** - Set the pixel index of a 1-, 4- or 8-bit palettized image at position (x, y), including range check (slow access). - @param x Pixel position in horizontal direction - @param y Pixel position in vertical direction - @param value Pixel index - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SetPixelIndex - */ - BOOL setPixelIndex(unsigned x, unsigned y, BYTE *value); - - /** - Set the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow access). - @param x Pixel position in horizontal direction - @param y Pixel position in vertical direction - @param value Pixel color - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SetPixelColor - */ - BOOL setPixelColor(unsigned x, unsigned y, RGBQUAD *value); - - //@} - - /** @name Conversion routines - * Bitmaps are always loaded in their default bit depth. If you want the bitmap to be stored in another bit depth, the class provides several conversion functions. - */ - //@{ - /** - Converts an image to a type supported by FreeImage. - @param image_type New image type - @param scale_linear TRUE if image pixels must be scaled linearly when converting to a standard bitmap - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertToType, FreeImage_ConvertToStandardType - */ - BOOL convertToType(FREE_IMAGE_TYPE image_type, BOOL scale_linear = TRUE); - - /** - Converts the bitmap to 1 bit using a threshold T. - @param T Threshold value in [0..255] - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Threshold - */ - BOOL threshold(BYTE T); - - /** - Converts a 8-bit image to a monochrome 1-bit image using a dithering algorithm. - @param algorithm Dithering algorithm to use. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Dither, FREE_IMAGE_DITHER - */ - BOOL dither(FREE_IMAGE_DITHER algorithm); - - /** - Converts the bitmap to 4 bits. Unless the bitmap is a 1-bit palettized bitmap, colour values are converted to greyscale. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertTo4Bits - */ - BOOL convertTo4Bits(); - - /** - Converts the bitmap to 8 bits. If the bitmap is 24 or 32-bit RGB, the colour values are converted to greyscale. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertTo8Bits - */ - BOOL convertTo8Bits(); - - /** - Converts the bitmap to 8 bits.
- For palletized bitmaps, the color map is converted to a greyscale ramp. - @see FreeImage_ConvertToGreyscale - @return Returns TRUE if successful, FALSE otherwise. - */ - BOOL convertToGrayscale(); - - /** - Quantizes a full colour 24-bit bitmap to a palletised 8-bit bitmap.
- The quantize parameter specifies which colour reduction algorithm should be used. - @param algorithm Color quantization algorithm to use. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ColorQuantize, FREE_IMAGE_QUANTIZE - */ - BOOL colorQuantize(FREE_IMAGE_QUANTIZE algorithm); - - /** - Converts the bitmap to 16 bits. The resulting bitmap has a layout of 5 bits red, 5 bits green, 5 bits blue and 1 unused bit. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertTo16Bits555 - */ - BOOL convertTo16Bits555(); - - /** - Converts the bitmap to 16 bits. The resulting bitmap has a layout of 5 bits red, 6 bits green and 5 bits blue. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertTo16Bits565 - */ - BOOL convertTo16Bits565(); - - /** - Converts the bitmap to 24 bits. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertTo24Bits - */ - BOOL convertTo24Bits(); - - /** - Converts the bitmap to 32 bits. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertTo32Bits - */ - BOOL convertTo32Bits(); - - /** - Converts the bitmap to a 32-bit float image. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertToFloat - */ - BOOL convertToFloat(); - - /** - Converts the bitmap to a 96-bit RGBF image. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertToRGBF - */ - BOOL convertToRGBF(); - - /** - Converts the bitmap to a 128-bit RGBAF image. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertToRGBAF - */ - BOOL convertToRGBAF(); - - /** - Converts the bitmap to a 16-bit unsigned short image. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertToUINT16 - */ - BOOL convertToUINT16(); - - /** - Converts the bitmap to a 48-bit RGB16 image. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertToRGB16 - */ - BOOL convertToRGB16(); - - /** - Converts the bitmap to a 64-bit RGBA16 image. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertToRGBA16 - */ - BOOL convertToRGBA16(); - - /** - Converts a High Dynamic Range image (48-bit RGB or 96-bit RGB Float) to a 24-bit RGB image. - @param tmo Tone mapping operator - @param first_param First tone mapping algorithm parameter (algorithm dependant) - @param second_param Second tone mapping algorithm parameter (algorithm dependant) - @param third_param Third tone mapping algorithm parameter (algorithm dependant) - @param fourth_param Fourth tone mapping algorithm parameter (algorithm dependant) - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ToneMapping, FreeImage_TmoReinhard05Ex - */ - BOOL toneMapping(FREE_IMAGE_TMO tmo, double first_param = 0, double second_param = 0, double third_param = 1, double fourth_param = 0); - - //@} - - /** @name Transparency support: background colour and alpha channel */ - //@{ - - /** - Returns TRUE if the image is transparent, returns FALSE otherwise - @see FreeImage_IsTransparent - */ - BOOL isTransparent() const; - - /** - 8-bit transparency : get the number of transparent colors. - @return Returns the number of transparent colors in a palletised bitmap. - @see FreeImage_GetTransparencyCount - */ - unsigned getTransparencyCount() const; - - /** - 8-bit transparency : get the bitmap’s transparency table. - @return Returns a pointer to the bitmap’s transparency table. - @see FreeImage_GetTransparencyTable - */ - BYTE* getTransparencyTable() const; - - /** - 8-bit transparency : set the bitmap’s transparency table. - @see FreeImage_SetTransparencyTable - */ - void setTransparencyTable(BYTE *table, int count); - - /** - Returns TRUE when the image has a file background color, FALSE otherwise. - @see FreeImage_HasBackgroundColor - */ - BOOL hasFileBkColor() const; - - /** - @brief Retrieves the file background color of an image. - - For 8-bit images, the color index - in the palette is returned in the rgbReserved member of the bkcolor parameter. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_GetBackgroundColor - */ - BOOL getFileBkColor(RGBQUAD *bkcolor) const; - - /** - @brief Set the file background color of an image. - - When saving an image to PNG, this background color is transparently saved to the PNG file. - When the bkcolor parameter is NULL, the background color is removed from the image. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SetBackgroundColor - */ - BOOL setFileBkColor(RGBQUAD *bkcolor); - //@} - - /**@name Channel processing support */ - //@{ - /** @brief Retrieves the red, green, blue or alpha channel of a 24- or 32-bit BGR[A] image. - @param image Output image to be extracted - @param channel Color channel to extract - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_GetChannel, FREE_IMAGE_COLOR_CHANNEL - */ - BOOL getChannel(fipImage& image, FREE_IMAGE_COLOR_CHANNEL channel) const; - - /** - @brief Insert a 8-bit dib into a 24- or 32-bit image. - @param image Input 8-bit image to insert - @param channel Color channel to replace - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SetChannel, FREE_IMAGE_COLOR_CHANNEL - */ - BOOL setChannel(fipImage& image, FREE_IMAGE_COLOR_CHANNEL channel); - - /** @brief Split a 24-bit RGB image into 3 greyscale images corresponding to the red, green and blue channels. - @param RedChannel Output red channel. - @param GreenChannel Output green channel. - @param BlueChannel Output blue channel. - @return Returns FALSE if the dib isn't a valid image, if it's not a 24-bit image or if - one of the output channel can't be allocated. Returns TRUE otherwise. - @see FreeImage_GetChannel - */ - BOOL splitChannels(fipImage& RedChannel, fipImage& GreenChannel, fipImage& BlueChannel); - - /** @brief Builds a 24-bit RGB image given its red, green and blue channel. - @param red Input red channel. - @param green Input green channel. - @param blue Input blue channel. - @return Returns FALSE if the dib can't be allocated, if the input channels are not 8-bit images. Returns TRUE otherwise. - @see FreeImage_SetChannel - */ - BOOL combineChannels(fipImage& red, fipImage& green, fipImage& blue); - //@} - - /**@name Rotation and flipping */ - //@{ - /** - Image translation and rotation using B-Splines. - @param angle Image rotation angle, in degree - @param x_shift Image horizontal shift - @param y_shift Image vertical shift - @param x_origin Origin of the x-axis - @param y_origin Origin of the y-axis - @param use_mask Whether or not to mask the image. Image mirroring is applied when use_mask is set to FALSE - @return Returns the translated & rotated dib if successful, returns NULL otherwise - @see FreeImage_RotateEx - */ - BOOL rotateEx(double angle, double x_shift, double y_shift, double x_origin, double y_origin, BOOL use_mask); - - /** - Image rotation by means of three shears. - @param angle Image rotation angle, in degree - @param bkcolor Background color (image type dependent), default to black background - @return Returns rotated dib if successful, returns NULL otherwise - @see FreeImage_Rotate - */ - BOOL rotate(double angle, const void *bkcolor = NULL); - - /** - Flip the image horizontally along the vertical axis - @see FreeImage_FlipHorizontal - */ - BOOL flipHorizontal(); - - /** - Flip the image vertically along the horizontal axis - @see FreeImage_FlipVertical - */ - BOOL flipVertical(); - //@} - - /**@name Color manipulation routines */ - //@{ - /** - Inverts each pixel data. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Invert - */ - BOOL invert(); - - /** @brief Perfoms an histogram transformation on a 8, 24 or 32-bit image - according to the values of a lookup table (LUT). - - The transformation is done as follows.
- Image 8-bit : if the image has a color palette, the LUT is applied to this palette, - otherwise, it is applied to the grey values.
- Image 24-bit & 32-bit : if channel == IPL_CC_RGB, the same LUT is applied to each color - plane (R,G, and B). Otherwise, the LUT is applied to the specified channel only. - @param LUT Lookup table. The size of 'LUT' is assumed to be 256. - @param channel The color channel to be processed (only used with 24 & 32-bit DIB). - @return Returns TRUE if the operation was successful, FALSE otherwise - @see FreeImage_AdjustCurve, FREE_IMAGE_COLOR_CHANNEL - */ - BOOL adjustCurve(BYTE *LUT, FREE_IMAGE_COLOR_CHANNEL channel); - - /** @brief Performs gamma correction on a 8, 24 or 32-bit image. - @param gamma Gamma value to use. A value of 1.0 leaves the image alone, - less than one darkens it, and greater than one lightens it. - @return Returns TRUE if the operation was successful, FALSE otherwise - @see FreeImage_AdjustGamma, adjustCurve - */ - BOOL adjustGamma(double gamma); - - /** @brief Adjusts the brightness of a 8, 24 or 32-bit image by a certain amount. - @param percentage Where -100 <= percentage <= 100
- A value 0 means no change, less than 0 will make the image darker - and greater than 0 will make the image brighter. - @return Returns TRUE if the operation was succesful, FALSE otherwise - @see FreeImage_AdjustBrightness, adjustCurve - */ - BOOL adjustBrightness(double percentage); - - /** @brief Adjusts the contrast of a 8, 24 or 32-bit image by a certain amount. - @param percentage Where -100 <= percentage <= 100
- A value 0 means no change, less than 0 will decrease the contrast - and greater than 0 will increase the contrast of the image. - @return Returns TRUE if the operation was succesfull, FALSE otherwise - @see FreeImage_AdjustContrast, adjustCurve - */ - BOOL adjustContrast(double percentage); - - /** - Adjusts an image's brightness, contrast and gamma within a single operation. - If more than one of these image display properties need to be adjusted, - using this function should be preferred over calling each adjustment function separately. - That's particularly true for huge images or if performance is an issue. - @see adjustBrightness - @see adjustContrast - @see adjustGamma - @see FreeImage_AdjustColors - */ - BOOL adjustBrightnessContrastGamma(double brightness, double contrast, double gamma); - - /** @brief Computes image histogram - - For 24-bit and 32-bit images, histogram can be computed from red, green, blue and - black channels. For 8-bit images, histogram is computed from the black channel. Other - bit depth is not supported. - @param histo pointer to an histogram array. Size of this array is assumed to be 256. - @param channel Color channel to use - @return Returns TRUE if the operation was succesfull, FALSE otherwise - @see FreeImage_GetHistogram - */ - BOOL getHistogram(DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel = FICC_BLACK) const; - //@} - - /**@name Upsampling / downsampling */ - //@{ - - /** @brief Rescale the image to a new width / height. - - @param new_width New image width - @param new_height New image height - @param filter The filter parameter specifies which resampling filter should be used. - @return Returns TRUE if the operation was successful, FALSE otherwise - @see FreeImage_Rescale, FREE_IMAGE_FILTER - */ - BOOL rescale(unsigned new_width, unsigned new_height, FREE_IMAGE_FILTER filter); - - /** @brief Creates a thumbnail image keeping aspect ratio - - @param max_size Maximum width or height in pixel units - @param convert When set to TRUE, converts the image to a standard type - @return Returns TRUE if the operation was successful, FALSE otherwise - @see FreeImage_MakeThumbnail - */ - BOOL makeThumbnail(unsigned max_size, BOOL convert = TRUE); - //@} - - /**@name Image status */ - //@{ - /** - Set the image status as 'modified'.
- When using the fipWinImage class, the image status is used to refresh the display. - It is changed to FALSE whenever the display has just been refreshed. - @param bStatus TRUE if the image should be marked as modified, FALSE otherwise - @see isModified - */ - void setModified(BOOL bStatus = TRUE) { - _bHasChanged = bStatus; - } - - /** - Get the image status - @return Returns TRUE if the image is marked as modified, FALSE otherwise - @see setModified - */ - BOOL isModified() { - return _bHasChanged; - } - //@} - - /**@name Metadata */ - //@{ - /** - Returns the number of tags contained in the model metadata model - attached to the dib - @param model Metadata model to look for - */ - unsigned getMetadataCount(FREE_IMAGE_MDMODEL model) const; - /** - Retrieve a metadata attached to the dib - @param model Metadata model to look for - @param key Metadata field name - @param tag Returned tag - @return Returns TRUE if the operation was succesfull, FALSE otherwise - @see FreeImage_GetMetadata - */ - BOOL getMetadata(FREE_IMAGE_MDMODEL model, const char *key, fipTag& tag) const; - /** - Attach a new FreeImage tag to the dib.
- Sample use :
-
-	fipImage image;
-	// ...
-	fipTag tag;
-	tag.setKeyValue("Caption/Abstract", "my caption");
-	image.setMetadata(FIMD_IPTC, tag.getKey(), tag);
-	tag.setKeyValue("Keywords", "FreeImage;Library;Images;Compression");
-	image.setMetadata(FIMD_IPTC, tag.getKey(), tag);
-	
- - @param model Metadata model used to store the tag - @param key Tag field name - @param tag Tag to be attached - @return Returns TRUE if the operation was succesfull, FALSE otherwise - @see FreeImage_SetMetadata - */ - BOOL setMetadata(FREE_IMAGE_MDMODEL model, const char *key, fipTag& tag); - //@} - - - protected: - /**@name Internal use */ - //@{ - BOOL replace(FIBITMAP *new_dib); - //@} - -}; - -// ---------------------------------------------------------- - -/** A class designed for MS Windows (TM) platforms. - - fipWinImage provides methods used to : -
    -
  • Display a DIB on the screen -
  • Copy / Paste a DIB to/from Windows devices (HANDLE, HBITMAP, Clipboard) -
  • Capture a window (HWND) and convert it to an image -
- @version FreeImage 3 - @author Hervé Drolon -*/ -#ifdef _WIN32 - -class FIP_API fipWinImage : public fipImage -{ -public: - /**@name Creation & Destruction */ - //@{ - /// Constructor - fipWinImage(FREE_IMAGE_TYPE image_type = FIT_BITMAP, unsigned width = 0, unsigned height = 0, unsigned bpp = 0); - - /// Destructor - virtual ~fipWinImage(); - - /// Destroy image data - virtual void clear(); - - /// Returns TRUE if the image is allocated, FALSE otherwise - BOOL isValid() const; - //@} - - /**@name Copying */ - //@{ - - /** - Copy constructor. - Delete internal _display_dib data and copy the base class image data. - Tone mapping parameters are left unchanged. - @see FreeImage_Clone - */ - fipWinImage& operator=(const fipImage& src); - - /** - Copy constructor - Delete internal _display_dib data and copy tone mapping parameters. - Copy also the base class image data. - @see FreeImage_Clone - */ - fipWinImage& operator=(const fipWinImage& src); - - /** Clone function used for clipboard copy.
- Convert the FIBITMAP image to a DIB, - and transfer the DIB in a global bitmap handle.
- For non standard bitmaps, the BITMAPINFOHEADER->biCompression field is set to 0xFF + FreeImage_GetImageType(_dib), - in order to recognize the bitmap as non standard. - */ - HANDLE copyToHandle() const; - - /** Copy constructor used for clipboard paste.
- Converts a global object to a FIBITMAP. The clipboard format must be CF_DIB.
- When the BITMAPINFOHEADER->biCompression field is set to 0xFF + [one of the predefined FREE_IMAGE_TYPE], - the bitmap is recognized as non standard and correctly copied. - @return Returns TRUE if successful, returns FALSE otherwise - */ - BOOL copyFromHandle(HANDLE hMem); - - /** Copy constructor.
- Converts a HBITMAP object to a FIBITMAP. - @return Returns TRUE if successful, returns FALSE otherwise - */ - BOOL copyFromBitmap(HBITMAP hbmp); - //@} - - /**@name Clipboard operations */ - //@{ - /** - Clipboard copy. - @param hWndNewOwner Handle to the window to be associated with the open clipboard. - In MFC, you can use AfxGetApp()->m_pMainWnd->GetSafeHwnd(). - @return Returns TRUE if successful, returns FALSE otherwise - */ - BOOL copyToClipboard(HWND hWndNewOwner) const; - - /** - Retrieves data from the clipboard. The clipboard format must be CF_DIB. - @return Returns TRUE if successful, returns FALSE otherwise - */ - BOOL pasteFromClipboard(); - //@} - - /**@name Screen capture */ - //@{ - /** Capture a window and convert it to an image - @param hWndApplicationWindow Handle to the application main window - @param hWndSelectedWindow Handle to the window to be captured - @return Returns TRUE if successful, returns FALSE otherwise - */ - BOOL captureWindow(HWND hWndApplicationWindow, HWND hWndSelectedWindow); - //@} - - - /**@name Painting operations */ - //@{ - - /** @brief Draw (stretch) the image on a HDC, using StretchDIBits. - - When the image is transparent or has a file background, this function composite - the foreground image against a checkerboard background image. - @param hDC Handle to the device context - @param rcDest Destination rectangle - @see FreeImage_Composite - */ - void draw(HDC hDC, RECT& rcDest) const { - drawEx(hDC, rcDest, FALSE, NULL, NULL); - } - - /** @brief Draw (stretch) the image on a HDC, using StretchDIBits. - - When the image is transparent or has a file background, this function can composite - the foreground image against a checkerboard background image, against a single background color or - against a user background image.
- When the image is a High Dynamic Range image (48-bit or RGB float), this function will apply a - tone mapping operator before drawing the image.
- The original image (located in the fipImage class) will not be affected by any of the operations - that could be done in order to display it. - @param hDC Handle to the device context - @param rcDest Destination rectangle - @param useFileBkg When set to TRUE, the function uses the file color background if there is one - @param appBkColor When a color is given, the function uses it as the background color - @param bg When a FIBITMAP is given, the function uses it as the background image - @see FreeImage_Composite - @see setToneMappingOperator - */ - void drawEx(HDC hDC, RECT& rcDest, BOOL useFileBkg = FALSE, RGBQUAD *appBkColor = NULL, FIBITMAP *bg = NULL) const; - - /** - Select a tone mapping algorithm used for drawing and set the image as modified - so that the display will be refreshed. - @param tmo Tone mapping operator - @param first_param First tone mapping algorithm parameter - @param second_param Second tone mapping algorithm parameter - @param third_param Third tone mapping algorithm parameter - @param fourth_param Fourth tone mapping algorithm parameter - @see FreeImage_ToneMapping - */ - void setToneMappingOperator(FREE_IMAGE_TMO tmo, double first_param = 0, double second_param = 0, double third_param = 1, double fourth_param = 0); - - /** - Get the tone mapping algorithm used for drawing, with its parameters. - @param tmo Tone mapping operator - @param first_param First tone mapping algorithm parameter - @param second_param Second tone mapping algorithm parameter - @param third_param Third tone mapping algorithm parameter - @param fourth_param Fourth tone mapping algorithm parameter - @see FreeImage_ToneMapping - */ - void getToneMappingOperator(FREE_IMAGE_TMO *tmo, double *first_param, double *second_param, double *third_param, double *fourth_param) const; - - //@} - -protected: - /// DIB used for display (this allow to display non-standard bitmaps) - mutable FIBITMAP *_display_dib; - /// remember to delete _display_dib - mutable BOOL _bDeleteMe; - /// tone mapping operator - FREE_IMAGE_TMO _tmo; - /// first tone mapping algorithm parameter - double _tmo_param_1; - /// second tone mapping algorithm parameter - double _tmo_param_2; - /// third tone mapping algorithm parameter - double _tmo_param_3; - /// fourth tone mapping algorithm parameter - double _tmo_param_4; -}; - -#endif // _WIN32 - -// ---------------------------------------------------------- - -/** Memory handle - - fipMemoryIO is a class that allows you to load / save images from / to a memory stream. - @version FreeImage 3 - @author Hervé Drolon -*/ -class FIP_API fipMemoryIO : public fipObject -{ -protected: - /// Pointer to a memory stream - FIMEMORY *_hmem; - -public : - /** Constructor. - Wrap a memory buffer containing image data.
- The memory buffer is read only and has to be freed by the user - when no longer in use.
- When default arguments are used, open a memory file as read/write. - @param data Pointer to the memory buffer - @param size_in_bytes Buffer size in bytes - @see FreeImage_OpenMemory - */ - fipMemoryIO(BYTE *data = NULL, DWORD size_in_bytes = 0); - - /** Destructor. - Free any allocated memory - @see FreeImage_CloseMemory - */ - virtual ~fipMemoryIO(); - - /** Destructor. - Free any allocated memory and invalidate the stream - @see FreeImage_CloseMemory - */ - void close(); - - /** Returns TRUE if the internal memory buffer is a valid buffer, returns FALSE otherwise - */ - BOOL isValid() const; - - /** Returns the buffer image format - @see FreeImage_GetFileTypeFromMemory - */ - FREE_IMAGE_FORMAT getFileType() const; - - /** - Returns a pointer to the FIMEMORY data. Used for direct access from FREEIMAGE functions - or from your own low level C functions. - */ - operator FIMEMORY*() { - return _hmem; - } - - /**@name Memory IO routines */ - //@{ - /** - Loads a dib from a memory stream - @param fif Format identifier (FreeImage format) - @param flags The signification of this flag depends on the image to be loaded. - @return Returns the loaded dib if successful, returns NULL otherwise - @see FreeImage_LoadFromMemory - */ - FIBITMAP* load(FREE_IMAGE_FORMAT fif, int flags = 0) const; - /** - Loads a multi-page bitmap from a memory stream - @param fif Format identifier (FreeImage format) - @param flags The signification of this flag depends on the multi-page to be loaded. - @return Returns the loaded multi-page if successful, returns NULL otherwise - @see FreeImage_LoadMultiBitmapFromMemory - */ - FIMULTIBITMAP* loadMultiPage(FREE_IMAGE_FORMAT fif, int flags = 0) const; - /** - Saves a dib to a memory stream - @param fif Format identifier (FreeImage format) - @param dib Image to be saved - @param flags The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SaveToMemory - */ - BOOL save(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, int flags = 0); - /** - Saves a multi-page bitmap to a memory stream - @param fif Format identifier (FreeImage format) - @param bitmap Multi-page image to be saved - @param flags The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SaveMultiBitmapToMemory - */ - BOOL saveMultiPage(FREE_IMAGE_FORMAT fif, FIMULTIBITMAP *bitmap, int flags = 0); - /** - Reads data from a memory stream - @param buffer Storage location for data - @param size Item size in bytes - @param count Maximum number of items to be read - @return Returns the number of full items actually read, which may be less than count if an error occurs - @see FreeImage_ReadMemory - */ - unsigned read(void *buffer, unsigned size, unsigned count) const; - /** - Writes data to a memory stream - @param buffer Pointer to data to be written - @param size Item size in bytes - @param count Maximum number of items to be written - @return Returns the number of full items actually written, which may be less than count if an error occurs - @see FreeImage_WriteMemory - */ - unsigned write(const void *buffer, unsigned size, unsigned count); - /** - Gets the current position of a memory pointer - @see FreeImage_TellMemory - */ - long tell() const; - /** - Moves the memory pointer to a specified location - @see FreeImage_SeekMemory - */ - BOOL seek(long offset, int origin); - /** - Provides a direct buffer access to a memory stream - @param data Pointer to the memory buffer (returned value) - @param size_in_bytes Buffer size in bytes (returned value) - @see FreeImage_AcquireMemory - */ - BOOL acquire(BYTE **data, DWORD *size_in_bytes); - //@} - -private: - /// Disable copy - fipMemoryIO(const fipMemoryIO& src); - /// Disable copy - fipMemoryIO& operator=(const fipMemoryIO& src); - -}; - -// ---------------------------------------------------------- - -/** Multi-page file stream - - fipMultiPage encapsulates the multi-page API. It supports reading/writing - multi-page TIFF, ICO and GIF files. -*/ -class FIP_API fipMultiPage : public fipObject -{ -protected: - /// Pointer to a multi-page file stream - FIMULTIBITMAP *_mpage; - /// TRUE when using a memory cache, FALSE otherwise - BOOL _bMemoryCache; - -public: - /** - Constructor - @param keep_cache_in_memory When it is TRUE, all gathered bitmap data in the page manipulation process is kept in memory, otherwise it is lazily flushed to a temporary file on the hard disk in 64 Kb blocks. - */ - fipMultiPage(BOOL keep_cache_in_memory = FALSE); - - /** - Destructor - Close the file stream if not already done. - */ - virtual ~fipMultiPage(); - - /// Returns TRUE if the multi-page stream is opened - BOOL isValid() const; - - /** - Returns a pointer to the FIMULTIBITMAP data. Used for direct access from FREEIMAGE functions - or from your own low level C functions. - */ - operator FIMULTIBITMAP*() { - return _mpage; - } - - /** - Open a multi-page file stream - @param lpszPathName Name of the multi-page bitmap file - @param create_new When TRUE, it means that a new bitmap will be created rather than an existing one being opened - @param read_only When TRUE the bitmap is opened read-only - @param flags Load flags. The signification of this flag depends on the image to be loaded. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_OpenMultiBitmap - */ - BOOL open(const char* lpszPathName, BOOL create_new, BOOL read_only, int flags = 0); - - /** - Open a multi-page memory stream as read/write. - @param memIO Memory stream. The memory stream MUST BE a wrapped user buffer. - @param flags Load flags. The signification of this flag depends on the image to be loaded. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_LoadMultiBitmapFromMemory - */ - BOOL open(fipMemoryIO& memIO, int flags = 0); - - /** - Open a multi-page image as read/write, using the specified FreeImageIO struct and fi_handle, and an optional flag. - @param io FreeImageIO structure - @param handle FreeImage fi_handle - @param flag The signification of this flag depends on the image to be read. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_OpenMultiBitmapFromHandle - */ - BOOL open(FreeImageIO *io, fi_handle handle, int flags = 0); - - /** - Close a file stream - @param flags Save flags. The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_CloseMultiBitmap - */ - BOOL close(int flags = 0); - - /** - Saves a multi-page image using the specified FreeImageIO struct and fi_handle, and an optional flag. - @param fif Format identifier (FreeImage format) - @param io FreeImageIO structure - @param handle FreeImage fi_handle - @param flag The signification of this flag depends on the multi-page image to be saved. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SaveMultiBitmapToHandle, FreeImage documentation - */ - BOOL saveToHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags = 0) const; - - /** - Saves a multi-page image using the specified memory stream and an optional flag. - @param fif Format identifier (FreeImage format) - @param memIO FreeImage memory stream - @param flag The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SaveMultiBitmapToMemory, FreeImage documentation - */ - BOOL saveToMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO& memIO, int flags = 0) const; - - /** - Returns the number of pages currently available in the multi-paged bitmap - @see FreeImage_GetPageCount - */ - int getPageCount() const; - - /** - Appends a new page to the end of the bitmap - @param image Image to append - @see FreeImage_AppendPage - */ - void appendPage(fipImage& image); - - /** - Inserts a new page before the given position in the bitmap - @param page Page number. Page has to be a number smaller than the current number of pages available in the bitmap. - @param image Image to insert - @see FreeImage_InsertPage - */ - void insertPage(int page, fipImage& image); - - /** - Deletes the page on the given position - @param page Page number - @see FreeImage_DeletePage - */ - void deletePage(int page); - - /** - Moves the source page to the position of the target page. - @param target Target page position - @param source Source page position - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_MovePage - */ - BOOL movePage(int target, int source); - - /** - Locks a page in memory for editing. You must call unlockPage to free the page
- Usage :
-
-	fipMultiPage mpage;
-	// ...
-	fipImage image;		// You must declare this before
-	image = mpage.lockPage(2);
-	if(image.isValid()) {
-	  // ...
-	  mpage.unlockPage(image, TRUE);
-	}
-	
- @param page Page number - @return Returns the page if successful, returns NULL otherwise - @see FreeImage_LockPage - */ - FIBITMAP* lockPage(int page); - - /** - Unlocks a previously locked page and gives it back to the multi-page engine - @param image Page to unlock - @param changed When TRUE, the page is marked changed and the new page data is applied in the multi-page bitmap. - @see FreeImage_UnlockPage - */ - void unlockPage(fipImage& image, BOOL changed); - - /** - Returns an array of page-numbers that are currently locked in memory. - When the pages parameter is NULL, the size of the array is returned in the count variable. - You can then allocate the array of the desired size and call - getLockedPageNumbers again to populate the array. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_GetLockedPageNumbers - */ - BOOL getLockedPageNumbers(int *pages, int *count) const; -}; - -// ---------------------------------------------------------- - -/** -FreeImage Tag - -FreeImage uses this structure to store metadata information. -*/ -class FIP_API fipTag : public fipObject -{ -protected: - /// Pointer to a FreeImage tag - FITAG *_tag; - -public: - /**@name Creation & Destruction */ - //@{ - /** - Constructor - @see FreeImage_CreateTag - */ - fipTag(); - /** - Destructor - @see FreeImage_DeleteTag - */ - virtual ~fipTag(); - /** - Construct a FIDT_ASCII tag (ASCII string).
- This method is useful to store comments or IPTC tags. - @param name Field name - @param value Field value - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_CreateTag - */ - BOOL setKeyValue(const char *key, const char *value); - - //@} - - /**@name Copying */ - //@{ - /** - Copy constructor - @see FreeImage_CloneTag - */ - fipTag(const fipTag& tag); - /** - Copy constructor - @see FreeImage_CloneTag - */ - fipTag& operator=(const fipTag& tag); - /** - Assignement operator
- Copy the input pointer and manage its destruction - @see operator FITAG*() - */ - fipTag& operator=(FITAG *tag); - //@} - - /** - Returns a pointer to the FITAG data. Used for direct access from FREEIMAGE functions - or from your own low level C functions. - @see operator=(FITAG *tag) - */ - operator FITAG*() { - return _tag; - } - - /// Returns TRUE if the tag is allocated, FALSE otherwise - BOOL isValid() const; - - /**@name Tag accessors */ - //@{ - /** - Returns the tag field name (unique inside a metadata model). - @see FreeImage_GetTagKey - */ - const char *getKey() const; - /** - Returns the tag description if available, returns NULL otherwise - @see FreeImage_GetTagDescription - */ - const char *getDescription() const; - /** - Returns the tag ID if available, returns 0 otherwise - @see FreeImage_GetTagID - */ - WORD getID() const; - /** - Returns the tag data type - @see FreeImage_GetTagType - */ - FREE_IMAGE_MDTYPE getType() const; - /** - Returns the number of components in the tag (in tag type units) - @see FreeImage_GetTagCount - */ - DWORD getCount() const; - /** - Returns the length of the tag value in bytes - @see FreeImage_GetTagLength - */ - DWORD getLength() const; - /** - Returns the tag value - @see FreeImage_GetTagValue - */ - const void *getValue() const; - /** - Set the tag field name - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagKey - */ - BOOL setKey(const char *key); - /** - Set the (usually optional) tag description - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagDescription - */ - BOOL setDescription(const char *description); - /** - Set the (usually optional) tad ID - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagID - */ - BOOL setID(WORD id); - /** - Set the tag data type - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagType - */ - BOOL setType(FREE_IMAGE_MDTYPE type); - /** - Set the number of data in the tag - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagCount - */ - BOOL setCount(DWORD count); - /** - Set the length of the tag value, in bytes - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagLength - */ - BOOL setLength(DWORD length); - /** - Set the tag value - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagValue - */ - BOOL setValue(const void *value); - - //@} - - /** - Converts a FreeImage tag structure to a string that represents the interpreted tag value - @param model Metadata model specification (metadata model from which the tag was extracted) - @param Make Camera model (not used yet) - */ - const char* toString(FREE_IMAGE_MDMODEL model, char *Make = NULL) const; - -}; - -/** -Metadata iterator - -Usage :
-
-fipImage image;
-// ...
-fipTag tag;
-fipMetadataFind finder;
-if( finder.findFirstMetadata(FIMD_EXIF_MAIN, image, tag) ) {
-  do {
-    // process the tag
-	cout << tag.getKey() << "\n";
-
-  } while( finder.findNextMetadata(tag) );
-}
-// the class can be called again with another metadata model
-if( finder.findFirstMetadata(FIMD_EXIF_EXIF, image, tag) ) {
-  do {
-    // process the tag
-	cout << tag.getKey() << "\n";
-
-  } while( finder.findNextMetadata(tag) );
-}
-
-*/ -class FIP_API fipMetadataFind : public fipObject -{ -protected: - /// Pointer to a search handle - FIMETADATA *_mdhandle; - -public: - /// Returns TRUE if the search handle is allocated, FALSE otherwise - BOOL isValid() const; - - /// Constructor - fipMetadataFind(); - /** - Destructor - @see FreeImage_FindCloseMetadata - */ - virtual ~fipMetadataFind(); - /** - Provides information about the first instance of a tag that matches - the metadata model specified in the model argument. - @param model Metadata model - @param image Input image - @param tag Returned tag - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_FindFirstMetadata - */ - BOOL findFirstMetadata(FREE_IMAGE_MDMODEL model, fipImage& image, fipTag& tag); - /** - Find the next tag, if any, that matches the metadata model argument - in a previous call to findFirstMetadata - @param tag Returned tag - @return Returns TRUE if successful, returns FALSE otherwise, indicating that no more matching tags could be found - @see FreeImage_FindNextMetadata - */ - BOOL findNextMetadata(fipTag& tag); - -}; - -#endif // FREEIMAGEPLUS_H diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.rc b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.rc deleted file mode 100644 index 740b570..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.rc +++ /dev/null @@ -1,44 +0,0 @@ -#include - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,17,0,0 - PRODUCTVERSION 3,17,0,0 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e2" - BEGIN - VALUE "Comments", "FreeImage is an Open Source library project for developers who would like to support popular graphics image formats like PNG, BMP, JPEG, TIFF and others as needed by today's multimedia applications.\0" - VALUE "CompanyName", "FreeImage\0" - VALUE "FileDescription", "FreeImagePlus library\0" - VALUE "FileVersion", "3, 17, 0, 0\0" - VALUE "InternalName", "FreeImagePlus\0" - VALUE "LegalCopyright", "Copyright © 2003-2015 by FreeImage\0" - VALUE "LegalTrademarks", "See http://freeimage.sourceforge.net\0" - VALUE "OriginalFilename", "FreeImagePlus.dll\0" - VALUE "PrivateBuild", "\0" - VALUE "ProductName", "FreeImagePlus\0" - VALUE "ProductVersion", "3, 17, 0, 0\0" - VALUE "SpecialBuild", "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1250 - END -END - diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/WhatsNew_FIP.txt b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/WhatsNew_FIP.txt deleted file mode 100644 index 15a6877..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/WhatsNew_FIP.txt +++ /dev/null @@ -1,184 +0,0 @@ -What's New for FreeImagePlus - -* : fixed -- : removed -! : changed -+ : added - -March 01st, 2015 -+ [Herve Drolon] added fipImage::convertToRGBAF -+ [Herve Drolon] added fipImage::convertToRGBA16 -+ [Herve Drolon] added fipImage::getImageMemorySize -* [Herve Drolon] fixed returnd type of fipImage::getImageSize from LONG to unsigned - -July 17th, 2011 -+ [Herve Drolon] added fipImage::convertToRGB16 - -February 26th, 2011 -+ [Herve Drolon] added fipImage::convertToFloat - -November 14th, 2010 -+ [Herve Drolon] added getThumbnail, setThumbnail, hasThumbnail, clearThumbnail to fipImage - -November 7th, 2010 -+ [Herve Drolon] added fipImage::convertToUINT16 - -October 9th, 2010 -* [Herve Drolon] fixed fipWinImage::setToneMappingOperator when displaying RGBA HDR images - -April 18th, 2010 -+ [Herve Drolon] added new multi-page functions - added fipMemoryIO:close - added fipMemoryIO:loadMultiPage - added fipMemoryIO:saveMultiPage - added fipMultiPage:FIMULTIBITMAP* - added fipMultiPage:open(FreeImageIO *io, fi_handle handle, int flags = 0) - added fipMultiPage:saveToHandle - added fipMultiPage:saveToMemory - -October 24th, 2009 -! [Herve Drolon] fixed the '65535' width/height/pitch size limitation (need recompilation as several prototypes changed) - -September 1rd, 2009 -! [Herve Drolon] changed prototypes for fipWinImage::setToneMappingOperator and fipWinImage::getToneMappingOperator -! [Herve Drolon] changed prototype for fipImage::toneMapping -! [Herve Drolon] changed prototype for fipImage::rotate (now support optional supplied background color) -+ [Herve Drolon] added FreeImage_TmoReinhard05Ex capability to fipImage & fipWinImage - -August 11th, 2009 -* [Mihail Naydenov] fixed fipImage::operator=(FIBITMAP *dib) for cases where dib == _dib - -July 10th, 2009 -+ [Herve Drolon] added fipImage::adjustBrightnessContrastGamma(double brightness, double contrast, double gamma) - -October 27th, 2008 -+ [Herve Drolon] added FIF static identification functions to fipImage - -August 3rd, 2008 -* [dimitriy.b] fixed warnings about "non virtual destructor with virtual class members" with gcc 4.1.2 -* [Herve Drolon] fixed display of RGBAF EXR images in fipWinImage::drawEx - -October 10th, 2007 -* [Terry Russell] fixed a memory leak in fipWinImage::captureWindow - -January 20th, 2007 -+ [Herve Drolon] added support for 64-bit RGBA images - -January 11th, 2007 -+ [Herve Drolon] added setKeyValue method (a ASCII tag constructor) to fipTag -+ [Herve Drolon] added PSD format support to fipMultiPage::open - -October 30th, 2006 - 3.9.2 -+ [Herve Drolon] added BOOL fipMultiPage::open(fipMemoryIO& memIO, int flags) -+ [Herve Drolon] added fipMemoryIO::operator FIMEMORY*() -* [Herve Drolon] fixed missing 'isValid' method in fipMetadataFind - -July 16th, 2006 - 3.9.1 -* [Herve Drolon] fixed a bug in fipWinImage::copyFromBitmap occuring with palettized images - -July 6th, 2006 - 3.9.0 -! [Herve Drolon] renamed fipMemoryIO::read to fipMemoryIO::load -! [Herve Drolon] renamed fipMemoryIO::write to fipMemoryIO::save -+ [Herve Drolon] added fipMemoryIO::read (wrapper for FreeImage_ReadMemory) -+ [Herve Drolon] added fipMemoryIO::write (wrapper for FreeImage_WriteMemory) -+ [Herve Drolon] added version info to the DLL -+ [Herve Drolon] added fipImage::crop -+ [Herve Drolon] added support for most image types to fipImage::rescale -+ [Herve Drolon] added fipImage::makeThumbnail -+ [Herve Drolon] added fipTag -+ [Herve Drolon] added fipMetadataFind -* [Sandor Szalacsi] improved fipWinWimage::drawEx behavior with non transparent PNG having a file background -* [Herve Drolon] fixed a bug in fipWinImage::setToneMappingOperator -* [Conrado PLG] added const keyword to fip methods -* [Conrado PLG] made the copy constructors of fipMemoryIO private - -September 5, 2005 - 3.8.0 -[Herve Drolon] -! fipImage::convertToGrayscale now uses FreeImage_ConvertToGreyscale -! fipWinImage::captureWindow now converts 32-bit images to 24-bit -+ added UNICODE function fipImage::loadU -+ added UNICODE function fipImage::saveU -+ added load flags to fipMultiPage::open -+ fipWinImage::copyTo/FromHandle now work with non-standard bitmap types -+ added copy constructors to fipWinImage -+ added fipImage::clear() and fipWinImage::clear() -* fixed a bug in fipWinWimage::drawEx with non transparent PNG having a file background -* fixed fipMultiPage not reading GIF files -* fixed a bug in fipImage::rescale whan handling FIT_UINT16 bitmaps - -May 3rd, 2005 -[Herve Drolon] -+ added accessors fipImage::setModified and fipImage::isModified -+ added fipImage::convertToRGBF -+ added fipImage::toneMapping -+ added tone mapping functions to fipWinImage (see get/setToneMappingOperator) -+ added tone mapping capabilities to fipWinImage::drawEx - -January 5th, 2005 -[Herve Drolon] -! changed the prototype of get/set Resolution functions - -December 19th, 2004 -[Herve Drolon] -! updated fipImage::rotate to handle 1-bit images - -November 18th, 2004 -[Herve Drolon] -+ added fipImage::convertTo4Bits - -August 18th, 2004 -[Herve Drolon] -- removed fipInternetIO -- removed copy constructor fipImage::fipImage(const FIBITMAP*) -- removed copy constructor fipWinImage::fipWinImage(const FIBITMAP*) -! fipMemoryIO rewritten. It now wraps the FreeImage memory stream API -! fipGenericImage is now called fipObject -+ added fipImage::loadFromMemory -+ added fipImage::saveToMemory -+ added fipMultiPage - -March, 17th, 2004 -[Herve Drolon] -! fipImage::setSize now accepts color masks -* fixed fipWinImage::copyFromHandle not working with DIB having color masks - -February 11th, 2004 -[Herve Drolon] -- removed fipImage::getRedChannel -- removed fipImage::getGreenChannel -- removed fipImage::getBlueChannel -- removed fipImage::getAlphaChannel -- removed fipImage::setAlphaChannel -+ added fipImage::setChannel -+ added fipImage::isTransparent -+ added fipImage::getTransparencyCount -+ added fipImage::getTransparencyTable -+ added fipImage::setTransparencyTable -+ added fipImage::hasFileBkColor -+ added fipImage::getFileBkColor -+ added fipImage::setFileBkColor -+ added fipWinImage::drawEx -! fipWinImage::draw now works with transparent images - -January 26th, 2004 -[Herve Drolon] -+ added fipMemoryIO -+ added fipInternetIO (WIN32 only) -+ added fipImage::getImageType -+ added fipImage::convertToType -+ added fipWinImage::copyToClipboard -+ added fipWinImage::pasteFromClipboard -+ added fipWinImage::captureWindow - -! changed fipImage constructor -! fipWinImage::copyFromHandle now returns a BOOL -! fipWinImage::copyFromBitmap now returns a BOOL - -November 2, 2003 -+ [Herve Drolon] added fipImage::getScanLine - -October 20, 2003 -* [Dennis Lim] fixed a bug in fipImage constructor -! [Herve Drolon] fixed a bug with fipImage::saveToHandle prototype - -September 8th 2003 - Wrapper for FreeImage 3.0.0 diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/clean.bat b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/clean.bat deleted file mode 100644 index 65a5e36..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/clean.bat +++ /dev/null @@ -1,26 +0,0 @@ -del dist\*.dll /s /q -del dist\*.lib /s /q -del dist\*.h /s /q -del *.ncb /s /q -del *.plg /s /q -del *.opt /s /q -del *.suo /s /q /a:h -del *.user /s /q -del *.log /s /q -del *.sdf /s /q -del test\page*.tiff -del test\*.png -del test\mpage*.tif -del test\clone*.tif -del test\redirect-stream.tif -rd dist\x64 /s /q -rd dist\x32 /s /q -rd Release /s /q -rd Debug /s /q -rd x64 /s /q -rd Win32 /s /q -rd test\x64 /s /q -rd test\Win32 /s /q -rd test\Debug /s /q -rd test\Release /s /q - diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/dist/delete.me b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/dist/delete.me deleted file mode 100644 index e69de29..0000000 diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/dist/x32/FreeImagePlus.dll b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/dist/x32/FreeImagePlus.dll deleted file mode 100644 index 90977a4..0000000 Binary files a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/dist/x32/FreeImagePlus.dll and /dev/null differ diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/dist/x32/FreeImagePlus.h b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/dist/x32/FreeImagePlus.h deleted file mode 100644 index 571010f..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/dist/x32/FreeImagePlus.h +++ /dev/null @@ -1,1713 +0,0 @@ -// ========================================================== -// FreeImagePlus 3 -// -// Design and implementation by -// - Hervé Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#ifndef FREEIMAGEPLUS_H -#define FREEIMAGEPLUS_H - -#ifdef _WIN32 -#include -#endif // _WIN32 -#include "FreeImage.h" - - -// Compiler options --------------------------------------------------------- - -#if defined(FREEIMAGE_LIB) - #define FIP_API - #define FIP_CALLCONV -#else - #if defined(_WIN32) || defined(__WIN32__) - #define WIN32_LEAN_AND_MEAN - #define FIP_CALLCONV __stdcall - // The following ifdef block is the standard way of creating macros which make exporting - // from a DLL simpler. All files within this DLL are compiled with the FIP_EXPORTS - // symbol defined on the command line. this symbol should not be defined on any project - // that uses this DLL. This way any other project whose source files include this file see - // FIP_API functions as being imported from a DLL, wheras this DLL sees symbols - // defined with this macro as being exported. - #ifdef FIP_EXPORTS - #define FIP_API __declspec(dllexport) - #else - #define FIP_API __declspec(dllimport) - #endif // FIP_EXPORTS - #else - // try the gcc visibility support (see http://gcc.gnu.org/wiki/Visibility) - #if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) - #ifndef GCC_HASCLASSVISIBILITY - #define GCC_HASCLASSVISIBILITY - #endif - #endif - #define FIP_CALLCONV - #if defined(GCC_HASCLASSVISIBILITY) - #define FIP_API __attribute__ ((visibility("default"))) - #else - #define FIP_API - #endif - #endif // WIN32 / !WIN32 -#endif // FREEIMAGE_LIB - -/////////////////////////////////////////////////////////////////////////////////////////// - -// ---------------------------------------------------------- - -/** Abstract base class for all objects used by the library. - @version FreeImage 3 - @author Hervé Drolon -*/ - -class FIP_API fipObject -{ -public: - /// Destructor - virtual ~fipObject(){}; - - /**@name Information functions */ - //@{ - /// Returns TRUE if the object is allocated, FALSE otherwise - virtual BOOL isValid() const = 0; - //@} -}; - -// ---------------------------------------------------------- - -class fipMemoryIO; -class fipMultiPage; -class fipTag; - -/** A class used to manage all photo related images and all image types used by the library. - - fipImage encapsulates the FIBITMAP format. It relies on the FreeImage library, especially for - loading / saving images and for bit depth conversion. - @version FreeImage 3 - @author Hervé Drolon -*/ - -class FIP_API fipImage : public fipObject -{ -protected: - /// DIB data - FIBITMAP *_dib; - /// Original (or last saved) fif format if available, FIF_UNKNOWN otherwise - FREE_IMAGE_FORMAT _fif; - /// TRUE whenever the display need to be refreshed - mutable BOOL _bHasChanged; - -public: - friend class fipMultiPage; - -public: - - /**@name Creation & Destruction */ - //@{ - /** - Constructor - @see FreeImage_AllocateT - */ - fipImage(FREE_IMAGE_TYPE image_type = FIT_BITMAP, unsigned width = 0, unsigned height = 0, unsigned bpp = 0); - /// Destructor - virtual ~fipImage(); - /** - Image allocator - @see FreeImage_AllocateT - */ - BOOL setSize(FREE_IMAGE_TYPE image_type, unsigned width, unsigned height, unsigned bpp, unsigned red_mask = 0, unsigned green_mask = 0, unsigned blue_mask = 0); - /// Destroy image data - virtual void clear(); - //@} - - /**@name Copying */ - //@{ - /** - Copy constructor - @see FreeImage_Clone - */ - fipImage(const fipImage& src); - /** - Copy constructor - @see FreeImage_Clone - */ - fipImage& operator=(const fipImage& src); - /** - Assignement operator
- Copy the input pointer and manage its destruction - @see operator FIBITMAP*() - */ - fipImage& operator=(FIBITMAP *dib); - - - /** - @brief Copy a sub part of the current image and returns it as a fipImage object. - - This method works with any bitmap type. - @param dst Output subimage - @param left Specifies the left position of the cropped rectangle. - @param top Specifies the top position of the cropped rectangle. - @param right Specifies the right position of the cropped rectangle. - @param bottom Specifies the bottom position of the cropped rectangle. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Copy - */ - BOOL copySubImage(fipImage& dst, int left, int top, int right, int bottom) const; - - /** - @brief Alpha blend or combine a sub part image with the current image. - - The bit depth of dst bitmap must be greater than or equal to the bit depth of src. - Upper promotion of src is done internally. Supported bit depth equals to 4, 8, 16, 24 or 32. - @param src Source subimage - @param left Specifies the left position of the sub image. - @param top Specifies the top position of the sub image. - @param alpha Alpha blend factor. The source and destination images are alpha blended if - alpha = 0..255. If alpha > 255, then the source image is combined to the destination image. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Paste - */ - BOOL pasteSubImage(fipImage& src, int left, int top, int alpha = 256); - - /** - @brief Crop a sub part of the current image and update it accordingly. - - This method works with any bitmap type. - @param left Specifies the left position of the cropped rectangle. - @param top Specifies the top position of the cropped rectangle. - @param right Specifies the right position of the cropped rectangle. - @param bottom Specifies the bottom position of the cropped rectangle. - @return Returns TRUE if successful, FALSE otherwise. - */ - BOOL crop(int left, int top, int right, int bottom); - - //@} - - /** @name File type identification - */ - //@{ - /** - @brief Identifies an image from disk, given its file name - @param lpszPathName Path and file name of the image to identify. - @return Returns the found FreeImage format if successful, returns FIF_UNKNOWN otherwise. - @see FreeImage_GetFileType, FreeImage_GetFIFFromFilename, FreeImage documentation - */ - static FREE_IMAGE_FORMAT identifyFIF(const char* lpszPathName); - - /** - UNICODE version of identifyFIF (this function only works under WIN32 and does nothing on other OS) - @see FreeImage_GetFileTypeU, FreeImage_GetFIFFromFilenameU, FreeImage documentation - */ - static FREE_IMAGE_FORMAT identifyFIFU(const wchar_t* lpszPathName); - - /** - @brief Identifies an image using the specified FreeImageIO struct and fi_handle. - @param io FreeImageIO structure - @param handle FreeImage fi_handle - @return Returns the found FreeImage format if successful, returns FIF_UNKNOWN otherwise. - @see FreeImage_GetFileTypeFromHandle, FreeImage documentation - */ - static FREE_IMAGE_FORMAT identifyFIFFromHandle(FreeImageIO *io, fi_handle handle); - - /** - @brief Identifies an image using the specified memory stream. - @param hmem FreeImage memory stream - @return Returns the found FreeImage format if successful, returns FIF_UNKNOWN otherwise. - @see FreeImage_GetFileTypeFromMemory, FreeImage documentation - */ - static FREE_IMAGE_FORMAT identifyFIFFromMemory(FIMEMORY *hmem); - - //@} - - - /** @name Loading & Saving - * Loading and saving is handled by the FreeImage library. - */ - //@{ - /** - @brief Loads an image from disk, given its file name and an optional flag. - @param lpszPathName Path and file name of the image to load. - @param flag The signification of this flag depends on the image to be read. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Load, FreeImage documentation - */ - BOOL load(const char* lpszPathName, int flag = 0); - - /** - UNICODE version of load (this function only works under WIN32 and does nothing on other OS) - @see load - */ - BOOL loadU(const wchar_t* lpszPathName, int flag = 0); - - /** - @brief Loads an image using the specified FreeImageIO struct and fi_handle, and an optional flag. - @param io FreeImageIO structure - @param handle FreeImage fi_handle - @param flag The signification of this flag depends on the image to be read. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_LoadFromHandle, FreeImage documentation - */ - BOOL loadFromHandle(FreeImageIO *io, fi_handle handle, int flag = 0); - - /** - @brief Loads an image using the specified memory stream and an optional flag. - @param memIO FreeImage memory stream - @param flag The signification of this flag depends on the image to be read. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_LoadFromMemory, FreeImage documentation - */ - BOOL loadFromMemory(fipMemoryIO& memIO, int flag = 0); - - /** - @brief Saves an image to disk, given its file name and an optional flag. - @param lpszPathName Path and file name of the image to save. - @param flag The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Save, FreeImage documentation - */ - BOOL save(const char* lpszPathName, int flag = 0) const; - - /** - UNICODE version of save (this function only works under WIN32 and does nothing on other OS) - @see save - */ - BOOL saveU(const wchar_t* lpszPathName, int flag = 0) const; - - /** - @brief Saves an image using the specified FreeImageIO struct and fi_handle, and an optional flag. - @param fif Format identifier (FreeImage format) - @param io FreeImageIO structure - @param handle FreeImage fi_handle - @param flag The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SaveToHandle, FreeImage documentation - */ - BOOL saveToHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flag = 0) const; - - /** - @brief Saves an image using the specified memory stream and an optional flag. - @param fif Format identifier (FreeImage format) - @param memIO FreeImage memory stream - @param flag The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SaveToMemory, FreeImage documentation - */ - BOOL saveToMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO& memIO, int flag = 0) const; - - //@} - - /** @name Information functions - * Accessors to the DIB BITMAPINFO structure. - */ - //@{ - - /** - Returns the data type of the image - @see FreeImage_GetImageType - */ - FREE_IMAGE_TYPE getImageType() const; - - /** - Returns the image width in pixels - @see FreeImage_GetWidth - */ - unsigned getWidth() const; - - /** - Returns the image height in pixels - @see FreeImage_GetHeight - */ - unsigned getHeight() const; - - /** - Returns the width of the bitmap in bytes rounded to the nearest DWORD. - @see FreeImage_GetPitch - */ - unsigned getScanWidth() const; - - /** - Returns a pointer to the FIBITMAP data. Used for direct access from FREEIMAGE functions - or from your own low level C functions.
- Sample use :
-
-	fipImage src, dst;
-	src.load("test.png");
-	dst = FreeImage_ConvertTo8Bits(src);
-	FreeImage_Save(FIF_TIFF, dst, "test.tif", 0);
-	
- @see operator=(FIBITMAP *dib) - */ - operator FIBITMAP*() { - return _dib; - } - - /// Returns TRUE if the image is allocated, FALSE otherwise - BOOL isValid() const; - - /** - Returns a pointer to the bitmap's BITMAPINFO header. - @see FreeImage_GetInfo - */ - BITMAPINFO* getInfo() const; - - /** - Returns a pointer to the bitmap's BITMAPINFOHEADER. - @see FreeImage_GetInfoHeader - */ - BITMAPINFOHEADER* getInfoHeader() const; - - /** - Returns the size of the bitmap in bytes. - The size of the bitmap is the BITMAPINFOHEADER + the size of the palette + the size of the bitmap data. - @see FreeImage_GetDIBSize - */ - unsigned getImageSize() const; - - /** - Returns the memory footprint of a bitmap, in bytes. - @see FreeImage_GetMemorySize - */ - unsigned getImageMemorySize() const; - - /** - Returns the bitdepth of the bitmap.
- When the image type is FIT_BITMAP, valid bitdepth can be 1, 4, 8, 16, 24 or 32. - @see FreeImage_GetBPP, getImageType - */ - unsigned getBitsPerPixel() const; - - /** - Returns the width of the bitmap in bytes.
- This is not the size of the scanline. - @see FreeImage_GetLine, getScanWidth - */ - unsigned getLine() const; - - /** - Returns the bitmap resolution along the X axis, in pixels / cm - @see FreeImage_GetDotsPerMeterX - */ - double getHorizontalResolution() const; - - /** - Returns the bitmap resolution along the Y axis, in pixels / cm - @see FreeImage_GetDotsPerMeterY - */ - double getVerticalResolution() const; - - /** - set the bitmap resolution along the X axis, in pixels / cm - @see FreeImage_GetInfoHeader - */ - void setHorizontalResolution(double value); - - /** - set the bitmap resolution along the Y axis, in pixels / cm - @see FreeImage_GetInfoHeader - */ - void setVerticalResolution(double value); - - //@} - - /**@name Palette operations */ - //@{ - /** - Returns a pointer to the bitmap's palette. If the bitmap doesn't have a palette, getPalette returns NULL. - @see FreeImage_GetPalette - */ - RGBQUAD* getPalette() const; - - /** - Returns the palette size in bytes. - @see FreeImage_GetColorsUsed - */ - unsigned getPaletteSize() const; - - /** - Retrieves the number of colours used in the bitmap. If the bitmap is non-palletised, 0 is returned. - @see FreeImage_GetColorsUsed - */ - unsigned getColorsUsed() const; - - /** - Investigates the colour type of the bitmap. - @see FreeImage_GetColorType, FREE_IMAGE_COLOR_TYPE - */ - FREE_IMAGE_COLOR_TYPE getColorType() const; - - /** - Returns TRUE if the bitmap is a 8-bit bitmap with a greyscale palette, FALSE otherwise - @see FreeImage_GetBPP, FreeImage_GetColorType - */ - BOOL isGrayscale() const; - //@} - - /**@name Thumbnail access */ - //@{ - - /** - Retrieves a copy the thumbnail possibly attached to the bitmap - @return Returns TRUE if the thumbnail is present in the bitmap and successfuly retrieved, returns FALSE otherwise - @see FreeImage_GetThumbnail - */ - BOOL getThumbnail(fipImage& image) const; - - /** - Attach a thumbnail to the bitmap - @return Returns TRUE if the thumbnail was successfuly set, returns FALSE otherwise - @see FreeImage_SetThumbnail - */ - BOOL setThumbnail(const fipImage& image); - - /** - Check if the image has an embedded thumbnail - @return Returns TRUE if a thumbnail is present in the bitmap, returns FALSE otherwise - @see FreeImage_GetThumbnail - */ - BOOL hasThumbnail() const; - - /** - Clear the thumbnail possibly attached to the bitmap - @return Returns TRUE if successful, returns FALSe otherwise - @see FreeImage_SetThumbnail - */ - BOOL clearThumbnail(); - - //@} - - /**@name Pixel access */ - //@{ - - /** @brief Returns a pointer to the bitmap bits. - - It is up to you to interpret these bytes correctly, - according to the results of FreeImage_GetBPP and - GetRedMask, FreeImage_GetGreenMask and FreeImage_GetBlueMask.
- Use this function with getScanWidth to iterates through the pixels. - @see FreeImage_GetBits - */ - BYTE* accessPixels() const; - - /** @brief Returns a pointer to the start of the given scanline in the bitmap’s data-bits. - This pointer can be cast according to the result returned by getImageType.
- Use this function with getScanWidth to iterates through the pixels. - @see FreeImage_GetScanLine, FreeImage documentation - */ - BYTE* getScanLine(unsigned scanline) const; - - /** - Get the pixel index of a 1-, 4- or 8-bit palettized image at position (x, y), including range check (slow access). - @param x Pixel position in horizontal direction - @param y Pixel position in vertical direction - @param value Pixel index (returned value) - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_GetPixelIndex - */ - BOOL getPixelIndex(unsigned x, unsigned y, BYTE *value) const; - - /** - Get the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow access). - @param x Pixel position in horizontal direction - @param y Pixel position in vertical direction - @param value Pixel color (returned value) - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_GetPixelColor - */ - BOOL getPixelColor(unsigned x, unsigned y, RGBQUAD *value) const; - - /** - Set the pixel index of a 1-, 4- or 8-bit palettized image at position (x, y), including range check (slow access). - @param x Pixel position in horizontal direction - @param y Pixel position in vertical direction - @param value Pixel index - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SetPixelIndex - */ - BOOL setPixelIndex(unsigned x, unsigned y, BYTE *value); - - /** - Set the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow access). - @param x Pixel position in horizontal direction - @param y Pixel position in vertical direction - @param value Pixel color - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SetPixelColor - */ - BOOL setPixelColor(unsigned x, unsigned y, RGBQUAD *value); - - //@} - - /** @name Conversion routines - * Bitmaps are always loaded in their default bit depth. If you want the bitmap to be stored in another bit depth, the class provides several conversion functions. - */ - //@{ - /** - Converts an image to a type supported by FreeImage. - @param image_type New image type - @param scale_linear TRUE if image pixels must be scaled linearly when converting to a standard bitmap - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertToType, FreeImage_ConvertToStandardType - */ - BOOL convertToType(FREE_IMAGE_TYPE image_type, BOOL scale_linear = TRUE); - - /** - Converts the bitmap to 1 bit using a threshold T. - @param T Threshold value in [0..255] - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Threshold - */ - BOOL threshold(BYTE T); - - /** - Converts a 8-bit image to a monochrome 1-bit image using a dithering algorithm. - @param algorithm Dithering algorithm to use. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Dither, FREE_IMAGE_DITHER - */ - BOOL dither(FREE_IMAGE_DITHER algorithm); - - /** - Converts the bitmap to 4 bits. Unless the bitmap is a 1-bit palettized bitmap, colour values are converted to greyscale. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertTo4Bits - */ - BOOL convertTo4Bits(); - - /** - Converts the bitmap to 8 bits. If the bitmap is 24 or 32-bit RGB, the colour values are converted to greyscale. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertTo8Bits - */ - BOOL convertTo8Bits(); - - /** - Converts the bitmap to 8 bits.
- For palletized bitmaps, the color map is converted to a greyscale ramp. - @see FreeImage_ConvertToGreyscale - @return Returns TRUE if successful, FALSE otherwise. - */ - BOOL convertToGrayscale(); - - /** - Quantizes a full colour 24-bit bitmap to a palletised 8-bit bitmap.
- The quantize parameter specifies which colour reduction algorithm should be used. - @param algorithm Color quantization algorithm to use. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ColorQuantize, FREE_IMAGE_QUANTIZE - */ - BOOL colorQuantize(FREE_IMAGE_QUANTIZE algorithm); - - /** - Converts the bitmap to 16 bits. The resulting bitmap has a layout of 5 bits red, 5 bits green, 5 bits blue and 1 unused bit. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertTo16Bits555 - */ - BOOL convertTo16Bits555(); - - /** - Converts the bitmap to 16 bits. The resulting bitmap has a layout of 5 bits red, 6 bits green and 5 bits blue. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertTo16Bits565 - */ - BOOL convertTo16Bits565(); - - /** - Converts the bitmap to 24 bits. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertTo24Bits - */ - BOOL convertTo24Bits(); - - /** - Converts the bitmap to 32 bits. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertTo32Bits - */ - BOOL convertTo32Bits(); - - /** - Converts the bitmap to a 32-bit float image. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertToFloat - */ - BOOL convertToFloat(); - - /** - Converts the bitmap to a 96-bit RGBF image. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertToRGBF - */ - BOOL convertToRGBF(); - - /** - Converts the bitmap to a 128-bit RGBAF image. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertToRGBAF - */ - BOOL convertToRGBAF(); - - /** - Converts the bitmap to a 16-bit unsigned short image. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertToUINT16 - */ - BOOL convertToUINT16(); - - /** - Converts the bitmap to a 48-bit RGB16 image. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertToRGB16 - */ - BOOL convertToRGB16(); - - /** - Converts the bitmap to a 64-bit RGBA16 image. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertToRGBA16 - */ - BOOL convertToRGBA16(); - - /** - Converts a High Dynamic Range image (48-bit RGB or 96-bit RGB Float) to a 24-bit RGB image. - @param tmo Tone mapping operator - @param first_param First tone mapping algorithm parameter (algorithm dependant) - @param second_param Second tone mapping algorithm parameter (algorithm dependant) - @param third_param Third tone mapping algorithm parameter (algorithm dependant) - @param fourth_param Fourth tone mapping algorithm parameter (algorithm dependant) - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ToneMapping, FreeImage_TmoReinhard05Ex - */ - BOOL toneMapping(FREE_IMAGE_TMO tmo, double first_param = 0, double second_param = 0, double third_param = 1, double fourth_param = 0); - - //@} - - /** @name Transparency support: background colour and alpha channel */ - //@{ - - /** - Returns TRUE if the image is transparent, returns FALSE otherwise - @see FreeImage_IsTransparent - */ - BOOL isTransparent() const; - - /** - 8-bit transparency : get the number of transparent colors. - @return Returns the number of transparent colors in a palletised bitmap. - @see FreeImage_GetTransparencyCount - */ - unsigned getTransparencyCount() const; - - /** - 8-bit transparency : get the bitmap’s transparency table. - @return Returns a pointer to the bitmap’s transparency table. - @see FreeImage_GetTransparencyTable - */ - BYTE* getTransparencyTable() const; - - /** - 8-bit transparency : set the bitmap’s transparency table. - @see FreeImage_SetTransparencyTable - */ - void setTransparencyTable(BYTE *table, int count); - - /** - Returns TRUE when the image has a file background color, FALSE otherwise. - @see FreeImage_HasBackgroundColor - */ - BOOL hasFileBkColor() const; - - /** - @brief Retrieves the file background color of an image. - - For 8-bit images, the color index - in the palette is returned in the rgbReserved member of the bkcolor parameter. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_GetBackgroundColor - */ - BOOL getFileBkColor(RGBQUAD *bkcolor) const; - - /** - @brief Set the file background color of an image. - - When saving an image to PNG, this background color is transparently saved to the PNG file. - When the bkcolor parameter is NULL, the background color is removed from the image. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SetBackgroundColor - */ - BOOL setFileBkColor(RGBQUAD *bkcolor); - //@} - - /**@name Channel processing support */ - //@{ - /** @brief Retrieves the red, green, blue or alpha channel of a 24- or 32-bit BGR[A] image. - @param image Output image to be extracted - @param channel Color channel to extract - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_GetChannel, FREE_IMAGE_COLOR_CHANNEL - */ - BOOL getChannel(fipImage& image, FREE_IMAGE_COLOR_CHANNEL channel) const; - - /** - @brief Insert a 8-bit dib into a 24- or 32-bit image. - @param image Input 8-bit image to insert - @param channel Color channel to replace - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SetChannel, FREE_IMAGE_COLOR_CHANNEL - */ - BOOL setChannel(fipImage& image, FREE_IMAGE_COLOR_CHANNEL channel); - - /** @brief Split a 24-bit RGB image into 3 greyscale images corresponding to the red, green and blue channels. - @param RedChannel Output red channel. - @param GreenChannel Output green channel. - @param BlueChannel Output blue channel. - @return Returns FALSE if the dib isn't a valid image, if it's not a 24-bit image or if - one of the output channel can't be allocated. Returns TRUE otherwise. - @see FreeImage_GetChannel - */ - BOOL splitChannels(fipImage& RedChannel, fipImage& GreenChannel, fipImage& BlueChannel); - - /** @brief Builds a 24-bit RGB image given its red, green and blue channel. - @param red Input red channel. - @param green Input green channel. - @param blue Input blue channel. - @return Returns FALSE if the dib can't be allocated, if the input channels are not 8-bit images. Returns TRUE otherwise. - @see FreeImage_SetChannel - */ - BOOL combineChannels(fipImage& red, fipImage& green, fipImage& blue); - //@} - - /**@name Rotation and flipping */ - //@{ - /** - Image translation and rotation using B-Splines. - @param angle Image rotation angle, in degree - @param x_shift Image horizontal shift - @param y_shift Image vertical shift - @param x_origin Origin of the x-axis - @param y_origin Origin of the y-axis - @param use_mask Whether or not to mask the image. Image mirroring is applied when use_mask is set to FALSE - @return Returns the translated & rotated dib if successful, returns NULL otherwise - @see FreeImage_RotateEx - */ - BOOL rotateEx(double angle, double x_shift, double y_shift, double x_origin, double y_origin, BOOL use_mask); - - /** - Image rotation by means of three shears. - @param angle Image rotation angle, in degree - @param bkcolor Background color (image type dependent), default to black background - @return Returns rotated dib if successful, returns NULL otherwise - @see FreeImage_Rotate - */ - BOOL rotate(double angle, const void *bkcolor = NULL); - - /** - Flip the image horizontally along the vertical axis - @see FreeImage_FlipHorizontal - */ - BOOL flipHorizontal(); - - /** - Flip the image vertically along the horizontal axis - @see FreeImage_FlipVertical - */ - BOOL flipVertical(); - //@} - - /**@name Color manipulation routines */ - //@{ - /** - Inverts each pixel data. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Invert - */ - BOOL invert(); - - /** @brief Perfoms an histogram transformation on a 8, 24 or 32-bit image - according to the values of a lookup table (LUT). - - The transformation is done as follows.
- Image 8-bit : if the image has a color palette, the LUT is applied to this palette, - otherwise, it is applied to the grey values.
- Image 24-bit & 32-bit : if channel == IPL_CC_RGB, the same LUT is applied to each color - plane (R,G, and B). Otherwise, the LUT is applied to the specified channel only. - @param LUT Lookup table. The size of 'LUT' is assumed to be 256. - @param channel The color channel to be processed (only used with 24 & 32-bit DIB). - @return Returns TRUE if the operation was successful, FALSE otherwise - @see FreeImage_AdjustCurve, FREE_IMAGE_COLOR_CHANNEL - */ - BOOL adjustCurve(BYTE *LUT, FREE_IMAGE_COLOR_CHANNEL channel); - - /** @brief Performs gamma correction on a 8, 24 or 32-bit image. - @param gamma Gamma value to use. A value of 1.0 leaves the image alone, - less than one darkens it, and greater than one lightens it. - @return Returns TRUE if the operation was successful, FALSE otherwise - @see FreeImage_AdjustGamma, adjustCurve - */ - BOOL adjustGamma(double gamma); - - /** @brief Adjusts the brightness of a 8, 24 or 32-bit image by a certain amount. - @param percentage Where -100 <= percentage <= 100
- A value 0 means no change, less than 0 will make the image darker - and greater than 0 will make the image brighter. - @return Returns TRUE if the operation was succesful, FALSE otherwise - @see FreeImage_AdjustBrightness, adjustCurve - */ - BOOL adjustBrightness(double percentage); - - /** @brief Adjusts the contrast of a 8, 24 or 32-bit image by a certain amount. - @param percentage Where -100 <= percentage <= 100
- A value 0 means no change, less than 0 will decrease the contrast - and greater than 0 will increase the contrast of the image. - @return Returns TRUE if the operation was succesfull, FALSE otherwise - @see FreeImage_AdjustContrast, adjustCurve - */ - BOOL adjustContrast(double percentage); - - /** - Adjusts an image's brightness, contrast and gamma within a single operation. - If more than one of these image display properties need to be adjusted, - using this function should be preferred over calling each adjustment function separately. - That's particularly true for huge images or if performance is an issue. - @see adjustBrightness - @see adjustContrast - @see adjustGamma - @see FreeImage_AdjustColors - */ - BOOL adjustBrightnessContrastGamma(double brightness, double contrast, double gamma); - - /** @brief Computes image histogram - - For 24-bit and 32-bit images, histogram can be computed from red, green, blue and - black channels. For 8-bit images, histogram is computed from the black channel. Other - bit depth is not supported. - @param histo pointer to an histogram array. Size of this array is assumed to be 256. - @param channel Color channel to use - @return Returns TRUE if the operation was succesfull, FALSE otherwise - @see FreeImage_GetHistogram - */ - BOOL getHistogram(DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel = FICC_BLACK) const; - //@} - - /**@name Upsampling / downsampling */ - //@{ - - /** @brief Rescale the image to a new width / height. - - @param new_width New image width - @param new_height New image height - @param filter The filter parameter specifies which resampling filter should be used. - @return Returns TRUE if the operation was successful, FALSE otherwise - @see FreeImage_Rescale, FREE_IMAGE_FILTER - */ - BOOL rescale(unsigned new_width, unsigned new_height, FREE_IMAGE_FILTER filter); - - /** @brief Creates a thumbnail image keeping aspect ratio - - @param max_size Maximum width or height in pixel units - @param convert When set to TRUE, converts the image to a standard type - @return Returns TRUE if the operation was successful, FALSE otherwise - @see FreeImage_MakeThumbnail - */ - BOOL makeThumbnail(unsigned max_size, BOOL convert = TRUE); - //@} - - /**@name Image status */ - //@{ - /** - Set the image status as 'modified'.
- When using the fipWinImage class, the image status is used to refresh the display. - It is changed to FALSE whenever the display has just been refreshed. - @param bStatus TRUE if the image should be marked as modified, FALSE otherwise - @see isModified - */ - void setModified(BOOL bStatus = TRUE) { - _bHasChanged = bStatus; - } - - /** - Get the image status - @return Returns TRUE if the image is marked as modified, FALSE otherwise - @see setModified - */ - BOOL isModified() { - return _bHasChanged; - } - //@} - - /**@name Metadata */ - //@{ - /** - Returns the number of tags contained in the model metadata model - attached to the dib - @param model Metadata model to look for - */ - unsigned getMetadataCount(FREE_IMAGE_MDMODEL model) const; - /** - Retrieve a metadata attached to the dib - @param model Metadata model to look for - @param key Metadata field name - @param tag Returned tag - @return Returns TRUE if the operation was succesfull, FALSE otherwise - @see FreeImage_GetMetadata - */ - BOOL getMetadata(FREE_IMAGE_MDMODEL model, const char *key, fipTag& tag) const; - /** - Attach a new FreeImage tag to the dib.
- Sample use :
-
-	fipImage image;
-	// ...
-	fipTag tag;
-	tag.setKeyValue("Caption/Abstract", "my caption");
-	image.setMetadata(FIMD_IPTC, tag.getKey(), tag);
-	tag.setKeyValue("Keywords", "FreeImage;Library;Images;Compression");
-	image.setMetadata(FIMD_IPTC, tag.getKey(), tag);
-	
- - @param model Metadata model used to store the tag - @param key Tag field name - @param tag Tag to be attached - @return Returns TRUE if the operation was succesfull, FALSE otherwise - @see FreeImage_SetMetadata - */ - BOOL setMetadata(FREE_IMAGE_MDMODEL model, const char *key, fipTag& tag); - //@} - - - protected: - /**@name Internal use */ - //@{ - BOOL replace(FIBITMAP *new_dib); - //@} - -}; - -// ---------------------------------------------------------- - -/** A class designed for MS Windows (TM) platforms. - - fipWinImage provides methods used to : -
    -
  • Display a DIB on the screen -
  • Copy / Paste a DIB to/from Windows devices (HANDLE, HBITMAP, Clipboard) -
  • Capture a window (HWND) and convert it to an image -
- @version FreeImage 3 - @author Hervé Drolon -*/ -#ifdef _WIN32 - -class FIP_API fipWinImage : public fipImage -{ -public: - /**@name Creation & Destruction */ - //@{ - /// Constructor - fipWinImage(FREE_IMAGE_TYPE image_type = FIT_BITMAP, unsigned width = 0, unsigned height = 0, unsigned bpp = 0); - - /// Destructor - virtual ~fipWinImage(); - - /// Destroy image data - virtual void clear(); - - /// Returns TRUE if the image is allocated, FALSE otherwise - BOOL isValid() const; - //@} - - /**@name Copying */ - //@{ - - /** - Copy constructor. - Delete internal _display_dib data and copy the base class image data. - Tone mapping parameters are left unchanged. - @see FreeImage_Clone - */ - fipWinImage& operator=(const fipImage& src); - - /** - Copy constructor - Delete internal _display_dib data and copy tone mapping parameters. - Copy also the base class image data. - @see FreeImage_Clone - */ - fipWinImage& operator=(const fipWinImage& src); - - /** Clone function used for clipboard copy.
- Convert the FIBITMAP image to a DIB, - and transfer the DIB in a global bitmap handle.
- For non standard bitmaps, the BITMAPINFOHEADER->biCompression field is set to 0xFF + FreeImage_GetImageType(_dib), - in order to recognize the bitmap as non standard. - */ - HANDLE copyToHandle() const; - - /** Copy constructor used for clipboard paste.
- Converts a global object to a FIBITMAP. The clipboard format must be CF_DIB.
- When the BITMAPINFOHEADER->biCompression field is set to 0xFF + [one of the predefined FREE_IMAGE_TYPE], - the bitmap is recognized as non standard and correctly copied. - @return Returns TRUE if successful, returns FALSE otherwise - */ - BOOL copyFromHandle(HANDLE hMem); - - /** Copy constructor.
- Converts a HBITMAP object to a FIBITMAP. - @return Returns TRUE if successful, returns FALSE otherwise - */ - BOOL copyFromBitmap(HBITMAP hbmp); - //@} - - /**@name Clipboard operations */ - //@{ - /** - Clipboard copy. - @param hWndNewOwner Handle to the window to be associated with the open clipboard. - In MFC, you can use AfxGetApp()->m_pMainWnd->GetSafeHwnd(). - @return Returns TRUE if successful, returns FALSE otherwise - */ - BOOL copyToClipboard(HWND hWndNewOwner) const; - - /** - Retrieves data from the clipboard. The clipboard format must be CF_DIB. - @return Returns TRUE if successful, returns FALSE otherwise - */ - BOOL pasteFromClipboard(); - //@} - - /**@name Screen capture */ - //@{ - /** Capture a window and convert it to an image - @param hWndApplicationWindow Handle to the application main window - @param hWndSelectedWindow Handle to the window to be captured - @return Returns TRUE if successful, returns FALSE otherwise - */ - BOOL captureWindow(HWND hWndApplicationWindow, HWND hWndSelectedWindow); - //@} - - - /**@name Painting operations */ - //@{ - - /** @brief Draw (stretch) the image on a HDC, using StretchDIBits. - - When the image is transparent or has a file background, this function composite - the foreground image against a checkerboard background image. - @param hDC Handle to the device context - @param rcDest Destination rectangle - @see FreeImage_Composite - */ - void draw(HDC hDC, RECT& rcDest) const { - drawEx(hDC, rcDest, FALSE, NULL, NULL); - } - - /** @brief Draw (stretch) the image on a HDC, using StretchDIBits. - - When the image is transparent or has a file background, this function can composite - the foreground image against a checkerboard background image, against a single background color or - against a user background image.
- When the image is a High Dynamic Range image (48-bit or RGB float), this function will apply a - tone mapping operator before drawing the image.
- The original image (located in the fipImage class) will not be affected by any of the operations - that could be done in order to display it. - @param hDC Handle to the device context - @param rcDest Destination rectangle - @param useFileBkg When set to TRUE, the function uses the file color background if there is one - @param appBkColor When a color is given, the function uses it as the background color - @param bg When a FIBITMAP is given, the function uses it as the background image - @see FreeImage_Composite - @see setToneMappingOperator - */ - void drawEx(HDC hDC, RECT& rcDest, BOOL useFileBkg = FALSE, RGBQUAD *appBkColor = NULL, FIBITMAP *bg = NULL) const; - - /** - Select a tone mapping algorithm used for drawing and set the image as modified - so that the display will be refreshed. - @param tmo Tone mapping operator - @param first_param First tone mapping algorithm parameter - @param second_param Second tone mapping algorithm parameter - @param third_param Third tone mapping algorithm parameter - @param fourth_param Fourth tone mapping algorithm parameter - @see FreeImage_ToneMapping - */ - void setToneMappingOperator(FREE_IMAGE_TMO tmo, double first_param = 0, double second_param = 0, double third_param = 1, double fourth_param = 0); - - /** - Get the tone mapping algorithm used for drawing, with its parameters. - @param tmo Tone mapping operator - @param first_param First tone mapping algorithm parameter - @param second_param Second tone mapping algorithm parameter - @param third_param Third tone mapping algorithm parameter - @param fourth_param Fourth tone mapping algorithm parameter - @see FreeImage_ToneMapping - */ - void getToneMappingOperator(FREE_IMAGE_TMO *tmo, double *first_param, double *second_param, double *third_param, double *fourth_param) const; - - //@} - -protected: - /// DIB used for display (this allow to display non-standard bitmaps) - mutable FIBITMAP *_display_dib; - /// remember to delete _display_dib - mutable BOOL _bDeleteMe; - /// tone mapping operator - FREE_IMAGE_TMO _tmo; - /// first tone mapping algorithm parameter - double _tmo_param_1; - /// second tone mapping algorithm parameter - double _tmo_param_2; - /// third tone mapping algorithm parameter - double _tmo_param_3; - /// fourth tone mapping algorithm parameter - double _tmo_param_4; -}; - -#endif // _WIN32 - -// ---------------------------------------------------------- - -/** Memory handle - - fipMemoryIO is a class that allows you to load / save images from / to a memory stream. - @version FreeImage 3 - @author Hervé Drolon -*/ -class FIP_API fipMemoryIO : public fipObject -{ -protected: - /// Pointer to a memory stream - FIMEMORY *_hmem; - -public : - /** Constructor. - Wrap a memory buffer containing image data.
- The memory buffer is read only and has to be freed by the user - when no longer in use.
- When default arguments are used, open a memory file as read/write. - @param data Pointer to the memory buffer - @param size_in_bytes Buffer size in bytes - @see FreeImage_OpenMemory - */ - fipMemoryIO(BYTE *data = NULL, DWORD size_in_bytes = 0); - - /** Destructor. - Free any allocated memory - @see FreeImage_CloseMemory - */ - virtual ~fipMemoryIO(); - - /** Destructor. - Free any allocated memory and invalidate the stream - @see FreeImage_CloseMemory - */ - void close(); - - /** Returns TRUE if the internal memory buffer is a valid buffer, returns FALSE otherwise - */ - BOOL isValid() const; - - /** Returns the buffer image format - @see FreeImage_GetFileTypeFromMemory - */ - FREE_IMAGE_FORMAT getFileType() const; - - /** - Returns a pointer to the FIMEMORY data. Used for direct access from FREEIMAGE functions - or from your own low level C functions. - */ - operator FIMEMORY*() { - return _hmem; - } - - /**@name Memory IO routines */ - //@{ - /** - Loads a dib from a memory stream - @param fif Format identifier (FreeImage format) - @param flags The signification of this flag depends on the image to be loaded. - @return Returns the loaded dib if successful, returns NULL otherwise - @see FreeImage_LoadFromMemory - */ - FIBITMAP* load(FREE_IMAGE_FORMAT fif, int flags = 0) const; - /** - Loads a multi-page bitmap from a memory stream - @param fif Format identifier (FreeImage format) - @param flags The signification of this flag depends on the multi-page to be loaded. - @return Returns the loaded multi-page if successful, returns NULL otherwise - @see FreeImage_LoadMultiBitmapFromMemory - */ - FIMULTIBITMAP* loadMultiPage(FREE_IMAGE_FORMAT fif, int flags = 0) const; - /** - Saves a dib to a memory stream - @param fif Format identifier (FreeImage format) - @param dib Image to be saved - @param flags The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SaveToMemory - */ - BOOL save(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, int flags = 0); - /** - Saves a multi-page bitmap to a memory stream - @param fif Format identifier (FreeImage format) - @param bitmap Multi-page image to be saved - @param flags The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SaveMultiBitmapToMemory - */ - BOOL saveMultiPage(FREE_IMAGE_FORMAT fif, FIMULTIBITMAP *bitmap, int flags = 0); - /** - Reads data from a memory stream - @param buffer Storage location for data - @param size Item size in bytes - @param count Maximum number of items to be read - @return Returns the number of full items actually read, which may be less than count if an error occurs - @see FreeImage_ReadMemory - */ - unsigned read(void *buffer, unsigned size, unsigned count) const; - /** - Writes data to a memory stream - @param buffer Pointer to data to be written - @param size Item size in bytes - @param count Maximum number of items to be written - @return Returns the number of full items actually written, which may be less than count if an error occurs - @see FreeImage_WriteMemory - */ - unsigned write(const void *buffer, unsigned size, unsigned count); - /** - Gets the current position of a memory pointer - @see FreeImage_TellMemory - */ - long tell() const; - /** - Moves the memory pointer to a specified location - @see FreeImage_SeekMemory - */ - BOOL seek(long offset, int origin); - /** - Provides a direct buffer access to a memory stream - @param data Pointer to the memory buffer (returned value) - @param size_in_bytes Buffer size in bytes (returned value) - @see FreeImage_AcquireMemory - */ - BOOL acquire(BYTE **data, DWORD *size_in_bytes); - //@} - -private: - /// Disable copy - fipMemoryIO(const fipMemoryIO& src); - /// Disable copy - fipMemoryIO& operator=(const fipMemoryIO& src); - -}; - -// ---------------------------------------------------------- - -/** Multi-page file stream - - fipMultiPage encapsulates the multi-page API. It supports reading/writing - multi-page TIFF, ICO and GIF files. -*/ -class FIP_API fipMultiPage : public fipObject -{ -protected: - /// Pointer to a multi-page file stream - FIMULTIBITMAP *_mpage; - /// TRUE when using a memory cache, FALSE otherwise - BOOL _bMemoryCache; - -public: - /** - Constructor - @param keep_cache_in_memory When it is TRUE, all gathered bitmap data in the page manipulation process is kept in memory, otherwise it is lazily flushed to a temporary file on the hard disk in 64 Kb blocks. - */ - fipMultiPage(BOOL keep_cache_in_memory = FALSE); - - /** - Destructor - Close the file stream if not already done. - */ - virtual ~fipMultiPage(); - - /// Returns TRUE if the multi-page stream is opened - BOOL isValid() const; - - /** - Returns a pointer to the FIMULTIBITMAP data. Used for direct access from FREEIMAGE functions - or from your own low level C functions. - */ - operator FIMULTIBITMAP*() { - return _mpage; - } - - /** - Open a multi-page file stream - @param lpszPathName Name of the multi-page bitmap file - @param create_new When TRUE, it means that a new bitmap will be created rather than an existing one being opened - @param read_only When TRUE the bitmap is opened read-only - @param flags Load flags. The signification of this flag depends on the image to be loaded. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_OpenMultiBitmap - */ - BOOL open(const char* lpszPathName, BOOL create_new, BOOL read_only, int flags = 0); - - /** - Open a multi-page memory stream as read/write. - @param memIO Memory stream. The memory stream MUST BE a wrapped user buffer. - @param flags Load flags. The signification of this flag depends on the image to be loaded. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_LoadMultiBitmapFromMemory - */ - BOOL open(fipMemoryIO& memIO, int flags = 0); - - /** - Open a multi-page image as read/write, using the specified FreeImageIO struct and fi_handle, and an optional flag. - @param io FreeImageIO structure - @param handle FreeImage fi_handle - @param flag The signification of this flag depends on the image to be read. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_OpenMultiBitmapFromHandle - */ - BOOL open(FreeImageIO *io, fi_handle handle, int flags = 0); - - /** - Close a file stream - @param flags Save flags. The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_CloseMultiBitmap - */ - BOOL close(int flags = 0); - - /** - Saves a multi-page image using the specified FreeImageIO struct and fi_handle, and an optional flag. - @param fif Format identifier (FreeImage format) - @param io FreeImageIO structure - @param handle FreeImage fi_handle - @param flag The signification of this flag depends on the multi-page image to be saved. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SaveMultiBitmapToHandle, FreeImage documentation - */ - BOOL saveToHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags = 0) const; - - /** - Saves a multi-page image using the specified memory stream and an optional flag. - @param fif Format identifier (FreeImage format) - @param memIO FreeImage memory stream - @param flag The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SaveMultiBitmapToMemory, FreeImage documentation - */ - BOOL saveToMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO& memIO, int flags = 0) const; - - /** - Returns the number of pages currently available in the multi-paged bitmap - @see FreeImage_GetPageCount - */ - int getPageCount() const; - - /** - Appends a new page to the end of the bitmap - @param image Image to append - @see FreeImage_AppendPage - */ - void appendPage(fipImage& image); - - /** - Inserts a new page before the given position in the bitmap - @param page Page number. Page has to be a number smaller than the current number of pages available in the bitmap. - @param image Image to insert - @see FreeImage_InsertPage - */ - void insertPage(int page, fipImage& image); - - /** - Deletes the page on the given position - @param page Page number - @see FreeImage_DeletePage - */ - void deletePage(int page); - - /** - Moves the source page to the position of the target page. - @param target Target page position - @param source Source page position - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_MovePage - */ - BOOL movePage(int target, int source); - - /** - Locks a page in memory for editing. You must call unlockPage to free the page
- Usage :
-
-	fipMultiPage mpage;
-	// ...
-	fipImage image;		// You must declare this before
-	image = mpage.lockPage(2);
-	if(image.isValid()) {
-	  // ...
-	  mpage.unlockPage(image, TRUE);
-	}
-	
- @param page Page number - @return Returns the page if successful, returns NULL otherwise - @see FreeImage_LockPage - */ - FIBITMAP* lockPage(int page); - - /** - Unlocks a previously locked page and gives it back to the multi-page engine - @param image Page to unlock - @param changed When TRUE, the page is marked changed and the new page data is applied in the multi-page bitmap. - @see FreeImage_UnlockPage - */ - void unlockPage(fipImage& image, BOOL changed); - - /** - Returns an array of page-numbers that are currently locked in memory. - When the pages parameter is NULL, the size of the array is returned in the count variable. - You can then allocate the array of the desired size and call - getLockedPageNumbers again to populate the array. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_GetLockedPageNumbers - */ - BOOL getLockedPageNumbers(int *pages, int *count) const; -}; - -// ---------------------------------------------------------- - -/** -FreeImage Tag - -FreeImage uses this structure to store metadata information. -*/ -class FIP_API fipTag : public fipObject -{ -protected: - /// Pointer to a FreeImage tag - FITAG *_tag; - -public: - /**@name Creation & Destruction */ - //@{ - /** - Constructor - @see FreeImage_CreateTag - */ - fipTag(); - /** - Destructor - @see FreeImage_DeleteTag - */ - virtual ~fipTag(); - /** - Construct a FIDT_ASCII tag (ASCII string).
- This method is useful to store comments or IPTC tags. - @param name Field name - @param value Field value - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_CreateTag - */ - BOOL setKeyValue(const char *key, const char *value); - - //@} - - /**@name Copying */ - //@{ - /** - Copy constructor - @see FreeImage_CloneTag - */ - fipTag(const fipTag& tag); - /** - Copy constructor - @see FreeImage_CloneTag - */ - fipTag& operator=(const fipTag& tag); - /** - Assignement operator
- Copy the input pointer and manage its destruction - @see operator FITAG*() - */ - fipTag& operator=(FITAG *tag); - //@} - - /** - Returns a pointer to the FITAG data. Used for direct access from FREEIMAGE functions - or from your own low level C functions. - @see operator=(FITAG *tag) - */ - operator FITAG*() { - return _tag; - } - - /// Returns TRUE if the tag is allocated, FALSE otherwise - BOOL isValid() const; - - /**@name Tag accessors */ - //@{ - /** - Returns the tag field name (unique inside a metadata model). - @see FreeImage_GetTagKey - */ - const char *getKey() const; - /** - Returns the tag description if available, returns NULL otherwise - @see FreeImage_GetTagDescription - */ - const char *getDescription() const; - /** - Returns the tag ID if available, returns 0 otherwise - @see FreeImage_GetTagID - */ - WORD getID() const; - /** - Returns the tag data type - @see FreeImage_GetTagType - */ - FREE_IMAGE_MDTYPE getType() const; - /** - Returns the number of components in the tag (in tag type units) - @see FreeImage_GetTagCount - */ - DWORD getCount() const; - /** - Returns the length of the tag value in bytes - @see FreeImage_GetTagLength - */ - DWORD getLength() const; - /** - Returns the tag value - @see FreeImage_GetTagValue - */ - const void *getValue() const; - /** - Set the tag field name - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagKey - */ - BOOL setKey(const char *key); - /** - Set the (usually optional) tag description - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagDescription - */ - BOOL setDescription(const char *description); - /** - Set the (usually optional) tad ID - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagID - */ - BOOL setID(WORD id); - /** - Set the tag data type - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagType - */ - BOOL setType(FREE_IMAGE_MDTYPE type); - /** - Set the number of data in the tag - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagCount - */ - BOOL setCount(DWORD count); - /** - Set the length of the tag value, in bytes - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagLength - */ - BOOL setLength(DWORD length); - /** - Set the tag value - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagValue - */ - BOOL setValue(const void *value); - - //@} - - /** - Converts a FreeImage tag structure to a string that represents the interpreted tag value - @param model Metadata model specification (metadata model from which the tag was extracted) - @param Make Camera model (not used yet) - */ - const char* toString(FREE_IMAGE_MDMODEL model, char *Make = NULL) const; - -}; - -/** -Metadata iterator - -Usage :
-
-fipImage image;
-// ...
-fipTag tag;
-fipMetadataFind finder;
-if( finder.findFirstMetadata(FIMD_EXIF_MAIN, image, tag) ) {
-  do {
-    // process the tag
-	cout << tag.getKey() << "\n";
-
-  } while( finder.findNextMetadata(tag) );
-}
-// the class can be called again with another metadata model
-if( finder.findFirstMetadata(FIMD_EXIF_EXIF, image, tag) ) {
-  do {
-    // process the tag
-	cout << tag.getKey() << "\n";
-
-  } while( finder.findNextMetadata(tag) );
-}
-
-*/ -class FIP_API fipMetadataFind : public fipObject -{ -protected: - /// Pointer to a search handle - FIMETADATA *_mdhandle; - -public: - /// Returns TRUE if the search handle is allocated, FALSE otherwise - BOOL isValid() const; - - /// Constructor - fipMetadataFind(); - /** - Destructor - @see FreeImage_FindCloseMetadata - */ - virtual ~fipMetadataFind(); - /** - Provides information about the first instance of a tag that matches - the metadata model specified in the model argument. - @param model Metadata model - @param image Input image - @param tag Returned tag - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_FindFirstMetadata - */ - BOOL findFirstMetadata(FREE_IMAGE_MDMODEL model, fipImage& image, fipTag& tag); - /** - Find the next tag, if any, that matches the metadata model argument - in a previous call to findFirstMetadata - @param tag Returned tag - @return Returns TRUE if successful, returns FALSE otherwise, indicating that no more matching tags could be found - @see FreeImage_FindNextMetadata - */ - BOOL findNextMetadata(fipTag& tag); - -}; - -#endif // FREEIMAGEPLUS_H diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/dist/x32/FreeImagePlus.lib b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/dist/x32/FreeImagePlus.lib deleted file mode 100644 index 30771ff..0000000 Binary files a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/dist/x32/FreeImagePlus.lib and /dev/null differ diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/dist/x64/FreeImagePlus.dll b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/dist/x64/FreeImagePlus.dll deleted file mode 100644 index e423fee..0000000 Binary files a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/dist/x64/FreeImagePlus.dll and /dev/null differ diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/dist/x64/FreeImagePlus.h b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/dist/x64/FreeImagePlus.h deleted file mode 100644 index 571010f..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/dist/x64/FreeImagePlus.h +++ /dev/null @@ -1,1713 +0,0 @@ -// ========================================================== -// FreeImagePlus 3 -// -// Design and implementation by -// - Hervé Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#ifndef FREEIMAGEPLUS_H -#define FREEIMAGEPLUS_H - -#ifdef _WIN32 -#include -#endif // _WIN32 -#include "FreeImage.h" - - -// Compiler options --------------------------------------------------------- - -#if defined(FREEIMAGE_LIB) - #define FIP_API - #define FIP_CALLCONV -#else - #if defined(_WIN32) || defined(__WIN32__) - #define WIN32_LEAN_AND_MEAN - #define FIP_CALLCONV __stdcall - // The following ifdef block is the standard way of creating macros which make exporting - // from a DLL simpler. All files within this DLL are compiled with the FIP_EXPORTS - // symbol defined on the command line. this symbol should not be defined on any project - // that uses this DLL. This way any other project whose source files include this file see - // FIP_API functions as being imported from a DLL, wheras this DLL sees symbols - // defined with this macro as being exported. - #ifdef FIP_EXPORTS - #define FIP_API __declspec(dllexport) - #else - #define FIP_API __declspec(dllimport) - #endif // FIP_EXPORTS - #else - // try the gcc visibility support (see http://gcc.gnu.org/wiki/Visibility) - #if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) - #ifndef GCC_HASCLASSVISIBILITY - #define GCC_HASCLASSVISIBILITY - #endif - #endif - #define FIP_CALLCONV - #if defined(GCC_HASCLASSVISIBILITY) - #define FIP_API __attribute__ ((visibility("default"))) - #else - #define FIP_API - #endif - #endif // WIN32 / !WIN32 -#endif // FREEIMAGE_LIB - -/////////////////////////////////////////////////////////////////////////////////////////// - -// ---------------------------------------------------------- - -/** Abstract base class for all objects used by the library. - @version FreeImage 3 - @author Hervé Drolon -*/ - -class FIP_API fipObject -{ -public: - /// Destructor - virtual ~fipObject(){}; - - /**@name Information functions */ - //@{ - /// Returns TRUE if the object is allocated, FALSE otherwise - virtual BOOL isValid() const = 0; - //@} -}; - -// ---------------------------------------------------------- - -class fipMemoryIO; -class fipMultiPage; -class fipTag; - -/** A class used to manage all photo related images and all image types used by the library. - - fipImage encapsulates the FIBITMAP format. It relies on the FreeImage library, especially for - loading / saving images and for bit depth conversion. - @version FreeImage 3 - @author Hervé Drolon -*/ - -class FIP_API fipImage : public fipObject -{ -protected: - /// DIB data - FIBITMAP *_dib; - /// Original (or last saved) fif format if available, FIF_UNKNOWN otherwise - FREE_IMAGE_FORMAT _fif; - /// TRUE whenever the display need to be refreshed - mutable BOOL _bHasChanged; - -public: - friend class fipMultiPage; - -public: - - /**@name Creation & Destruction */ - //@{ - /** - Constructor - @see FreeImage_AllocateT - */ - fipImage(FREE_IMAGE_TYPE image_type = FIT_BITMAP, unsigned width = 0, unsigned height = 0, unsigned bpp = 0); - /// Destructor - virtual ~fipImage(); - /** - Image allocator - @see FreeImage_AllocateT - */ - BOOL setSize(FREE_IMAGE_TYPE image_type, unsigned width, unsigned height, unsigned bpp, unsigned red_mask = 0, unsigned green_mask = 0, unsigned blue_mask = 0); - /// Destroy image data - virtual void clear(); - //@} - - /**@name Copying */ - //@{ - /** - Copy constructor - @see FreeImage_Clone - */ - fipImage(const fipImage& src); - /** - Copy constructor - @see FreeImage_Clone - */ - fipImage& operator=(const fipImage& src); - /** - Assignement operator
- Copy the input pointer and manage its destruction - @see operator FIBITMAP*() - */ - fipImage& operator=(FIBITMAP *dib); - - - /** - @brief Copy a sub part of the current image and returns it as a fipImage object. - - This method works with any bitmap type. - @param dst Output subimage - @param left Specifies the left position of the cropped rectangle. - @param top Specifies the top position of the cropped rectangle. - @param right Specifies the right position of the cropped rectangle. - @param bottom Specifies the bottom position of the cropped rectangle. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Copy - */ - BOOL copySubImage(fipImage& dst, int left, int top, int right, int bottom) const; - - /** - @brief Alpha blend or combine a sub part image with the current image. - - The bit depth of dst bitmap must be greater than or equal to the bit depth of src. - Upper promotion of src is done internally. Supported bit depth equals to 4, 8, 16, 24 or 32. - @param src Source subimage - @param left Specifies the left position of the sub image. - @param top Specifies the top position of the sub image. - @param alpha Alpha blend factor. The source and destination images are alpha blended if - alpha = 0..255. If alpha > 255, then the source image is combined to the destination image. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Paste - */ - BOOL pasteSubImage(fipImage& src, int left, int top, int alpha = 256); - - /** - @brief Crop a sub part of the current image and update it accordingly. - - This method works with any bitmap type. - @param left Specifies the left position of the cropped rectangle. - @param top Specifies the top position of the cropped rectangle. - @param right Specifies the right position of the cropped rectangle. - @param bottom Specifies the bottom position of the cropped rectangle. - @return Returns TRUE if successful, FALSE otherwise. - */ - BOOL crop(int left, int top, int right, int bottom); - - //@} - - /** @name File type identification - */ - //@{ - /** - @brief Identifies an image from disk, given its file name - @param lpszPathName Path and file name of the image to identify. - @return Returns the found FreeImage format if successful, returns FIF_UNKNOWN otherwise. - @see FreeImage_GetFileType, FreeImage_GetFIFFromFilename, FreeImage documentation - */ - static FREE_IMAGE_FORMAT identifyFIF(const char* lpszPathName); - - /** - UNICODE version of identifyFIF (this function only works under WIN32 and does nothing on other OS) - @see FreeImage_GetFileTypeU, FreeImage_GetFIFFromFilenameU, FreeImage documentation - */ - static FREE_IMAGE_FORMAT identifyFIFU(const wchar_t* lpszPathName); - - /** - @brief Identifies an image using the specified FreeImageIO struct and fi_handle. - @param io FreeImageIO structure - @param handle FreeImage fi_handle - @return Returns the found FreeImage format if successful, returns FIF_UNKNOWN otherwise. - @see FreeImage_GetFileTypeFromHandle, FreeImage documentation - */ - static FREE_IMAGE_FORMAT identifyFIFFromHandle(FreeImageIO *io, fi_handle handle); - - /** - @brief Identifies an image using the specified memory stream. - @param hmem FreeImage memory stream - @return Returns the found FreeImage format if successful, returns FIF_UNKNOWN otherwise. - @see FreeImage_GetFileTypeFromMemory, FreeImage documentation - */ - static FREE_IMAGE_FORMAT identifyFIFFromMemory(FIMEMORY *hmem); - - //@} - - - /** @name Loading & Saving - * Loading and saving is handled by the FreeImage library. - */ - //@{ - /** - @brief Loads an image from disk, given its file name and an optional flag. - @param lpszPathName Path and file name of the image to load. - @param flag The signification of this flag depends on the image to be read. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Load, FreeImage documentation - */ - BOOL load(const char* lpszPathName, int flag = 0); - - /** - UNICODE version of load (this function only works under WIN32 and does nothing on other OS) - @see load - */ - BOOL loadU(const wchar_t* lpszPathName, int flag = 0); - - /** - @brief Loads an image using the specified FreeImageIO struct and fi_handle, and an optional flag. - @param io FreeImageIO structure - @param handle FreeImage fi_handle - @param flag The signification of this flag depends on the image to be read. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_LoadFromHandle, FreeImage documentation - */ - BOOL loadFromHandle(FreeImageIO *io, fi_handle handle, int flag = 0); - - /** - @brief Loads an image using the specified memory stream and an optional flag. - @param memIO FreeImage memory stream - @param flag The signification of this flag depends on the image to be read. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_LoadFromMemory, FreeImage documentation - */ - BOOL loadFromMemory(fipMemoryIO& memIO, int flag = 0); - - /** - @brief Saves an image to disk, given its file name and an optional flag. - @param lpszPathName Path and file name of the image to save. - @param flag The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Save, FreeImage documentation - */ - BOOL save(const char* lpszPathName, int flag = 0) const; - - /** - UNICODE version of save (this function only works under WIN32 and does nothing on other OS) - @see save - */ - BOOL saveU(const wchar_t* lpszPathName, int flag = 0) const; - - /** - @brief Saves an image using the specified FreeImageIO struct and fi_handle, and an optional flag. - @param fif Format identifier (FreeImage format) - @param io FreeImageIO structure - @param handle FreeImage fi_handle - @param flag The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SaveToHandle, FreeImage documentation - */ - BOOL saveToHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flag = 0) const; - - /** - @brief Saves an image using the specified memory stream and an optional flag. - @param fif Format identifier (FreeImage format) - @param memIO FreeImage memory stream - @param flag The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SaveToMemory, FreeImage documentation - */ - BOOL saveToMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO& memIO, int flag = 0) const; - - //@} - - /** @name Information functions - * Accessors to the DIB BITMAPINFO structure. - */ - //@{ - - /** - Returns the data type of the image - @see FreeImage_GetImageType - */ - FREE_IMAGE_TYPE getImageType() const; - - /** - Returns the image width in pixels - @see FreeImage_GetWidth - */ - unsigned getWidth() const; - - /** - Returns the image height in pixels - @see FreeImage_GetHeight - */ - unsigned getHeight() const; - - /** - Returns the width of the bitmap in bytes rounded to the nearest DWORD. - @see FreeImage_GetPitch - */ - unsigned getScanWidth() const; - - /** - Returns a pointer to the FIBITMAP data. Used for direct access from FREEIMAGE functions - or from your own low level C functions.
- Sample use :
-
-	fipImage src, dst;
-	src.load("test.png");
-	dst = FreeImage_ConvertTo8Bits(src);
-	FreeImage_Save(FIF_TIFF, dst, "test.tif", 0);
-	
- @see operator=(FIBITMAP *dib) - */ - operator FIBITMAP*() { - return _dib; - } - - /// Returns TRUE if the image is allocated, FALSE otherwise - BOOL isValid() const; - - /** - Returns a pointer to the bitmap's BITMAPINFO header. - @see FreeImage_GetInfo - */ - BITMAPINFO* getInfo() const; - - /** - Returns a pointer to the bitmap's BITMAPINFOHEADER. - @see FreeImage_GetInfoHeader - */ - BITMAPINFOHEADER* getInfoHeader() const; - - /** - Returns the size of the bitmap in bytes. - The size of the bitmap is the BITMAPINFOHEADER + the size of the palette + the size of the bitmap data. - @see FreeImage_GetDIBSize - */ - unsigned getImageSize() const; - - /** - Returns the memory footprint of a bitmap, in bytes. - @see FreeImage_GetMemorySize - */ - unsigned getImageMemorySize() const; - - /** - Returns the bitdepth of the bitmap.
- When the image type is FIT_BITMAP, valid bitdepth can be 1, 4, 8, 16, 24 or 32. - @see FreeImage_GetBPP, getImageType - */ - unsigned getBitsPerPixel() const; - - /** - Returns the width of the bitmap in bytes.
- This is not the size of the scanline. - @see FreeImage_GetLine, getScanWidth - */ - unsigned getLine() const; - - /** - Returns the bitmap resolution along the X axis, in pixels / cm - @see FreeImage_GetDotsPerMeterX - */ - double getHorizontalResolution() const; - - /** - Returns the bitmap resolution along the Y axis, in pixels / cm - @see FreeImage_GetDotsPerMeterY - */ - double getVerticalResolution() const; - - /** - set the bitmap resolution along the X axis, in pixels / cm - @see FreeImage_GetInfoHeader - */ - void setHorizontalResolution(double value); - - /** - set the bitmap resolution along the Y axis, in pixels / cm - @see FreeImage_GetInfoHeader - */ - void setVerticalResolution(double value); - - //@} - - /**@name Palette operations */ - //@{ - /** - Returns a pointer to the bitmap's palette. If the bitmap doesn't have a palette, getPalette returns NULL. - @see FreeImage_GetPalette - */ - RGBQUAD* getPalette() const; - - /** - Returns the palette size in bytes. - @see FreeImage_GetColorsUsed - */ - unsigned getPaletteSize() const; - - /** - Retrieves the number of colours used in the bitmap. If the bitmap is non-palletised, 0 is returned. - @see FreeImage_GetColorsUsed - */ - unsigned getColorsUsed() const; - - /** - Investigates the colour type of the bitmap. - @see FreeImage_GetColorType, FREE_IMAGE_COLOR_TYPE - */ - FREE_IMAGE_COLOR_TYPE getColorType() const; - - /** - Returns TRUE if the bitmap is a 8-bit bitmap with a greyscale palette, FALSE otherwise - @see FreeImage_GetBPP, FreeImage_GetColorType - */ - BOOL isGrayscale() const; - //@} - - /**@name Thumbnail access */ - //@{ - - /** - Retrieves a copy the thumbnail possibly attached to the bitmap - @return Returns TRUE if the thumbnail is present in the bitmap and successfuly retrieved, returns FALSE otherwise - @see FreeImage_GetThumbnail - */ - BOOL getThumbnail(fipImage& image) const; - - /** - Attach a thumbnail to the bitmap - @return Returns TRUE if the thumbnail was successfuly set, returns FALSE otherwise - @see FreeImage_SetThumbnail - */ - BOOL setThumbnail(const fipImage& image); - - /** - Check if the image has an embedded thumbnail - @return Returns TRUE if a thumbnail is present in the bitmap, returns FALSE otherwise - @see FreeImage_GetThumbnail - */ - BOOL hasThumbnail() const; - - /** - Clear the thumbnail possibly attached to the bitmap - @return Returns TRUE if successful, returns FALSe otherwise - @see FreeImage_SetThumbnail - */ - BOOL clearThumbnail(); - - //@} - - /**@name Pixel access */ - //@{ - - /** @brief Returns a pointer to the bitmap bits. - - It is up to you to interpret these bytes correctly, - according to the results of FreeImage_GetBPP and - GetRedMask, FreeImage_GetGreenMask and FreeImage_GetBlueMask.
- Use this function with getScanWidth to iterates through the pixels. - @see FreeImage_GetBits - */ - BYTE* accessPixels() const; - - /** @brief Returns a pointer to the start of the given scanline in the bitmap’s data-bits. - This pointer can be cast according to the result returned by getImageType.
- Use this function with getScanWidth to iterates through the pixels. - @see FreeImage_GetScanLine, FreeImage documentation - */ - BYTE* getScanLine(unsigned scanline) const; - - /** - Get the pixel index of a 1-, 4- or 8-bit palettized image at position (x, y), including range check (slow access). - @param x Pixel position in horizontal direction - @param y Pixel position in vertical direction - @param value Pixel index (returned value) - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_GetPixelIndex - */ - BOOL getPixelIndex(unsigned x, unsigned y, BYTE *value) const; - - /** - Get the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow access). - @param x Pixel position in horizontal direction - @param y Pixel position in vertical direction - @param value Pixel color (returned value) - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_GetPixelColor - */ - BOOL getPixelColor(unsigned x, unsigned y, RGBQUAD *value) const; - - /** - Set the pixel index of a 1-, 4- or 8-bit palettized image at position (x, y), including range check (slow access). - @param x Pixel position in horizontal direction - @param y Pixel position in vertical direction - @param value Pixel index - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SetPixelIndex - */ - BOOL setPixelIndex(unsigned x, unsigned y, BYTE *value); - - /** - Set the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow access). - @param x Pixel position in horizontal direction - @param y Pixel position in vertical direction - @param value Pixel color - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SetPixelColor - */ - BOOL setPixelColor(unsigned x, unsigned y, RGBQUAD *value); - - //@} - - /** @name Conversion routines - * Bitmaps are always loaded in their default bit depth. If you want the bitmap to be stored in another bit depth, the class provides several conversion functions. - */ - //@{ - /** - Converts an image to a type supported by FreeImage. - @param image_type New image type - @param scale_linear TRUE if image pixels must be scaled linearly when converting to a standard bitmap - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertToType, FreeImage_ConvertToStandardType - */ - BOOL convertToType(FREE_IMAGE_TYPE image_type, BOOL scale_linear = TRUE); - - /** - Converts the bitmap to 1 bit using a threshold T. - @param T Threshold value in [0..255] - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Threshold - */ - BOOL threshold(BYTE T); - - /** - Converts a 8-bit image to a monochrome 1-bit image using a dithering algorithm. - @param algorithm Dithering algorithm to use. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Dither, FREE_IMAGE_DITHER - */ - BOOL dither(FREE_IMAGE_DITHER algorithm); - - /** - Converts the bitmap to 4 bits. Unless the bitmap is a 1-bit palettized bitmap, colour values are converted to greyscale. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertTo4Bits - */ - BOOL convertTo4Bits(); - - /** - Converts the bitmap to 8 bits. If the bitmap is 24 or 32-bit RGB, the colour values are converted to greyscale. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertTo8Bits - */ - BOOL convertTo8Bits(); - - /** - Converts the bitmap to 8 bits.
- For palletized bitmaps, the color map is converted to a greyscale ramp. - @see FreeImage_ConvertToGreyscale - @return Returns TRUE if successful, FALSE otherwise. - */ - BOOL convertToGrayscale(); - - /** - Quantizes a full colour 24-bit bitmap to a palletised 8-bit bitmap.
- The quantize parameter specifies which colour reduction algorithm should be used. - @param algorithm Color quantization algorithm to use. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ColorQuantize, FREE_IMAGE_QUANTIZE - */ - BOOL colorQuantize(FREE_IMAGE_QUANTIZE algorithm); - - /** - Converts the bitmap to 16 bits. The resulting bitmap has a layout of 5 bits red, 5 bits green, 5 bits blue and 1 unused bit. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertTo16Bits555 - */ - BOOL convertTo16Bits555(); - - /** - Converts the bitmap to 16 bits. The resulting bitmap has a layout of 5 bits red, 6 bits green and 5 bits blue. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertTo16Bits565 - */ - BOOL convertTo16Bits565(); - - /** - Converts the bitmap to 24 bits. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertTo24Bits - */ - BOOL convertTo24Bits(); - - /** - Converts the bitmap to 32 bits. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertTo32Bits - */ - BOOL convertTo32Bits(); - - /** - Converts the bitmap to a 32-bit float image. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertToFloat - */ - BOOL convertToFloat(); - - /** - Converts the bitmap to a 96-bit RGBF image. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertToRGBF - */ - BOOL convertToRGBF(); - - /** - Converts the bitmap to a 128-bit RGBAF image. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertToRGBAF - */ - BOOL convertToRGBAF(); - - /** - Converts the bitmap to a 16-bit unsigned short image. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertToUINT16 - */ - BOOL convertToUINT16(); - - /** - Converts the bitmap to a 48-bit RGB16 image. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertToRGB16 - */ - BOOL convertToRGB16(); - - /** - Converts the bitmap to a 64-bit RGBA16 image. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ConvertToRGBA16 - */ - BOOL convertToRGBA16(); - - /** - Converts a High Dynamic Range image (48-bit RGB or 96-bit RGB Float) to a 24-bit RGB image. - @param tmo Tone mapping operator - @param first_param First tone mapping algorithm parameter (algorithm dependant) - @param second_param Second tone mapping algorithm parameter (algorithm dependant) - @param third_param Third tone mapping algorithm parameter (algorithm dependant) - @param fourth_param Fourth tone mapping algorithm parameter (algorithm dependant) - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_ToneMapping, FreeImage_TmoReinhard05Ex - */ - BOOL toneMapping(FREE_IMAGE_TMO tmo, double first_param = 0, double second_param = 0, double third_param = 1, double fourth_param = 0); - - //@} - - /** @name Transparency support: background colour and alpha channel */ - //@{ - - /** - Returns TRUE if the image is transparent, returns FALSE otherwise - @see FreeImage_IsTransparent - */ - BOOL isTransparent() const; - - /** - 8-bit transparency : get the number of transparent colors. - @return Returns the number of transparent colors in a palletised bitmap. - @see FreeImage_GetTransparencyCount - */ - unsigned getTransparencyCount() const; - - /** - 8-bit transparency : get the bitmap’s transparency table. - @return Returns a pointer to the bitmap’s transparency table. - @see FreeImage_GetTransparencyTable - */ - BYTE* getTransparencyTable() const; - - /** - 8-bit transparency : set the bitmap’s transparency table. - @see FreeImage_SetTransparencyTable - */ - void setTransparencyTable(BYTE *table, int count); - - /** - Returns TRUE when the image has a file background color, FALSE otherwise. - @see FreeImage_HasBackgroundColor - */ - BOOL hasFileBkColor() const; - - /** - @brief Retrieves the file background color of an image. - - For 8-bit images, the color index - in the palette is returned in the rgbReserved member of the bkcolor parameter. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_GetBackgroundColor - */ - BOOL getFileBkColor(RGBQUAD *bkcolor) const; - - /** - @brief Set the file background color of an image. - - When saving an image to PNG, this background color is transparently saved to the PNG file. - When the bkcolor parameter is NULL, the background color is removed from the image. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SetBackgroundColor - */ - BOOL setFileBkColor(RGBQUAD *bkcolor); - //@} - - /**@name Channel processing support */ - //@{ - /** @brief Retrieves the red, green, blue or alpha channel of a 24- or 32-bit BGR[A] image. - @param image Output image to be extracted - @param channel Color channel to extract - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_GetChannel, FREE_IMAGE_COLOR_CHANNEL - */ - BOOL getChannel(fipImage& image, FREE_IMAGE_COLOR_CHANNEL channel) const; - - /** - @brief Insert a 8-bit dib into a 24- or 32-bit image. - @param image Input 8-bit image to insert - @param channel Color channel to replace - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SetChannel, FREE_IMAGE_COLOR_CHANNEL - */ - BOOL setChannel(fipImage& image, FREE_IMAGE_COLOR_CHANNEL channel); - - /** @brief Split a 24-bit RGB image into 3 greyscale images corresponding to the red, green and blue channels. - @param RedChannel Output red channel. - @param GreenChannel Output green channel. - @param BlueChannel Output blue channel. - @return Returns FALSE if the dib isn't a valid image, if it's not a 24-bit image or if - one of the output channel can't be allocated. Returns TRUE otherwise. - @see FreeImage_GetChannel - */ - BOOL splitChannels(fipImage& RedChannel, fipImage& GreenChannel, fipImage& BlueChannel); - - /** @brief Builds a 24-bit RGB image given its red, green and blue channel. - @param red Input red channel. - @param green Input green channel. - @param blue Input blue channel. - @return Returns FALSE if the dib can't be allocated, if the input channels are not 8-bit images. Returns TRUE otherwise. - @see FreeImage_SetChannel - */ - BOOL combineChannels(fipImage& red, fipImage& green, fipImage& blue); - //@} - - /**@name Rotation and flipping */ - //@{ - /** - Image translation and rotation using B-Splines. - @param angle Image rotation angle, in degree - @param x_shift Image horizontal shift - @param y_shift Image vertical shift - @param x_origin Origin of the x-axis - @param y_origin Origin of the y-axis - @param use_mask Whether or not to mask the image. Image mirroring is applied when use_mask is set to FALSE - @return Returns the translated & rotated dib if successful, returns NULL otherwise - @see FreeImage_RotateEx - */ - BOOL rotateEx(double angle, double x_shift, double y_shift, double x_origin, double y_origin, BOOL use_mask); - - /** - Image rotation by means of three shears. - @param angle Image rotation angle, in degree - @param bkcolor Background color (image type dependent), default to black background - @return Returns rotated dib if successful, returns NULL otherwise - @see FreeImage_Rotate - */ - BOOL rotate(double angle, const void *bkcolor = NULL); - - /** - Flip the image horizontally along the vertical axis - @see FreeImage_FlipHorizontal - */ - BOOL flipHorizontal(); - - /** - Flip the image vertically along the horizontal axis - @see FreeImage_FlipVertical - */ - BOOL flipVertical(); - //@} - - /**@name Color manipulation routines */ - //@{ - /** - Inverts each pixel data. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Invert - */ - BOOL invert(); - - /** @brief Perfoms an histogram transformation on a 8, 24 or 32-bit image - according to the values of a lookup table (LUT). - - The transformation is done as follows.
- Image 8-bit : if the image has a color palette, the LUT is applied to this palette, - otherwise, it is applied to the grey values.
- Image 24-bit & 32-bit : if channel == IPL_CC_RGB, the same LUT is applied to each color - plane (R,G, and B). Otherwise, the LUT is applied to the specified channel only. - @param LUT Lookup table. The size of 'LUT' is assumed to be 256. - @param channel The color channel to be processed (only used with 24 & 32-bit DIB). - @return Returns TRUE if the operation was successful, FALSE otherwise - @see FreeImage_AdjustCurve, FREE_IMAGE_COLOR_CHANNEL - */ - BOOL adjustCurve(BYTE *LUT, FREE_IMAGE_COLOR_CHANNEL channel); - - /** @brief Performs gamma correction on a 8, 24 or 32-bit image. - @param gamma Gamma value to use. A value of 1.0 leaves the image alone, - less than one darkens it, and greater than one lightens it. - @return Returns TRUE if the operation was successful, FALSE otherwise - @see FreeImage_AdjustGamma, adjustCurve - */ - BOOL adjustGamma(double gamma); - - /** @brief Adjusts the brightness of a 8, 24 or 32-bit image by a certain amount. - @param percentage Where -100 <= percentage <= 100
- A value 0 means no change, less than 0 will make the image darker - and greater than 0 will make the image brighter. - @return Returns TRUE if the operation was succesful, FALSE otherwise - @see FreeImage_AdjustBrightness, adjustCurve - */ - BOOL adjustBrightness(double percentage); - - /** @brief Adjusts the contrast of a 8, 24 or 32-bit image by a certain amount. - @param percentage Where -100 <= percentage <= 100
- A value 0 means no change, less than 0 will decrease the contrast - and greater than 0 will increase the contrast of the image. - @return Returns TRUE if the operation was succesfull, FALSE otherwise - @see FreeImage_AdjustContrast, adjustCurve - */ - BOOL adjustContrast(double percentage); - - /** - Adjusts an image's brightness, contrast and gamma within a single operation. - If more than one of these image display properties need to be adjusted, - using this function should be preferred over calling each adjustment function separately. - That's particularly true for huge images or if performance is an issue. - @see adjustBrightness - @see adjustContrast - @see adjustGamma - @see FreeImage_AdjustColors - */ - BOOL adjustBrightnessContrastGamma(double brightness, double contrast, double gamma); - - /** @brief Computes image histogram - - For 24-bit and 32-bit images, histogram can be computed from red, green, blue and - black channels. For 8-bit images, histogram is computed from the black channel. Other - bit depth is not supported. - @param histo pointer to an histogram array. Size of this array is assumed to be 256. - @param channel Color channel to use - @return Returns TRUE if the operation was succesfull, FALSE otherwise - @see FreeImage_GetHistogram - */ - BOOL getHistogram(DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel = FICC_BLACK) const; - //@} - - /**@name Upsampling / downsampling */ - //@{ - - /** @brief Rescale the image to a new width / height. - - @param new_width New image width - @param new_height New image height - @param filter The filter parameter specifies which resampling filter should be used. - @return Returns TRUE if the operation was successful, FALSE otherwise - @see FreeImage_Rescale, FREE_IMAGE_FILTER - */ - BOOL rescale(unsigned new_width, unsigned new_height, FREE_IMAGE_FILTER filter); - - /** @brief Creates a thumbnail image keeping aspect ratio - - @param max_size Maximum width or height in pixel units - @param convert When set to TRUE, converts the image to a standard type - @return Returns TRUE if the operation was successful, FALSE otherwise - @see FreeImage_MakeThumbnail - */ - BOOL makeThumbnail(unsigned max_size, BOOL convert = TRUE); - //@} - - /**@name Image status */ - //@{ - /** - Set the image status as 'modified'.
- When using the fipWinImage class, the image status is used to refresh the display. - It is changed to FALSE whenever the display has just been refreshed. - @param bStatus TRUE if the image should be marked as modified, FALSE otherwise - @see isModified - */ - void setModified(BOOL bStatus = TRUE) { - _bHasChanged = bStatus; - } - - /** - Get the image status - @return Returns TRUE if the image is marked as modified, FALSE otherwise - @see setModified - */ - BOOL isModified() { - return _bHasChanged; - } - //@} - - /**@name Metadata */ - //@{ - /** - Returns the number of tags contained in the model metadata model - attached to the dib - @param model Metadata model to look for - */ - unsigned getMetadataCount(FREE_IMAGE_MDMODEL model) const; - /** - Retrieve a metadata attached to the dib - @param model Metadata model to look for - @param key Metadata field name - @param tag Returned tag - @return Returns TRUE if the operation was succesfull, FALSE otherwise - @see FreeImage_GetMetadata - */ - BOOL getMetadata(FREE_IMAGE_MDMODEL model, const char *key, fipTag& tag) const; - /** - Attach a new FreeImage tag to the dib.
- Sample use :
-
-	fipImage image;
-	// ...
-	fipTag tag;
-	tag.setKeyValue("Caption/Abstract", "my caption");
-	image.setMetadata(FIMD_IPTC, tag.getKey(), tag);
-	tag.setKeyValue("Keywords", "FreeImage;Library;Images;Compression");
-	image.setMetadata(FIMD_IPTC, tag.getKey(), tag);
-	
- - @param model Metadata model used to store the tag - @param key Tag field name - @param tag Tag to be attached - @return Returns TRUE if the operation was succesfull, FALSE otherwise - @see FreeImage_SetMetadata - */ - BOOL setMetadata(FREE_IMAGE_MDMODEL model, const char *key, fipTag& tag); - //@} - - - protected: - /**@name Internal use */ - //@{ - BOOL replace(FIBITMAP *new_dib); - //@} - -}; - -// ---------------------------------------------------------- - -/** A class designed for MS Windows (TM) platforms. - - fipWinImage provides methods used to : -
    -
  • Display a DIB on the screen -
  • Copy / Paste a DIB to/from Windows devices (HANDLE, HBITMAP, Clipboard) -
  • Capture a window (HWND) and convert it to an image -
- @version FreeImage 3 - @author Hervé Drolon -*/ -#ifdef _WIN32 - -class FIP_API fipWinImage : public fipImage -{ -public: - /**@name Creation & Destruction */ - //@{ - /// Constructor - fipWinImage(FREE_IMAGE_TYPE image_type = FIT_BITMAP, unsigned width = 0, unsigned height = 0, unsigned bpp = 0); - - /// Destructor - virtual ~fipWinImage(); - - /// Destroy image data - virtual void clear(); - - /// Returns TRUE if the image is allocated, FALSE otherwise - BOOL isValid() const; - //@} - - /**@name Copying */ - //@{ - - /** - Copy constructor. - Delete internal _display_dib data and copy the base class image data. - Tone mapping parameters are left unchanged. - @see FreeImage_Clone - */ - fipWinImage& operator=(const fipImage& src); - - /** - Copy constructor - Delete internal _display_dib data and copy tone mapping parameters. - Copy also the base class image data. - @see FreeImage_Clone - */ - fipWinImage& operator=(const fipWinImage& src); - - /** Clone function used for clipboard copy.
- Convert the FIBITMAP image to a DIB, - and transfer the DIB in a global bitmap handle.
- For non standard bitmaps, the BITMAPINFOHEADER->biCompression field is set to 0xFF + FreeImage_GetImageType(_dib), - in order to recognize the bitmap as non standard. - */ - HANDLE copyToHandle() const; - - /** Copy constructor used for clipboard paste.
- Converts a global object to a FIBITMAP. The clipboard format must be CF_DIB.
- When the BITMAPINFOHEADER->biCompression field is set to 0xFF + [one of the predefined FREE_IMAGE_TYPE], - the bitmap is recognized as non standard and correctly copied. - @return Returns TRUE if successful, returns FALSE otherwise - */ - BOOL copyFromHandle(HANDLE hMem); - - /** Copy constructor.
- Converts a HBITMAP object to a FIBITMAP. - @return Returns TRUE if successful, returns FALSE otherwise - */ - BOOL copyFromBitmap(HBITMAP hbmp); - //@} - - /**@name Clipboard operations */ - //@{ - /** - Clipboard copy. - @param hWndNewOwner Handle to the window to be associated with the open clipboard. - In MFC, you can use AfxGetApp()->m_pMainWnd->GetSafeHwnd(). - @return Returns TRUE if successful, returns FALSE otherwise - */ - BOOL copyToClipboard(HWND hWndNewOwner) const; - - /** - Retrieves data from the clipboard. The clipboard format must be CF_DIB. - @return Returns TRUE if successful, returns FALSE otherwise - */ - BOOL pasteFromClipboard(); - //@} - - /**@name Screen capture */ - //@{ - /** Capture a window and convert it to an image - @param hWndApplicationWindow Handle to the application main window - @param hWndSelectedWindow Handle to the window to be captured - @return Returns TRUE if successful, returns FALSE otherwise - */ - BOOL captureWindow(HWND hWndApplicationWindow, HWND hWndSelectedWindow); - //@} - - - /**@name Painting operations */ - //@{ - - /** @brief Draw (stretch) the image on a HDC, using StretchDIBits. - - When the image is transparent or has a file background, this function composite - the foreground image against a checkerboard background image. - @param hDC Handle to the device context - @param rcDest Destination rectangle - @see FreeImage_Composite - */ - void draw(HDC hDC, RECT& rcDest) const { - drawEx(hDC, rcDest, FALSE, NULL, NULL); - } - - /** @brief Draw (stretch) the image on a HDC, using StretchDIBits. - - When the image is transparent or has a file background, this function can composite - the foreground image against a checkerboard background image, against a single background color or - against a user background image.
- When the image is a High Dynamic Range image (48-bit or RGB float), this function will apply a - tone mapping operator before drawing the image.
- The original image (located in the fipImage class) will not be affected by any of the operations - that could be done in order to display it. - @param hDC Handle to the device context - @param rcDest Destination rectangle - @param useFileBkg When set to TRUE, the function uses the file color background if there is one - @param appBkColor When a color is given, the function uses it as the background color - @param bg When a FIBITMAP is given, the function uses it as the background image - @see FreeImage_Composite - @see setToneMappingOperator - */ - void drawEx(HDC hDC, RECT& rcDest, BOOL useFileBkg = FALSE, RGBQUAD *appBkColor = NULL, FIBITMAP *bg = NULL) const; - - /** - Select a tone mapping algorithm used for drawing and set the image as modified - so that the display will be refreshed. - @param tmo Tone mapping operator - @param first_param First tone mapping algorithm parameter - @param second_param Second tone mapping algorithm parameter - @param third_param Third tone mapping algorithm parameter - @param fourth_param Fourth tone mapping algorithm parameter - @see FreeImage_ToneMapping - */ - void setToneMappingOperator(FREE_IMAGE_TMO tmo, double first_param = 0, double second_param = 0, double third_param = 1, double fourth_param = 0); - - /** - Get the tone mapping algorithm used for drawing, with its parameters. - @param tmo Tone mapping operator - @param first_param First tone mapping algorithm parameter - @param second_param Second tone mapping algorithm parameter - @param third_param Third tone mapping algorithm parameter - @param fourth_param Fourth tone mapping algorithm parameter - @see FreeImage_ToneMapping - */ - void getToneMappingOperator(FREE_IMAGE_TMO *tmo, double *first_param, double *second_param, double *third_param, double *fourth_param) const; - - //@} - -protected: - /// DIB used for display (this allow to display non-standard bitmaps) - mutable FIBITMAP *_display_dib; - /// remember to delete _display_dib - mutable BOOL _bDeleteMe; - /// tone mapping operator - FREE_IMAGE_TMO _tmo; - /// first tone mapping algorithm parameter - double _tmo_param_1; - /// second tone mapping algorithm parameter - double _tmo_param_2; - /// third tone mapping algorithm parameter - double _tmo_param_3; - /// fourth tone mapping algorithm parameter - double _tmo_param_4; -}; - -#endif // _WIN32 - -// ---------------------------------------------------------- - -/** Memory handle - - fipMemoryIO is a class that allows you to load / save images from / to a memory stream. - @version FreeImage 3 - @author Hervé Drolon -*/ -class FIP_API fipMemoryIO : public fipObject -{ -protected: - /// Pointer to a memory stream - FIMEMORY *_hmem; - -public : - /** Constructor. - Wrap a memory buffer containing image data.
- The memory buffer is read only and has to be freed by the user - when no longer in use.
- When default arguments are used, open a memory file as read/write. - @param data Pointer to the memory buffer - @param size_in_bytes Buffer size in bytes - @see FreeImage_OpenMemory - */ - fipMemoryIO(BYTE *data = NULL, DWORD size_in_bytes = 0); - - /** Destructor. - Free any allocated memory - @see FreeImage_CloseMemory - */ - virtual ~fipMemoryIO(); - - /** Destructor. - Free any allocated memory and invalidate the stream - @see FreeImage_CloseMemory - */ - void close(); - - /** Returns TRUE if the internal memory buffer is a valid buffer, returns FALSE otherwise - */ - BOOL isValid() const; - - /** Returns the buffer image format - @see FreeImage_GetFileTypeFromMemory - */ - FREE_IMAGE_FORMAT getFileType() const; - - /** - Returns a pointer to the FIMEMORY data. Used for direct access from FREEIMAGE functions - or from your own low level C functions. - */ - operator FIMEMORY*() { - return _hmem; - } - - /**@name Memory IO routines */ - //@{ - /** - Loads a dib from a memory stream - @param fif Format identifier (FreeImage format) - @param flags The signification of this flag depends on the image to be loaded. - @return Returns the loaded dib if successful, returns NULL otherwise - @see FreeImage_LoadFromMemory - */ - FIBITMAP* load(FREE_IMAGE_FORMAT fif, int flags = 0) const; - /** - Loads a multi-page bitmap from a memory stream - @param fif Format identifier (FreeImage format) - @param flags The signification of this flag depends on the multi-page to be loaded. - @return Returns the loaded multi-page if successful, returns NULL otherwise - @see FreeImage_LoadMultiBitmapFromMemory - */ - FIMULTIBITMAP* loadMultiPage(FREE_IMAGE_FORMAT fif, int flags = 0) const; - /** - Saves a dib to a memory stream - @param fif Format identifier (FreeImage format) - @param dib Image to be saved - @param flags The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SaveToMemory - */ - BOOL save(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, int flags = 0); - /** - Saves a multi-page bitmap to a memory stream - @param fif Format identifier (FreeImage format) - @param bitmap Multi-page image to be saved - @param flags The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SaveMultiBitmapToMemory - */ - BOOL saveMultiPage(FREE_IMAGE_FORMAT fif, FIMULTIBITMAP *bitmap, int flags = 0); - /** - Reads data from a memory stream - @param buffer Storage location for data - @param size Item size in bytes - @param count Maximum number of items to be read - @return Returns the number of full items actually read, which may be less than count if an error occurs - @see FreeImage_ReadMemory - */ - unsigned read(void *buffer, unsigned size, unsigned count) const; - /** - Writes data to a memory stream - @param buffer Pointer to data to be written - @param size Item size in bytes - @param count Maximum number of items to be written - @return Returns the number of full items actually written, which may be less than count if an error occurs - @see FreeImage_WriteMemory - */ - unsigned write(const void *buffer, unsigned size, unsigned count); - /** - Gets the current position of a memory pointer - @see FreeImage_TellMemory - */ - long tell() const; - /** - Moves the memory pointer to a specified location - @see FreeImage_SeekMemory - */ - BOOL seek(long offset, int origin); - /** - Provides a direct buffer access to a memory stream - @param data Pointer to the memory buffer (returned value) - @param size_in_bytes Buffer size in bytes (returned value) - @see FreeImage_AcquireMemory - */ - BOOL acquire(BYTE **data, DWORD *size_in_bytes); - //@} - -private: - /// Disable copy - fipMemoryIO(const fipMemoryIO& src); - /// Disable copy - fipMemoryIO& operator=(const fipMemoryIO& src); - -}; - -// ---------------------------------------------------------- - -/** Multi-page file stream - - fipMultiPage encapsulates the multi-page API. It supports reading/writing - multi-page TIFF, ICO and GIF files. -*/ -class FIP_API fipMultiPage : public fipObject -{ -protected: - /// Pointer to a multi-page file stream - FIMULTIBITMAP *_mpage; - /// TRUE when using a memory cache, FALSE otherwise - BOOL _bMemoryCache; - -public: - /** - Constructor - @param keep_cache_in_memory When it is TRUE, all gathered bitmap data in the page manipulation process is kept in memory, otherwise it is lazily flushed to a temporary file on the hard disk in 64 Kb blocks. - */ - fipMultiPage(BOOL keep_cache_in_memory = FALSE); - - /** - Destructor - Close the file stream if not already done. - */ - virtual ~fipMultiPage(); - - /// Returns TRUE if the multi-page stream is opened - BOOL isValid() const; - - /** - Returns a pointer to the FIMULTIBITMAP data. Used for direct access from FREEIMAGE functions - or from your own low level C functions. - */ - operator FIMULTIBITMAP*() { - return _mpage; - } - - /** - Open a multi-page file stream - @param lpszPathName Name of the multi-page bitmap file - @param create_new When TRUE, it means that a new bitmap will be created rather than an existing one being opened - @param read_only When TRUE the bitmap is opened read-only - @param flags Load flags. The signification of this flag depends on the image to be loaded. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_OpenMultiBitmap - */ - BOOL open(const char* lpszPathName, BOOL create_new, BOOL read_only, int flags = 0); - - /** - Open a multi-page memory stream as read/write. - @param memIO Memory stream. The memory stream MUST BE a wrapped user buffer. - @param flags Load flags. The signification of this flag depends on the image to be loaded. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_LoadMultiBitmapFromMemory - */ - BOOL open(fipMemoryIO& memIO, int flags = 0); - - /** - Open a multi-page image as read/write, using the specified FreeImageIO struct and fi_handle, and an optional flag. - @param io FreeImageIO structure - @param handle FreeImage fi_handle - @param flag The signification of this flag depends on the image to be read. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_OpenMultiBitmapFromHandle - */ - BOOL open(FreeImageIO *io, fi_handle handle, int flags = 0); - - /** - Close a file stream - @param flags Save flags. The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_CloseMultiBitmap - */ - BOOL close(int flags = 0); - - /** - Saves a multi-page image using the specified FreeImageIO struct and fi_handle, and an optional flag. - @param fif Format identifier (FreeImage format) - @param io FreeImageIO structure - @param handle FreeImage fi_handle - @param flag The signification of this flag depends on the multi-page image to be saved. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SaveMultiBitmapToHandle, FreeImage documentation - */ - BOOL saveToHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags = 0) const; - - /** - Saves a multi-page image using the specified memory stream and an optional flag. - @param fif Format identifier (FreeImage format) - @param memIO FreeImage memory stream - @param flag The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SaveMultiBitmapToMemory, FreeImage documentation - */ - BOOL saveToMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO& memIO, int flags = 0) const; - - /** - Returns the number of pages currently available in the multi-paged bitmap - @see FreeImage_GetPageCount - */ - int getPageCount() const; - - /** - Appends a new page to the end of the bitmap - @param image Image to append - @see FreeImage_AppendPage - */ - void appendPage(fipImage& image); - - /** - Inserts a new page before the given position in the bitmap - @param page Page number. Page has to be a number smaller than the current number of pages available in the bitmap. - @param image Image to insert - @see FreeImage_InsertPage - */ - void insertPage(int page, fipImage& image); - - /** - Deletes the page on the given position - @param page Page number - @see FreeImage_DeletePage - */ - void deletePage(int page); - - /** - Moves the source page to the position of the target page. - @param target Target page position - @param source Source page position - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_MovePage - */ - BOOL movePage(int target, int source); - - /** - Locks a page in memory for editing. You must call unlockPage to free the page
- Usage :
-
-	fipMultiPage mpage;
-	// ...
-	fipImage image;		// You must declare this before
-	image = mpage.lockPage(2);
-	if(image.isValid()) {
-	  // ...
-	  mpage.unlockPage(image, TRUE);
-	}
-	
- @param page Page number - @return Returns the page if successful, returns NULL otherwise - @see FreeImage_LockPage - */ - FIBITMAP* lockPage(int page); - - /** - Unlocks a previously locked page and gives it back to the multi-page engine - @param image Page to unlock - @param changed When TRUE, the page is marked changed and the new page data is applied in the multi-page bitmap. - @see FreeImage_UnlockPage - */ - void unlockPage(fipImage& image, BOOL changed); - - /** - Returns an array of page-numbers that are currently locked in memory. - When the pages parameter is NULL, the size of the array is returned in the count variable. - You can then allocate the array of the desired size and call - getLockedPageNumbers again to populate the array. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_GetLockedPageNumbers - */ - BOOL getLockedPageNumbers(int *pages, int *count) const; -}; - -// ---------------------------------------------------------- - -/** -FreeImage Tag - -FreeImage uses this structure to store metadata information. -*/ -class FIP_API fipTag : public fipObject -{ -protected: - /// Pointer to a FreeImage tag - FITAG *_tag; - -public: - /**@name Creation & Destruction */ - //@{ - /** - Constructor - @see FreeImage_CreateTag - */ - fipTag(); - /** - Destructor - @see FreeImage_DeleteTag - */ - virtual ~fipTag(); - /** - Construct a FIDT_ASCII tag (ASCII string).
- This method is useful to store comments or IPTC tags. - @param name Field name - @param value Field value - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_CreateTag - */ - BOOL setKeyValue(const char *key, const char *value); - - //@} - - /**@name Copying */ - //@{ - /** - Copy constructor - @see FreeImage_CloneTag - */ - fipTag(const fipTag& tag); - /** - Copy constructor - @see FreeImage_CloneTag - */ - fipTag& operator=(const fipTag& tag); - /** - Assignement operator
- Copy the input pointer and manage its destruction - @see operator FITAG*() - */ - fipTag& operator=(FITAG *tag); - //@} - - /** - Returns a pointer to the FITAG data. Used for direct access from FREEIMAGE functions - or from your own low level C functions. - @see operator=(FITAG *tag) - */ - operator FITAG*() { - return _tag; - } - - /// Returns TRUE if the tag is allocated, FALSE otherwise - BOOL isValid() const; - - /**@name Tag accessors */ - //@{ - /** - Returns the tag field name (unique inside a metadata model). - @see FreeImage_GetTagKey - */ - const char *getKey() const; - /** - Returns the tag description if available, returns NULL otherwise - @see FreeImage_GetTagDescription - */ - const char *getDescription() const; - /** - Returns the tag ID if available, returns 0 otherwise - @see FreeImage_GetTagID - */ - WORD getID() const; - /** - Returns the tag data type - @see FreeImage_GetTagType - */ - FREE_IMAGE_MDTYPE getType() const; - /** - Returns the number of components in the tag (in tag type units) - @see FreeImage_GetTagCount - */ - DWORD getCount() const; - /** - Returns the length of the tag value in bytes - @see FreeImage_GetTagLength - */ - DWORD getLength() const; - /** - Returns the tag value - @see FreeImage_GetTagValue - */ - const void *getValue() const; - /** - Set the tag field name - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagKey - */ - BOOL setKey(const char *key); - /** - Set the (usually optional) tag description - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagDescription - */ - BOOL setDescription(const char *description); - /** - Set the (usually optional) tad ID - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagID - */ - BOOL setID(WORD id); - /** - Set the tag data type - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagType - */ - BOOL setType(FREE_IMAGE_MDTYPE type); - /** - Set the number of data in the tag - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagCount - */ - BOOL setCount(DWORD count); - /** - Set the length of the tag value, in bytes - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagLength - */ - BOOL setLength(DWORD length); - /** - Set the tag value - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagValue - */ - BOOL setValue(const void *value); - - //@} - - /** - Converts a FreeImage tag structure to a string that represents the interpreted tag value - @param model Metadata model specification (metadata model from which the tag was extracted) - @param Make Camera model (not used yet) - */ - const char* toString(FREE_IMAGE_MDMODEL model, char *Make = NULL) const; - -}; - -/** -Metadata iterator - -Usage :
-
-fipImage image;
-// ...
-fipTag tag;
-fipMetadataFind finder;
-if( finder.findFirstMetadata(FIMD_EXIF_MAIN, image, tag) ) {
-  do {
-    // process the tag
-	cout << tag.getKey() << "\n";
-
-  } while( finder.findNextMetadata(tag) );
-}
-// the class can be called again with another metadata model
-if( finder.findFirstMetadata(FIMD_EXIF_EXIF, image, tag) ) {
-  do {
-    // process the tag
-	cout << tag.getKey() << "\n";
-
-  } while( finder.findNextMetadata(tag) );
-}
-
-*/ -class FIP_API fipMetadataFind : public fipObject -{ -protected: - /// Pointer to a search handle - FIMETADATA *_mdhandle; - -public: - /// Returns TRUE if the search handle is allocated, FALSE otherwise - BOOL isValid() const; - - /// Constructor - fipMetadataFind(); - /** - Destructor - @see FreeImage_FindCloseMetadata - */ - virtual ~fipMetadataFind(); - /** - Provides information about the first instance of a tag that matches - the metadata model specified in the model argument. - @param model Metadata model - @param image Input image - @param tag Returned tag - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_FindFirstMetadata - */ - BOOL findFirstMetadata(FREE_IMAGE_MDMODEL model, fipImage& image, fipTag& tag); - /** - Find the next tag, if any, that matches the metadata model argument - in a previous call to findFirstMetadata - @param tag Returned tag - @return Returns TRUE if successful, returns FALSE otherwise, indicating that no more matching tags could be found - @see FreeImage_FindNextMetadata - */ - BOOL findNextMetadata(fipTag& tag); - -}; - -#endif // FREEIMAGEPLUS_H diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/dist/x64/FreeImagePlus.lib b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/dist/x64/FreeImagePlus.lib deleted file mode 100644 index 6b52f0e..0000000 Binary files a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/dist/x64/FreeImagePlus.lib and /dev/null differ diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/doc/FreeImagePlus.dox b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/doc/FreeImagePlus.dox deleted file mode 100644 index 8c32d39..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/doc/FreeImagePlus.dox +++ /dev/null @@ -1,1709 +0,0 @@ -# Doxyfile 1.7.4 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all -# text before the first occurrence of this tag. Doxygen uses libiconv (or the -# iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = FreeImagePlus - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = "- FreeImage 3.15.1" - -# Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer -# a quick idea about the purpose of the project. Keep the description short. - -PROJECT_BRIEF = - -# With the PROJECT_LOGO tag one can specify an logo or icon that is -# included in the documentation. The maximum height of the logo should not -# exceed 55 pixels and the maximum width should not exceed 200 pixels. -# Doxygen will copy the logo to the output directory. - -PROJECT_LOGO = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = D:/Projects/FreeImage/Wrapper/FreeImagePlus/ - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, -# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English -# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, -# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, -# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = YES - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = NO - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful if your file system -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) - -JAVADOC_AUTOBRIEF = YES - -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 8 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = NO - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for -# Java. For instance, namespaces will be presented as packages, qualified -# scopes will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources only. Doxygen will then generate output that is more tailored for -# Fortran. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for -# VHDL. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given extension. -# Doxygen has a built-in mapping, but you can override or extend it using this -# tag. The format is ext=language, where ext is a file extension, and language -# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, -# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make -# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C -# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions -# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. - -EXTENSION_MAPPING = - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also makes the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. -# Doxygen will parse them like normal C++ but will assume all classes use public -# instead of private inheritance when no explicit protection keyword is present. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate getter -# and setter methods for a property. Setting this option to YES (the default) -# will make doxygen replace the get and set methods by a property in the -# documentation. This will only work if the methods are indeed getting or -# setting a simple type. If this is not the case, or you want to show the -# methods anyway, you should set this option to NO. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = YES - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and -# unions are shown inside the group in which they are included (e.g. using -# @ingroup) instead of on a separate page (for HTML and Man pages) or -# section (for LaTeX and RTF). - -INLINE_GROUPED_CLASSES = NO - -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum -# is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically -# be useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. - -TYPEDEF_HIDES_STRUCT = NO - -# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to -# determine which symbols to keep in memory and which to flush to disk. -# When the cache is full, less often used symbols will be written to disk. -# For small to medium size projects (<1000 input files) the default value is -# probably good enough. For larger projects a too small cache size can cause -# doxygen to be busy swapping symbols to and from disk most of the time -# causing a significant performance penalty. -# If the system has enough physical memory increasing the cache will improve the -# performance by keeping more symbols in memory. Note that the value works on -# a logarithmic scale so increasing the size by one will roughly double the -# memory usage. The cache size is given by this formula: -# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols - -SYMBOL_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = NO - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = NO - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base -# name of the file that contains the anonymous namespace. By default -# anonymous namespaces are hidden. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen -# will list include files with double quotes in the documentation -# rather than with sharp brackets. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen -# will sort the (brief and detailed) documentation of class members so that -# constructors and destructors are listed first. If set to NO (the default) -# the constructors will appear in the respective orders defined by -# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. -# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO -# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the -# hierarchy of group names into alphabetical order. If set to NO (the default) -# the group names will appear in their defined order. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to -# do proper type resolution of all parameters of a function it will reject a -# match between the prototype and the implementation of a member function even -# if there is only one candidate or it is obvious which candidate to choose -# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen -# will still accept a match between prototype and implementation in such cases. - -STRICT_PROTO_MATCHING = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or macro consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and macros in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = YES - -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy -# in the documentation. The default is NO. - -SHOW_DIRECTORIES = NO - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. -# This will remove the Files entry from the Quick Index and from the -# Folder Tree View (if specified). The default is YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the -# Namespaces page. This will remove the Namespaces entry from the Quick Index -# and from the Folder Tree View (if specified). The default is YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. The create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. -# You can optionally specify a file name after the option, if omitted -# DoxygenLayout.xml will be used as the name of the layout file. - -LAYOUT_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# The WARN_NO_PARAMDOC option can be enabled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = NO - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = D:\Projects\FreeImage\Wrapper\FreeImagePlus\doc\doxygen.log - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = D:/Projects/FreeImage/Source/FreeImage.h \ - D:/Projects/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.h - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is -# also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for -# the list of possible encodings. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh -# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py -# *.f90 *.f *.for *.vhd *.vhdl - -FILE_PATTERNS = *.h - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix file system feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty or if -# non of the patterns match the file name, INPUT_FILTER is applied. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file -# pattern. A pattern will override the setting for FILTER_PATTERN (if any) -# and it is also possible to disable source filtering for a specific pattern -# using *.ext= (so without naming a filter). This option only has effect when -# FILTER_SOURCE_FILES is enabled. - -FILTER_SOURCE_PATTERNS = - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = YES - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. Otherwise they will link to the documentation. - -REFERENCES_LINK_SOURCE = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = YES - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. Note that when using a custom header you are responsible -# for the proper inclusion of any scripts and style sheets that doxygen -# needs, which is dependent on the configuration options used. -# It is adviced to generate a default header using "doxygen -w html -# header.html footer.html stylesheet.css YourConfigFile" and then modify -# that header. Note that the header is subject to change so you typically -# have to redo this when upgrading to a newer version of doxygen or when -# changing the value of configuration settings such as GENERATE_TREEVIEW! - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = footer.html - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = - -# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or -# other source files which should be copied to the HTML output directory. Note -# that these files will be copied to the base HTML output directory. Use the -# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these -# files. In the HTML_STYLESHEET file, use the file name only. Also note that -# the files will be copied as-is; there are no commands or markers available. - -HTML_EXTRA_FILES = - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. -# Doxygen will adjust the colors in the stylesheet and background images -# according to this color. Hue is specified as an angle on a colorwheel, -# see http://en.wikipedia.org/wiki/Hue for more information. -# For instance the value 0 represents red, 60 is yellow, 120 is green, -# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. -# The allowed range is 0 to 359. - -HTML_COLORSTYLE_HUE = 220 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of -# the colors in the HTML output. For a value of 0 the output will use -# grayscales only. A value of 255 will produce the most vivid colors. - -HTML_COLORSTYLE_SAT = 100 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to -# the luminance component of the colors in the HTML output. Values below -# 100 gradually make the output lighter, whereas values above 100 make -# the output darker. The value divided by 100 is the actual gamma applied, -# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, -# and 100 does not change the gamma. - -HTML_COLORSTYLE_GAMMA = 80 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting -# this to NO can help when comparing the output of multiple runs. - -HTML_TIMESTAMP = YES - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. For this to work a browser that supports -# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox -# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). - -HTML_DYNAMIC_SECTIONS = NO - -# If the GENERATE_DOCSET tag is set to YES, additional index files -# will be generated that can be used as input for Apple's Xcode 3 -# integrated development environment, introduced with OSX 10.5 (Leopard). -# To create a documentation set, doxygen will generate a Makefile in the -# HTML output directory. Running make will produce the docset in that -# directory and running "make install" will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find -# it at startup. -# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. - -GENERATE_DOCSET = NO - -# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the -# feed. A documentation feed provides an umbrella under which multiple -# documentation sets from a single provider (such as a company or product suite) -# can be grouped. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that -# should uniquely identify the documentation set bundle. This should be a -# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen -# will append .docset to the name. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify -# the documentation publisher. This should be a reverse domain-name style -# string, e.g. com.mycompany.MyDocSet.documentation. - -DOCSET_PUBLISHER_ID = org.doxygen.Publisher - -# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. - -DOCSET_PUBLISHER_NAME = Publisher - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING -# is used to encode HtmlHelp index (hhk), content (hhc) and project file -# content. - -CHM_INDEX_ENCODING = - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = YES - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated -# that can be used as input for Qt's qhelpgenerator to generate a -# Qt Compressed Help (.qch) of the generated HTML documentation. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can -# be used to specify the file name of the resulting .qch file. -# The path specified is relative to the HTML output folder. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#namespace - -QHP_NAMESPACE = org.doxygen.Project - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#virtual-folders - -QHP_VIRTUAL_FOLDER = doc - -# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to -# add. For more information please see -# http://doc.trolltech.com/qthelpproject.html#custom-filters - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see -# -# Qt Help Project / Custom Filters. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's -# filter section matches. -# -# Qt Help Project / Filter Attributes. - -QHP_SECT_FILTER_ATTRS = - -# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can -# be used to specify the location of Qt's qhelpgenerator. -# If non-empty doxygen will try to run qhelpgenerator on the generated -# .qhp file. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files -# will be generated, which together with the HTML files, form an Eclipse help -# plugin. To install this plugin and make it available under the help contents -# menu in Eclipse, the contents of the directory containing the HTML and XML -# files needs to be copied into the plugins directory of eclipse. The name of -# the directory within the plugins directory should be the same as -# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before -# the help appears. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have -# this name. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values -# (range [0,1..20]) that doxygen will group on one line in the generated HTML -# documentation. Note that a value of 0 will completely suppress the enum -# values from appearing in the overview section. - -ENUM_VALUES_PER_LINE = 4 - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. -# If the tag value is set to YES, a side panel will be generated -# containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). -# Windows users are probably better off using the HTML help feature. - -GENERATE_TREEVIEW = NO - -# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, -# and Class Hierarchy pages using a tree view instead of an ordered list. - -USE_INLINE_TREES = NO - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open -# links to external symbols imported via tag files in a separate window. - -EXT_LINKS_IN_WINDOW = NO - -# Use this tag to change the font size of Latex formulas included -# as images in the HTML documentation. The default is 10. Note that -# when you change the font size after a successful doxygen run you need -# to manually remove any form_*.png images from the HTML output directory -# to force them to be regenerated. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are -# not supported properly for IE 6.0, but are supported on all modern browsers. -# Note that when changing this option you need to delete any form_*.png files -# in the HTML output before the changes have effect. - -FORMULA_TRANSPARENT = YES - -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax -# (see http://www.mathjax.org) which uses client side Javascript for the -# rendering instead of using prerendered bitmaps. Use this if you do not -# have LaTeX installed or if you want to formulas look prettier in the HTML -# output. When enabled you also need to install MathJax separately and -# configure the path to it using the MATHJAX_RELPATH option. - -USE_MATHJAX = NO - -# When MathJax is enabled you need to specify the location relative to the -# HTML output directory using the MATHJAX_RELPATH option. The destination -# directory should contain the MathJax.js script. For instance, if the mathjax -# directory is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to the -# mathjax.org site, so you can quickly see the result without installing -# MathJax, but it is strongly recommended to install a local copy of MathJax -# before deployment. - -MATHJAX_RELPATH = http://www.mathjax.org/mathjax - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box -# for the HTML output. The underlying search engine uses javascript -# and DHTML and should work on any modern browser. Note that when using -# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets -# (GENERATE_DOCSET) there is already a search function so this one should -# typically be disabled. For large projects the javascript based search engine -# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. - -SEARCHENGINE = NO - -# When the SERVER_BASED_SEARCH tag is enabled the search engine will be -# implemented using a PHP enabled web server instead of at the web client -# using Javascript. Doxygen will generate the search PHP script and index -# file to put on the web server. The advantage of the server -# based approach is that it scales better to large projects and allows -# full text search. The disadvantages are that it is more difficult to setup -# and does not have live searching capabilities. - -SERVER_BASED_SEARCH = NO - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. -# Note that when enabling USE_PDFLATEX this option is only used for -# generating bitmaps for formulas in the HTML output, but not in the -# Makefile that is written to the output directory. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for -# the generated latex document. The footer should contain everything after -# the last chapter. If it is left blank doxygen will generate a -# standard footer. Notice: only use this tag if you know what you are doing! - -LATEX_FOOTER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = NO - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = NO - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -# If LATEX_SOURCE_CODE is set to YES then doxygen will include -# source code with syntax highlighting in the LaTeX output. -# Note that which sources are shown also depends on other settings -# such as SOURCE_BROWSER. - -LATEX_SOURCE_CODE = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = NO - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = YES - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# pointed to by INCLUDE_PATH will be searched when a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = _WIN32 - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition that -# overrules the definition found in the source code. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all references to function-like macros -# that are alone on a line, have an all uppercase name, and do not end with a -# semicolon, because these will confuse the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option also works with HAVE_DOT disabled, but it is recommended to -# install and use dot, since it yields more powerful graphs. - -CLASS_DIAGRAMS = YES - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see -# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = NO - -# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is -# allowed to run in parallel. When set to 0 (the default) doxygen will -# base this on the number of processors available in the system. You can set it -# explicitly to a value larger than 0 to get control over the balance -# between CPU load and processing speed. - -DOT_NUM_THREADS = 0 - -# By default doxygen will write a font called Helvetica to the output -# directory and reference it in all dot files that doxygen generates. -# When you want a differently looking font you can specify the font name -# using DOT_FONTNAME. You need to make sure dot is able to find the font, -# which can be done by putting it in a standard location or by setting the -# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory -# containing the font. - -DOT_FONTNAME = Helvetica - -# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. -# The default size is 10pt. - -DOT_FONTSIZE = 10 - -# By default doxygen will tell dot to use the output directory to look for the -# FreeSans.ttf font (which doxygen will put there itself). If you specify a -# different font using DOT_FONTNAME you can set the path where dot -# can find it using this tag. - -DOT_FONTPATH = - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT options are set to YES then -# doxygen will generate a call dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable call graphs -# for selected functions only using the \callgraph command. - -CALL_GRAPH = NO - -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then -# doxygen will generate a caller dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable caller -# graphs for selected functions only using the \callergraph command. - -CALLER_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will generate a graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are svg, png, jpg, or gif. -# If left blank png will be used. - -DOT_IMAGE_FORMAT = png - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The MSCFILE_DIRS tag can be used to specify one or more directories that -# contain msc files that are included in the documentation (see the -# \mscfile command). - -MSCFILE_DIRS = - -# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of -# nodes that will be shown in the graph. If the number of nodes in a graph -# becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen if the -# number of direct children of the root node in a graph is already larger than -# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note -# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. - -DOT_GRAPH_MAX_NODES = 50 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that the size of a graph can be further restricted by -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. - -MAX_DOT_GRAPH_DEPTH = 0 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not -# seem to support this out of the box. Warning: Depending on the platform used, -# enabling this option may lead to badly anti-aliased labels on the edges of -# a graph (i.e. they become hard to read). - -DOT_TRANSPARENT = NO - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = NO - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/doc/footer.html b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/doc/footer.html deleted file mode 100644 index ed36a62..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/doc/footer.html +++ /dev/null @@ -1,7 +0,0 @@ -
-

-
-

- - - diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/doc/freeimage.png b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/doc/freeimage.png deleted file mode 100644 index 4fa7923..0000000 Binary files a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/doc/freeimage.png and /dev/null differ diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/doc/freeimagedoc.jpg b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/doc/freeimagedoc.jpg deleted file mode 100644 index 0a31440..0000000 Binary files a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/doc/freeimagedoc.jpg and /dev/null differ diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/doc/index.html b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/doc/index.html deleted file mode 100644 index 108c46b..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/doc/index.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - -FreeImagePlus: Main Page - - - - - -
-
- - - - - - -
-
FreeImagePlus - FreeImage 3.15.1
-
-
- -
-
-
-
FreeImagePlus Documentation
-
-
-
-

-
-

-

A C++ wrapper for FreeImage 3

- - - diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/src/FreeImagePlus.cpp b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/src/FreeImagePlus.cpp deleted file mode 100644 index efb8fe9..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/src/FreeImagePlus.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// ========================================================== -// FreeImagePlus.cpp : Defines the entry point for the DLL application. -// -// Design and implementation by -// - Hervé Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#ifdef _WIN32 -#include -#endif // _WIN32 - -#include "FreeImagePlus.h" - -//---------------------------------------------------------------------- - -#ifdef _WIN32 - -BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) -{ - switch (ul_reason_for_call) - { - case DLL_PROCESS_ATTACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: - break; - } - return TRUE; -} - - -#endif // _WIN32 diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/src/fipImage.cpp b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/src/fipImage.cpp deleted file mode 100644 index 0ce5688..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/src/fipImage.cpp +++ /dev/null @@ -1,974 +0,0 @@ -// ========================================================== -// fipImage class implementation -// -// Design and implementation by -// - Hervé Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#include "FreeImagePlus.h" - -/////////////////////////////////////////////////////////////////// -// Protected functions - -BOOL fipImage::replace(FIBITMAP *new_dib) { - if(new_dib == NULL) - return FALSE; - if(_dib) - FreeImage_Unload(_dib); - _dib = new_dib; - _bHasChanged = TRUE; - return TRUE; -} - -/////////////////////////////////////////////////////////////////// -// Creation & Destruction - -fipImage::fipImage(FREE_IMAGE_TYPE image_type, unsigned width, unsigned height, unsigned bpp) { - _dib = NULL; - _bHasChanged = FALSE; - if(width && height && bpp) - setSize(image_type, width, height, bpp); -} - -fipImage::~fipImage() { - if(_dib) { - FreeImage_Unload(_dib); - _dib = NULL; - } -} - -BOOL fipImage::setSize(FREE_IMAGE_TYPE image_type, unsigned width, unsigned height, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask) { - if(_dib) { - FreeImage_Unload(_dib); - } - if((_dib = FreeImage_AllocateT(image_type, width, height, bpp, red_mask, green_mask, blue_mask)) == NULL) - return FALSE; - - if(image_type == FIT_BITMAP) { - // Create palette if needed - switch(bpp) { - case 1: - case 4: - case 8: - RGBQUAD *pal = FreeImage_GetPalette(_dib); - for(unsigned i = 0; i < FreeImage_GetColorsUsed(_dib); i++) { - pal[i].rgbRed = i; - pal[i].rgbGreen = i; - pal[i].rgbBlue = i; - } - break; - } - } - - _bHasChanged = TRUE; - - return TRUE; -} - -void fipImage::clear() { - if(_dib) { - FreeImage_Unload(_dib); - _dib = NULL; - } - _bHasChanged = TRUE; -} - -/////////////////////////////////////////////////////////////////// -// Copying - -fipImage::fipImage(const fipImage& Image) { - _dib = NULL; - _fif = FIF_UNKNOWN; - FIBITMAP *clone = FreeImage_Clone((FIBITMAP*)Image._dib); - replace(clone); -} - -fipImage& fipImage::operator=(const fipImage& Image) { - if(this != &Image) { - FIBITMAP *clone = FreeImage_Clone((FIBITMAP*)Image._dib); - replace(clone); - } - return *this; -} - -fipImage& fipImage::operator=(FIBITMAP *dib) { - if(_dib != dib) { - replace(dib); - } - return *this; -} - -BOOL fipImage::copySubImage(fipImage& dst, int left, int top, int right, int bottom) const { - if(_dib) { - dst = FreeImage_Copy(_dib, left, top, right, bottom); - return dst.isValid(); - } - return FALSE; -} - -BOOL fipImage::pasteSubImage(fipImage& src, int left, int top, int alpha) { - if(_dib) { - BOOL bResult = FreeImage_Paste(_dib, src._dib, left, top, alpha); - _bHasChanged = TRUE; - return bResult; - } - return FALSE; -} - -BOOL fipImage::crop(int left, int top, int right, int bottom) { - if(_dib) { - FIBITMAP *dst = FreeImage_Copy(_dib, left, top, right, bottom); - return replace(dst); - } - return FALSE; -} - - -/////////////////////////////////////////////////////////////////// -// Information functions - -FREE_IMAGE_TYPE fipImage::getImageType() const { - return FreeImage_GetImageType(_dib); -} - -unsigned fipImage::getWidth() const { - return FreeImage_GetWidth(_dib); -} - -unsigned fipImage::getHeight() const { - return FreeImage_GetHeight(_dib); -} - -unsigned fipImage::getScanWidth() const { - return FreeImage_GetPitch(_dib); -} - -BOOL fipImage::isValid() const { - return (_dib != NULL) ? TRUE:FALSE; -} - -BITMAPINFO* fipImage::getInfo() const { - return FreeImage_GetInfo(_dib); -} - -BITMAPINFOHEADER* fipImage::getInfoHeader() const { - return FreeImage_GetInfoHeader(_dib); -} - -unsigned fipImage::getImageSize() const { - return FreeImage_GetDIBSize(_dib); -} - -unsigned fipImage::getImageMemorySize() const { - return FreeImage_GetMemorySize(_dib); -} - -unsigned fipImage::getBitsPerPixel() const { - return FreeImage_GetBPP(_dib); -} - -unsigned fipImage::getLine() const { - return FreeImage_GetLine(_dib); -} - -double fipImage::getHorizontalResolution() const { - return (FreeImage_GetDotsPerMeterX(_dib) / (double)100); -} - -double fipImage::getVerticalResolution() const { - return (FreeImage_GetDotsPerMeterY(_dib) / (double)100); -} - -void fipImage::setHorizontalResolution(double value) { - FreeImage_SetDotsPerMeterX(_dib, (unsigned)(value * 100 + 0.5)); -} - -void fipImage::setVerticalResolution(double value) { - FreeImage_SetDotsPerMeterY(_dib, (unsigned)(value * 100 + 0.5)); -} - - -/////////////////////////////////////////////////////////////////// -// Palette operations - -RGBQUAD* fipImage::getPalette() const { - return FreeImage_GetPalette(_dib); -} - -unsigned fipImage::getPaletteSize() const { - return FreeImage_GetColorsUsed(_dib) * sizeof(RGBQUAD); -} - -unsigned fipImage::getColorsUsed() const { - return FreeImage_GetColorsUsed(_dib); -} - -FREE_IMAGE_COLOR_TYPE fipImage::getColorType() const { - return FreeImage_GetColorType(_dib); -} - -BOOL fipImage::isGrayscale() const { - return ((FreeImage_GetBPP(_dib) == 8) && (FreeImage_GetColorType(_dib) != FIC_PALETTE)); -} - -/////////////////////////////////////////////////////////////////// -// Thumbnail access - -BOOL fipImage::getThumbnail(fipImage& image) const { - image = FreeImage_Clone( FreeImage_GetThumbnail(_dib) ); - return image.isValid(); -} - -BOOL fipImage::setThumbnail(const fipImage& image) { - return FreeImage_SetThumbnail(_dib, (FIBITMAP*)image._dib); -} - -BOOL fipImage::hasThumbnail() const { - return (FreeImage_GetThumbnail(_dib) != NULL); -} - -BOOL fipImage::clearThumbnail() { - return FreeImage_SetThumbnail(_dib, NULL); -} - - -/////////////////////////////////////////////////////////////////// -// Pixel access - -BYTE* fipImage::accessPixels() const { - return FreeImage_GetBits(_dib); -} - -BYTE* fipImage::getScanLine(unsigned scanline) const { - if(scanline < FreeImage_GetHeight(_dib)) { - return FreeImage_GetScanLine(_dib, scanline); - } - return NULL; -} - -BOOL fipImage::getPixelIndex(unsigned x, unsigned y, BYTE *value) const { - return FreeImage_GetPixelIndex(_dib, x, y, value); -} - -BOOL fipImage::getPixelColor(unsigned x, unsigned y, RGBQUAD *value) const { - return FreeImage_GetPixelColor(_dib, x, y, value); -} - -BOOL fipImage::setPixelIndex(unsigned x, unsigned y, BYTE *value) { - _bHasChanged = TRUE; - return FreeImage_SetPixelIndex(_dib, x, y, value); -} - -BOOL fipImage::setPixelColor(unsigned x, unsigned y, RGBQUAD *value) { - _bHasChanged = TRUE; - return FreeImage_SetPixelColor(_dib, x, y, value); -} - -/////////////////////////////////////////////////////////////////// -// File type identification - -FREE_IMAGE_FORMAT fipImage::identifyFIF(const char* lpszPathName) { - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - - // check the file signature and get its format - // (the second argument is currently not used by FreeImage) - fif = FreeImage_GetFileType(lpszPathName, 0); - if(fif == FIF_UNKNOWN) { - // no signature ? - // try to guess the file format from the file extension - fif = FreeImage_GetFIFFromFilename(lpszPathName); - } - - return fif; -} - -FREE_IMAGE_FORMAT fipImage::identifyFIFU(const wchar_t* lpszPathName) { - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - - // check the file signature and get its format - // (the second argument is currently not used by FreeImage) - fif = FreeImage_GetFileTypeU(lpszPathName, 0); - if(fif == FIF_UNKNOWN) { - // no signature ? - // try to guess the file format from the file extension - fif = FreeImage_GetFIFFromFilenameU(lpszPathName); - } - - return fif; -} - -FREE_IMAGE_FORMAT fipImage::identifyFIFFromHandle(FreeImageIO *io, fi_handle handle) { - if(io && handle) { - // check the file signature and get its format - return FreeImage_GetFileTypeFromHandle(io, handle, 16); - } - return FIF_UNKNOWN; -} - -FREE_IMAGE_FORMAT fipImage::identifyFIFFromMemory(FIMEMORY *hmem) { - if(hmem != NULL) { - return FreeImage_GetFileTypeFromMemory(hmem, 0); - } - return FIF_UNKNOWN; -} - - -/////////////////////////////////////////////////////////////////// -// Loading & Saving - -BOOL fipImage::load(const char* lpszPathName, int flag) { - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - - // check the file signature and get its format - // (the second argument is currently not used by FreeImage) - fif = FreeImage_GetFileType(lpszPathName, 0); - if(fif == FIF_UNKNOWN) { - // no signature ? - // try to guess the file format from the file extension - fif = FreeImage_GetFIFFromFilename(lpszPathName); - } - // check that the plugin has reading capabilities ... - if((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) { - // Free the previous dib - if(_dib) { - FreeImage_Unload(_dib); - } - // Load the file - _dib = FreeImage_Load(fif, lpszPathName, flag); - _bHasChanged = TRUE; - if(_dib == NULL) - return FALSE; - return TRUE; - } - return FALSE; -} - -BOOL fipImage::loadU(const wchar_t* lpszPathName, int flag) { - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - - // check the file signature and get its format - // (the second argument is currently not used by FreeImage) - fif = FreeImage_GetFileTypeU(lpszPathName, 0); - if(fif == FIF_UNKNOWN) { - // no signature ? - // try to guess the file format from the file extension - fif = FreeImage_GetFIFFromFilenameU(lpszPathName); - } - // check that the plugin has reading capabilities ... - if((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) { - // Free the previous dib - if(_dib) { - FreeImage_Unload(_dib); - } - // Load the file - _dib = FreeImage_LoadU(fif, lpszPathName, flag); - _bHasChanged = TRUE; - if(_dib == NULL) - return FALSE; - return TRUE; - } - return FALSE; -} - -BOOL fipImage::loadFromHandle(FreeImageIO *io, fi_handle handle, int flag) { - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - - // check the file signature and get its format - fif = FreeImage_GetFileTypeFromHandle(io, handle, 16); - if((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) { - // Free the previous dib - if(_dib) { - FreeImage_Unload(_dib); - } - // Load the file - _dib = FreeImage_LoadFromHandle(fif, io, handle, flag); - _bHasChanged = TRUE; - if(_dib == NULL) - return FALSE; - return TRUE; - } - return FALSE; -} - -BOOL fipImage::loadFromMemory(fipMemoryIO& memIO, int flag) { - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - - // check the file signature and get its format - fif = memIO.getFileType(); - if((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) { - // Free the previous dib - if(_dib) { - FreeImage_Unload(_dib); - } - // Load the file - _dib = memIO.load(fif, flag); - _bHasChanged = TRUE; - if(_dib == NULL) - return FALSE; - return TRUE; - } - return FALSE; -} - -BOOL fipImage::save(const char* lpszPathName, int flag) const { - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - BOOL bSuccess = FALSE; - - // Try to guess the file format from the file extension - fif = FreeImage_GetFIFFromFilename(lpszPathName); - if(fif != FIF_UNKNOWN ) { - // Check that the dib can be saved in this format - BOOL bCanSave; - - FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(_dib); - if(image_type == FIT_BITMAP) { - // standard bitmap type - WORD bpp = FreeImage_GetBPP(_dib); - bCanSave = (FreeImage_FIFSupportsWriting(fif) && FreeImage_FIFSupportsExportBPP(fif, bpp)); - } else { - // special bitmap type - bCanSave = FreeImage_FIFSupportsExportType(fif, image_type); - } - - if(bCanSave) { - bSuccess = FreeImage_Save(fif, _dib, lpszPathName, flag); - return bSuccess; - } - } - return bSuccess; -} - -BOOL fipImage::saveU(const wchar_t* lpszPathName, int flag) const { - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - BOOL bSuccess = FALSE; - - // Try to guess the file format from the file extension - fif = FreeImage_GetFIFFromFilenameU(lpszPathName); - if(fif != FIF_UNKNOWN ) { - // Check that the dib can be saved in this format - BOOL bCanSave; - - FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(_dib); - if(image_type == FIT_BITMAP) { - // standard bitmap type - WORD bpp = FreeImage_GetBPP(_dib); - bCanSave = (FreeImage_FIFSupportsWriting(fif) && FreeImage_FIFSupportsExportBPP(fif, bpp)); - } else { - // special bitmap type - bCanSave = FreeImage_FIFSupportsExportType(fif, image_type); - } - - if(bCanSave) { - bSuccess = FreeImage_SaveU(fif, _dib, lpszPathName, flag); - return bSuccess; - } - } - return bSuccess; -} - -BOOL fipImage::saveToHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flag) const { - BOOL bSuccess = FALSE; - - if(fif != FIF_UNKNOWN ) { - // Check that the dib can be saved in this format - BOOL bCanSave; - - FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(_dib); - if(image_type == FIT_BITMAP) { - // standard bitmap type - WORD bpp = FreeImage_GetBPP(_dib); - bCanSave = (FreeImage_FIFSupportsWriting(fif) && FreeImage_FIFSupportsExportBPP(fif, bpp)); - } else { - // special bitmap type - bCanSave = FreeImage_FIFSupportsExportType(fif, image_type); - } - - if(bCanSave) { - bSuccess = FreeImage_SaveToHandle(fif, _dib, io, handle, flag); - return bSuccess; - } - } - return bSuccess; -} - -BOOL fipImage::saveToMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO& memIO, int flag) const { - BOOL bSuccess = FALSE; - - if(fif != FIF_UNKNOWN ) { - // Check that the dib can be saved in this format - BOOL bCanSave; - - FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(_dib); - if(image_type == FIT_BITMAP) { - // standard bitmap type - WORD bpp = FreeImage_GetBPP(_dib); - bCanSave = (FreeImage_FIFSupportsWriting(fif) && FreeImage_FIFSupportsExportBPP(fif, bpp)); - } else { - // special bitmap type - bCanSave = FreeImage_FIFSupportsExportType(fif, image_type); - } - - if(bCanSave) { - bSuccess = memIO.save(fif, _dib, flag); - return bSuccess; - } - } - return bSuccess; -} - -/////////////////////////////////////////////////////////////////// -// Conversion routines - -BOOL fipImage::convertToType(FREE_IMAGE_TYPE image_type, BOOL scale_linear) { - if(_dib) { - FIBITMAP *dib = FreeImage_ConvertToType(_dib, image_type, scale_linear); - return replace(dib); - } - return FALSE; -} - -BOOL fipImage::threshold(BYTE T) { - if(_dib) { - FIBITMAP *dib1 = FreeImage_Threshold(_dib, T); - return replace(dib1); - } - return FALSE; -} - -BOOL fipImage::convertTo4Bits() { - if(_dib) { - FIBITMAP *dib4 = FreeImage_ConvertTo4Bits(_dib); - return replace(dib4); - } - return FALSE; -} - -BOOL fipImage::convertTo8Bits() { - if(_dib) { - FIBITMAP *dib8 = FreeImage_ConvertTo8Bits(_dib); - return replace(dib8); - } - return FALSE; -} - -BOOL fipImage::convertTo16Bits555() { - if(_dib) { - FIBITMAP *dib16_555 = FreeImage_ConvertTo16Bits555(_dib); - return replace(dib16_555); - } - return FALSE; -} - -BOOL fipImage::convertTo16Bits565() { - if(_dib) { - FIBITMAP *dib16_565 = FreeImage_ConvertTo16Bits565(_dib); - return replace(dib16_565); - } - return FALSE; -} - -BOOL fipImage::convertTo24Bits() { - if(_dib) { - FIBITMAP *dibRGB = FreeImage_ConvertTo24Bits(_dib); - return replace(dibRGB); - } - return FALSE; -} - -BOOL fipImage::convertTo32Bits() { - if(_dib) { - FIBITMAP *dib32 = FreeImage_ConvertTo32Bits(_dib); - return replace(dib32); - } - return FALSE; -} - -BOOL fipImage::convertToGrayscale() { - if(_dib) { - FIBITMAP *dib8 = FreeImage_ConvertToGreyscale(_dib); - return replace(dib8); - } - return FALSE; -} - -BOOL fipImage::colorQuantize(FREE_IMAGE_QUANTIZE algorithm) { - if(_dib) { - FIBITMAP *dib8 = FreeImage_ColorQuantize(_dib, algorithm); - return replace(dib8); - } - return FALSE; -} - -BOOL fipImage::dither(FREE_IMAGE_DITHER algorithm) { - if(_dib) { - FIBITMAP *dib = FreeImage_Dither(_dib, algorithm); - return replace(dib); - } - return FALSE; -} - -BOOL fipImage::convertToFloat() { - if(_dib) { - FIBITMAP *dib = FreeImage_ConvertToFloat(_dib); - return replace(dib); - } - return FALSE; -} - -BOOL fipImage::convertToRGBF() { - if(_dib) { - FIBITMAP *dib = FreeImage_ConvertToRGBF(_dib); - return replace(dib); - } - return FALSE; -} - -BOOL fipImage::convertToRGBAF() { - if(_dib) { - FIBITMAP *dib = FreeImage_ConvertToRGBAF(_dib); - return replace(dib); - } - return FALSE; -} - -BOOL fipImage::convertToUINT16() { - if(_dib) { - FIBITMAP *dib = FreeImage_ConvertToUINT16(_dib); - return replace(dib); - } - return FALSE; -} - -BOOL fipImage::convertToRGB16() { - if(_dib) { - FIBITMAP *dib = FreeImage_ConvertToRGB16(_dib); - return replace(dib); - } - return FALSE; -} - -BOOL fipImage::convertToRGBA16() { - if(_dib) { - FIBITMAP *dib = FreeImage_ConvertToRGBA16(_dib); - return replace(dib); - } - return FALSE; -} - -BOOL fipImage::toneMapping(FREE_IMAGE_TMO tmo, double first_param, double second_param, double third_param, double fourth_param) { - if(_dib) { - FIBITMAP *dst = NULL; - // Apply a tone mapping algorithm and convert to 24-bit - switch(tmo) { - case FITMO_REINHARD05: - dst = FreeImage_TmoReinhard05Ex(_dib, first_param, second_param, third_param, fourth_param); - break; - default: - dst = FreeImage_ToneMapping(_dib, tmo, first_param, second_param); - break; - } - - return replace(dst); - } - return FALSE; -} - -/////////////////////////////////////////////////////////////////// -// Transparency support: background colour and alpha channel - -BOOL fipImage::isTransparent() const { - return FreeImage_IsTransparent(_dib); -} - -unsigned fipImage::getTransparencyCount() const { - return FreeImage_GetTransparencyCount(_dib); -} - -BYTE* fipImage::getTransparencyTable() const { - return FreeImage_GetTransparencyTable(_dib); -} - -void fipImage::setTransparencyTable(BYTE *table, int count) { - FreeImage_SetTransparencyTable(_dib, table, count); - _bHasChanged = TRUE; -} - -BOOL fipImage::hasFileBkColor() const { - return FreeImage_HasBackgroundColor(_dib); -} - -BOOL fipImage::getFileBkColor(RGBQUAD *bkcolor) const { - return FreeImage_GetBackgroundColor(_dib, bkcolor); -} - -BOOL fipImage::setFileBkColor(RGBQUAD *bkcolor) { - _bHasChanged = TRUE; - return FreeImage_SetBackgroundColor(_dib, bkcolor); -} - -/////////////////////////////////////////////////////////////////// -// Channel processing support - -BOOL fipImage::getChannel(fipImage& image, FREE_IMAGE_COLOR_CHANNEL channel) const { - if(_dib) { - image = FreeImage_GetChannel(_dib, channel); - return image.isValid(); - } - return FALSE; -} - -BOOL fipImage::setChannel(fipImage& image, FREE_IMAGE_COLOR_CHANNEL channel) { - if(_dib) { - _bHasChanged = TRUE; - return FreeImage_SetChannel(_dib, image._dib, channel); - } - return FALSE; -} - -BOOL fipImage::splitChannels(fipImage& RedChannel, fipImage& GreenChannel, fipImage& BlueChannel) { - if(_dib) { - RedChannel = FreeImage_GetChannel(_dib, FICC_RED); - GreenChannel = FreeImage_GetChannel(_dib, FICC_GREEN); - BlueChannel = FreeImage_GetChannel(_dib, FICC_BLUE); - - return (RedChannel.isValid() && GreenChannel.isValid() && BlueChannel.isValid()); - } - return FALSE; -} - -BOOL fipImage::combineChannels(fipImage& red, fipImage& green, fipImage& blue) { - if(!_dib) { - int width = red.getWidth(); - int height = red.getHeight(); - _dib = FreeImage_Allocate(width, height, 24, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK); - } - - if(_dib) { - BOOL bResult = TRUE; - bResult &= FreeImage_SetChannel(_dib, red._dib, FICC_RED); - bResult &= FreeImage_SetChannel(_dib, green._dib, FICC_GREEN); - bResult &= FreeImage_SetChannel(_dib, blue._dib, FICC_BLUE); - - _bHasChanged = TRUE; - - return bResult; - } - return FALSE; -} - -/////////////////////////////////////////////////////////////////// -// Rotation and flipping - -BOOL fipImage::rotateEx(double angle, double x_shift, double y_shift, double x_origin, double y_origin, BOOL use_mask) { - if(_dib) { - if(FreeImage_GetBPP(_dib) >= 8) { - FIBITMAP *rotated = FreeImage_RotateEx(_dib, angle, x_shift, y_shift, x_origin, y_origin, use_mask); - return replace(rotated); - } - } - return FALSE; -} - -BOOL fipImage::rotate(double angle, const void *bkcolor) { - if(_dib) { - switch(FreeImage_GetImageType(_dib)) { - case FIT_BITMAP: - switch(FreeImage_GetBPP(_dib)) { - case 1: - case 8: - case 24: - case 32: - break; - default: - return FALSE; - } - break; - - case FIT_UINT16: - case FIT_RGB16: - case FIT_RGBA16: - case FIT_FLOAT: - case FIT_RGBF: - case FIT_RGBAF: - break; - default: - return FALSE; - break; - } - - FIBITMAP *rotated = FreeImage_Rotate(_dib, angle, bkcolor); - return replace(rotated); - - } - return FALSE; -} - -BOOL fipImage::flipVertical() { - if(_dib) { - _bHasChanged = TRUE; - - return FreeImage_FlipVertical(_dib); - } - return FALSE; -} - -BOOL fipImage::flipHorizontal() { - if(_dib) { - _bHasChanged = TRUE; - - return FreeImage_FlipHorizontal(_dib); - } - return FALSE; -} - -/////////////////////////////////////////////////////////////////// -// Color manipulation routines - -BOOL fipImage::invert() { - if(_dib) { - _bHasChanged = TRUE; - - return FreeImage_Invert(_dib); - } - return FALSE; -} - -BOOL fipImage::adjustCurve(BYTE *LUT, FREE_IMAGE_COLOR_CHANNEL channel) { - if(_dib) { - _bHasChanged = TRUE; - - return FreeImage_AdjustCurve(_dib, LUT, channel); - } - return FALSE; -} - -BOOL fipImage::adjustGamma(double gamma) { - if(_dib) { - _bHasChanged = TRUE; - - return FreeImage_AdjustGamma(_dib, gamma); - } - return FALSE; -} - -BOOL fipImage::adjustBrightness(double percentage) { - if(_dib) { - _bHasChanged = TRUE; - - return FreeImage_AdjustBrightness(_dib, percentage); - } - return FALSE; -} - -BOOL fipImage::adjustContrast(double percentage) { - if(_dib) { - _bHasChanged = TRUE; - - return FreeImage_AdjustContrast(_dib, percentage); - } - return FALSE; -} - -BOOL fipImage::adjustBrightnessContrastGamma(double brightness, double contrast, double gamma) { - if(_dib) { - _bHasChanged = TRUE; - - return FreeImage_AdjustColors(_dib, brightness, contrast, gamma, FALSE); - } - return FALSE; -} - -BOOL fipImage::getHistogram(DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel) const { - if(_dib) { - return FreeImage_GetHistogram(_dib, histo, channel); - } - return FALSE; -} - -/////////////////////////////////////////////////////////////////// -// Upsampling / downsampling routine - -BOOL fipImage::rescale(unsigned new_width, unsigned new_height, FREE_IMAGE_FILTER filter) { - if(_dib) { - switch(FreeImage_GetImageType(_dib)) { - case FIT_BITMAP: - case FIT_UINT16: - case FIT_RGB16: - case FIT_RGBA16: - case FIT_FLOAT: - case FIT_RGBF: - case FIT_RGBAF: - break; - default: - return FALSE; - break; - } - - // Perform upsampling / downsampling - FIBITMAP *dst = FreeImage_Rescale(_dib, new_width, new_height, filter); - return replace(dst); - } - return FALSE; -} - -BOOL fipImage::makeThumbnail(unsigned max_size, BOOL convert) { - if(_dib) { - switch(FreeImage_GetImageType(_dib)) { - case FIT_BITMAP: - case FIT_UINT16: - case FIT_RGB16: - case FIT_RGBA16: - case FIT_FLOAT: - case FIT_RGBF: - case FIT_RGBAF: - break; - default: - return FALSE; - break; - } - - // Perform downsampling - FIBITMAP *dst = FreeImage_MakeThumbnail(_dib, max_size, convert); - return replace(dst); - } - return FALSE; -} - -/////////////////////////////////////////////////////////////////// -// Metadata - -unsigned fipImage::getMetadataCount(FREE_IMAGE_MDMODEL model) const { - return FreeImage_GetMetadataCount(model, _dib); -} - -BOOL fipImage::getMetadata(FREE_IMAGE_MDMODEL model, const char *key, fipTag& tag) const { - FITAG *searchedTag = NULL; - FreeImage_GetMetadata(model, _dib, key, &searchedTag); - if(searchedTag != NULL) { - tag = FreeImage_CloneTag(searchedTag); - return TRUE; - } else { - // clear the tag - tag = (FITAG*)NULL; - } - return FALSE; -} - -BOOL fipImage::setMetadata(FREE_IMAGE_MDMODEL model, const char *key, fipTag& tag) { - return FreeImage_SetMetadata(model, _dib, key, tag); -} - diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/src/fipMemoryIO.cpp b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/src/fipMemoryIO.cpp deleted file mode 100644 index 4a8fe80..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/src/fipMemoryIO.cpp +++ /dev/null @@ -1,95 +0,0 @@ -// ========================================================== -// fipMemoryIO class implementation -// -// Design and implementation by -// - Hervé Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#include "FreeImagePlus.h" -#include -#include -#include -#include -#include -#include - -fipMemoryIO::fipMemoryIO(BYTE *data, DWORD size_in_bytes) { - _hmem = FreeImage_OpenMemory(data, size_in_bytes); -} - -fipMemoryIO::~fipMemoryIO() { - if(_hmem != NULL) { - FreeImage_CloseMemory(_hmem); - } -} - -void fipMemoryIO::close() { - if(_hmem != NULL) { - FreeImage_CloseMemory(_hmem); - _hmem = NULL; - } -} - -BOOL fipMemoryIO::isValid() const { - return (_hmem != NULL); -} - -FREE_IMAGE_FORMAT fipMemoryIO::getFileType() const { - if(_hmem != NULL) { - return FreeImage_GetFileTypeFromMemory(_hmem, 0); - } - - return FIF_UNKNOWN; -} - -FIBITMAP* fipMemoryIO::load(FREE_IMAGE_FORMAT fif, int flags) const { - return FreeImage_LoadFromMemory(fif, _hmem, flags); -} - -FIMULTIBITMAP* fipMemoryIO::loadMultiPage(FREE_IMAGE_FORMAT fif, int flags) const { - return FreeImage_LoadMultiBitmapFromMemory(fif, _hmem, flags); -} - -BOOL fipMemoryIO::save(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, int flags) { - return FreeImage_SaveToMemory(fif, dib, _hmem, flags); -} - -BOOL fipMemoryIO::saveMultiPage(FREE_IMAGE_FORMAT fif, FIMULTIBITMAP *bitmap, int flags) { - return FreeImage_SaveMultiBitmapToMemory(fif, bitmap, _hmem, flags); -} - -unsigned fipMemoryIO::read(void *buffer, unsigned size, unsigned count) const { - return FreeImage_ReadMemory(buffer, size, count, _hmem); -} - -unsigned fipMemoryIO::write(const void *buffer, unsigned size, unsigned count) { - return FreeImage_WriteMemory(buffer, size, count, _hmem); -} - -long fipMemoryIO::tell() const { - return FreeImage_TellMemory(_hmem); -} - -BOOL fipMemoryIO::seek(long offset, int origin) { - return FreeImage_SeekMemory(_hmem, offset, origin); -} - -BOOL fipMemoryIO::acquire(BYTE **data, DWORD *size_in_bytes) { - return FreeImage_AcquireMemory(_hmem, data, size_in_bytes); -} - - diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/src/fipMetadataFind.cpp b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/src/fipMetadataFind.cpp deleted file mode 100644 index 57d01f6..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/src/fipMetadataFind.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// ========================================================== -// fipMetadataFind class implementation -// -// Design and implementation by -// - Hervé Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#include "FreeImagePlus.h" - -BOOL fipMetadataFind::isValid() const { - return (_mdhandle != NULL) ? TRUE : FALSE; -} - -fipMetadataFind::fipMetadataFind() : _mdhandle(NULL) { -} - -fipMetadataFind::~fipMetadataFind() { - FreeImage_FindCloseMetadata(_mdhandle); -} - -BOOL fipMetadataFind::findFirstMetadata(FREE_IMAGE_MDMODEL model, fipImage& image, fipTag& tag) { - FITAG *firstTag = NULL; - if(_mdhandle) FreeImage_FindCloseMetadata(_mdhandle); - _mdhandle = FreeImage_FindFirstMetadata(model, image, &firstTag); - if(_mdhandle) { - tag = FreeImage_CloneTag(firstTag); - return TRUE; - } - return FALSE; -} - -BOOL fipMetadataFind::findNextMetadata(fipTag& tag) { - FITAG *nextTag = NULL; - if( FreeImage_FindNextMetadata(_mdhandle, &nextTag) ) { - tag = FreeImage_CloneTag(nextTag); - return TRUE; - } - return FALSE; -} - diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/src/fipMultiPage.cpp b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/src/fipMultiPage.cpp deleted file mode 100644 index cc33196..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/src/fipMultiPage.cpp +++ /dev/null @@ -1,140 +0,0 @@ -// ========================================================== -// fipMultiPage class implementation -// -// Design and implementation by -// - Hervé Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#include "FreeImagePlus.h" - -fipMultiPage::fipMultiPage(BOOL keep_cache_in_memory) : _mpage(NULL), _bMemoryCache(keep_cache_in_memory) { -} - -fipMultiPage::~fipMultiPage() { - if(_mpage) { - // close the stream - close(0); - } -} - -BOOL fipMultiPage::isValid() const { - return (NULL != _mpage) ? TRUE : FALSE; -} - -BOOL fipMultiPage::open(const char* lpszPathName, BOOL create_new, BOOL read_only, int flags) { - // try to guess the file format from the filename - FREE_IMAGE_FORMAT fif = FreeImage_GetFIFFromFilename(lpszPathName); - - // open the stream - _mpage = FreeImage_OpenMultiBitmap(fif, lpszPathName, create_new, read_only, _bMemoryCache, flags); - - return (NULL != _mpage ) ? TRUE : FALSE; -} - -BOOL fipMultiPage::open(fipMemoryIO& memIO, int flags) { - // try to guess the file format from the memory handle - FREE_IMAGE_FORMAT fif = memIO.getFileType(); - - // open the stream - _mpage = memIO.loadMultiPage(fif, flags); - - return (NULL != _mpage ) ? TRUE : FALSE; -} - -BOOL fipMultiPage::open(FreeImageIO *io, fi_handle handle, int flags) { - // try to guess the file format from the handle - FREE_IMAGE_FORMAT fif = FreeImage_GetFileTypeFromHandle(io, handle, 0); - - // open the stream - _mpage = FreeImage_OpenMultiBitmapFromHandle(fif, io, handle, flags); - - return (NULL != _mpage ) ? TRUE : FALSE; -} - -BOOL fipMultiPage::close(int flags) { - BOOL bSuccess = FALSE; - if(_mpage) { - // close the stream - bSuccess = FreeImage_CloseMultiBitmap(_mpage, flags); - _mpage = NULL; - } - - return bSuccess; -} - -BOOL fipMultiPage::saveToHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags) const { - BOOL bSuccess = FALSE; - if(_mpage) { - bSuccess = FreeImage_SaveMultiBitmapToHandle(fif, _mpage, io, handle, flags); - } - - return bSuccess; -} - -BOOL fipMultiPage::saveToMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO& memIO, int flags) const { - BOOL bSuccess = FALSE; - if(_mpage) { - bSuccess = memIO.saveMultiPage(fif, _mpage, flags); - } - - return bSuccess; -} - -int fipMultiPage::getPageCount() const { - return _mpage ? FreeImage_GetPageCount(_mpage) : 0; -} - -void fipMultiPage::appendPage(fipImage& image) { - if(_mpage) { - FreeImage_AppendPage(_mpage, image); - } -} - -void fipMultiPage::insertPage(int page, fipImage& image) { - if(_mpage) { - FreeImage_InsertPage(_mpage, page, image); - } -} - -void fipMultiPage::deletePage(int page) { - if(_mpage) { - FreeImage_DeletePage(_mpage, page); - } -} - -BOOL fipMultiPage::movePage(int target, int source) { - return _mpage ? FreeImage_MovePage(_mpage, target, source) : FALSE; -} - -FIBITMAP* fipMultiPage::lockPage(int page) { - return _mpage ? FreeImage_LockPage(_mpage, page) : NULL; -} - -void fipMultiPage::unlockPage(fipImage& image, BOOL changed) { - if(_mpage) { - FreeImage_UnlockPage(_mpage, image, changed); - // clear the image so that it becomes invalid. - // this is possible because of the friend declaration - image._dib = NULL; - image._bHasChanged = FALSE; - } -} - -BOOL fipMultiPage::getLockedPageNumbers(int *pages, int *count) const { - return _mpage ? FreeImage_GetLockedPageNumbers(_mpage, pages, count) : FALSE; -} - diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/src/fipTag.cpp b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/src/fipTag.cpp deleted file mode 100644 index b00a095..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/src/fipTag.cpp +++ /dev/null @@ -1,134 +0,0 @@ -// ========================================================== -// fipTag class implementation -// -// Design and implementation by -// - Hervé Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#include -#include "FreeImagePlus.h" - -fipTag::fipTag() { - _tag = FreeImage_CreateTag(); -} - -fipTag::~fipTag() { - FreeImage_DeleteTag(_tag); -} - -BOOL fipTag::setKeyValue(const char *key, const char *value) { - if(_tag) { - FreeImage_DeleteTag(_tag); - _tag = NULL; - } - // create a tag - _tag = FreeImage_CreateTag(); - if(_tag) { - BOOL bSuccess = TRUE; - // fill the tag - DWORD tag_length = (DWORD)(strlen(value) + 1); - bSuccess &= FreeImage_SetTagKey(_tag, key); - bSuccess &= FreeImage_SetTagLength(_tag, tag_length); - bSuccess &= FreeImage_SetTagCount(_tag, tag_length); - bSuccess &= FreeImage_SetTagType(_tag, FIDT_ASCII); - bSuccess &= FreeImage_SetTagValue(_tag, value); - return bSuccess; - } - return FALSE; -} - -fipTag::fipTag(const fipTag& tag) { - _tag = FreeImage_CloneTag(tag._tag); -} - -fipTag& fipTag::operator=(const fipTag& tag) { - if(this != &tag) { - if(_tag) FreeImage_DeleteTag(_tag); - _tag = FreeImage_CloneTag(tag._tag); - } - return *this; -} - -fipTag& fipTag::operator=(FITAG *tag) { - if(_tag) FreeImage_DeleteTag(_tag); - _tag = tag; - return *this; -} - -BOOL fipTag::isValid() const { - return (_tag != NULL) ? TRUE : FALSE; -} - -const char* fipTag::getKey() const { - return FreeImage_GetTagKey(_tag); -} - -const char* fipTag::getDescription() const { - return FreeImage_GetTagDescription(_tag); -} - -WORD fipTag::getID() const { - return FreeImage_GetTagID(_tag); -} - -FREE_IMAGE_MDTYPE fipTag::getType() const { - return FreeImage_GetTagType(_tag); -} - -DWORD fipTag::getCount() const { - return FreeImage_GetTagCount(_tag); -} - -DWORD fipTag::getLength() const { - return FreeImage_GetTagLength(_tag); -} - -const void* fipTag::getValue() const { - return FreeImage_GetTagValue(_tag); -} - -BOOL fipTag::setKey(const char *key) { - return FreeImage_SetTagKey(_tag, key); -} - -BOOL fipTag::setDescription(const char *description) { - return FreeImage_SetTagDescription(_tag, description); -} - -BOOL fipTag::setID(WORD id) { - return FreeImage_SetTagID(_tag, id); -} - -BOOL fipTag::setType(FREE_IMAGE_MDTYPE type) { - return FreeImage_SetTagType(_tag, type); -} - -BOOL fipTag::setCount(DWORD count) { - return FreeImage_SetTagCount(_tag, count); -} - -BOOL fipTag::setLength(DWORD length) { - return FreeImage_SetTagLength(_tag, length); -} - -BOOL fipTag::setValue(const void *value) { - return FreeImage_SetTagValue(_tag, value); -} - -const char* fipTag::toString(FREE_IMAGE_MDMODEL model, char *Make) const { - return FreeImage_TagToString(model, _tag, Make); -} diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/src/fipWinImage.cpp b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/src/fipWinImage.cpp deleted file mode 100644 index 092b655..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/src/fipWinImage.cpp +++ /dev/null @@ -1,488 +0,0 @@ -// ========================================================== -// fipWinImage class implementation -// -// Design and implementation by -// - Hervé Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#include "FreeImagePlus.h" - -#ifdef _WIN32 - -// marker used for clipboard copy / paste - -static inline void -SET_FREEIMAGE_MARKER(BITMAPINFOHEADER *bmih, FIBITMAP *dib) { - // Windows constants goes from 0L to 5L - // Add 0xFF to avoid conflicts - bmih->biCompression = 0xFF + FreeImage_GetImageType(dib); -} - -static inline FREE_IMAGE_TYPE -GET_FREEIMAGE_MARKER(BITMAPINFOHEADER *bmih) { - return (FREE_IMAGE_TYPE)(bmih->biCompression - 0xFF); -} - -/////////////////////////////////////////////////////////////////// -// Construction / Destruction - -fipWinImage::fipWinImage(FREE_IMAGE_TYPE image_type, unsigned width, unsigned height, unsigned bpp) : fipImage(image_type, width, height, bpp) { - _display_dib = NULL; - _bDeleteMe = FALSE; - // default tone mapping operator - _tmo = FITMO_DRAGO03; - _tmo_param_1 = 0; - _tmo_param_2 = 0; - _tmo_param_3 = 1; - _tmo_param_4 = 0; -} - -fipWinImage::~fipWinImage() { - if(_bDeleteMe) { - FreeImage_Unload(_display_dib); - } -} - -void fipWinImage::clear() { - // delete _display_dib - if(_bDeleteMe) { - FreeImage_Unload(_display_dib); - } - _display_dib = NULL; - _bDeleteMe = FALSE; - // delete base class data - fipImage::clear(); -} - -BOOL fipWinImage::isValid() const { - return fipImage::isValid(); -} - -/////////////////////////////////////////////////////////////////// -// Copying - -fipWinImage& fipWinImage::operator=(const fipImage& Image) { - // delete _display_dib - if(_bDeleteMe) { - FreeImage_Unload(_display_dib); - } - _display_dib = NULL; - _bDeleteMe = FALSE; - // clone the base class - fipImage::operator=(Image); - - return *this; -} - -fipWinImage& fipWinImage::operator=(const fipWinImage& Image) { - if(this != &Image) { - // delete _display_dib - if(_bDeleteMe) { - FreeImage_Unload(_display_dib); - } - _display_dib = NULL; - _bDeleteMe = FALSE; - // copy tmo data - _tmo = Image._tmo; - _tmo_param_1 = Image._tmo_param_1; - _tmo_param_2 = Image._tmo_param_2; - _tmo_param_3 = Image._tmo_param_3; - _tmo_param_4 = Image._tmo_param_4; - - // clone the base class - fipImage::operator=(Image); - } - return *this; -} - -HANDLE fipWinImage::copyToHandle() const { - HANDLE hMem = NULL; - - if(_dib) { - - // Get equivalent DIB size - long dib_size = sizeof(BITMAPINFOHEADER); - dib_size += FreeImage_GetColorsUsed(_dib) * sizeof(RGBQUAD); - dib_size += FreeImage_GetPitch(_dib) * FreeImage_GetHeight(_dib); - - // Allocate a DIB - hMem = GlobalAlloc(GHND, dib_size); - BYTE *dib = (BYTE*)GlobalLock(hMem); - - memset(dib, 0, dib_size); - - BYTE *p_dib = (BYTE*)dib; - - // Copy the BITMAPINFOHEADER - - BITMAPINFOHEADER *bih = FreeImage_GetInfoHeader(_dib); - memcpy(p_dib, bih, sizeof(BITMAPINFOHEADER)); - if(FreeImage_GetImageType(_dib) != FIT_BITMAP) { - // this hack is used to store the bitmap type in the biCompression member of the BITMAPINFOHEADER - SET_FREEIMAGE_MARKER((BITMAPINFOHEADER*)p_dib, _dib); - } - p_dib += sizeof(BITMAPINFOHEADER); - - // Copy the palette - - RGBQUAD *pal = FreeImage_GetPalette(_dib); - memcpy(p_dib, pal, FreeImage_GetColorsUsed(_dib) * sizeof(RGBQUAD)); - p_dib += FreeImage_GetColorsUsed(_dib) * sizeof(RGBQUAD); - - // Copy the bitmap - - BYTE *bits = FreeImage_GetBits(_dib); - memcpy(p_dib, bits, FreeImage_GetPitch(_dib) * FreeImage_GetHeight(_dib)); - - GlobalUnlock(hMem); - } - - return hMem; -} - -BOOL fipWinImage::copyFromHandle(HANDLE hMem) { - BYTE *lpVoid = NULL; - BITMAPINFOHEADER *pHead = NULL; - RGBQUAD *pPalette = NULL; - BYTE *bits = NULL; - DWORD bitfields[3] = {0, 0, 0}; - - // Get a pointer to the bitmap - lpVoid = (BYTE *)GlobalLock(hMem); - - // Get a pointer to the bitmap header - pHead = (BITMAPINFOHEADER *)lpVoid; - - // Get a pointer to the palette - if(pHead->biBitCount < 16) - pPalette = (RGBQUAD *)(((BYTE *)pHead) + sizeof(BITMAPINFOHEADER)); - - // Get a pointer to the pixels - bits = ((BYTE*)pHead + sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * pHead->biClrUsed); - - if(pHead->biCompression == BI_BITFIELDS) { - // Take into account the color masks that specify the red, green, and blue components (16- and 32-bit) - unsigned mask_size = 3 * sizeof(DWORD); - memcpy(&bitfields[0], bits, mask_size); - bits += mask_size; - } - - if(lpVoid) { - - // Allocate a new FIBITMAP - - FREE_IMAGE_TYPE image_type = FIT_BITMAP; - // Use a hack to decide if the clipboard contains non standard bitmaps ... - switch(GET_FREEIMAGE_MARKER(pHead)) { - case FIT_UINT16: - case FIT_INT16: - case FIT_UINT32: - case FIT_INT32: - case FIT_FLOAT: - case FIT_DOUBLE: - case FIT_COMPLEX: - case FIT_RGB16: - case FIT_RGBA16: - case FIT_RGBF: - case FIT_RGBAF: - image_type = GET_FREEIMAGE_MARKER(pHead); - break; - } - if(!setSize(image_type, (WORD)pHead->biWidth, (WORD)pHead->biHeight, pHead->biBitCount, bitfields[2], bitfields[1], bitfields[0])) { - GlobalUnlock(lpVoid); - return FALSE; - } - - // Copy the bitmap header - memcpy(FreeImage_GetInfoHeader(_dib), pHead, sizeof(BITMAPINFOHEADER)); - - - // Copy the palette - memcpy(FreeImage_GetPalette(_dib), pPalette, pHead->biClrUsed * sizeof(RGBQUAD)); - - // Copy the bitmap - memcpy(FreeImage_GetBits(_dib), bits, FreeImage_GetPitch(_dib) * FreeImage_GetHeight(_dib)); - - GlobalUnlock(lpVoid); - - return TRUE; - } - - return FALSE; -} - -BOOL fipWinImage::copyFromBitmap(HBITMAP hbmp) { - if(hbmp) { - int Success; - BITMAP bm; - // Get informations about the bitmap - GetObject(hbmp, sizeof(BITMAP), (LPSTR) &bm); - // Create the image - setSize(FIT_BITMAP, (WORD)bm.bmWidth, (WORD)bm.bmHeight, (WORD)bm.bmBitsPixel); - - // The GetDIBits function clears the biClrUsed and biClrImportant BITMAPINFO members (dont't know why) - // So we save these infos below. This is needed for palettized images only. - int nColors = FreeImage_GetColorsUsed(_dib); - - // Create a device context for the bitmap - HDC dc = GetDC(NULL); - // Copy the pixels - Success = GetDIBits(dc, // handle to DC - hbmp, // handle to bitmap - 0, // first scan line to set - FreeImage_GetHeight(_dib), // number of scan lines to copy - FreeImage_GetBits(_dib), // array for bitmap bits - FreeImage_GetInfo(_dib), // bitmap data buffer - DIB_RGB_COLORS // RGB - ); - if(Success == 0) { - FreeImage_OutputMessageProc(FIF_UNKNOWN, "Error : GetDIBits failed"); - ReleaseDC(NULL, dc); - return FALSE; - } - ReleaseDC(NULL, dc); - - // restore BITMAPINFO members - - FreeImage_GetInfoHeader(_dib)->biClrUsed = nColors; - FreeImage_GetInfoHeader(_dib)->biClrImportant = nColors; - - return TRUE; - } - - return FALSE; -} - -BOOL fipWinImage::copyToClipboard(HWND hWndNewOwner) const { - HANDLE hDIB = copyToHandle(); - - if(OpenClipboard(hWndNewOwner)) { - if(EmptyClipboard()) { - if(SetClipboardData(CF_DIB, hDIB) == NULL) { - MessageBox(hWndNewOwner, "Unable to set Clipboard data", "FreeImage", MB_ICONERROR); - CloseClipboard(); - return FALSE; - } - } - } - CloseClipboard(); - - return TRUE; -} - -BOOL fipWinImage::pasteFromClipboard() { - if(!IsClipboardFormatAvailable(CF_DIB)) - return FALSE; - - if(OpenClipboard(NULL)) { - HANDLE hDIB = GetClipboardData(CF_DIB); - copyFromHandle(hDIB); - CloseClipboard(); - return TRUE; - } - CloseClipboard(); - - return FALSE; -} - -/////////////////////////////////////////////////////////////////// -// Screen capture - -BOOL fipWinImage::captureWindow(HWND hWndApplicationWindow, HWND hWndSelectedWindow) { - int xScreen, yScreen, xshift, yshift; - RECT r; - - // Get window size - GetWindowRect(hWndSelectedWindow, &r); - - // Check if the window is out of the screen or maximixed - xshift = 0; - yshift = 0; - xScreen = GetSystemMetrics(SM_CXSCREEN); - yScreen = GetSystemMetrics(SM_CYSCREEN); - if(r.right > xScreen) - r.right = xScreen; - if(r.bottom > yScreen) - r.bottom = yScreen; - if(r.left < 0) { - xshift = -r.left; - r.left = 0; - } - if(r.top < 0){ - yshift = -r.top; - r.top = 0; - } - - int width = r.right - r.left; - int height = r.bottom - r.top; - - if(width <= 0 || height <= 0) - return FALSE; - - // Hide the application window. - ShowWindow(hWndApplicationWindow, SW_HIDE); - // Bring the window at the top most level - SetWindowPos(hWndSelectedWindow, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); - // Give enough time to refresh the window - Sleep(500); - - // Prepare the DCs - HDC dstDC = GetDC(NULL); - HDC srcDC = GetWindowDC(hWndSelectedWindow); // full window (GetDC(hWndSelectedWindow) = clientarea) - HDC memDC = CreateCompatibleDC(dstDC); - - // Copy the screen to the bitmap - HBITMAP bm = CreateCompatibleBitmap(dstDC, width, height); - HBITMAP oldbm = (HBITMAP)SelectObject(memDC, bm); - BitBlt(memDC, 0, 0, width, height, srcDC, xshift, yshift, SRCCOPY); - - // Redraw the application window. - ShowWindow(hWndApplicationWindow, SW_SHOW); - - // Restore the position - SetWindowPos(hWndSelectedWindow, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); - SetWindowPos(hWndApplicationWindow, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); - - // Convert the HBITMAP to a FIBITMAP - copyFromBitmap(bm); - - // Free objects - DeleteObject(SelectObject(memDC, oldbm)); - DeleteDC(memDC); - - // Convert 32-bit images to 24-bit - if(getBitsPerPixel() == 32) { - convertTo24Bits(); - } - - return TRUE; -} - - -/////////////////////////////////////////////////////////////////// -// Painting operations - -void fipWinImage::drawEx(HDC hDC, RECT& rcDest, BOOL useFileBkg, RGBQUAD *appBkColor, FIBITMAP *bg) const { - // Convert to a standard bitmap if needed - if(_bHasChanged) { - if(_bDeleteMe) { - FreeImage_Unload(_display_dib); - _display_dib = NULL; - _bDeleteMe = FALSE; - } - - FREE_IMAGE_TYPE image_type = getImageType(); - if(image_type == FIT_BITMAP) { - BOOL bHasBackground = FreeImage_HasBackgroundColor(_dib); - BOOL bIsTransparent = FreeImage_IsTransparent(_dib); - - if(!bIsTransparent && (!bHasBackground || !useFileBkg)) { - // Copy pointer - _display_dib = _dib; - } - else { - // Create the transparent / alpha blended image - _display_dib = FreeImage_Composite(_dib, useFileBkg, appBkColor, bg); - if(_display_dib) { - // Remember to delete _display_dib - _bDeleteMe = TRUE; - } else { - // Something failed: copy pointers - _display_dib = _dib; - } - } - } else { - // Convert to a standard dib for display - - if(image_type == FIT_COMPLEX) { - // Convert to type FIT_DOUBLE - FIBITMAP *dib_double = FreeImage_GetComplexChannel(_dib, FICC_MAG); - // Convert to a standard bitmap (linear scaling) - _display_dib = FreeImage_ConvertToStandardType(dib_double, TRUE); - // Free image of type FIT_DOUBLE - FreeImage_Unload(dib_double); - } else if((image_type == FIT_RGBF) || (image_type == FIT_RGBAF) || (image_type == FIT_RGB16)) { - // Apply a tone mapping algorithm and convert to 24-bit - switch(_tmo) { - case FITMO_REINHARD05: - _display_dib = FreeImage_TmoReinhard05Ex(_dib, _tmo_param_1, _tmo_param_2, _tmo_param_3, _tmo_param_4); - break; - default: - _display_dib = FreeImage_ToneMapping(_dib, _tmo, _tmo_param_1, _tmo_param_2); - break; - } - } else if(image_type == FIT_RGBA16) { - // Convert to 32-bit - FIBITMAP *dib32 = FreeImage_ConvertTo32Bits(_dib); - if(dib32) { - // Create the transparent / alpha blended image - _display_dib = FreeImage_Composite(dib32, useFileBkg, appBkColor, bg); - FreeImage_Unload(dib32); - } - } else { - // Other cases: convert to a standard bitmap (linear scaling) - _display_dib = FreeImage_ConvertToStandardType(_dib, TRUE); - } - // Remember to delete _display_dib - _bDeleteMe = TRUE; - } - - _bHasChanged = FALSE; - } - - // Draw the dib - SetStretchBltMode(hDC, COLORONCOLOR); - StretchDIBits(hDC, rcDest.left, rcDest.top, - rcDest.right-rcDest.left, rcDest.bottom-rcDest.top, - 0, 0, FreeImage_GetWidth(_display_dib), FreeImage_GetHeight(_display_dib), - FreeImage_GetBits(_display_dib), FreeImage_GetInfo(_display_dib), DIB_RGB_COLORS, SRCCOPY); - -} - -void fipWinImage::setToneMappingOperator(FREE_IMAGE_TMO tmo, double first_param, double second_param, double third_param, double fourth_param) { - // avoid costly operations if possible ... - if((_tmo != tmo) || (_tmo_param_1 != first_param) || (_tmo_param_2 != second_param) || (_tmo_param_3 != third_param) || (_tmo_param_4 != fourth_param)) { - _tmo = tmo; - _tmo_param_1 = first_param; - _tmo_param_2 = second_param; - _tmo_param_3 = third_param; - _tmo_param_4 = fourth_param; - - FREE_IMAGE_TYPE image_type = getImageType(); - switch(image_type) { - case FIT_RGBF: - case FIT_RGBAF: - case FIT_RGB16: - case FIT_RGBA16: - _bHasChanged = TRUE; - break; - default: - break; - } - } -} - -void fipWinImage::getToneMappingOperator(FREE_IMAGE_TMO *tmo, double *first_param, double *second_param, double *third_param, double *fourth_param) const { - *tmo = _tmo; - *first_param = _tmo_param_1; - *second_param = _tmo_param_2; - *third_param = _tmo_param_3; - *fourth_param = _tmo_param_4; -} - - -#endif // _WIN32 diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2005.sln b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2005.sln deleted file mode 100644 index 1a76773..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2005.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fipTest", "fipTest.2005.vcproj", "{39B399CB-50D7-43CF-9967-CBA4309C7034}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {39B399CB-50D7-43CF-9967-CBA4309C7034}.Debug|Win32.ActiveCfg = Debug|Win32 - {39B399CB-50D7-43CF-9967-CBA4309C7034}.Debug|Win32.Build.0 = Debug|Win32 - {39B399CB-50D7-43CF-9967-CBA4309C7034}.Release|Win32.ActiveCfg = Release|Win32 - {39B399CB-50D7-43CF-9967-CBA4309C7034}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2005.vcproj b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2005.vcproj deleted file mode 100644 index d0ff7c1..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2005.vcproj +++ /dev/null @@ -1,282 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2008.sln b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2008.sln deleted file mode 100644 index cf7f9f6..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2008.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fipTest", "fipTest.2008.vcproj", "{66DCA866-A381-42D5-97FB-9792066C0F20}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {66DCA866-A381-42D5-97FB-9792066C0F20}.Debug|Win32.ActiveCfg = Debug|Win32 - {66DCA866-A381-42D5-97FB-9792066C0F20}.Debug|Win32.Build.0 = Debug|Win32 - {66DCA866-A381-42D5-97FB-9792066C0F20}.Debug|x64.ActiveCfg = Debug|x64 - {66DCA866-A381-42D5-97FB-9792066C0F20}.Debug|x64.Build.0 = Debug|x64 - {66DCA866-A381-42D5-97FB-9792066C0F20}.Release|Win32.ActiveCfg = Release|Win32 - {66DCA866-A381-42D5-97FB-9792066C0F20}.Release|Win32.Build.0 = Release|Win32 - {66DCA866-A381-42D5-97FB-9792066C0F20}.Release|x64.ActiveCfg = Release|x64 - {66DCA866-A381-42D5-97FB-9792066C0F20}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2008.vcproj b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2008.vcproj deleted file mode 100644 index bbec75f..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2008.vcproj +++ /dev/null @@ -1,520 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2013.sln b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2013.sln deleted file mode 100644 index a60d69a..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2013.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Express 2013 for Windows Desktop -VisualStudioVersion = 12.0.21005.1 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fipTest", "fipTest.2013.vcxproj", "{66DCA866-A381-42D5-97FB-9792066C0F20}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {66DCA866-A381-42D5-97FB-9792066C0F20}.Debug|Win32.ActiveCfg = Debug|Win32 - {66DCA866-A381-42D5-97FB-9792066C0F20}.Debug|Win32.Build.0 = Debug|Win32 - {66DCA866-A381-42D5-97FB-9792066C0F20}.Debug|x64.ActiveCfg = Debug|x64 - {66DCA866-A381-42D5-97FB-9792066C0F20}.Debug|x64.Build.0 = Debug|x64 - {66DCA866-A381-42D5-97FB-9792066C0F20}.Release|Win32.ActiveCfg = Release|Win32 - {66DCA866-A381-42D5-97FB-9792066C0F20}.Release|Win32.Build.0 = Release|Win32 - {66DCA866-A381-42D5-97FB-9792066C0F20}.Release|x64.ActiveCfg = Release|x64 - {66DCA866-A381-42D5-97FB-9792066C0F20}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2013.vcxproj b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2013.vcxproj deleted file mode 100644 index 0b9362d..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2013.vcxproj +++ /dev/null @@ -1,263 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - fipTest - {66DCA866-A381-42D5-97FB-9792066C0F20} - - - - Application - v120 - false - MultiByte - - - Application - v120 - false - MultiByte - - - Application - v120 - false - MultiByte - - - Application - v120 - false - MultiByte - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>12.0.21005.1 - - - .\$(Platform)\$(Configuration)\ - .\$(Platform)\$(Configuration)\ - true - - - .\$(Platform)\$(Configuration)\ - .\$(Platform)\$(Configuration)\ - false - - - .\$(Platform)\$(Configuration)\ - .\$(Platform)\$(Configuration)\ - true - - - .\$(Platform)\$(Configuration)\ - .\$(Platform)\$(Configuration)\ - false - - - - .\Debug/fipTest.tlb - - - - Disabled - WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - NotUsing - Level3 - true - EditAndContinue - ..\..\..\Dist\x32 - - - _DEBUG;%(PreprocessorDefinitions) - 0x040c - - - FreeImaged.lib;FreeImagePlusd.lib;%(AdditionalDependencies) - true - true - Console - false - - MachineX86 - ..\..\..\Dist\x32;..\dist\x32 - false - - - copy ..\..\..\Dist\x32\FreeImaged.dll .\$(Platform)\$(Configuration)\ -copy ..\dist\x32\FreeImagePlusd.dll .\$(Platform)\$(Configuration)\ - - - - - - - .\Release/fipTest.tlb - - - - MaxSpeed - OnlyExplicitInline - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - MultiThreaded - true - NotUsing - Level3 - true - ..\..\..\Dist\x32 - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - FreeImage.lib;FreeImagePlus.lib;%(AdditionalDependencies) - true - Console - false - - MachineX86 - ..\..\..\Dist\x32;..\dist\x32 - false - - - - - X64 - .\Debug/fipTest.tlb - - - - Disabled - WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - NotUsing - Level3 - true - ProgramDatabase - ..\..\..\Dist\x64 - - - _DEBUG;%(PreprocessorDefinitions) - 0x040c - - - FreeImaged.lib;FreeImagePlusd.lib;%(AdditionalDependencies) - true - true - Console - false - - MachineX64 - ..\..\..\Dist\x64;..\dist\x64 - false - - - - - X64 - .\Release/fipTest.tlb - - - - MaxSpeed - OnlyExplicitInline - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - MultiThreaded - true - NotUsing - Level3 - true - ..\..\..\Dist\x64 - - - NDEBUG;%(PreprocessorDefinitions) - 0x040c - - - FreeImage.lib;FreeImagePlus.lib;%(AdditionalDependencies) - true - Console - false - - MachineX64 - ..\..\..\Dist\x64;..\dist\x64 - false - - - - - Disabled - EnableFastChecks - Disabled - EnableFastChecks - MaxSpeed - MaxSpeed - - - Disabled - EnableFastChecks - Disabled - EnableFastChecks - MaxSpeed - MaxSpeed - - - Disabled - EnableFastChecks - Disabled - EnableFastChecks - MaxSpeed - MaxSpeed - - - - - - - - - - - \ No newline at end of file diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTest.cpp b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTest.cpp deleted file mode 100644 index 0501c6f..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTest.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// ========================================================== -// FreeImagePlus Test Script -// -// Design and implementation by -// - Hervé Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - - -#include "fipTest.h" - -using namespace std; - -// ---------------------------------------------------------- - -/** - FreeImage error handler - @param fif Format / Plugin responsible for the error - @param message Error message -*/ -void FreeImageErrorHandler(FREE_IMAGE_FORMAT fif, const char *message) { - cout << "\n*** "; - if(fif != FIF_UNKNOWN) { - cout << FreeImage_GetFormatFromFIF(fif) << " Format\n"; - } - cout << message; - cout << " ***\n"; -} - -// ---------------------------------------------------------- - -int main(int argc, char *argv[]) { - char *lpszTestFile = "test.jpg"; - char *lpszMultiPage = "test.tif"; - -#if defined(FREEIMAGE_LIB) || !defined(WIN32) - FreeImage_Initialise(); -#endif - - // initialize our own FreeImage error handler - - FreeImage_SetOutputMessage(FreeImageErrorHandler); - - // test memory IO - testMemIO(lpszTestFile); - - // test multipage IO - testMultiPage(lpszMultiPage); - - // test multipage memory IO - testMultiPageMemory(lpszMultiPage); - - // test multipage stream IO - testStreamMultiPage(lpszMultiPage); - -#if defined(FREEIMAGE_LIB) || !defined(WIN32) - FreeImage_DeInitialise(); -#endif - - return 0; -} - - diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTest.h b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTest.h deleted file mode 100644 index 3b8d1de..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTest.h +++ /dev/null @@ -1,79 +0,0 @@ -// ========================================================== -// FreeImagePlus Test Script -// -// Design and implementation by -// - Hervé Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#ifndef TEST_FREEIMAGEPLUS_API_H -#define TEST_FREEIMAGEPLUS_API_H - -#include "../FreeImagePlus.h" -#include -#include -#include - -#include - -// -------------------------------------------------------------------------- -// Memory IO test scripts - -/// Test saving to a memory stream -void testSaveMemIO(const char *lpszPathName); -/// Test loading from a buffer attached to a memory stream -void testLoadMemIO(const char *lpszPathName); -/// Test extracting a memory buffer from a memory stream -void testAcquireMemIO(const char *lpszPathName); -/// Test Loading / Saving from / to a memory stream using fipImage -void testImageMemIO(const char *lpszPathName); -/// Test the above functions -void testMemIO(const char *lpszPathName); - -// -------------------------------------------------------------------------- -// Multipage test scripts - -/// Test multipage loading & saving -BOOL testCloneMultiPage(const char *input, const char *output, int output_flag); -/// Test the above functions -void testMultiPage(const char *lpszMultiPage); - -// -------------------------------------------------------------------------- -// Multipage memory IO test scripts - -/// test FreeImage_LoadMultiBitmapFromMemory -BOOL testLoadMultiBitmapFromMemory(const char *lpszPathName); -/// test FreeImage_SaveMultiBitmapToMemory -BOOL testSaveMultiBitmapToMemory(const char *input, const char *output, int output_flag); -/// test FreeImage_LoadMultiBitmapFromMemory & FreeImage_SaveMultiBitmapToMemory -BOOL testMemoryStreamMultiPageOpenSave(const char *lpszPathName, char *output, int input_flag, int output_flag); -/// Test the above functions -void testMultiPageMemory(const char *lpszPathName); - -// -------------------------------------------------------------------------- -// Multipage IO test scripts - -/// test multipage stream (opening) -BOOL testStreamMultiPageOpen(const char *input, int flags); -/// test multipage stream (save as) -BOOL testStreamMultiPageSave(const char *input, const char *output, int input_flag, int output_flag); -/// test multipage stream (open, modify, save as) -BOOL testStreamMultiPageOpenSave(const char *input, const char *output, int input_flag, int output_flag); -/// Test the above functions -void testStreamMultiPage(const char *lpszPathName); - - -#endif // TEST_FREEIMAGEPLUS_API_H diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTestMPage.cpp b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTestMPage.cpp deleted file mode 100644 index ec2572f..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTestMPage.cpp +++ /dev/null @@ -1,87 +0,0 @@ -// ========================================================== -// FreeImagePlus Test Script -// -// Design and implementation by -// - Hervé Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - - -#include "fipTest.h" - -using namespace std; - -// -------------------------------------------------------------------------- -// Multipage test scripts - -BOOL testCloneMultiPage(const char *input, const char *output, int output_flag) { - BOOL bSuccess = FALSE; - BOOL bMemoryCache = TRUE; - - fipMultiPage src(bMemoryCache); - fipMultiPage dst(bMemoryCache); - - // You MUST declare this before using it. - // We will use the assignement operator, i.e. operator=() - fipImage image; - - // Open src file (read-only, use memory cache) - bSuccess = src.open(input, FALSE, TRUE); - assert(bSuccess); - - if(src.isValid()) { - // Open dst file (creation, use memory cache) - bSuccess = dst.open(output, TRUE, FALSE); - assert(bSuccess); - - // Get src page count - int count = src.getPageCount(); - - // Clone src to dst - for(int page = 0; page < count; page++) { - // Load the bitmap at position 'page' - image = src.lockPage(page); - if(image.isValid()) { - // add a new bitmap to dst - dst.appendPage(image); - // Unload the bitmap (do not apply any change to src) - src.unlockPage(image, FALSE); - } - } - - // Close src - bSuccess = src.close(0); - assert(bSuccess); - - // Save and close dst - bSuccess = dst.close(output_flag); - assert(bSuccess); - - return TRUE; - } - - return FALSE; -} - -// ---------------------------------------------------------- - -void testMultiPage(const char *lpszMultiPage) { - cout << "testMultiPage ...\n"; - - testCloneMultiPage(lpszMultiPage, "clone.tif", 0); -} - - diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTestMPageMemory.cpp b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTestMPageMemory.cpp deleted file mode 100644 index 352c9ff..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTestMPageMemory.cpp +++ /dev/null @@ -1,277 +0,0 @@ -// ========================================================== -// FreeImagePlus Test Script -// -// Design and implementation by -// - Hervé Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - - -#include "fipTest.h" - -using namespace std; - -// -------------------------------------------------------------------------- - -static BOOL -loadBuffer(const char *lpszPathName, BYTE **buffer, DWORD *length) { - struct stat file_info; - int result; - - // get data associated with lpszPathName - result = stat(lpszPathName, &file_info); - assert(result == 0); - if(result == 0) { - // allocate a memory buffer and load temporary data - *buffer = (BYTE*)malloc(file_info.st_size * sizeof(BYTE)); - if(*buffer) { - FILE *stream = fopen(lpszPathName, "rb"); - if(stream) { - *length = (DWORD)fread(*buffer, sizeof(BYTE), file_info.st_size, stream); - fclose(stream); - - return TRUE; - } - } - } - - return FALSE; -} - -static BOOL -extractPagesFromMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO& memIO) { - BOOL bMemoryCache = TRUE; - - char filename[256]; - fipImage image; - - // open the multipage bitmap stream as read-only - fipMultiPage src(bMemoryCache); - - src.open(memIO); - - if(src.isValid()) { - // get the page count - int count = src.getPageCount(); - // extract all pages - for(int page = 0; page < count; page++) { - // load the bitmap at position 'page' - image = src.lockPage(page); - if(image.isValid()) { - // save the page - sprintf(filename, "page%d.%s", page, FreeImage_GetFormatFromFIF(fif)); - image.save(filename, 0); - // Unload the bitmap (do not apply any change to src) - src.unlockPage(image, FALSE); - } else { - // an error occured: free the multipage bitmap handle (fipMultiPage destructor) and return - src.close(0); - return FALSE; - } - } - } - // make sure to close the multipage bitmap handle on exit (fipMultiPage destructor or direct call to src.close(0)) - return src.close(0); -} - -BOOL testLoadMultiBitmapFromMemory(const char *lpszPathName) { - BOOL bSuccess = FALSE; - - BYTE *buffer = NULL; - DWORD buffer_size = 0; - - // load source stream as a buffer, i.e. - // allocate a memory buffer and load temporary data - bSuccess = loadBuffer(lpszPathName, &buffer, &buffer_size); - assert(bSuccess); - - if(bSuccess) { - // attach the binary data to a memory stream - fipMemoryIO memIO(buffer, buffer_size); - - // get the file type - FREE_IMAGE_FORMAT fif = memIO.getFileType(); - - // extract pages - bSuccess = extractPagesFromMemory(fif, memIO); - assert(bSuccess); - - // close the memory stream (memIO destructor) - } - - // user is responsible for freeing the data - free(buffer); - - return bSuccess; -} - -// -------------------------------------------------------------------------- - -BOOL testSaveMultiBitmapToMemory(const char *input, const char *output, int output_flag) { - BOOL bSuccess; - - BOOL bCreateNew = FALSE; - BOOL bReadOnly = TRUE; - BOOL bMemoryCache = TRUE; - - // Open src file (read-only, use memory cache) - fipMultiPage src(bMemoryCache); - src.open(input, bCreateNew, bReadOnly, 0); - - if(src.isValid()) { - // open and allocate a memory stream - fipMemoryIO memIO; - - // save the file to memory - FREE_IMAGE_FORMAT fif = fipImage::identifyFIF(output); - bSuccess = src.saveToMemory(fif, memIO, output_flag); - assert(bSuccess); - - // src is no longer needed: close and free src file - src.close(0); - - // get the buffer from the memory stream - BYTE *mem_buffer = NULL; - DWORD size_in_bytes = 0; - - bSuccess = memIO.acquire(&mem_buffer, &size_in_bytes); - assert(bSuccess); - - // save the buffer in a file stream - FILE *stream = fopen(output, "wb"); - if(stream) { - fwrite(mem_buffer, sizeof(BYTE), size_in_bytes, stream); - fclose(stream); - } - - // close and free the memory stream (memIO destructor) - - return TRUE; - } - - return FALSE; -} - -BOOL testMemoryStreamMultiPageOpenSave(const char *lpszPathName, char *output, int input_flag, int output_flag) { - BOOL bSuccess = FALSE; - - BYTE *buffer = NULL; - DWORD buffer_size = 0; - - // load source stream as a buffer, i.e. - // allocate a memory buffer and load temporary data - bSuccess = loadBuffer(lpszPathName, &buffer, &buffer_size); - assert(bSuccess); - - // attach the binary data to a memory stream - fipMemoryIO src_stream(buffer, buffer_size); - assert(src_stream.isValid()); - - // open the multipage bitmap stream - fipMultiPage src; - src.open(src_stream, input_flag); - - // apply some modifications (everything being stored to the cache) ... - - if(src.isValid()) { - fipImage image; - - // get the page count - int count = src.getPageCount(); - assert(count > 2); - - // Load the bitmap at position '2' - image = src.lockPage(2); - if(image.isValid()) { - image.invert(); - // Unload the bitmap (apply change to src, modifications are stored to the cache) - src.unlockPage(image, TRUE); - } - - // delete page 0 (modifications are stored to the cache) - src.deletePage(0); - - // insert a new page at position '0' (modifications are stored to the cache) - image.load("test.jpg"); - src.insertPage(0, image); - } - - // save the modification into the output stream ... - - if(src.isValid()) { - // open and allocate a memory stream - fipMemoryIO dst_stream; - assert(dst_stream.isValid()); - - // save the file to memory - FREE_IMAGE_FORMAT fif = fipImage::identifyFIF(output); - src.saveToMemory(fif, dst_stream, output_flag); - - // src is no longer needed - // close and free the memory stream - src_stream.close(); - // close and free src file (nothing is done, the cache is cleared) - src.close(0); - - // at this point, the input buffer is no longer needed - // !!! user is responsible for freeing the initial source buffer !!! - free(buffer); buffer = NULL; - - // get the dst buffer from the memory stream - BYTE *dst_buffer = NULL; - DWORD size_in_bytes = 0; - - dst_stream.acquire(&dst_buffer, &size_in_bytes); - - // save the buffer in a file stream - FILE *stream = fopen(output, "wb"); - if(stream) { - fwrite(dst_buffer, sizeof(BYTE), size_in_bytes, stream); - fclose(stream); - } - - // close and free the memory stream (destructor is called) - - return TRUE; - } - - if(buffer) { - free(buffer); - } - - return FALSE; -} - -// -------------------------------------------------------------------------- - -void testMultiPageMemory(const char *lpszPathName) { - BOOL bSuccess; - - cout << "testMultiPageMemory ...\n"; - - // test FreeImage_LoadMultiBitmapFromMemory - bSuccess = testLoadMultiBitmapFromMemory(lpszPathName); - assert(bSuccess); - - // test FreeImage_SaveMultiBitmapToMemory - bSuccess = testSaveMultiBitmapToMemory(lpszPathName, "mpage-mstream.tif", 0); - assert(bSuccess); - - // test FreeImage_LoadMultiBitmapFromMemory & FreeImage_SaveMultiBitmapToMemory - bSuccess = testMemoryStreamMultiPageOpenSave(lpszPathName, "mpage-mstream-redirect.tif", 0, 0); - assert(bSuccess); - -} diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTestMPageStream.cpp b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTestMPageStream.cpp deleted file mode 100644 index c76c90c..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTestMPageStream.cpp +++ /dev/null @@ -1,222 +0,0 @@ -// ========================================================== -// FreeImagePlus Test Script -// -// Design and implementation by -// - Hervé Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - - -#include "fipTest.h" - -using namespace std; - -// -------------------------------------------------------------------------- - -static unsigned DLL_CALLCONV -myReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle) { - return fread(buffer, size, count, (FILE *)handle); -} - -static unsigned DLL_CALLCONV -myWriteProc(void *buffer, unsigned size, unsigned count, fi_handle handle) { - return fwrite(buffer, size, count, (FILE *)handle); -} - -static int DLL_CALLCONV -mySeekProc(fi_handle handle, long offset, int origin) { - return fseek((FILE *)handle, offset, origin); -} - -static long DLL_CALLCONV -myTellProc(fi_handle handle) { - return ftell((FILE *)handle); -} - -BOOL testStreamMultiPageOpen(const char *input, int flags) { - // initialize your own IO functions - - FreeImageIO io; - - io.read_proc = myReadProc; - io.write_proc = myWriteProc; - io.seek_proc = mySeekProc; - io.tell_proc = myTellProc; - - BOOL bSuccess = FALSE; - - // Open src stream in read-only mode - FILE *file = fopen(input, "r+b"); - if (file != NULL) { - fipMultiPage src; - - // Open the multi-page file - src.open(&io, (fi_handle)file, flags); - - if(src.isValid()) { - // get the page count - int count = src.getPageCount(); - assert(count > 1); - - // delete page 0 (modifications are stored to the cache) - src.deletePage(0); - - // Close src file (nothing is done, the cache is cleared) - bSuccess = src.close(0); - assert(bSuccess); - } - - // Close the src stream - fclose(file); - - return bSuccess; - } - - return bSuccess; -} - -BOOL testStreamMultiPageSave(const char *input, const char *output, int input_flag, int output_flag) { - // initialize your own IO functions - - FreeImageIO io; - - io.read_proc = myReadProc; - io.write_proc = myWriteProc; - io.seek_proc = mySeekProc; - io.tell_proc = myTellProc; - - BOOL bCreateNew = FALSE; - BOOL bReadOnly = TRUE; - BOOL bMemoryCache = TRUE; - - // Open src file (read-only, use memory cache) - fipMultiPage src(bMemoryCache); - src.open(input, bCreateNew, bReadOnly, input_flag); - - if(src.isValid()) { - // Open dst stream in read/write mode - FILE *file = fopen(output, "w+b"); - if (file != NULL) { - // Save the multi-page file to the stream - FREE_IMAGE_FORMAT fif = fipImage::identifyFIF(output); - BOOL bSuccess = src.saveToHandle(fif, &io, (fi_handle)file, output_flag); - assert(bSuccess); - - // Close the dst stream - fclose(file); - - // Close src file (or let the destructor close it) - return src.close(0); - - return TRUE; - } - - // Close src file (or let the destructor close it) - src.close(0); - } - - return FALSE; -} - -BOOL testStreamMultiPageOpenSave(const char *input, const char *output, int input_flag, int output_flag) { - // initialize your own IO functions - - FreeImageIO io; - - io.read_proc = myReadProc; - io.write_proc = myWriteProc; - io.seek_proc = mySeekProc; - io.tell_proc = myTellProc; - - BOOL bSuccess = FALSE; - - // Open src stream in read-only mode - FILE *src_file = fopen(input, "r+b"); - assert(src_file); - if (src_file != NULL) { - fipMultiPage src; - // Open the multi-page file - src.open(&io, (fi_handle)src_file, input_flag); - - if(src.isValid()) { - fipImage image; - - // get the page count - int count = src.getPageCount(); - assert(count > 2); - - // Load the bitmap at position '2' - image = src.lockPage(2); - if(image.isValid()) { - image.invert(); - // Unload the bitmap (apply change to src, modifications are stored to the cache) - src.unlockPage(image, TRUE); - } - - // delete page 0 (modifications are stored to the cache) - src.deletePage(0); - - // insert a new page at position '0' (modifications are stored to the cache) - image.load("test.jpg"); - src.insertPage(0, image); - - // Open dst stream in read/write mode - FILE *dst_file = fopen(output, "w+b"); - assert(dst_file); - if (dst_file != NULL) { - // Save the multi-page file to the stream (modifications are applied) - FREE_IMAGE_FORMAT fif = fipImage::identifyFIF(output); - BOOL bSuccess = src.saveToHandle(fif, &io, (fi_handle)dst_file, output_flag); - assert(bSuccess); - - // Close the dst stream - fclose(dst_file); - } - - // Close src file (nothing is done, the cache is cleared) - bSuccess = src.close(0); - assert(bSuccess); - } - - // Close the src stream - fclose(src_file); - - return bSuccess; - } - - return FALSE; -} - -// -------------------------------------------------------------------------- - -void testStreamMultiPage(const char *lpszPathName) { - BOOL bSuccess; - - cout << "testStreamMultiPage ...\n"; - - // test multipage stream (opening) - bSuccess = testStreamMultiPageOpen(lpszPathName, 0); - assert(bSuccess); - - // test multipage stream (save as) - bSuccess = testStreamMultiPageSave(lpszPathName, "clone-stream.tif", 0, 0); - assert(bSuccess); - - // test multipage stream (open, modify, save as) - bSuccess = testStreamMultiPageOpenSave(lpszPathName, "redirect-stream.tif", 0, 0); - assert(bSuccess); - -} diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTestMemIO.cpp b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTestMemIO.cpp deleted file mode 100644 index 3be469c..0000000 --- a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/fipTestMemIO.cpp +++ /dev/null @@ -1,182 +0,0 @@ -// ========================================================== -// FreeImagePlus Test Script -// -// Design and implementation by -// - Hervé Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - - -#include "fipTest.h" - -using namespace std; - -// -------------------------------------------------------------------------- -// Memory IO test scripts - -/** -Test saving to a memory stream -*/ -void testSaveMemIO(const char *lpszPathName) { - BOOL bSuccess = FALSE; - - // load a regular file - FREE_IMAGE_FORMAT fif = FreeImage_GetFileType(lpszPathName); - FIBITMAP *dib = FreeImage_Load(fif, lpszPathName, 0); - - // open a memory handle - fipMemoryIO memIO; - - // save the file to memory - bSuccess = memIO.save(fif, dib, 0); - assert(bSuccess == TRUE); - - // at this point, memIO contains the entire PNG data in memory. - // the amount of space used by the memory is equal to file_size - long file_size = memIO.tell(); - assert(file_size != 0); - - // its easy load an image from memory as well - - // seek to the start of the memory stream - memIO.seek(0L, SEEK_SET); - - // get the file type - FREE_IMAGE_FORMAT mem_fif = memIO.getFileType(); - - // load an image from the memory handle - FIBITMAP *check = memIO.load(mem_fif, 0); - assert(check != NULL); - - // save as a regular file - bSuccess = FreeImage_Save(FIF_PNG, check, "dump.png", PNG_DEFAULT); - assert(bSuccess == TRUE); - - FreeImage_Unload(check); - FreeImage_Unload(dib); - - // The memIO object will be destroyed automatically -} - -/** -Test loading from a buffer attached to a memory stream -*/ -void testLoadMemIO(const char *lpszPathName) { - struct stat buf; - int result; - BOOL bSuccess = FALSE; - - // get data associated with lpszPathName - result = stat(lpszPathName, &buf); - if(result == 0) { - // allocate a memory buffer and load temporary data - BYTE *mem_buffer = (BYTE*)malloc(buf.st_size * sizeof(BYTE)); - if(mem_buffer) { - FILE *stream = fopen(lpszPathName, "rb"); - if(stream) { - fread(mem_buffer, sizeof(BYTE), buf.st_size, stream); - fclose(stream); - - // attach the binary data to a memory stream - fipMemoryIO memIO(mem_buffer, buf.st_size); - - // get the file type - FREE_IMAGE_FORMAT fif = memIO.getFileType(); - - // load an image from the memory stream - FIBITMAP *check = memIO.load(fif, PNG_DEFAULT); - assert(check != NULL); - - // save as a regular file - bSuccess = FreeImage_Save(FIF_PNG, check, "blob.png", PNG_DEFAULT); - assert(bSuccess == TRUE); - - // close the stream (memIO is destroyed) - } - - // user is responsible for freeing the data - free(mem_buffer); - } - } -} - -/** -Test extracting a memory buffer from a memory stream -*/ -void testAcquireMemIO(const char *lpszPathName) { - BOOL bSuccess = FALSE; - - // load a regular file - FREE_IMAGE_FORMAT fif = FreeImage_GetFileType(lpszPathName); - FIBITMAP *dib = FreeImage_Load(fif, lpszPathName, 0); - - // open and allocate a memory stream - fipMemoryIO memIO; - - // save the file to memory - bSuccess = memIO.save(FIF_PNG, dib, PNG_DEFAULT); - assert(bSuccess == TRUE); - - // get the buffer from the memory stream - BYTE *mem_buffer = NULL; - DWORD size_in_bytes = 0; - - bSuccess = memIO.acquire(&mem_buffer, &size_in_bytes); - assert(bSuccess == TRUE); - - // save the buffer in a file stream - FILE *stream = fopen("buffer.png", "wb"); - if(stream) { - fwrite(mem_buffer, sizeof(BYTE), size_in_bytes, stream); - fclose(stream); - } - - // close and free the memory stream (memIO is destroyed) -} - -/** -Test Loading / Saving from / to a memory stream using fipImage -*/ -void testImageMemIO(const char *lpszPathName) { - BOOL bSuccess = FALSE; - - fipMemoryIO memIO; - fipImage image; - - // load a regular file - bSuccess = image.load(lpszPathName); - assert(bSuccess == TRUE); - if(bSuccess) { - // save the file to a memory stream - bSuccess = image.saveToMemory(FIF_PNG, memIO, PNG_DEFAULT); - assert(bSuccess); - - // load the file from the memory stream - memIO.seek(0L, SEEK_SET); - bSuccess = image.loadFromMemory(memIO, 0); - assert(bSuccess); - } -} - -void testMemIO(const char *lpszPathName) { - cout << "testMemIO ...\n"; - - testSaveMemIO(lpszPathName); - testLoadMemIO(lpszPathName); - testAcquireMemIO(lpszPathName); - testImageMemIO(lpszPathName); -} - diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/test.jpg b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/test.jpg deleted file mode 100644 index c9e425d..0000000 Binary files a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/test.jpg and /dev/null differ diff --git a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/test.tif b/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/test.tif deleted file mode 100644 index 886a7c9..0000000 Binary files a/#ThirdParty/FreeImage/Wrapper/FreeImagePlus/test/test.tif and /dev/null differ diff --git a/#ThirdParty/FreeImage/Wrapper/VB6/mfreeimage/MFreeImage.bas b/#ThirdParty/FreeImage/Wrapper/VB6/mfreeimage/MFreeImage.bas deleted file mode 100644 index 4fd3bd4..0000000 --- a/#ThirdParty/FreeImage/Wrapper/VB6/mfreeimage/MFreeImage.bas +++ /dev/null @@ -1,12352 +0,0 @@ -Attribute VB_Name = "MFreeImage" -'// ========================================================== -'// Visual Basic Wrapper for FreeImage 3 -'// Original FreeImage 3 functions and VB compatible derived functions -'// Design and implementation by -'// - Carsten Klein (cklein05@users.sourceforge.net) -'// -'// Main reference : Curland, Matthew., Advanced Visual Basic 6, Addison Wesley, ISBN 0201707128, (c) 2000 -'// Steve McMahon, creator of the excellent site vbAccelerator at http://www.vbaccelerator.com/ -'// MSDN Knowlede Base -'// -'// This file is part of FreeImage 3 -'// -'// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -'// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -'// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -'// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -'// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -'// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -'// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -'// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -'// THIS DISCLAIMER. -'// -'// Use at your own risk! -'// ========================================================== - -'// ========================================================== -'// CVS -'// $Revision: 2.23 $ -'// $Date: 2014/08/08 06:53:12 $ -'// $Id: MFreeImage.bas,v 2.23 2014/08/08 06:53:12 cklein05 Exp $ -'// ========================================================== - - -Option Explicit - - -'-------------------------------------------------------------------------------- -' Win32 API function, structure and constant declarations -'-------------------------------------------------------------------------------- - -Private Const ERROR_SUCCESS As Long = 0 - -'KERNEL32 -Private Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" ( _ - ByRef Destination As Any, _ - ByRef Source As Any, _ - ByVal Length As Long) - -Private Declare Function lstrlen Lib "kernel32.dll" Alias "lstrlenA" ( _ - ByVal lpString As Long) As Long - - -'OLEAUT32 -Private Declare Function OleCreatePictureIndirect Lib "oleaut32.dll" ( _ - ByRef lpPictDesc As PictDesc, _ - ByRef riid As Guid, _ - ByVal fOwn As Long, _ - ByRef lplpvObj As IPicture) As Long - -Private Declare Function SafeArrayAllocDescriptor Lib "oleaut32.dll" ( _ - ByVal cDims As Long, _ - ByRef ppsaOut As Long) As Long - -Private Declare Function SafeArrayDestroyDescriptor Lib "oleaut32.dll" ( _ - ByVal psa As Long) As Long - -Private Declare Sub SafeArrayDestroyData Lib "oleaut32.dll" ( _ - ByVal psa As Long) - -Private Declare Function OleTranslateColor Lib "oleaut32.dll" ( _ - ByVal clr As OLE_COLOR, _ - ByVal hPal As Long, _ - ByRef lpcolorref As Long) As Long - -Private Const CLR_INVALID As Long = &HFFFF& - - -'SAFEARRAY -Private Const FADF_AUTO As Long = (&H1) -Private Const FADF_FIXEDSIZE As Long = (&H10) - -Private Type SAVEARRAY1D - cDims As Integer - fFeatures As Integer - cbElements As Long - cLocks As Long - pvData As Long - cElements As Long - lLbound As Long -End Type - -Private Type SAVEARRAY2D - cDims As Integer - fFeatures As Integer - cbElements As Long - cLocks As Long - pvData As Long - cElements1 As Long - lLbound1 As Long - cElements2 As Long - lLbound2 As Long -End Type - - -'MSVBVM60 -Private Declare Function VarPtrArray Lib "msvbvm60.dll" Alias "VarPtr" ( _ - ByRef Ptr() As Any) As Long - - -'USER32 -Private Declare Function ReleaseDC Lib "user32.dll" ( _ - ByVal hWnd As Long, _ - ByVal hDC As Long) As Long - -Private Declare Function GetDC Lib "user32.dll" ( _ - ByVal hWnd As Long) As Long - -Private Declare Function GetDesktopWindow Lib "user32.dll" () As Long - -Private Declare Function GetDCEx Lib "user32.dll" ( _ - ByVal hWnd As Long, _ - ByVal hrgnclip As Long, _ - ByVal fdwOptions As Long) As Long - -Private Const DCX_WINDOW As Long = &H1& - -Private Declare Function GetWindowRect Lib "user32.dll" ( _ - ByVal hWnd As Long, _ - ByRef lpRect As RECT) As Long - -Private Declare Function GetClientRect Lib "user32.dll" ( _ - ByVal hWnd As Long, _ - ByRef lpRect As RECT) As Long - -Private Declare Function DestroyIcon Lib "user32.dll" ( _ - ByVal hIcon As Long) As Long - -Private Declare Function CreateIconIndirect Lib "user32.dll" ( _ - ByRef piconinfo As ICONINFO) As Long - -Private Type RECT - Left As Long - Top As Long - Right As Long - Bottom As Long -End Type - -Private Type Guid - Data1 As Long - Data2 As Integer - Data3 As Integer - Data4(0 To 7) As Byte -End Type - -Private Type PictDesc - cbSizeofStruct As Long - picType As Long - hImage As Long - xExt As Long - yExt As Long -End Type - -Private Type BITMAP_API - bmType As Long - bmWidth As Long - bmHeight As Long - bmWidthBytes As Long - bmPlanes As Integer - bmBitsPixel As Integer - bmBits As Long -End Type - -Private Type ICONINFO - fIcon As Long - xHotspot As Long - yHotspot As Long - hBmMask As Long - hbmColor As Long -End Type - -Private Type BLENDFUNCTION - BlendOp As Byte - BlendFlags As Byte - SourceConstantAlpha As Byte - AlphaFormat As Byte -End Type - - -'GDI32 -Private Declare Function GetDeviceCaps Lib "gdi32.dll" ( _ - ByVal hDC As Long, _ - ByVal nIndex As Long) As Long - -Private Const HORZRES As Long = 8 -Private Const VERTRES As Long = 10 - -Private Declare Function GetStretchBltMode Lib "gdi32.dll" ( _ - ByVal hDC As Long) As Long - -Private Declare Function SetStretchBltMode Lib "gdi32.dll" ( _ - ByVal hDC As Long, _ - ByVal nStretchMode As Long) As Long - -Private Declare Function SetDIBitsToDevice Lib "gdi32.dll" ( _ - ByVal hDC As Long, _ - ByVal x As Long, _ - ByVal y As Long, _ - ByVal dx As Long, _ - ByVal dy As Long, _ - ByVal SrcX As Long, _ - ByVal SrcY As Long, _ - ByVal Scan As Long, _ - ByVal NumScans As Long, _ - ByVal Bits As Long, _ - ByVal BitsInfo As Long, _ - ByVal wUsage As Long) As Long - -Private Declare Function StretchDIBits Lib "gdi32.dll" ( _ - ByVal hDC As Long, _ - ByVal x As Long, _ - ByVal y As Long, _ - ByVal dx As Long, _ - ByVal dy As Long, _ - ByVal SrcX As Long, _ - ByVal SrcY As Long, _ - ByVal wSrcWidth As Long, _ - ByVal wSrcHeight As Long, _ - ByVal lpBits As Long, _ - ByVal lpBitsInfo As Long, _ - ByVal wUsage As Long, _ - ByVal dwRop As Long) As Long - -Private Declare Function CreateDIBitmap Lib "gdi32.dll" ( _ - ByVal hDC As Long, _ - ByVal lpInfoHeader As Long, _ - ByVal dwUsage As Long, _ - ByVal lpInitBits As Long, _ - ByVal lpInitInfo As Long, _ - ByVal wUsage As Long) As Long - -Private Declare Function CreateDIBSection Lib "gdi32.dll" ( _ - ByVal hDC As Long, _ - ByVal pbmi As Long, _ - ByVal iUsage As Long, _ - ByRef ppvBits As Long, _ - ByVal hSection As Long, _ - ByVal dwOffset As Long) As Long - -Private Const CBM_INIT As Long = &H4 - -Private Declare Function CreateCompatibleBitmap Lib "gdi32.dll" ( _ - ByVal hDC As Long, _ - ByVal nWidth As Long, _ - ByVal nHeight As Long) As Long - -Private Declare Function CreateCompatibleDC Lib "gdi32.dll" ( _ - ByVal hDC As Long) As Long - -Private Declare Function DeleteDC Lib "gdi32.dll" ( _ - ByVal hDC As Long) As Long - -Private Declare Function BitBlt Lib "gdi32.dll" ( _ - ByVal hDestDC As Long, _ - ByVal x As Long, _ - ByVal y As Long, _ - ByVal nWidth As Long, _ - ByVal nHeight As Long, _ - ByVal hSrcDC As Long, _ - ByVal XSrc As Long, _ - ByVal YSrc As Long, _ - ByVal dwRop As Long) As Long - -Private Declare Function GetDIBits Lib "gdi32.dll" ( _ - ByVal aHDC As Long, _ - ByVal hBitmap As Long, _ - ByVal nStartScan As Long, _ - ByVal nNumScans As Long, _ - ByVal lpBits As Long, _ - ByVal lpBI As Long, _ - ByVal wUsage As Long) As Long - -Private Declare Function GetObjectAPI Lib "gdi32.dll" Alias "GetObjectA" ( _ - ByVal hObject As Long, _ - ByVal nCount As Long, _ - ByRef lpObject As Any) As Long - -Private Declare Function SelectObject Lib "gdi32.dll" ( _ - ByVal hDC As Long, _ - ByVal hObject As Long) As Long - -Private Declare Function DeleteObject Lib "gdi32.dll" ( _ - ByVal hObject As Long) As Long - -Private Declare Function GetCurrentObject Lib "gdi32.dll" ( _ - ByVal hDC As Long, _ - ByVal uObjectType As Long) As Long - -Private Const OBJ_BITMAP As Long = 7 - - -'MSIMG32 -Private Declare Function AlphaBlend Lib "msimg32.dll" ( _ - ByVal hdcDest As Long, _ - ByVal nXOriginDest As Long, _ - ByVal nYOriginDest As Long, _ - ByVal nWidthDest As Long, _ - ByVal nHeightDest As Long, _ - ByVal hdcSrc As Long, _ - ByVal nXOriginSrc As Long, _ - ByVal nYOriginSrc As Long, _ - ByVal nWidthSrc As Long, _ - ByVal nHeightSrc As Long, _ - ByVal lBlendFunction As Long) As Long - -Private Const AC_SRC_OVER = &H0 -Private Const AC_SRC_ALPHA = &H1 - -Private Const BLACKONWHITE As Long = 1 -Private Const WHITEONBLACK As Long = 2 -Private Const COLORONCOLOR As Long = 3 - -Public Enum STRETCH_MODE - SM_BLACKONWHITE = BLACKONWHITE - SM_WHITEONBLACK = WHITEONBLACK - SM_COLORONCOLOR = COLORONCOLOR -End Enum - -Private Const SRCAND As Long = &H8800C6 -Private Const SRCCOPY As Long = &HCC0020 -Private Const SRCERASE As Long = &H440328 -Private Const SRCINVERT As Long = &H660046 -Private Const SRCPAINT As Long = &HEE0086 -Private Const CAPTUREBLT As Long = &H40000000 - -Public Enum RASTER_OPERATOR - ROP_SRCAND = SRCAND - ROP_SRCCOPY = SRCCOPY - ROP_SRCERASE = SRCERASE - ROP_SRCINVERT = SRCINVERT - ROP_SRCPAINT = SRCPAINT -End Enum - -Private Const DIB_PAL_COLORS As Long = 1 -Private Const DIB_RGB_COLORS As Long = 0 - -Public Enum DRAW_MODE - DM_DRAW_DEFAULT = &H0 - DM_MIRROR_NONE = DM_DRAW_DEFAULT - DM_MIRROR_VERTICAL = &H1 - DM_MIRROR_HORIZONTAL = &H2 - DM_MIRROR_BOTH = DM_MIRROR_VERTICAL Or DM_MIRROR_HORIZONTAL -End Enum - -Public Enum HISTOGRAM_ORIENTATION - HOR_TOP_DOWN = &H0 - HOR_BOTTOM_UP = &H1 -End Enum - -'-------------------------------------------------------------------------------- -' FreeImage 3 types, constants and enumerations -'-------------------------------------------------------------------------------- - -'FREEIMAGE - -' Version information -Public Const FREEIMAGE_MAJOR_VERSION As Long = 3 -Public Const FREEIMAGE_MINOR_VERSION As Long = 16 -Public Const FREEIMAGE_RELEASE_SERIAL As Long = 0 - -' Memory stream pointer operation flags -Public Const SEEK_SET As Long = 0 -Public Const SEEK_CUR As Long = 1 -Public Const SEEK_END As Long = 2 - -' Indexes for byte arrays, masks and shifts for treating pixels as words -' These coincide with the order of RGBQUAD and RGBTRIPLE -' Little Endian (x86 / MS Windows, Linux) : BGR(A) order -Public Const FI_RGBA_RED As Long = 2 -Public Const FI_RGBA_GREEN As Long = 1 -Public Const FI_RGBA_BLUE As Long = 0 -Public Const FI_RGBA_ALPHA As Long = 3 -Public Const FI_RGBA_RED_MASK As Long = &HFF0000 -Public Const FI_RGBA_GREEN_MASK As Long = &HFF00 -Public Const FI_RGBA_BLUE_MASK As Long = &HFF -Public Const FI_RGBA_ALPHA_MASK As Long = &HFF000000 -Public Const FI_RGBA_RED_SHIFT As Long = 16 -Public Const FI_RGBA_GREEN_SHIFT As Long = 8 -Public Const FI_RGBA_BLUE_SHIFT As Long = 0 -Public Const FI_RGBA_ALPHA_SHIFT As Long = 24 - -' The 16 bit macros only include masks and shifts, since each color element is not byte aligned -Public Const FI16_555_RED_MASK As Long = &H7C00 -Public Const FI16_555_GREEN_MASK As Long = &H3E0 -Public Const FI16_555_BLUE_MASK As Long = &H1F -Public Const FI16_555_RED_SHIFT As Long = 10 -Public Const FI16_555_GREEN_SHIFT As Long = 5 -Public Const FI16_555_BLUE_SHIFT As Long = 0 -Public Const FI16_565_RED_MASK As Long = &HF800 -Public Const FI16_565_GREEN_MASK As Long = &H7E0 -Public Const FI16_565_BLUE_MASK As Long = &H1F -Public Const FI16_565_RED_SHIFT As Long = 11 -Public Const FI16_565_GREEN_SHIFT As Long = 5 -Public Const FI16_565_BLUE_SHIFT As Long = 0 - -' ICC profile support -Public Const FIICC_DEFAULT As Long = &H0 -Public Const FIICC_COLOR_IS_CMYK As Long = &H1 - -Private Const FREE_IMAGE_ICC_COLOR_MODEL_MASK As Long = &H1 -Public Enum FREE_IMAGE_ICC_COLOR_MODEL - FIICC_COLOR_MODEL_RGB = &H0 - FIICC_COLOR_MODEL_CMYK = &H1 -End Enum - -' Load / Save flag constants -Public Const FIF_LOAD_NOPIXELS = &H8000 ' load the image header only (not supported by all plugins) - -Public Const BMP_DEFAULT As Long = 0 -Public Const BMP_SAVE_RLE As Long = 1 -Public Const CUT_DEFAULT As Long = 0 -Public Const DDS_DEFAULT As Long = 0 -Public Const EXR_DEFAULT As Long = 0 ' save data as half with piz-based wavelet compression -Public Const EXR_FLOAT As Long = &H1 ' save data as float instead of as half (not recommended) -Public Const EXR_NONE As Long = &H2 ' save with no compression -Public Const EXR_ZIP As Long = &H4 ' save with zlib compression, in blocks of 16 scan lines -Public Const EXR_PIZ As Long = &H8 ' save with piz-based wavelet compression -Public Const EXR_PXR24 As Long = &H10 ' save with lossy 24-bit float compression -Public Const EXR_B44 As Long = &H20 ' save with lossy 44% float compression - goes to 22% when combined with EXR_LC -Public Const EXR_LC As Long = &H40 ' save images with one luminance and two chroma channels, rather than as RGB (lossy compression) -Public Const FAXG3_DEFAULT As Long = 0 -Public Const GIF_DEFAULT As Long = 0 -Public Const GIF_LOAD256 As Long = 1 ' Load the image as a 256 color image with ununsed palette entries, if it's 16 or 2 color -Public Const GIF_PLAYBACK As Long = 2 ''Play' the GIF to generate each frame (as 32bpp) instead of returning raw frame data when loading -Public Const HDR_DEFAULT As Long = 0 -Public Const ICO_DEFAULT As Long = 0 -Public Const ICO_MAKEALPHA As Long = 1 ' convert to 32bpp and create an alpha channel from the AND-mask when loading -Public Const IFF_DEFAULT As Long = 0 -Public Const J2K_DEFAULT As Long = 0 ' save with a 16:1 rate -Public Const JP2_DEFAULT As Long = 0 ' save with a 16:1 rate -Public Const JPEG_DEFAULT As Long = 0 ' loading (see JPEG_FAST); saving (see JPEG_QUALITYGOOD|JPEG_SUBSAMPLING_420) -Public Const JPEG_FAST As Long = &H1 ' load the file as fast as possible, sacrificing some quality -Public Const JPEG_ACCURATE As Long = &H2 ' load the file with the best quality, sacrificing some speed -Public Const JPEG_CMYK As Long = &H4 ' load separated CMYK "as is" (use 'OR' to combine with other flags) -Public Const JPEG_EXIFROTATE As Long = &H8 ' load and rotate according to Exif 'Orientation' tag if available -Public Const JPEG_GREYSCALE As Long = &H10 ' load and convert to a 8-bit greyscale image -Public Const JPEG_QUALITYSUPERB As Long = &H80 ' save with superb quality (100:1) -Public Const JPEG_QUALITYGOOD As Long = &H100 ' save with good quality (75:1) -Public Const JPEG_QUALITYNORMAL As Long = &H200 ' save with normal quality (50:1) -Public Const JPEG_QUALITYAVERAGE As Long = &H400 ' save with average quality (25:1) -Public Const JPEG_QUALITYBAD As Long = &H800 ' save with bad quality (10:1) -Public Const JPEG_PROGRESSIVE As Long = &H2000 ' save as a progressive-JPEG (use 'OR' to combine with other save flags) -Public Const JPEG_SUBSAMPLING_411 As Long = &H1000 ' save with high 4x1 chroma subsampling (4:1:1) -Public Const JPEG_SUBSAMPLING_420 As Long = &H4000 ' save with medium 2x2 medium chroma subsampling (4:2:0) - default value -Public Const JPEG_SUBSAMPLING_422 As Long = &H8000 ' save with low 2x1 chroma subsampling (4:2:2) -Public Const JPEG_SUBSAMPLING_444 As Long = &H10000 ' save with no chroma subsampling (4:4:4) -Public Const JPEG_OPTIMIZE As Long = &H20000 ' on saving, compute optimal Huffman coding tables (can reduce a few percent of file size) -Public Const JPEG_BASELINE As Long = &H40000 ' save basic JPEG, without metadata or any markers -Public Const KOALA_DEFAULT As Long = 0 -Public Const LBM_DEFAULT As Long = 0 -Public Const MNG_DEFAULT As Long = 0 -Public Const PCD_DEFAULT As Long = 0 -Public Const PCD_BASE As Long = 1 ' load the bitmap sized 768 x 512 -Public Const PCD_BASEDIV4 As Long = 2 ' load the bitmap sized 384 x 256 -Public Const PCD_BASEDIV16 As Long = 3 ' load the bitmap sized 192 x 128 -Public Const PCX_DEFAULT As Long = 0 -Public Const PFM_DEFAULT As Long = 0 -Public Const PICT_DEFAULT As Long = 0 -Public Const PNG_DEFAULT As Long = 0 -Public Const PNG_IGNOREGAMMA As Long = 1 ' avoid gamma correction -Public Const PNG_Z_BEST_SPEED As Long = &H1 ' save using ZLib level 1 compression flag (default value is 6) -Public Const PNG_Z_DEFAULT_COMPRESSION As Long = &H6 ' save using ZLib level 6 compression flag (default recommended value) -Public Const PNG_Z_BEST_COMPRESSION As Long = &H9 ' save using ZLib level 9 compression flag (default value is 6) -Public Const PNG_Z_NO_COMPRESSION As Long = &H100 ' save without ZLib compression -Public Const PNG_INTERLACED As Long = &H200 ' save using Adam7 interlacing (use | to combine with other save flags) -Public Const PNM_DEFAULT As Long = 0 -Public Const PNM_SAVE_RAW As Long = 0 ' if set, the writer saves in RAW format (i.e. P4, P5 or P6) -Public Const PNM_SAVE_ASCII As Long = 1 ' if set, the writer saves in ASCII format (i.e. P1, P2 or P3) -Public Const PSD_DEFAULT As Long = 0 -Public Const PSD_CMYK As Long = 1 ' reads tags for separated CMYK (default is conversion to RGB) -Public Const PSD_LAB As Long = 2 ' reads tags for CIELab (default is conversion to RGB) -Public Const RAS_DEFAULT As Long = 0 -Public Const RAW_DEFAULT As Long = 0 ' load the file as linear RGB 48-bit -Public Const RAW_PREVIEW As Long = 1 ' try to load the embedded JPEG preview with included Exif Data or default to RGB 24-bit -Public Const RAW_DISPLAY As Long = 2 ' load the file as RGB 24-bit -Public Const RAW_HALFSIZE As Long = 4 ' load the file as half-size color image -Public Const RAW_UNPROCESSED As Long = 8 ' load the file as FIT_UINT16 raw Bayer image -Public Const SGI_DEFAULT As Long = 0 -Public Const TARGA_DEFAULT As Long = 0 -Public Const TARGA_LOAD_RGB888 As Long = 1 ' if set, the loader converts RGB555 and ARGB8888 -> RGB888 -Public Const TARGA_SAVE_RLE As Long = 2 ' if set, the writer saves with RLE compression -Public Const TIFF_DEFAULT As Long = 0 -Public Const TIFF_CMYK As Long = &H1 ' reads/stores tags for separated CMYK (use 'OR' to combine with compression flags) -Public Const TIFF_PACKBITS As Long = &H100 ' save using PACKBITS compression -Public Const TIFF_DEFLATE As Long = &H200 ' save using DEFLATE compression (a.k.a. ZLIB compression) -Public Const TIFF_ADOBE_DEFLATE As Long = &H400 ' save using ADOBE DEFLATE compression -Public Const TIFF_NONE As Long = &H800 ' save without any compression -Public Const TIFF_CCITTFAX3 As Long = &H1000 ' save using CCITT Group 3 fax encoding -Public Const TIFF_CCITTFAX4 As Long = &H2000 ' save using CCITT Group 4 fax encoding -Public Const TIFF_LZW As Long = &H4000 ' save using LZW compression -Public Const TIFF_JPEG As Long = &H8000 ' save using JPEG compression -Public Const TIFF_LOGLUV As Long = &H10000 ' save using LogLuv compression -Public Const WBMP_DEFAULT As Long = 0 -Public Const XBM_DEFAULT As Long = 0 -Public Const XPM_DEFAULT As Long = 0 -Public Const WEBP_DEFAULT As Long = 0 ' save with good quality (75:1) -Public Const WEBP_LOSSLESS As Long = &H100 ' save in lossless mode -Public Const JXR_DEFAULT As Long = 0 ' save with quality 80 and no chroma subsampling (4:4:4) -Public Const JXR_LOSSLESS As Long = &H64 ' save in lossless mode -Public Const JXR_PROGRESSIVE As Long = &H2000 ' save as a progressive-JXR (use Or to combine with other save flags) - -' I/O image format identifiers -Public Enum FREE_IMAGE_FORMAT - FIF_UNKNOWN = -1 - FIF_BMP = 0 - FIF_ICO = 1 - FIF_JPEG = 2 - FIF_JNG = 3 - FIF_KOALA = 4 - FIF_LBM = 5 - FIF_IFF = FIF_LBM - FIF_MNG = 6 - FIF_PBM = 7 - FIF_PBMRAW = 8 - FIF_PCD = 9 - FIF_PCX = 10 - FIF_PGM = 11 - FIF_PGMRAW = 12 - FIF_PNG = 13 - FIF_PPM = 14 - FIF_PPMRAW = 15 - FIF_RAS = 16 - FIF_TARGA = 17 - FIF_TIFF = 18 - FIF_WBMP = 19 - FIF_PSD = 20 - FIF_CUT = 21 - FIF_XBM = 22 - FIF_XPM = 23 - FIF_DDS = 24 - FIF_GIF = 25 - FIF_HDR = 26 - FIF_FAXG3 = 27 - FIF_SGI = 28 - FIF_EXR = 29 - FIF_J2K = 30 - FIF_JP2 = 31 - FIF_PFM = 32 - FIF_PICT = 33 - FIF_RAW = 34 - FIF_WEBP = 35 - FIF_JXR = 36 -End Enum - -' Image load options -Public Enum FREE_IMAGE_LOAD_OPTIONS - FILO_LOAD_NOPIXELS = FIF_LOAD_NOPIXELS ' load the image header only (not supported by all plugins) - FILO_LOAD_DEFAULT = 0 - FILO_GIF_DEFAULT = GIF_DEFAULT - FILO_GIF_LOAD256 = GIF_LOAD256 ' load the image as a 256 color image with ununsed palette entries, if it's 16 or 2 color - FILO_GIF_PLAYBACK = GIF_PLAYBACK ' 'play' the GIF to generate each frame (as 32bpp) instead of returning raw frame data when loading - FILO_ICO_DEFAULT = ICO_DEFAULT - FILO_ICO_MAKEALPHA = ICO_MAKEALPHA ' convert to 32bpp and create an alpha channel from the AND-mask when loading - FILO_JPEG_DEFAULT = JPEG_DEFAULT ' for loading this is a synonym for FILO_JPEG_FAST - FILO_JPEG_FAST = JPEG_FAST ' load the file as fast as possible, sacrificing some quality - FILO_JPEG_ACCURATE = JPEG_ACCURATE ' load the file with the best quality, sacrificing some speed - FILO_JPEG_CMYK = JPEG_CMYK ' load separated CMYK "as is" (use 'OR' to combine with other load flags) - FILO_JPEG_EXIFROTATE = JPEG_EXIFROTATE ' load and rotate according to Exif 'Orientation' tag if available - FILO_JPEG_GREYSCALE = JPEG_GREYSCALE ' load and convert to a 8-bit greyscale image - FILO_PCD_DEFAULT = PCD_DEFAULT - FILO_PCD_BASE = PCD_BASE ' load the bitmap sized 768 x 512 - FILO_PCD_BASEDIV4 = PCD_BASEDIV4 ' load the bitmap sized 384 x 256 - FILO_PCD_BASEDIV16 = PCD_BASEDIV16 ' load the bitmap sized 192 x 128 - FILO_PNG_DEFAULT = PNG_DEFAULT - FILO_PNG_IGNOREGAMMA = PNG_IGNOREGAMMA ' avoid gamma correction - FILO_PSD_CMYK = PSD_CMYK ' reads tags for separated CMYK (default is conversion to RGB) - FILO_PSD_LAB = PSD_LAB ' reads tags for CIELab (default is conversion to RGB) - FILO_RAW_DEFAULT = RAW_DEFAULT ' load the file as linear RGB 48-bit - FILO_RAW_PREVIEW = RAW_PREVIEW ' try to load the embedded JPEG preview with included Exif Data or default to RGB 24-bit - FILO_RAW_DISPLAY = RAW_DISPLAY ' load the file as RGB 24-bit - FILO_RAW_HALFSIZE = RAW_HALFSIZE ' load the file as half-size color image - FILO_RAW_UNPROCESSED = RAW_UNPROCESSED ' load the file as FIT_UINT16 raw Bayer image - FILO_TARGA_DEFAULT = TARGA_LOAD_RGB888 - FILO_TARGA_LOAD_RGB888 = TARGA_LOAD_RGB888 ' if set, the loader converts RGB555 and ARGB8888 -> RGB888 - FISO_TIFF_DEFAULT = TIFF_DEFAULT - FISO_TIFF_CMYK = TIFF_CMYK ' reads tags for separated CMYK -End Enum - -' Image save options -Public Enum FREE_IMAGE_SAVE_OPTIONS - FISO_SAVE_DEFAULT = 0 - FISO_BMP_DEFAULT = BMP_DEFAULT - FISO_BMP_SAVE_RLE = BMP_SAVE_RLE - FISO_EXR_DEFAULT = EXR_DEFAULT ' save data as half with piz-based wavelet compression - FISO_EXR_FLOAT = EXR_FLOAT ' save data as float instead of as half (not recommended) - FISO_EXR_NONE = EXR_NONE ' save with no compression - FISO_EXR_ZIP = EXR_ZIP ' save with zlib compression, in blocks of 16 scan lines - FISO_EXR_PIZ = EXR_PIZ ' save with piz-based wavelet compression - FISO_EXR_PXR24 = EXR_PXR24 ' save with lossy 24-bit float compression - FISO_EXR_B44 = EXR_B44 ' save with lossy 44% float compression - goes to 22% when combined with EXR_LC - FISO_EXR_LC = EXR_LC ' save images with one luminance and two chroma channels, rather than as RGB (lossy compression) - FISO_JPEG_DEFAULT = JPEG_DEFAULT ' for saving this is a synonym for FISO_JPEG_QUALITYGOOD - FISO_JPEG_QUALITYSUPERB = JPEG_QUALITYSUPERB ' save with superb quality (100:1) - FISO_JPEG_QUALITYGOOD = JPEG_QUALITYGOOD ' save with good quality (75:1) - FISO_JPEG_QUALITYNORMAL = JPEG_QUALITYNORMAL ' save with normal quality (50:1) - FISO_JPEG_QUALITYAVERAGE = JPEG_QUALITYAVERAGE ' save with average quality (25:1) - FISO_JPEG_QUALITYBAD = JPEG_QUALITYBAD ' save with bad quality (10:1) - FISO_JPEG_PROGRESSIVE = JPEG_PROGRESSIVE ' save as a progressive-JPEG (use 'OR' to combine with other save flags) - FISO_JPEG_SUBSAMPLING_411 = JPEG_SUBSAMPLING_411 ' save with high 4x1 chroma subsampling (4:1:1) - FISO_JPEG_SUBSAMPLING_420 = JPEG_SUBSAMPLING_420 ' save with medium 2x2 medium chroma subsampling (4:2:0) - default value - FISO_JPEG_SUBSAMPLING_422 = JPEG_SUBSAMPLING_422 ' save with low 2x1 chroma subsampling (4:2:2) - FISO_JPEG_SUBSAMPLING_444 = JPEG_SUBSAMPLING_444 ' save with no chroma subsampling (4:4:4) - FISO_JPEG_OPTIMIZE = JPEG_OPTIMIZE ' compute optimal Huffman coding tables (can reduce a few percent of file size) - FISO_JPEG_BASELINE = JPEG_BASELINE ' save basic JPEG, without metadata or any markers - FISO_PNG_Z_BEST_SPEED = PNG_Z_BEST_SPEED ' save using ZLib level 1 compression flag (default value is 6) - FISO_PNG_Z_DEFAULT_COMPRESSION = PNG_Z_DEFAULT_COMPRESSION ' save using ZLib level 6 compression flag (default recommended value) - FISO_PNG_Z_BEST_COMPRESSION = PNG_Z_BEST_COMPRESSION ' save using ZLib level 9 compression flag (default value is 6) - FISO_PNG_Z_NO_COMPRESSION = PNG_Z_NO_COMPRESSION ' save without ZLib compression - FISO_PNG_INTERLACED = PNG_INTERLACED ' save using Adam7 interlacing (use | to combine with other save flags) - FISO_PNM_DEFAULT = PNM_DEFAULT - FISO_PNM_SAVE_RAW = PNM_SAVE_RAW ' if set, the writer saves in RAW format (i.e. P4, P5 or P6) - FISO_PNM_SAVE_ASCII = PNM_SAVE_ASCII ' if set, the writer saves in ASCII format (i.e. P1, P2 or P3) - FISO_TARGA_SAVE_RLE = TARGA_SAVE_RLE ' if set, the writer saves with RLE compression - FISO_TIFF_DEFAULT = TIFF_DEFAULT - FISO_TIFF_CMYK = TIFF_CMYK ' stores tags for separated CMYK (use 'OR' to combine with compression flags) - FISO_TIFF_PACKBITS = TIFF_PACKBITS ' save using PACKBITS compression - FISO_TIFF_DEFLATE = TIFF_DEFLATE ' save using DEFLATE compression (a.k.a. ZLIB compression) - FISO_TIFF_ADOBE_DEFLATE = TIFF_ADOBE_DEFLATE ' save using ADOBE DEFLATE compression - FISO_TIFF_NONE = TIFF_NONE ' save without any compression - FISO_TIFF_CCITTFAX3 = TIFF_CCITTFAX3 ' save using CCITT Group 3 fax encoding - FISO_TIFF_CCITTFAX4 = TIFF_CCITTFAX4 ' save using CCITT Group 4 fax encoding - FISO_TIFF_LZW = TIFF_LZW ' save using LZW compression - FISO_TIFF_JPEG = TIFF_JPEG ' save using JPEG compression - FISO_TIFF_LOGLUV = TIFF_LOGLUV ' save using LogLuv compression - FISO_WEBP_LOSSLESS = WEBP_LOSSLESS ' save in lossless mode - FISO_JXR_LOSSLESS = JXR_LOSSLESS ' save in lossless mode - FISO_JXR_PROGRESSIVE = JXR_PROGRESSIVE ' save as a progressive-JXR (use Or to combine with other save flags) -End Enum - -' Image types used in FreeImage -Public Enum FREE_IMAGE_TYPE - FIT_UNKNOWN = 0 ' unknown type - FIT_BITMAP = 1 ' standard image : 1-, 4-, 8-, 16-, 24-, 32-bit - FIT_UINT16 = 2 ' array of unsigned short : unsigned 16-bit - FIT_INT16 = 3 ' array of short : signed 16-bit - FIT_UINT32 = 4 ' array of unsigned long : unsigned 32-bit - FIT_INT32 = 5 ' array of long : signed 32-bit - FIT_FLOAT = 6 ' array of float : 32-bit IEEE floating point - FIT_DOUBLE = 7 ' array of double : 64-bit IEEE floating point - FIT_COMPLEX = 8 ' array of FICOMPLEX : 2 x 64-bit IEEE floating point - FIT_RGB16 = 9 ' 48-bit RGB image : 3 x 16-bit - FIT_RGBA16 = 10 ' 64-bit RGBA image : 4 x 16-bit - FIT_RGBF = 11 ' 96-bit RGB float image : 3 x 32-bit IEEE floating point - FIT_RGBAF = 12 ' 128-bit RGBA float image : 4 x 32-bit IEEE floating point -End Enum - -' Image color types used in FreeImage -Public Enum FREE_IMAGE_COLOR_TYPE - FIC_MINISWHITE = 0 ' min value is white - FIC_MINISBLACK = 1 ' min value is black - FIC_RGB = 2 ' RGB color model - FIC_PALETTE = 3 ' color map indexed - FIC_RGBALPHA = 4 ' RGB color model with alpha channel - FIC_CMYK = 5 ' CMYK color model -End Enum - -' Color quantization algorithm constants -Public Enum FREE_IMAGE_QUANTIZE - FIQ_WUQUANT = 0 ' Xiaolin Wu color quantization algorithm - FIQ_NNQUANT = 1 ' NeuQuant neural-net quantization algorithm by Anthony Dekker -End Enum - -' Dithering algorithm constants -Public Enum FREE_IMAGE_DITHER - FID_FS = 0 ' Floyd & Steinberg error diffusion - FID_BAYER4x4 = 1 ' Bayer ordered dispersed dot dithering (order 2 dithering matrix) - FID_BAYER8x8 = 2 ' Bayer ordered dispersed dot dithering (order 3 dithering matrix) - FID_CLUSTER6x6 = 3 ' Ordered clustered dot dithering (order 3 - 6x6 matrix) - FID_CLUSTER8x8 = 4 ' Ordered clustered dot dithering (order 4 - 8x8 matrix) - FID_CLUSTER16x16 = 5 ' Ordered clustered dot dithering (order 8 - 16x16 matrix) - FID_BAYER16x16 = 6 ' Bayer ordered dispersed dot dithering (order 4 dithering matrix) -End Enum - -' Lossless JPEG transformation constants -Public Enum FREE_IMAGE_JPEG_OPERATION - FIJPEG_OP_NONE = 0 ' no transformation - FIJPEG_OP_FLIP_H = 1 ' horizontal flip - FIJPEG_OP_FLIP_V = 2 ' vertical flip - FIJPEG_OP_TRANSPOSE = 3 ' transpose across UL-to-LR axis - FIJPEG_OP_TRANSVERSE = 4 ' transpose across UR-to-LL axis - FIJPEG_OP_ROTATE_90 = 5 ' 90-degree clockwise rotation - FIJPEG_OP_ROTATE_180 = 6 ' 180-degree rotation - FIJPEG_OP_ROTATE_270 = 7 ' 270-degree clockwise (or 90 ccw) -End Enum - -' Tone mapping operator constants -Public Enum FREE_IMAGE_TMO - FITMO_DRAGO03 = 0 ' Adaptive logarithmic mapping (F. Drago, 2003) - FITMO_REINHARD05 = 1 ' Dynamic range reduction inspired by photoreceptor physiology (E. Reinhard, 2005) - FITMO_FATTAL02 = 2 ' Gradient domain high dynamic range compression (R. Fattal, 2002) -End Enum - -' Up- / Downsampling filter constants -Public Enum FREE_IMAGE_FILTER - FILTER_BOX = 0 ' Box, pulse, Fourier window, 1st order (constant) b-spline - FILTER_BICUBIC = 1 ' Mitchell & Netravali's two-param cubic filter - FILTER_BILINEAR = 2 ' Bilinear filter - FILTER_BSPLINE = 3 ' 4th order (cubic) b-spline - FILTER_CATMULLROM = 4 ' Catmull-Rom spline, Overhauser spline - FILTER_LANCZOS3 = 5 ' Lanczos3 filter -End Enum - -' Color channel constants -Public Enum FREE_IMAGE_COLOR_CHANNEL - FICC_RGB = 0 ' Use red, green and blue channels - FICC_RED = 1 ' Use red channel - FICC_GREEN = 2 ' Use green channel - FICC_BLUE = 3 ' Use blue channel - FICC_ALPHA = 4 ' Use alpha channel - FICC_BLACK = 5 ' Use black channel - FICC_REAL = 6 ' Complex images: use real part - FICC_IMAG = 7 ' Complex images: use imaginary part - FICC_MAG = 8 ' Complex images: use magnitude - FICC_PHASE = 9 ' Complex images: use phase -End Enum - -' Tag data type information constants (based on TIFF specifications) -Public Enum FREE_IMAGE_MDTYPE - FIDT_NOTYPE = 0 ' placeholder - FIDT_BYTE = 1 ' 8-bit unsigned integer - FIDT_ASCII = 2 ' 8-bit bytes w/ last byte null - FIDT_SHORT = 3 ' 16-bit unsigned integer - FIDT_LONG = 4 ' 32-bit unsigned integer - FIDT_RATIONAL = 5 ' 64-bit unsigned fraction - FIDT_SBYTE = 6 ' 8-bit signed integer - FIDT_UNDEFINED = 7 ' 8-bit untyped data - FIDT_SSHORT = 8 ' 16-bit signed integer - FIDT_SLONG = 9 ' 32-bit signed integer - FIDT_SRATIONAL = 10 ' 64-bit signed fraction - FIDT_FLOAT = 11 ' 32-bit IEEE floating point - FIDT_DOUBLE = 12 ' 64-bit IEEE floating point - FIDT_IFD = 13 ' 32-bit unsigned integer (offset) - FIDT_PALETTE = 14 ' 32-bit RGBQUAD -End Enum - -' Metadata models supported by FreeImage -Public Enum FREE_IMAGE_MDMODEL - FIMD_NODATA = -1 ' - FIMD_COMMENTS = 0 ' single comment or keywords - FIMD_EXIF_MAIN = 1 ' Exif-TIFF metadata - FIMD_EXIF_EXIF = 2 ' Exif-specific metadata - FIMD_EXIF_GPS = 3 ' Exif GPS metadata - FIMD_EXIF_MAKERNOTE = 4 ' Exif maker note metadata - FIMD_EXIF_INTEROP = 5 ' Exif interoperability metadata - FIMD_IPTC = 6 ' IPTC/NAA metadata - FIMD_XMP = 7 ' Abobe XMP metadata - FIMD_GEOTIFF = 8 ' GeoTIFF metadata - FIMD_ANIMATION = 9 ' Animation metadata - FIMD_CUSTOM = 10 ' Used to attach other metadata types to a dib - FIMD_EXIF_RAW = 11 ' Exif metadata as a raw buffer -End Enum - -' These are the GIF_DISPOSAL metadata constants -Public Enum FREE_IMAGE_FRAME_DISPOSAL_METHODS - FIFD_GIF_DISPOSAL_UNSPECIFIED = 0 - FIFD_GIF_DISPOSAL_LEAVE = 1 - FIFD_GIF_DISPOSAL_BACKGROUND = 2 - FIFD_GIF_DISPOSAL_PREVIOUS = 3 -End Enum - -' Constants used in FreeImage_FillBackground and FreeImage_EnlargeCanvas -Public Enum FREE_IMAGE_COLOR_OPTIONS - FI_COLOR_IS_RGB_COLOR = &H0 ' RGBQUAD color is a RGB color (contains no valid alpha channel) - FI_COLOR_IS_RGBA_COLOR = &H1 ' RGBQUAD color is a RGBA color (contains a valid alpha channel) - FI_COLOR_FIND_EQUAL_COLOR = &H2 ' For palettized images: lookup equal RGB color from palette - FI_COLOR_ALPHA_IS_INDEX = &H4 ' The color's rgbReserved member (alpha) contains the palette index to be used -End Enum -Public Const FI_COLOR_PALETTE_SEARCH_MASK = _ - (FI_COLOR_FIND_EQUAL_COLOR Or FI_COLOR_ALPHA_IS_INDEX) ' Flag to test, if any color lookup is performed - -' The following enum constants are used by derived (wrapper) functions of the -' FreeImage 3 VB Wrapper -Public Enum FREE_IMAGE_CONVERSION_FLAGS - FICF_MONOCHROME = &H1 - FICF_MONOCHROME_THRESHOLD = FICF_MONOCHROME - FICF_MONOCHROME_DITHER = &H3 - FICF_GREYSCALE_4BPP = &H4 - FICF_PALLETISED_8BPP = &H8 - FICF_GREYSCALE_8BPP = FICF_PALLETISED_8BPP Or FICF_MONOCHROME - FICF_GREYSCALE = FICF_GREYSCALE_8BPP - FICF_RGB_15BPP = &HF - FICF_RGB_16BPP = &H10 - FICF_RGB_24BPP = &H18 - FICF_RGB_32BPP = &H20 - FICF_RGB_ALPHA = FICF_RGB_32BPP - FICF_KEEP_UNORDERED_GREYSCALE_PALETTE = &H0 - FICF_REORDER_GREYSCALE_PALETTE = &H1000 -End Enum - -Public Enum FREE_IMAGE_COLOR_DEPTH - FICD_AUTO = &H0 - FICD_MONOCHROME = &H1 - FICD_MONOCHROME_THRESHOLD = FICF_MONOCHROME - FICD_MONOCHROME_DITHER = &H3 - FICD_1BPP = FICD_MONOCHROME - FICD_4BPP = &H4 - FICD_8BPP = &H8 - FICD_15BPP = &HF - FICD_16BPP = &H10 - FICD_24BPP = &H18 - FICD_32BPP = &H20 -End Enum - -Public Enum FREE_IMAGE_ADJUST_MODE - AM_STRECH = &H1 - AM_DEFAULT = AM_STRECH - AM_ADJUST_BOTH = AM_STRECH - AM_ADJUST_WIDTH = &H2 - AM_ADJUST_HEIGHT = &H4 - AM_ADJUST_OPTIMAL_SIZE = &H8 -End Enum - -Public Enum FREE_IMAGE_MASK_FLAGS - FIMF_MASK_NONE = &H0 - FIMF_MASK_FULL_TRANSPARENCY = &H1 - FIMF_MASK_ALPHA_TRANSPARENCY = &H2 - FIMF_MASK_COLOR_TRANSPARENCY = &H4 - FIMF_MASK_FORCE_TRANSPARENCY = &H8 - FIMF_MASK_INVERSE_MASK = &H10 -End Enum - -Public Enum FREE_IMAGE_COLOR_FORMAT_FLAGS - FICFF_COLOR_RGB = &H1 - FICFF_COLOR_BGR = &H2 - FICFF_COLOR_PALETTE_INDEX = &H4 - - FICFF_COLOR_HAS_ALPHA = &H100 - - FICFF_COLOR_ARGB = FICFF_COLOR_RGB Or FICFF_COLOR_HAS_ALPHA - FICFF_COLOR_ABGR = FICFF_COLOR_BGR Or FICFF_COLOR_HAS_ALPHA - - FICFF_COLOR_FORMAT_ORDER_MASK = FICFF_COLOR_RGB Or FICFF_COLOR_BGR -End Enum - -Public Enum FREE_IMAGE_MASK_CREATION_OPTION_FLAGS - MCOF_CREATE_MASK_IMAGE = &H1 - MCOF_MODIFY_SOURCE_IMAGE = &H2 - MCOF_CREATE_AND_MODIFY = MCOF_CREATE_MASK_IMAGE Or MCOF_MODIFY_SOURCE_IMAGE -End Enum - -Public Enum FREE_IMAGE_TRANSPARENCY_STATE_FLAGS - FITSF_IGNORE_TRANSPARENCY = &H0 - FITSF_NONTRANSPARENT = &H1 - FITSF_TRANSPARENT = &H2 - FITSF_INCLUDE_ALPHA_TRANSPARENCY = &H4 -End Enum - -Public Enum FREE_IMAGE_ICON_TRANSPARENCY_OPTION_FLAGS - ITOF_NO_TRANSPARENCY = &H0 - ITOF_USE_TRANSPARENCY_INFO = &H1 - ITOF_USE_TRANSPARENCY_INFO_ONLY = ITOF_USE_TRANSPARENCY_INFO - ITOF_USE_COLOR_TRANSPARENCY = &H2 - ITOF_USE_COLOR_TRANSPARENCY_ONLY = ITOF_USE_COLOR_TRANSPARENCY - ITOF_USE_TRANSPARENCY_INFO_OR_COLOR = ITOF_USE_TRANSPARENCY_INFO Or ITOF_USE_COLOR_TRANSPARENCY - ITOF_USE_DEFAULT_TRANSPARENCY = ITOF_USE_TRANSPARENCY_INFO_OR_COLOR - ITOF_USE_COLOR_TOP_LEFT_PIXEL = &H0 - ITOF_USE_COLOR_FIRST_PIXEL = ITOF_USE_COLOR_TOP_LEFT_PIXEL - ITOF_USE_COLOR_TOP_RIGHT_PIXEL = &H20 - ITOF_USE_COLOR_BOTTOM_LEFT_PIXEL = &H40 - ITOF_USE_COLOR_BOTTOM_RIGHT_PIXEL = &H80 - ITOF_USE_COLOR_SPECIFIED = &H100 - ITOF_FORCE_TRANSPARENCY_INFO = &H400 -End Enum - -Private Const ITOF_USE_COLOR_BITMASK As Long = ITOF_USE_COLOR_TOP_RIGHT_PIXEL Or _ - ITOF_USE_COLOR_BOTTOM_LEFT_PIXEL Or _ - ITOF_USE_COLOR_BOTTOM_RIGHT_PIXEL Or _ - ITOF_USE_COLOR_SPECIFIED - -Public Type RGBQUAD - rgbBlue As Byte - rgbGreen As Byte - rgbRed As Byte - rgbReserved As Byte -End Type - -Public Type RGBTRIPLE - rgbtBlue As Byte - rgbtGreen As Byte - rgbtRed As Byte -End Type - -Public Type BITMAPINFOHEADER - biSize As Long - biWidth As Long - biHeight As Long - biPlanes As Integer - biBitCount As Integer - biCompression As Long - biSizeImage As Long - biXPelsPerMeter As Long - biYPelsPerMeter As Long - biClrUsed As Long - biClrImportant As Long -End Type - -Public Type BITMAPINFO - bmiHeader As BITMAPINFOHEADER - bmiColors(0) As RGBQUAD -End Type - -Public Const BI_RGB As Long = 0 -Public Const BI_RLE8 As Long = 1 -Public Const BI_RLE4 As Long = 2 -Public Const BI_BITFIELDS As Long = 3 -Public Const BI_JPEG As Long = 4 -Public Const BI_PNG As Long = 5 - -Public Type FIICCPROFILE - Flags As Integer ' info flag - Size As Long ' profile's size measured in bytes - Data As Long ' points to a block of contiguous memory containing the profile -End Type - -' 48-bit RGB -Public Type FIRGB16 - Red As Integer - Green As Integer - Blue As Integer -End Type - -' 64-bit RGBA -Public Type FIRGBA16 - Red As Integer - Green As Integer - Blue As Integer - Alpha As Integer -End Type - -' 96-bit RGB Float -Public Type FIRGBF - Red As Single - Green As Single - Blue As Single -End Type - -' 128-bit RGBA Float -Public Type FIRGBAF - Red As Single - Green As Single - Blue As Single - Alpha As Single -End Type - -' data structure for COMPLEX type (complex number) -Public Type FICOMPLEX - r As Double ' real part - i As Double ' imaginary part -End Type - -Public Type FITAG - Key As Long - Description As Long - Id As Integer - Type As Integer - Count As Long - Length As Long - Value As Long -End Type - -Public Type FIRATIONAL - Numerator As Variant - Denominator As Variant -End Type - -Public Type FREE_IMAGE_TAG - Model As FREE_IMAGE_MDMODEL - TagPtr As Long - Key As String - Description As String - Id As Long - Type As FREE_IMAGE_MDTYPE - Count As Long - Length As Long - StringValue As String - Palette() As RGBQUAD - RationalValue() As FIRATIONAL - Value As Variant -End Type - -Public Type FreeImageIO - read_proc As Long - write_proc As Long - seek_proc As Long - tell_proc As Long -End Type - -Public Type Plugin - format_proc As Long - description_proc As Long - extension_proc As Long - regexpr_proc As Long - open_proc As Long - close_proc As Long - pagecount_proc As Long - pagecapability_proc As Long - load_proc As Long - save_proc As Long - validate_proc As Long - mime_proc As Long - supports_export_bpp_proc As Long - supports_export_type_proc As Long - supports_icc_profiles_proc As Long -End Type - -' The following structures are used by derived (wrapper) functions of the -' FreeImage 3 VB Wrapper -Public Type ScanLineRGBTRIBLE - Data() As RGBTRIPLE -End Type - -Public Type ScanLinesRGBTRIBLE - Scanline() As ScanLineRGBTRIBLE -End Type - -'-------------------------------------------------------------------------------- -' FreeImage 3 function declarations -'-------------------------------------------------------------------------------- - -' The FreeImage 3 functions are declared in the same order as they are described -' in the FreeImage 3 API documentation (mostly). The documentation's outline is -' included as comments. - -' Initialization / Deinitialization functions -Public Declare Sub FreeImage_Initialise Lib "FreeImage.dll" Alias "_FreeImage_Initialise@4" ( _ - Optional ByVal LoadLocalPluginsOnly As Long) - -Public Declare Sub FreeImage_DeInitialise Lib "FreeImage.dll" Alias "_FreeImage_DeInitialise@0" () - - -' Version functions -Private Declare Function FreeImage_GetVersionInt Lib "FreeImage.dll" Alias "_FreeImage_GetVersion@0" () As Long - -Private Declare Function FreeImage_GetCopyrightMessageInt Lib "FreeImage.dll" Alias "_FreeImage_GetCopyrightMessage@0" () As Long - - -' Message output functions -Public Declare Sub FreeImage_SetOutputMessage Lib "FreeImage.dll" Alias "_FreeImage_SetOutputMessageStdCall@4" ( _ - ByVal omf As Long) - - -' Allocate / Clone / Unload functions -Public Declare Function FreeImage_Allocate Lib "FreeImage.dll" Alias "_FreeImage_Allocate@24" ( _ - ByVal Width As Long, _ - ByVal Height As Long, _ - ByVal BitsPerPixel As Long, _ - Optional ByVal RedMask As Long, _ - Optional ByVal GreenMask As Long, _ - Optional ByVal BlueMask As Long) As Long - -Public Declare Function FreeImage_AllocateT Lib "FreeImage.dll" Alias "_FreeImage_AllocateT@28" ( _ - ByVal ImageType As FREE_IMAGE_TYPE, _ - ByVal Width As Long, _ - ByVal Height As Long, _ - Optional ByVal BitsPerPixel As Long = 8, _ - Optional ByVal RedMask As Long, _ - Optional ByVal GreenMask As Long, _ - Optional ByVal BlueMask As Long) As Long - -Public Declare Function FreeImage_Clone Lib "FreeImage.dll" Alias "_FreeImage_Clone@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Sub FreeImage_Unload Lib "FreeImage.dll" Alias "_FreeImage_Unload@4" ( _ - ByVal Bitmap As Long) - - -' Header loading functions -Public Declare Function FreeImage_HasPixelsInt Lib "FreeImage.dll" Alias "_FreeImage_HasPixels@4" ( _ - ByVal Bitmap As Long) As Long - - -' Load / Save functions -Public Declare Function FreeImage_Load Lib "FreeImage.dll" Alias "_FreeImage_Load@12" ( _ - ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Filename As String, _ - Optional ByVal Flags As FREE_IMAGE_LOAD_OPTIONS) As Long - -Private Declare Function FreeImage_LoadUInt Lib "FreeImage.dll" Alias "_FreeImage_LoadU@12" ( _ - ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Filename As Long, _ - Optional ByVal Flags As FREE_IMAGE_LOAD_OPTIONS) As Long - -Public Declare Function FreeImage_LoadFromHandle Lib "FreeImage.dll" Alias "_FreeImage_LoadFromHandle@16" ( _ - ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal IO As Long, _ - ByVal Handle As Long, _ - Optional ByVal Flags As FREE_IMAGE_LOAD_OPTIONS) As Long - -Private Declare Function FreeImage_SaveInt Lib "FreeImage.dll" Alias "_FreeImage_Save@16" ( _ - ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Bitmap As Long, _ - ByVal Filename As String, _ - Optional ByVal Flags As FREE_IMAGE_SAVE_OPTIONS) As Long - -Private Declare Function FreeImage_SaveUInt Lib "FreeImage.dll" Alias "_FreeImage_SaveU@16" ( _ - ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Bitmap As Long, _ - ByVal Filename As Long, _ - Optional ByVal Flags As FREE_IMAGE_SAVE_OPTIONS) As Long - -Private Declare Function FreeImage_SaveToHandleInt Lib "FreeImage.dll" Alias "_FreeImage_SaveToHandle@20" ( _ - ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Bitmap As Long, _ - ByVal IO As Long, _ - ByVal Handle As Long, _ - Optional ByVal Flags As FREE_IMAGE_SAVE_OPTIONS) As Long - - -' Memory I/O stream functions -Public Declare Function FreeImage_OpenMemory Lib "FreeImage.dll" Alias "_FreeImage_OpenMemory@8" ( _ - Optional ByRef Data As Byte, _ - Optional ByVal SizeInBytes As Long) As Long - -Public Declare Function FreeImage_OpenMemoryByPtr Lib "FreeImage.dll" Alias "_FreeImage_OpenMemory@8" ( _ - Optional ByVal DataPtr As Long, _ - Optional ByVal SizeInBytes As Long) As Long - -Public Declare Sub FreeImage_CloseMemory Lib "FreeImage.dll" Alias "_FreeImage_CloseMemory@4" ( _ - ByVal Stream As Long) - -Public Declare Function FreeImage_LoadFromMemory Lib "FreeImage.dll" Alias "_FreeImage_LoadFromMemory@12" ( _ - ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Stream As Long, _ - Optional ByVal Flags As FREE_IMAGE_LOAD_OPTIONS) As Long - -Private Declare Function FreeImage_SaveToMemoryInt Lib "FreeImage.dll" Alias "_FreeImage_SaveToMemory@16" ( _ - ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Bitmap As Long, _ - ByVal Stream As Long, _ - Optional ByVal Flags As FREE_IMAGE_SAVE_OPTIONS) As Long - -Public Declare Function FreeImage_TellMemory Lib "FreeImage.dll" Alias "_FreeImage_TellMemory@4" ( _ - ByVal Stream As Long) As Long - -Private Declare Function FreeImage_SeekMemoryInt Lib "FreeImage.dll" Alias "_FreeImage_SeekMemory@12" ( _ - ByVal Stream As Long, _ - ByVal Offset As Long, _ - ByVal Origin As Long) As Long - -Private Declare Function FreeImage_AcquireMemoryInt Lib "FreeImage.dll" Alias "_FreeImage_AcquireMemory@12" ( _ - ByVal Stream As Long, _ - ByRef DataPtr As Long, _ - ByRef SizeInBytes As Long) As Long - -Public Declare Function FreeImage_ReadMemory Lib "FreeImage.dll" Alias "_FreeImage_ReadMemory@16" ( _ - ByVal BufferPtr As Long, _ - ByVal Size As Long, _ - ByVal Count As Long, _ - ByVal Stream As Long) As Long - -Public Declare Function FreeImage_WriteMemory Lib "FreeImage.dll" Alias "_FreeImage_WriteMemory@16" ( _ - ByVal BufferPtr As Long, _ - ByVal Size As Long, _ - ByVal Count As Long, _ - ByVal Stream As Long) As Long - -Public Declare Function FreeImage_LoadMultiBitmapFromMemory Lib "FreeImage.dll" Alias "_FreeImage_LoadMultiBitmapFromMemory@12" ( _ - ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Stream As Long, _ - Optional ByVal Flags As FREE_IMAGE_LOAD_OPTIONS) As Long - -Public Declare Function FreeImage_SaveMultiBitmapToMemory Lib "FreeImage.dll" Alias "_FreeImage_SaveMultiBitmapToMemory@16" ( _ - ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Bitmap As Long, _ - ByVal Stream As Long, _ - Optional ByVal Flags As FREE_IMAGE_SAVE_OPTIONS) As Long - - -' Plugin / Format functions -Public Declare Function FreeImage_RegisterLocalPlugin Lib "FreeImage.dll" Alias "_FreeImage_RegisterLocalPlugin@20" ( _ - ByVal InitProcAddress As Long, _ - Optional ByVal Format As String, _ - Optional ByVal Description As String, _ - Optional ByVal Extension As String, _ - Optional ByVal RegExpr As String) As FREE_IMAGE_FORMAT - -Public Declare Function FreeImage_RegisterExternalPlugin Lib "FreeImage.dll" Alias "_FreeImage_RegisterExternalPlugin@20" ( _ - ByVal Path As String, _ - Optional ByVal Format As String, _ - Optional ByVal Description As String, _ - Optional ByVal Extension As String, _ - Optional ByVal RegExpr As String) As FREE_IMAGE_FORMAT - -Public Declare Function FreeImage_GetFIFCount Lib "FreeImage.dll" Alias "_FreeImage_GetFIFCount@0" () As Long - -Public Declare Function FreeImage_SetPluginEnabled Lib "FreeImage.dll" Alias "_FreeImage_SetPluginEnabled@8" ( _ - ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Value As Long) As Long - -Public Declare Function FreeImage_IsPluginEnabled Lib "FreeImage.dll" Alias "_FreeImage_IsPluginEnabled@4" ( _ - ByVal Format As FREE_IMAGE_FORMAT) As Long - -Public Declare Function FreeImage_GetFIFFromFormat Lib "FreeImage.dll" Alias "_FreeImage_GetFIFFromFormat@4" ( _ - ByVal Format As String) As FREE_IMAGE_FORMAT - -Public Declare Function FreeImage_GetFIFFromMime Lib "FreeImage.dll" Alias "_FreeImage_GetFIFFromMime@4" ( _ - ByVal MimeType As String) As FREE_IMAGE_FORMAT - -Private Declare Function FreeImage_GetFormatFromFIFInt Lib "FreeImage.dll" Alias "_FreeImage_GetFormatFromFIF@4" ( _ - ByVal Format As FREE_IMAGE_FORMAT) As Long - -Private Declare Function FreeImage_GetFIFExtensionListInt Lib "FreeImage.dll" Alias "_FreeImage_GetFIFExtensionList@4" ( _ - ByVal Format As FREE_IMAGE_FORMAT) As Long - -Private Declare Function FreeImage_GetFIFDescriptionInt Lib "FreeImage.dll" Alias "_FreeImage_GetFIFDescription@4" ( _ - ByVal Format As FREE_IMAGE_FORMAT) As Long - -Private Declare Function FreeImage_GetFIFRegExprInt Lib "FreeImage.dll" Alias "_FreeImage_GetFIFRegExpr@4" ( _ - ByVal Format As FREE_IMAGE_FORMAT) As Long - -Private Declare Function FreeImage_GetFIFMimeTypeInt Lib "FreeImage.dll" Alias "_FreeImage_GetFIFMimeType@4" ( _ - ByVal Format As FREE_IMAGE_FORMAT) As Long - -Public Declare Function FreeImage_GetFIFFromFilename Lib "FreeImage.dll" Alias "_FreeImage_GetFIFFromFilename@4" ( _ - ByVal Filename As String) As FREE_IMAGE_FORMAT - -Private Declare Function FreeImage_GetFIFFromFilenameUInt Lib "FreeImage.dll" Alias "_FreeImage_GetFIFFromFilenameU@4" ( _ - ByVal Filename As Long) As FREE_IMAGE_FORMAT - -Private Declare Function FreeImage_FIFSupportsReadingInt Lib "FreeImage.dll" Alias "_FreeImage_FIFSupportsReading@4" ( _ - ByVal Format As FREE_IMAGE_FORMAT) As Long - -Private Declare Function FreeImage_FIFSupportsWritingInt Lib "FreeImage.dll" Alias "_FreeImage_FIFSupportsWriting@4" ( _ - ByVal Format As FREE_IMAGE_FORMAT) As Long - -Private Declare Function FreeImage_FIFSupportsExportBPPInt Lib "FreeImage.dll" Alias "_FreeImage_FIFSupportsExportBPP@8" ( _ - ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal BitsPerPixel As Long) As Long - -Private Declare Function FreeImage_FIFSupportsExportTypeInt Lib "FreeImage.dll" Alias "_FreeImage_FIFSupportsExportType@8" ( _ - ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal ImageType As FREE_IMAGE_TYPE) As Long - -Private Declare Function FreeImage_FIFSupportsICCProfilesInt Lib "FreeImage.dll" Alias "_FreeImage_FIFSupportsICCProfiles@4" ( _ - ByVal Format As FREE_IMAGE_FORMAT) As Long - -Private Declare Function FreeImage_FIFSupportsNoPixelsInt Lib "FreeImage.dll" Alias "_FreeImage_FIFSupportsNoPixels@4" ( _ - ByVal Format As FREE_IMAGE_FORMAT) As Long - - -' Multipaging functions -Private Declare Function FreeImage_OpenMultiBitmapInt Lib "FreeImage.dll" Alias "_FreeImage_OpenMultiBitmap@24" ( _ - ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Filename As String, _ - ByVal CreateNew As Long, _ - ByVal ReadOnly As Long, _ - ByVal KeepCacheInMemory As Long, _ - ByVal Flags As FREE_IMAGE_LOAD_OPTIONS) As Long - -Private Declare Function FreeImage_CloseMultiBitmapInt Lib "FreeImage.dll" Alias "_FreeImage_CloseMultiBitmap@8" ( _ - ByVal Bitmap As Long, _ - Optional ByVal Flags As FREE_IMAGE_SAVE_OPTIONS) As Long - -Public Declare Function FreeImage_GetPageCount Lib "FreeImage.dll" Alias "_FreeImage_GetPageCount@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Sub FreeImage_AppendPage Lib "FreeImage.dll" Alias "_FreeImage_AppendPage@8" ( _ - ByVal Bitmap As Long, _ - ByVal PageBitmap As Long) - -Public Declare Sub FreeImage_InsertPage Lib "FreeImage.dll" Alias "_FreeImage_InsertPage@12" ( _ - ByVal Bitmap As Long, _ - ByVal Page As Long, _ - ByVal PageBitmap As Long) - -Public Declare Sub FreeImage_DeletePage Lib "FreeImage.dll" Alias "_FreeImage_DeletePage@8" ( _ - ByVal Bitmap As Long, _ - ByVal Page As Long) - -Public Declare Function FreeImage_LockPage Lib "FreeImage.dll" Alias "_FreeImage_LockPage@8" ( _ - ByVal Bitmap As Long, _ - ByVal Page As Long) As Long - -Private Declare Sub FreeImage_UnlockPageInt Lib "FreeImage.dll" Alias "_FreeImage_UnlockPage@12" ( _ - ByVal Bitmap As Long, _ - ByVal PageBitmap As Long, _ - ByVal ApplyChanges As Long) - -Private Declare Function FreeImage_MovePageInt Lib "FreeImage.dll" Alias "_FreeImage_MovePage@12" ( _ - ByVal Bitmap As Long, _ - ByVal TargetPage As Long, _ - ByVal SourcePage As Long) As Long - -Private Declare Function FreeImage_GetLockedPageNumbersInt Lib "FreeImage.dll" Alias "_FreeImage_GetLockedPageNumbers@12" ( _ - ByVal Bitmap As Long, _ - ByRef PagesPtr As Long, _ - ByRef Count As Long) As Long - - -' Filetype request functions -Public Declare Function FreeImage_GetFileType Lib "FreeImage.dll" Alias "_FreeImage_GetFileType@8" ( _ - ByVal Filename As String, _ - Optional ByVal Size As Long) As FREE_IMAGE_FORMAT - -Private Declare Function FreeImage_GetFileTypeUInt Lib "FreeImage.dll" Alias "_FreeImage_GetFileTypeU@8" ( _ - ByVal Filename As Long, _ - Optional ByVal Size As Long) As FREE_IMAGE_FORMAT - -Public Declare Function FreeImage_GetFileTypeFromHandle Lib "FreeImage.dll" Alias "_FreeImage_GetFileTypeFromHandle@12" ( _ - ByVal IO As Long, _ - ByVal Handle As Long, _ - Optional ByVal Size As Long) As FREE_IMAGE_FORMAT - -Public Declare Function FreeImage_GetFileTypeFromMemory Lib "FreeImage.dll" Alias "_FreeImage_GetFileTypeFromMemory@8" ( _ - ByVal Stream As Long, _ - Optional ByVal Size As Long) As FREE_IMAGE_FORMAT - - -' Image type request functions -Public Declare Function FreeImage_GetImageType Lib "FreeImage.dll" Alias "_FreeImage_GetImageType@4" ( _ - ByVal Bitmap As Long) As FREE_IMAGE_TYPE - - -' FreeImage helper functions -Private Declare Function FreeImage_IsLittleEndianInt Lib "FreeImage.dll" Alias "_FreeImage_IsLittleEndian@0" () As Long - -Private Declare Function FreeImage_LookupX11ColorInt Lib "FreeImage.dll" Alias "_FreeImage_LookupX11Color@16" ( _ - ByVal Color As String, _ - ByRef Red As Long, _ - ByRef Green As Long, _ - ByRef Blue As Long) As Long - -Private Declare Function FreeImage_LookupSVGColorInt Lib "FreeImage.dll" Alias "_FreeImage_LookupSVGColor@16" ( _ - ByVal Color As String, _ - ByRef Red As Long, _ - ByRef Green As Long, _ - ByRef Blue As Long) As Long - - -' Pixel access functions -Public Declare Function FreeImage_GetBits Lib "FreeImage.dll" Alias "_FreeImage_GetBits@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetScanline Lib "FreeImage.dll" Alias "_FreeImage_GetScanLine@8" ( _ - ByVal Bitmap As Long, _ - ByVal Scanline As Long) As Long - -Private Declare Function FreeImage_GetPixelIndexInt Lib "FreeImage.dll" Alias "_FreeImage_GetPixelIndex@16" ( _ - ByVal Bitmap As Long, _ - ByVal x As Long, _ - ByVal y As Long, _ - ByRef Value As Byte) As Long - -Private Declare Function FreeImage_GetPixelColorInt Lib "FreeImage.dll" Alias "_FreeImage_GetPixelColor@16" ( _ - ByVal Bitmap As Long, _ - ByVal x As Long, _ - ByVal y As Long, _ - ByRef Value As RGBQUAD) As Long - -Private Declare Function FreeImage_GetPixelColorByLongInt Lib "FreeImage.dll" Alias "_FreeImage_GetPixelColor@16" ( _ - ByVal Bitmap As Long, _ - ByVal x As Long, _ - ByVal y As Long, _ - ByRef Value As Long) As Long - -Private Declare Function FreeImage_SetPixelIndexInt Lib "FreeImage.dll" Alias "_FreeImage_SetPixelIndex@16" ( _ - ByVal Bitmap As Long, _ - ByVal x As Long, _ - ByVal y As Long, _ - ByRef Value As Byte) As Long - -Private Declare Function FreeImage_SetPixelColorInt Lib "FreeImage.dll" Alias "_FreeImage_SetPixelColor@16" ( _ - ByVal Bitmap As Long, _ - ByVal x As Long, _ - ByVal y As Long, _ - ByRef Value As RGBQUAD) As Long - -Private Declare Function FreeImage_SetPixelColorByLongInt Lib "FreeImage.dll" Alias "_FreeImage_SetPixelColor@16" ( _ - ByVal Bitmap As Long, _ - ByVal x As Long, _ - ByVal y As Long, _ - ByRef Value As Long) As Long - - -' DIB info functions -Public Declare Function FreeImage_GetColorsUsed Lib "FreeImage.dll" Alias "_FreeImage_GetColorsUsed@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetBPP Lib "FreeImage.dll" Alias "_FreeImage_GetBPP@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetWidth Lib "FreeImage.dll" Alias "_FreeImage_GetWidth@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetHeight Lib "FreeImage.dll" Alias "_FreeImage_GetHeight@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetLine Lib "FreeImage.dll" Alias "_FreeImage_GetLine@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetPitch Lib "FreeImage.dll" Alias "_FreeImage_GetPitch@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetDIBSize Lib "FreeImage.dll" Alias "_FreeImage_GetDIBSize@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetPalette Lib "FreeImage.dll" Alias "_FreeImage_GetPalette@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetDotsPerMeterX Lib "FreeImage.dll" Alias "_FreeImage_GetDotsPerMeterX@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetDotsPerMeterY Lib "FreeImage.dll" Alias "_FreeImage_GetDotsPerMeterY@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Sub FreeImage_SetDotsPerMeterX Lib "FreeImage.dll" Alias "_FreeImage_SetDotsPerMeterX@8" ( _ - ByVal Bitmap As Long, _ - ByVal Resolution As Long) - -Public Declare Sub FreeImage_SetDotsPerMeterY Lib "FreeImage.dll" Alias "_FreeImage_SetDotsPerMeterY@8" ( _ - ByVal Bitmap As Long, _ - ByVal Resolution As Long) - -Public Declare Function FreeImage_GetInfoHeader Lib "FreeImage.dll" Alias "_FreeImage_GetInfoHeader@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetInfo Lib "FreeImage.dll" Alias "_FreeImage_GetInfo@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetColorType Lib "FreeImage.dll" Alias "_FreeImage_GetColorType@4" ( _ - ByVal Bitmap As Long) As FREE_IMAGE_COLOR_TYPE - -Private Declare Function FreeImage_HasRGBMasksInt Lib "FreeImage.dll" Alias "_FreeImage_HasRGBMasks@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetRedMask Lib "FreeImage.dll" Alias "_FreeImage_GetRedMask@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetGreenMask Lib "FreeImage.dll" Alias "_FreeImage_GetGreenMask@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetBlueMask Lib "FreeImage.dll" Alias "_FreeImage_GetBlueMask@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetTransparencyCount Lib "FreeImage.dll" Alias "_FreeImage_GetTransparencyCount@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetTransparencyTable Lib "FreeImage.dll" Alias "_FreeImage_GetTransparencyTable@4" ( _ - ByVal Bitmap As Long) As Long - -Private Declare Sub FreeImage_SetTransparentInt Lib "FreeImage.dll" Alias "_FreeImage_SetTransparent@8" ( _ - ByVal Bitmap As Long, _ - ByVal Value As Long) - -Public Declare Sub FreeImage_SetTransparencyTable Lib "FreeImage.dll" Alias "_FreeImage_SetTransparencyTable@12" ( _ - ByVal Bitmap As Long, _ - ByVal TransTablePtr As Long, _ - ByVal Count As Long) - -Private Declare Function FreeImage_IsTransparentInt Lib "FreeImage.dll" Alias "_FreeImage_IsTransparent@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_SetTransparentIndex Lib "FreeImage.dll" Alias "_FreeImage_SetTransparentIndex@8" ( _ - ByVal Bitmap As Long, _ - ByVal Index As Long) As Long - -Public Declare Function FreeImage_GetTransparentIndex Lib "FreeImage.dll" Alias "_FreeImage_GetTransparentIndex@4" ( _ - ByVal Bitmap As Long) As Long - -Private Declare Function FreeImage_HasBackgroundColorInt Lib "FreeImage.dll" Alias "_FreeImage_HasBackgroundColor@4" ( _ - ByVal Bitmap As Long) As Long - -Private Declare Function FreeImage_GetBackgroundColorInt Lib "FreeImage.dll" Alias "_FreeImage_GetBackgroundColor@8" ( _ - ByVal Bitmap As Long, _ - ByRef BackColor As RGBQUAD) As Long - -Private Declare Function FreeImage_GetBackgroundColorAsLongInt Lib "FreeImage.dll" Alias "_FreeImage_GetBackgroundColor@8" ( _ - ByVal Bitmap As Long, _ - ByRef BackColor As Long) As Long - -Private Declare Function FreeImage_SetBackgroundColorInt Lib "FreeImage.dll" Alias "_FreeImage_SetBackgroundColor@8" ( _ - ByVal Bitmap As Long, _ - ByRef BackColor As RGBQUAD) As Long - -Private Declare Function FreeImage_SetBackgroundColorAsLongInt Lib "FreeImage.dll" Alias "_FreeImage_SetBackgroundColor@8" ( _ - ByVal Bitmap As Long, _ - ByRef BackColor As Long) As Long - -Public Declare Function FreeImage_GetThumbnail Lib "FreeImage.dll" Alias "_FreeImage_GetThumbnail@4" ( _ - ByVal Bitmap As Long) As Long - -Private Declare Function FreeImage_SetThumbnailInt Lib "FreeImage.dll" Alias "_FreeImage_SetThumbnail@8" ( _ - ByVal Bitmap As Long, ByVal Thumbnail As Long) As Long - - -' ICC profile functions -Private Declare Function FreeImage_GetICCProfileInt Lib "FreeImage.dll" Alias "_FreeImage_GetICCProfile@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_CreateICCProfile Lib "FreeImage.dll" Alias "_FreeImage_CreateICCProfile@12" ( _ - ByVal Bitmap As Long, _ - ByRef Data As Long, _ - ByVal Size As Long) As Long - -Public Declare Sub FreeImage_DestroyICCProfile Lib "FreeImage.dll" Alias "_FreeImage_DestroyICCProfile@4" ( _ - ByVal Bitmap As Long) - - -' Line conversion functions -Public Declare Sub FreeImage_ConvertLine1To4 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine1To4@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine8To4 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine1To8@16" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long, _ - ByVal PalettePtr As Long) - -Public Declare Sub FreeImage_ConvertLine16To4_555 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine16To4_555@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine16To4_565 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine16To4_565@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine24To4 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine1To24@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine32To4 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine32To4@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine1To8 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine1To8@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine4To8 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine4To8@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine16To8_555 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine16To8_555@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine16To8_565 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine16To8_565@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine24To8 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine24To8@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine32To8 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine32To8@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine1To16_555 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine1To16_555@16" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long, _ - ByVal PalettePtr As Long) - -Public Declare Sub FreeImage_ConvertLine4To16_555 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine4To16_555@16" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long, _ - ByVal PalettePtr As Long) - -Public Declare Sub FreeImage_ConvertLine8To16_555 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine8To16_555@16" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long, _ - ByVal PalettePtr As Long) - -Public Declare Sub FreeImage_ConvertLine16_565_To16_555 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine16_565_To16_555@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine24To16_555 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine24To16_555@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine32To16_555 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine32To16_555@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine1To16_565 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine1To16_565@16" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long, _ - ByVal PalettePtr As Long) - -Public Declare Sub FreeImage_ConvertLine4To16_565 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine4To16_565@16" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long, _ - ByVal PalettePtr As Long) - -Public Declare Sub FreeImage_ConvertLine8To16_565 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine8To16_565@16" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long, _ - ByVal PalettePtr As Long) - -Public Declare Sub FreeImage_ConvertLine16_555_To16_565 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine16_555_To16_565@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine24To16_565 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine24To16_565@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine32To16_565 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine32To16_565@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine1To24 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine1To24@16" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long, _ - ByVal PalettePtr As Long) - -Public Declare Sub FreeImage_ConvertLine4To24 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine4To24@16" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long, _ - ByVal PalettePtr As Long) - -Public Declare Sub FreeImage_ConvertLine8To24 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine8To24@16" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long, _ - ByVal PalettePtr As Long) - -Public Declare Sub FreeImage_ConvertLine16To24_555 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine16To24_555@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine16To24_565 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine16To24_565@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine32To24 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine32To24@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine1To32 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine1To32@16" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long, _ - ByVal PalettePtr As Long) - -Public Declare Sub FreeImage_ConvertLine4To32 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine4To32@16" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long, _ - ByVal PalettePtr As Long) - -Public Declare Sub FreeImage_ConvertLine8To32 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine8To32@16" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long, _ - ByVal PalettePtr As Long) - -Public Declare Sub FreeImage_ConvertLine16To32_555 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine16To32_555@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine16To32_565 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine16To32_565@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine24To32 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine24To32@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - - -' Smart conversion functions -Public Declare Function FreeImage_ConvertTo4Bits Lib "FreeImage.dll" Alias "_FreeImage_ConvertTo4Bits@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_ConvertTo8Bits Lib "FreeImage.dll" Alias "_FreeImage_ConvertTo8Bits@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_ConvertToGreyscale Lib "FreeImage.dll" Alias "_FreeImage_ConvertToGreyscale@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_ConvertTo16Bits555 Lib "FreeImage.dll" Alias "_FreeImage_ConvertTo16Bits555@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_ConvertTo16Bits565 Lib "FreeImage.dll" Alias "_FreeImage_ConvertTo16Bits565@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_ConvertTo24Bits Lib "FreeImage.dll" Alias "_FreeImage_ConvertTo24Bits@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_ConvertTo32Bits Lib "FreeImage.dll" Alias "_FreeImage_ConvertTo32Bits@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_ColorQuantize Lib "FreeImage.dll" Alias "_FreeImage_ColorQuantize@8" ( _ - ByVal Bitmap As Long, _ - ByVal QuantizeMethod As FREE_IMAGE_QUANTIZE) As Long - -Private Declare Function FreeImage_ColorQuantizeExInt Lib "FreeImage.dll" Alias "_FreeImage_ColorQuantizeEx@20" ( _ - ByVal Bitmap As Long, _ - Optional ByVal QuantizeMethod As FREE_IMAGE_QUANTIZE = FIQ_WUQUANT, _ - Optional ByVal PaletteSize As Long = 256, _ - Optional ByVal ReserveSize As Long = 0, _ - Optional ByVal ReservePalettePtr As Long = 0) As Long - -Public Declare Function FreeImage_Threshold Lib "FreeImage.dll" Alias "_FreeImage_Threshold@8" ( _ - ByVal Bitmap As Long, _ - ByVal Threshold As Byte) As Long - -Public Declare Function FreeImage_Dither Lib "FreeImage.dll" Alias "_FreeImage_Dither@8" ( _ - ByVal Bitmap As Long, _ - ByVal DitherMethod As FREE_IMAGE_DITHER) As Long - -Private Declare Function FreeImage_ConvertFromRawBitsInt Lib "FreeImage.dll" Alias "_FreeImage_ConvertFromRawBits@36" ( _ - ByVal BitsPtr As Long, _ - ByVal Width As Long, _ - ByVal Height As Long, _ - ByVal Pitch As Long, _ - ByVal BitsPerPixel As Long, _ - ByVal RedMask As Long, _ - ByVal GreenMask As Long, _ - ByVal BlueMask As Long, _ - ByVal TopDown As Long) As Long - -Private Declare Function FreeImage_ConvertFromRawBitsExInt Lib "FreeImage.dll" Alias "_FreeImage_ConvertFromRawBitsEx@44" ( _ - ByVal CopySource As Long, _ - ByVal BitsPtr As Long, _ - ByVal ImageType As FREE_IMAGE_TYPE, _ - ByVal Width As Long, _ - ByVal Height As Long, _ - ByVal Pitch As Long, _ - ByVal BitsPerPixel As Long, _ - ByVal RedMask As Long, _ - ByVal GreenMask As Long, _ - ByVal BlueMask As Long, _ - ByVal TopDown As Long) As Long - -Private Declare Sub FreeImage_ConvertToRawBitsInt Lib "FreeImage.dll" Alias "_FreeImage_ConvertToRawBits@32" ( _ - ByVal BitsPtr As Long, _ - ByVal Bitmap As Long, _ - ByVal Pitch As Long, _ - ByVal BitsPerPixel As Long, _ - ByVal RedMask As Long, _ - ByVal GreenMask As Long, _ - ByVal BlueMask As Long, _ - ByVal TopDown As Long) - -Public Declare Function FreeImage_ConvertToFloat Lib "FreeImage.dll" Alias "_FreeImage_ConvertToFloat@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_ConvertToRGBF Lib "FreeImage.dll" Alias "_FreeImage_ConvertToRGBF@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_ConvertToUINT16 Lib "FreeImage.dll" Alias "_FreeImage_ConvertToUINT16@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_ConvertToRGB16 Lib "FreeImage.dll" Alias "_FreeImage_ConvertToRGB16@4" ( _ - ByVal Bitmap As Long) As Long - -Private Declare Function FreeImage_ConvertToStandardTypeInt Lib "FreeImage.dll" Alias "_FreeImage_ConvertToStandardType@8" ( _ - ByVal Bitmap As Long, _ - ByVal ScaleLinear As Long) As Long - -Private Declare Function FreeImage_ConvertToTypeInt Lib "FreeImage.dll" Alias "_FreeImage_ConvertToType@12" ( _ - ByVal Bitmap As Long, _ - ByVal DestinationType As FREE_IMAGE_TYPE, _ - ByVal ScaleLinear As Long) As Long - - -' Tone mapping operators -Public Declare Function FreeImage_ToneMapping Lib "FreeImage.dll" Alias "_FreeImage_ToneMapping@24" ( _ - ByVal Bitmap As Long, _ - ByVal Operator As FREE_IMAGE_TMO, _ - Optional ByVal FirstArgument As Double, _ - Optional ByVal SecondArgument As Double) As Long - -Public Declare Function FreeImage_TmoDrago03 Lib "FreeImage.dll" Alias "_FreeImage_TmoDrago03@20" ( _ - ByVal Bitmap As Long, _ - Optional ByVal Gamma As Double = 2.2, _ - Optional ByVal Exposure As Double) As Long - -Public Declare Function FreeImage_TmoReinhard05 Lib "FreeImage.dll" Alias "_FreeImage_TmoReinhard05@20" ( _ - ByVal Bitmap As Long, _ - Optional ByVal Intensity As Double, _ - Optional ByVal Contrast As Double) As Long - -Public Declare Function FreeImage_TmoReinhard05Ex Lib "FreeImage.dll" Alias "_FreeImage_TmoReinhard05Ex@36" ( _ - ByVal Bitmap As Long, _ - Optional ByVal Intensity As Double, _ - Optional ByVal Contrast As Double, _ - Optional ByVal Adaptation As Double = 1, _ - Optional ByVal ColorCorrection As Double) As Long - -Public Declare Function FreeImage_TmoFattal02 Lib "FreeImage.dll" Alias "_FreeImage_TmoFattal02@20" ( _ - ByVal Bitmap As Long, _ - Optional ByVal ColorSaturation As Double = 0.5, _ - Optional ByVal Attenuation As Double = 0.85) As Long - - -' ZLib functions -Public Declare Function FreeImage_ZLibCompress Lib "FreeImage.dll" Alias "_FreeImage_ZLibCompress@16" ( _ - ByVal TargetPtr As Long, _ - ByVal TargetSize As Long, _ - ByVal SourcePtr As Long, _ - ByVal SourceSize As Long) As Long - -Public Declare Function FreeImage_ZLibUncompress Lib "FreeImage.dll" Alias "_FreeImage_ZLibUncompress@16" ( _ - ByVal TargetPtr As Long, _ - ByVal TargetSize As Long, _ - ByVal SourcePtr As Long, _ - ByVal SourceSize As Long) As Long - -Public Declare Function FreeImage_ZLibGZip Lib "FreeImage.dll" Alias "_FreeImage_ZLibGZip@16" ( _ - ByVal TargetPtr As Long, _ - ByVal TargetSize As Long, _ - ByVal SourcePtr As Long, _ - ByVal SourceSize As Long) As Long - -Public Declare Function FreeImage_ZLibGUnzip Lib "FreeImage.dll" Alias "_FreeImage_ZLibGUnzip@16" ( _ - ByVal TargetPtr As Long, _ - ByVal TargetSize As Long, _ - ByVal SourcePtr As Long, _ - ByVal SourceSize As Long) As Long - -Public Declare Function FreeImage_ZLibCRC32 Lib "FreeImage.dll" Alias "_FreeImage_ZLibCRC32@12" ( _ - ByVal CRC As Long, _ - ByVal SourcePtr As Long, _ - ByVal SourceSize As Long) As Long - - -'-------------------------------------------------------------------------------- -' Metadata functions -'-------------------------------------------------------------------------------- - -' tag creation / destruction -Private Declare Function FreeImage_CreateTag Lib "FreeImage.dll" Alias "_FreeImage_CreateTag@0" () As Long - -Private Declare Sub FreeImage_DeleteTag Lib "FreeImage.dll" Alias "_FreeImage_DeleteTag@4" ( _ - ByVal Tag As Long) - -Private Declare Function FreeImage_CloneTag Lib "FreeImage.dll" Alias "_FreeImage_CloneTag@4" ( _ - ByVal Tag As Long) As Long - - -' tag getters and setters (only those actually needed by wrapper functions) -Private Declare Function FreeImage_SetTagKey Lib "FreeImage.dll" Alias "_FreeImage_SetTagKey@8" ( _ - ByVal Tag As Long, _ - ByVal Key As String) As Long - -Private Declare Function FreeImage_SetTagValue Lib "FreeImage.dll" Alias "_FreeImage_SetTagValue@8" ( _ - ByVal Tag As Long, _ - ByVal ValuePtr As Long) As Long - - -' metadata iterators -Public Declare Function FreeImage_FindFirstMetadata Lib "FreeImage.dll" Alias "_FreeImage_FindFirstMetadata@12" ( _ - ByVal Model As FREE_IMAGE_MDMODEL, _ - ByVal Bitmap As Long, _ - ByRef Tag As Long) As Long - -Private Declare Function FreeImage_FindNextMetadataInt Lib "FreeImage.dll" Alias "_FreeImage_FindNextMetadata@8" ( _ - ByVal hFind As Long, _ - ByRef Tag As Long) As Long - -Public Declare Sub FreeImage_FindCloseMetadata Lib "FreeImage.dll" Alias "_FreeImage_FindCloseMetadata@4" ( _ - ByVal hFind As Long) - - -' metadata setters and getters -Private Declare Function FreeImage_SetMetadataInt Lib "FreeImage.dll" Alias "_FreeImage_SetMetadata@16" ( _ - ByVal Model As Long, _ - ByVal Bitmap As Long, _ - ByVal Key As String, _ - ByVal Tag As Long) As Long - -Private Declare Function FreeImage_GetMetadataInt Lib "FreeImage.dll" Alias "_FreeImage_GetMetadata@16" ( _ - ByVal Model As Long, _ - ByVal Bitmap As Long, _ - ByVal Key As String, _ - ByRef Tag As Long) As Long - -Private Declare Function FreeImage_SetMetadataKeyValueInt Lib "FreeImage.dll" Alias "_FreeImage_SetMetadataKeyValue@16" ( _ - ByVal Model As Long, _ - ByVal Bitmap As Long, _ - ByVal Key As String, _ - ByVal Tag As String) As Long - - -' metadata helper functions -Public Declare Function FreeImage_GetMetadataCount Lib "FreeImage.dll" Alias "_FreeImage_GetMetadataCount@8" ( _ - ByVal Model As Long, _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_CloneMetadataInt Lib "FreeImage.dll" Alias "_FreeImage_CloneMetadata@8" ( _ - ByVal BitmapDst As Long, _ - ByVal BitmapSrc As Long) As Long - - -' tag to string conversion functions -Private Declare Function FreeImage_TagToStringInt Lib "FreeImage.dll" Alias "_FreeImage_TagToString@12" ( _ - ByVal Model As Long, _ - ByVal Tag As Long, _ - Optional ByVal Make As String = vbNullString) As Long - - -'-------------------------------------------------------------------------------- -' JPEG lossless transformation functions -'-------------------------------------------------------------------------------- - -Private Declare Function FreeImage_JPEGTransformInt Lib "FreeImage.dll" Alias "_FreeImage_JPEGTransform@16" ( _ - ByVal SourceFile As String, _ - ByVal DestFile As String, _ - ByVal Operation As FREE_IMAGE_JPEG_OPERATION, _ - ByVal Perfect As Long) As Long - -Private Declare Function FreeImage_JPEGTransformUInt Lib "FreeImage.dll" Alias "_FreeImage_JPEGTransformU@16" ( _ - ByVal SourceFile As Long, _ - ByVal DestFile As Long, _ - ByVal Operation As FREE_IMAGE_JPEG_OPERATION, _ - ByVal Perfect As Long) As Long - -Private Declare Function FreeImage_JPEGCropInt Lib "FreeImage.dll" Alias "_FreeImage_JPEGCrop@24" ( _ - ByVal SourceFile As String, _ - ByVal DestFile As String, _ - ByVal Left As Long, _ - ByVal Top As Long, _ - ByVal Right As Long, _ - ByVal Bottom As Long) As Long - -Private Declare Function FreeImage_JPEGCropUInt Lib "FreeImage.dll" Alias "_FreeImage_JPEGCropU@24" ( _ - ByVal SourceFile As Long, _ - ByVal DestFile As Long, _ - ByVal Left As Long, _ - ByVal Top As Long, _ - ByVal Right As Long, _ - ByVal Bottom As Long) As Long - -Private Declare Function FreeImage_JPEGTransformCombinedInt Lib "FreeImage.dll" Alias "_FreeImage_JPEGTransformCombined@32" ( _ - ByVal SourceFile As String, _ - ByVal DestFile As String, _ - ByVal Operation As FREE_IMAGE_JPEG_OPERATION, _ - ByRef Left As Long, _ - ByRef Top As Long, _ - ByRef Right As Long, _ - ByRef Bottom As Long, _ - ByVal Perfect As Long) As Long - -Private Declare Function FreeImage_JPEGTransformCombinedUInt Lib "FreeImage.dll" Alias "_FreeImage_JPEGTransformCombinedU@32" ( _ - ByVal SourceFile As Long, _ - ByVal DestFile As Long, _ - ByVal Operation As FREE_IMAGE_JPEG_OPERATION, _ - ByRef Left As Long, _ - ByRef Top As Long, _ - ByRef Right As Long, _ - ByRef Bottom As Long, _ - ByVal Perfect As Long) As Long - -Private Declare Function FreeImage_JPEGTransformCombinedFromMemoryInt Lib "FreeImage.dll" Alias "_FreeImage_JPEGTransformCombinedFromMemory@32" ( _ - ByVal SourceStream As Long, _ - ByVal DestStream As Long, _ - ByVal Operation As FREE_IMAGE_JPEG_OPERATION, _ - ByRef Left As Long, _ - ByRef Top As Long, _ - ByRef Right As Long, _ - ByRef Bottom As Long, _ - ByVal Perfect As Long) As Long - - -'-------------------------------------------------------------------------------- -' Image manipulation toolkit functions -'-------------------------------------------------------------------------------- - -' rotation and flipping -Public Declare Function FreeImage_RotateClassic Lib "FreeImage.dll" Alias "_FreeImage_RotateClassic@12" ( _ - ByVal Bitmap As Long, _ - ByVal Angle As Double) As Long - -Public Declare Function FreeImage_Rotate Lib "FreeImage.dll" Alias "_FreeImage_Rotate@16" ( _ - ByVal Bitmap As Long, _ - ByVal Angle As Double, _ - Optional ByRef Color As Any = 0) As Long - -Private Declare Function FreeImage_RotateExInt Lib "FreeImage.dll" Alias "_FreeImage_RotateEx@48" ( _ - ByVal Bitmap As Long, _ - ByVal Angle As Double, _ - ByVal ShiftX As Double, _ - ByVal ShiftY As Double, _ - ByVal OriginX As Double, _ - ByVal OriginY As Double, _ - ByVal UseMask As Long) As Long - -Private Declare Function FreeImage_FlipHorizontalInt Lib "FreeImage.dll" Alias "_FreeImage_FlipHorizontal@4" ( _ - ByVal Bitmap As Long) As Long - -Private Declare Function FreeImage_FlipVerticalInt Lib "FreeImage.dll" Alias "_FreeImage_FlipVertical@4" ( _ - ByVal Bitmap As Long) As Long - - -' upsampling / downsampling -Public Declare Function FreeImage_Rescale Lib "FreeImage.dll" Alias "_FreeImage_Rescale@16" ( _ - ByVal Bitmap As Long, _ - ByVal Width As Long, _ - ByVal Height As Long, _ - ByVal Filter As FREE_IMAGE_FILTER) As Long - -Public Declare Function FreeImage_RescaleRect Lib "FreeImage.dll" Alias "_FreeImage_RescaleRect@32" ( _ - ByVal Bitmap As Long, _ - ByVal Left As Long, _ - ByVal Top As Long, _ - ByVal Right As Long, _ - ByVal Bottom As Long, _ - ByVal Width As Long, _ - ByVal Height As Long, _ - ByVal Filter As FREE_IMAGE_FILTER) As Long - -Private Declare Function FreeImage_MakeThumbnailInt Lib "FreeImage.dll" Alias "_FreeImage_MakeThumbnail@12" ( _ - ByVal Bitmap As Long, _ - ByVal MaxPixelSize As Long, _ - Optional ByVal Convert As Long) As Long - - -' color manipulation functions (point operations) -Private Declare Function FreeImage_AdjustCurveInt Lib "FreeImage.dll" Alias "_FreeImage_AdjustCurve@12" ( _ - ByVal Bitmap As Long, _ - ByVal LookupTablePtr As Long, _ - ByVal Channel As FREE_IMAGE_COLOR_CHANNEL) As Long - -Private Declare Function FreeImage_AdjustGammaInt Lib "FreeImage.dll" Alias "_FreeImage_AdjustGamma@12" ( _ - ByVal Bitmap As Long, _ - ByVal Gamma As Double) As Long - -Private Declare Function FreeImage_AdjustBrightnessInt Lib "FreeImage.dll" Alias "_FreeImage_AdjustBrightness@12" ( _ - ByVal Bitmap As Long, _ - ByVal Percentage As Double) As Long - -Private Declare Function FreeImage_AdjustContrastInt Lib "FreeImage.dll" Alias "_FreeImage_AdjustContrast@12" ( _ - ByVal Bitmap As Long, _ - ByVal Percentage As Double) As Long - -Private Declare Function FreeImage_InvertInt Lib "FreeImage.dll" Alias "_FreeImage_Invert@4" ( _ - ByVal Bitmap As Long) As Long - -Private Declare Function FreeImage_GetHistogramInt Lib "FreeImage.dll" Alias "_FreeImage_GetHistogram@12" ( _ - ByVal Bitmap As Long, _ - ByRef HistogramPtr As Long, _ - Optional ByVal Channel As FREE_IMAGE_COLOR_CHANNEL = FICC_BLACK) As Long - -Private Declare Function FreeImage_GetAdjustColorsLookupTableInt Lib "FreeImage.dll" Alias "_FreeImage_GetAdjustColorsLookupTable@32" ( _ - ByVal LookupTablePtr As Long, _ - ByVal Brightness As Double, _ - ByVal Contrast As Double, _ - ByVal Gamma As Double, _ - ByVal Invert As Long) As Long - -Private Declare Function FreeImage_AdjustColorsInt Lib "FreeImage.dll" Alias "_FreeImage_AdjustColors@32" ( _ - ByVal Bitmap As Long, _ - ByVal Brightness As Double, _ - ByVal Contrast As Double, _ - ByVal Gamma As Double, _ - ByVal Invert As Long) As Long - -Private Declare Function FreeImage_ApplyColorMappingInt Lib "FreeImage.dll" Alias "_FreeImage_ApplyColorMapping@24" ( _ - ByVal Bitmap As Long, _ - ByVal SourceColorsPtr As Long, _ - ByVal DestinationColorsPtr As Long, _ - ByVal Count As Long, _ - ByVal IgnoreAlpha As Long, _ - ByVal Swap As Long) As Long - -Private Declare Function FreeImage_SwapColorsInt Lib "FreeImage.dll" Alias "_FreeImage_SwapColors@16" ( _ - ByVal Bitmap As Long, _ - ByRef ColorA As RGBQUAD, _ - ByRef ColorB As RGBQUAD, _ - ByVal IgnoreAlpha As Long) As Long - -Private Declare Function FreeImage_SwapColorsByLongInt Lib "FreeImage.dll" Alias "_FreeImage_SwapColors@16" ( _ - ByVal Bitmap As Long, _ - ByRef ColorA As Long, _ - ByRef ColorB As Long, _ - ByVal IgnoreAlpha As Long) As Long - -Private Declare Function FreeImage_ApplyPaletteIndexMappingInt Lib "FreeImage.dll" Alias "_FreeImage_ApplyPaletteIndexMapping@20" ( _ - ByVal Bitmap As Long, _ - ByVal SourceIndicesPtr As Long, _ - ByVal DestinationIndicesPtr As Long, _ - ByVal Count As Long, _ - ByVal Swap As Long) As Long - -Public Declare Function FreeImage_SwapPaletteIndices Lib "FreeImage.dll" Alias "_FreeImage_SwapPaletteIndices@12" ( _ - ByVal Bitmap As Long, _ - ByRef IndexA As Byte, _ - ByRef IndexB As Byte) As Long - -' channel processing functions -Public Declare Function FreeImage_GetChannel Lib "FreeImage.dll" Alias "_FreeImage_GetChannel@8" ( _ - ByVal Bitmap As Long, _ - ByVal Channel As FREE_IMAGE_COLOR_CHANNEL) As Long - -Private Declare Function FreeImage_SetChannelInt Lib "FreeImage.dll" Alias "_FreeImage_SetChannel@12" ( _ - ByVal BitmapDst As Long, _ - ByVal BitmapSrc As Long, _ - ByVal Channel As FREE_IMAGE_COLOR_CHANNEL) As Long - -Public Declare Function FreeImage_GetComplexChannel Lib "FreeImage.dll" Alias "_FreeImage_GetComplexChannel@8" ( _ - ByVal Bitmap As Long, _ - ByVal Channel As FREE_IMAGE_COLOR_CHANNEL) As Long - -Private Declare Function FreeImage_SetComplexChannelInt Lib "FreeImage.dll" Alias "_FreeImage_SetComplexChannel@12" ( _ - ByVal BitmapDst As Long, _ - ByVal BitmapSrc As Long, _ - ByVal Channel As FREE_IMAGE_COLOR_CHANNEL) As Long - - -' copy / paste / composite functions -Public Declare Function FreeImage_Copy Lib "FreeImage.dll" Alias "_FreeImage_Copy@20" ( _ - ByVal Bitmap As Long, _ - ByVal Left As Long, _ - ByVal Top As Long, _ - ByVal Right As Long, _ - ByVal Bottom As Long) As Long - -Private Declare Function FreeImage_PasteInt Lib "FreeImage.dll" Alias "_FreeImage_Paste@20" ( _ - ByVal BitmapDst As Long, _ - ByVal BitmapSrc As Long, _ - ByVal Left As Long, _ - ByVal Top As Long, _ - ByVal Alpha As Long) As Long - -Public Declare Function FreeImage_Composite Lib "FreeImage.dll" Alias "_FreeImage_Composite@16" ( _ - ByVal Bitmap As Long, _ - Optional ByVal UseFileBackColor As Long, _ - Optional ByRef AppBackColor As Any, _ - Optional ByVal BackgroundBitmap As Long) As Long - -Private Declare Function FreeImage_PreMultiplyWithAlphaInt Lib "FreeImage.dll" Alias "_FreeImage_PreMultiplyWithAlpha@4" ( _ - ByVal Bitmap As Long) As Long - -' background filling functions -Public Declare Function FreeImage_FillBackground Lib "FreeImage.dll" Alias "_FreeImage_FillBackground@12" ( _ - ByVal Bitmap As Long, _ - ByRef Color As Any, _ - Optional ByVal Options As FREE_IMAGE_COLOR_OPTIONS = FI_COLOR_IS_RGB_COLOR) As Long - -Public Declare Function FreeImage_EnlargeCanvas Lib "FreeImage.dll" Alias "_FreeImage_EnlargeCanvas@28" ( _ - ByVal Bitmap As Long, _ - ByVal Left As Long, _ - ByVal Top As Long, _ - ByVal Right As Long, _ - ByVal Bottom As Long, _ - ByRef Color As Any, _ - Optional ByVal Options As FREE_IMAGE_COLOR_OPTIONS = FI_COLOR_IS_RGB_COLOR) As Long - -Public Declare Function FreeImage_AllocateEx Lib "FreeImage.dll" Alias "_FreeImage_AllocateEx@36" ( _ - ByVal Width As Long, _ - ByVal Height As Long, _ - Optional ByVal BitsPerPixel As Long = 8, _ - Optional ByRef Color As Any, _ - Optional ByVal Options As FREE_IMAGE_COLOR_OPTIONS, _ - Optional ByVal PalettePtr As Long = 0, _ - Optional ByVal RedMask As Long = 0, _ - Optional ByVal GreenMask As Long = 0, _ - Optional ByVal BlueMask As Long = 0) As Long - -Public Declare Function FreeImage_AllocateExT Lib "FreeImage.dll" Alias "_FreeImage_AllocateExT@36" ( _ - ByVal ImageType As FREE_IMAGE_TYPE, _ - ByVal Width As Long, _ - ByVal Height As Long, _ - Optional ByVal BitsPerPixel As Long = 8, _ - Optional ByRef Color As Any, _ - Optional ByVal Options As FREE_IMAGE_COLOR_OPTIONS, _ - Optional ByVal PalettePtr As Long, _ - Optional ByVal RedMask As Long, _ - Optional ByVal GreenMask As Long, _ - Optional ByVal BlueMask As Long) As Long - -' miscellaneous algorithms -Public Declare Function FreeImage_MultigridPoissonSolver Lib "FreeImage.dll" Alias "_FreeImage_MultigridPoissonSolver@8" ( _ - ByVal LaplacianBitmap As Long, _ - Optional ByVal Cyles As Long = 3) As Long - - - -'-------------------------------------------------------------------------------- -' Initialization functions -'-------------------------------------------------------------------------------- - -Public Function FreeImage_IsAvailable(Optional ByRef Version As String) As Boolean - - On Error Resume Next - Version = FreeImage_GetVersion() - FreeImage_IsAvailable = (Err.Number = ERROR_SUCCESS) - On Error GoTo 0 - -End Function - - - -'-------------------------------------------------------------------------------- -' Error handling functions -'-------------------------------------------------------------------------------- - -Public Sub FreeImage_InitErrorHandler() - - ' Call this function once for using the FreeImage 3 error handling callback. - ' The 'FreeImage_ErrorHandler' function is called on each FreeImage 3 error. - - Call FreeImage_SetOutputMessage(AddressOf FreeImage_ErrorHandler) - -End Sub - -Private Sub FreeImage_ErrorHandler(ByVal Format As FREE_IMAGE_FORMAT, ByVal Message As Long) - -Dim strErrorMessage As String -Dim strImageFormat As String - - ' This function is called whenever the FreeImage 3 libraray throws an error. - ' Currently this function gets the error message and the format name of the - ' involved image type as VB string and prints both to the VB Debug console. Feel - ' free to modify this function to call an error handling routine of your own. - - strErrorMessage = pGetStringFromPointerA(Message) - strImageFormat = FreeImage_GetFormatFromFIF(Format) - - Debug.Print "[FreeImage] Error: " & strErrorMessage - Debug.Print " Image: " & strImageFormat - Debug.Print " Code: " & Format - -End Sub - - - -'-------------------------------------------------------------------------------- -' String returning functions wrappers -'-------------------------------------------------------------------------------- - -Public Function FreeImage_GetVersion() As String - - ' This function returns the version of the FreeImage 3 library - ' as VB String. - - FreeImage_GetVersion = pGetStringFromPointerA(FreeImage_GetVersionInt) - -End Function - -Public Function FreeImage_GetCopyrightMessage() As String - - ' This function returns the copyright message of the FreeImage 3 library - ' as VB String. - - FreeImage_GetCopyrightMessage = pGetStringFromPointerA(FreeImage_GetCopyrightMessageInt) - -End Function - -Public Function FreeImage_GetFormatFromFIF(ByVal Format As FREE_IMAGE_FORMAT) As String - - ' This function returns the result of the 'FreeImage_GetFormatFromFIF' function - ' as VB String. - - ' The parameter 'Format' works according to the FreeImage 3 API documentation. - - FreeImage_GetFormatFromFIF = pGetStringFromPointerA(FreeImage_GetFormatFromFIFInt(Format)) - -End Function - -Public Function FreeImage_GetFIFExtensionList(ByVal Format As FREE_IMAGE_FORMAT) As String - - ' This function returns the result of the 'FreeImage_GetFIFExtensionList' function - ' as VB String. - - ' The parameter 'Format' works according to the FreeImage 3 API documentation. - - FreeImage_GetFIFExtensionList = pGetStringFromPointerA(FreeImage_GetFIFExtensionListInt(Format)) - -End Function - -Public Function FreeImage_GetFIFDescription(ByVal Format As FREE_IMAGE_FORMAT) As String - - ' This function returns the result of the 'FreeImage_GetFIFDescription' function - ' as VB String. - - ' The parameter 'Format' works according to the FreeImage 3 API documentation. - - FreeImage_GetFIFDescription = pGetStringFromPointerA(FreeImage_GetFIFDescriptionInt(Format)) - -End Function - -Public Function FreeImage_GetFIFRegExpr(ByVal Format As FREE_IMAGE_FORMAT) As String - - ' This function returns the result of the 'FreeImage_GetFIFRegExpr' function - ' as VB String. - - ' The parameter 'Format' works according to the FreeImage 3 API documentation. - - FreeImage_GetFIFRegExpr = pGetStringFromPointerA(FreeImage_GetFIFRegExprInt(Format)) - -End Function - -Public Function FreeImage_GetFIFMimeType(ByVal Format As FREE_IMAGE_FORMAT) As String - - ' This function returns the result of the 'FreeImage_GetFIFMimeType' function - ' as VB String. - - ' The parameter 'Format' works according to the FreeImage 3 API documentation. - - FreeImage_GetFIFMimeType = pGetStringFromPointerA(FreeImage_GetFIFMimeTypeInt(Format)) - -End Function - -Public Function FreeImage_TagToString(ByVal Model As Long, _ - ByVal Tag As Long, _ - Optional ByVal Make As String) As String - - ' This function returns the result of the 'FreeImage_TagToString' function - ' as VB String. - - ' All parameters work according to the FreeImage 3 API documentation. - - FreeImage_TagToString = pGetStringFromPointerA(FreeImage_TagToStringInt(Model, Tag, Make)) - -End Function - - - -'-------------------------------------------------------------------------------- -' UNICODE dealing functions wrappers -'-------------------------------------------------------------------------------- - -Public Function FreeImage_LoadU(ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Filename As String, _ - Optional ByVal Flags As FREE_IMAGE_LOAD_OPTIONS) As Long - - ' This function is just a thin wrapper to ease the call to an - ' UNICODE function. Since VB's BSTR strings are actually UNICODE - ' strings, we just need to pass the pointer to the string data - ' returned by the (undocumented) function StrPtr(). - - FreeImage_LoadU = FreeImage_LoadUInt(Format, StrPtr(Filename), Flags) - -End Function - -Public Function FreeImage_SaveU(ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Bitmap As Long, _ - ByVal Filename As String, _ - Optional ByVal Flags As FREE_IMAGE_SAVE_OPTIONS) As Boolean - - ' This function is just a thin wrapper to ease the call to an - ' UNICODE function. Since VB's BSTR strings are actually UNICODE - ' strings, we just need to pass the pointer to the string data - ' returned by the (undocumented) function StrPtr(). - - FreeImage_SaveU = (FreeImage_SaveUInt(Format, Bitmap, StrPtr(Filename), Flags) = 1) - -End Function - -Public Function FreeImage_GetFileTypeU(ByVal Filename As String, _ - Optional ByVal Size As Long = 0) As FREE_IMAGE_FORMAT - - ' This function is just a thin wrapper to ease the call to an - ' UNICODE function. Since VB's BSTR strings are actually UNICODE - ' strings, we just need to pass the pointer to the string data - ' returned by the (undocumented) function StrPtr(). - - FreeImage_GetFileTypeU = FreeImage_GetFileTypeUInt(StrPtr(Filename), Size) - -End Function - -Public Function FreeImage_GetFIFFromFilenameU(ByVal Filename As String) As FREE_IMAGE_FORMAT - - ' This function is just a thin wrapper to ease the call to an - ' UNICODE function. Since VB's BSTR strings are actually UNICODE - ' strings, we just need to pass the pointer to the string data - ' returned by the (undocumented) function StrPtr(). - - FreeImage_GetFIFFromFilenameU = FreeImage_GetFIFFromFilenameUInt(StrPtr(Filename)) - -End Function - - - -'-------------------------------------------------------------------------------- -' Boolean returning functions wrappers -'-------------------------------------------------------------------------------- - -Public Function FreeImage_HasPixels(ByVal Bitmap As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_HasPixels = (FreeImage_HasPixelsInt(Bitmap) = 1) - -End Function - -Public Function FreeImage_HasRGBMasks(ByVal Bitmap As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_HasRGBMasks = (FreeImage_HasRGBMasksInt(Bitmap) = 1) - -End Function - - -Public Function FreeImage_Save(ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Bitmap As Long, _ - ByVal Filename As String, _ - Optional ByVal Flags As FREE_IMAGE_SAVE_OPTIONS) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_Save = (FreeImage_SaveInt(Format, Bitmap, Filename, Flags) = 1) - -End Function - -Public Function FreeImage_SaveToHandle(ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Bitmap As Long, _ - ByVal IO As Long, _ - ByVal Handle As Long, _ - Optional ByVal Flags As FREE_IMAGE_SAVE_OPTIONS) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_SaveToHandle = (FreeImage_SaveToHandleInt(Format, Bitmap, IO, Handle, Flags) = 1) - -End Function - -Public Function FreeImage_IsTransparent(ByVal Bitmap As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_IsTransparent = (FreeImage_IsTransparentInt(Bitmap) = 1) - -End Function - -Public Sub FreeImage_SetTransparent(ByVal Bitmap As Long, ByVal Value As Boolean) - - If (Value) Then - Call FreeImage_SetTransparentInt(Bitmap, 1) - Else - Call FreeImage_SetTransparentInt(Bitmap, 0) - End If - -End Sub - -Public Function FreeImage_HasBackgroundColor(ByVal Bitmap As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_HasBackgroundColor = (FreeImage_HasBackgroundColorInt(Bitmap) = 1) - -End Function - -Public Function FreeImage_GetBackgroundColor(ByVal Bitmap As Long, _ - ByRef BackColor As RGBQUAD) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_GetBackgroundColor = (FreeImage_GetBackgroundColorInt(Bitmap, BackColor) = 1) - -End Function - -Public Function FreeImage_GetBackgroundColorAsLong(ByVal Bitmap As Long, _ - ByRef BackColor As Long) As Boolean - - ' This function gets the background color of an image as FreeImage_GetBackgroundColor() does but - ' provides it's result as a Long value. - - FreeImage_GetBackgroundColorAsLong = (FreeImage_GetBackgroundColorAsLongInt(Bitmap, BackColor) = 1) - -End Function - -Public Function FreeImage_GetBackgroundColorEx(ByVal Bitmap As Long, _ - ByRef Alpha As Byte, _ - ByRef Red As Byte, _ - ByRef Green As Byte, _ - ByRef Blue As Byte) As Boolean - -Dim bkcolor As RGBQUAD - - ' This function gets the background color of an image as FreeImage_GetBackgroundColor() does but - ' provides it's result as four different byte values, one for each color component. - - FreeImage_GetBackgroundColorEx = (FreeImage_GetBackgroundColorInt(Bitmap, bkcolor) = 1) - With bkcolor - Alpha = .rgbReserved - Red = .rgbRed - Green = .rgbGreen - Blue = .rgbBlue - End With - -End Function - -Public Function FreeImage_SetBackgroundColor(ByVal Bitmap As Long, _ - ByRef BackColor As RGBQUAD) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_SetBackgroundColor = (FreeImage_SetBackgroundColorInt(Bitmap, BackColor) = 1) - -End Function - -Public Function FreeImage_SetBackgroundColorAsLong(ByVal Bitmap As Long, _ - ByVal BackColor As Long) As Boolean - - ' This function sets the background color of an image as FreeImage_SetBackgroundColor() does but - ' the color value to set must be provided as a Long value. - - FreeImage_SetBackgroundColorAsLong = (FreeImage_SetBackgroundColorAsLongInt(Bitmap, BackColor) = 1) - -End Function - -Public Function FreeImage_SetBackgroundColorEx(ByVal Bitmap As Long, _ - ByVal Alpha As Byte, _ - ByVal Red As Byte, _ - ByVal Green As Byte, _ - ByVal Blue As Byte) As Boolean - -Dim tColor As RGBQUAD - - ' This function sets the color at position (x|y) as FreeImage_SetPixelColor() does but - ' the color value to set must be provided four different byte values, one for each - ' color component. - - With tColor - .rgbReserved = Alpha - .rgbRed = Red - .rgbGreen = Green - .rgbBlue = Blue - End With - FreeImage_SetBackgroundColorEx = (FreeImage_SetBackgroundColorInt(Bitmap, tColor) = 1) - -End Function - -Public Function FreeImage_GetPixelIndex(ByVal Bitmap As Long, _ - ByVal x As Long, _ - ByVal y As Long, _ - ByRef Value As Byte) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_GetPixelIndex = (FreeImage_GetPixelIndexInt(Bitmap, x, y, Value) = 1) - -End Function - -Public Function FreeImage_GetPixelColor(ByVal Bitmap As Long, _ - ByVal x As Long, _ - ByVal y As Long, _ - ByRef Value As RGBQUAD) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_GetPixelColor = (FreeImage_GetPixelColorInt(Bitmap, x, y, Value) = 1) - -End Function - -Public Function FreeImage_GetPixelColorByLong(ByVal Bitmap As Long, _ - ByVal x As Long, _ - ByVal y As Long, _ - ByRef Value As Long) As Boolean - - ' This function gets the color at position (x|y) as FreeImage_GetPixelColor() does but - ' provides it's result as a Long value. - - FreeImage_GetPixelColorByLong = (FreeImage_GetPixelColorByLongInt(Bitmap, x, y, Value) = 1) - -End Function - -Public Function FreeImage_GetPixelColorEx(ByVal Bitmap As Long, _ - ByVal x As Long, _ - ByVal y As Long, _ - ByRef Alpha As Byte, _ - ByRef Red As Byte, _ - ByRef Green As Byte, _ - ByRef Blue As Byte) As Boolean - -Dim Value As RGBQUAD - - ' This function gets the color at position (x|y) as FreeImage_GetPixelColor() does but - ' provides it's result as four different byte values, one for each color component. - - FreeImage_GetPixelColorEx = (FreeImage_GetPixelColorInt(Bitmap, x, y, Value) = 1) - With Value - Alpha = .rgbReserved - Red = .rgbRed - Green = .rgbGreen - Blue = .rgbBlue - End With - -End Function - -Public Function FreeImage_SetPixelIndex(ByVal Bitmap As Long, _ - ByVal x As Long, _ - ByVal y As Long, _ - ByRef Value As Byte) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_SetPixelIndex = (FreeImage_SetPixelIndexInt(Bitmap, x, y, Value) = 1) - -End Function - -Public Function FreeImage_SetPixelColor(ByVal Bitmap As Long, _ - ByVal x As Long, _ - ByVal y As Long, _ - ByRef Value As RGBQUAD) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_SetPixelColor = (FreeImage_SetPixelColorInt(Bitmap, x, y, Value) = 1) - -End Function - -Public Function FreeImage_SetPixelColorByLong(ByVal Bitmap As Long, _ - ByVal x As Long, _ - ByVal y As Long, _ - ByRef Value As Long) As Boolean - - ' This function sets the color at position (x|y) as FreeImage_SetPixelColor() does but - ' the color value to set must be provided as a Long value. - - FreeImage_SetPixelColorByLong = (FreeImage_SetPixelColorByLongInt(Bitmap, x, y, Value) = 1) - -End Function - -Public Function FreeImage_SetPixelColorEx(ByVal Bitmap As Long, _ - ByVal x As Long, _ - ByVal y As Long, _ - ByVal Alpha As Byte, _ - ByVal Red As Byte, _ - ByVal Green As Byte, _ - ByVal Blue As Byte) As Boolean - -Dim Value As RGBQUAD - - ' This function sets the color at position (x|y) as FreeImage_SetPixelColor() does but - ' the color value to set must be provided four different byte values, one for each - ' color component. - - With Value - .rgbReserved = Alpha - .rgbRed = Red - .rgbGreen = Green - .rgbBlue = Blue - End With - FreeImage_SetPixelColorEx = (FreeImage_SetPixelColorInt(Bitmap, x, y, Value) = 1) - -End Function - -Public Function FreeImage_FIFSupportsReading(ByVal Format As FREE_IMAGE_FORMAT) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_FIFSupportsReading = (FreeImage_FIFSupportsReadingInt(Format) = 1) - -End Function - -Public Function FreeImage_FIFSupportsWriting(ByVal Format As FREE_IMAGE_FORMAT) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_FIFSupportsWriting = (FreeImage_FIFSupportsWritingInt(Format) = 1) - -End Function - -Public Function FreeImage_FIFSupportsExportType(ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal ImageType As FREE_IMAGE_TYPE) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_FIFSupportsExportType = (FreeImage_FIFSupportsExportTypeInt(Format, ImageType) = 1) - -End Function - -Public Function FreeImage_FIFSupportsExportBPP(ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal BitsPerPixel As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_FIFSupportsExportBPP = (FreeImage_FIFSupportsExportBPPInt(Format, BitsPerPixel) = 1) - -End Function - -Public Function FreeImage_FIFSupportsICCProfiles(ByVal Format As FREE_IMAGE_FORMAT) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_FIFSupportsICCProfiles = (FreeImage_FIFSupportsICCProfilesInt(Format) = 1) - -End Function - -Public Function FreeImage_FIFSupportsNoPixels(ByVal Format As FREE_IMAGE_FORMAT) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_FIFSupportsNoPixels = (FreeImage_FIFSupportsNoPixelsInt(Format) = 1) - -End Function - -Public Function FreeImage_CloseMultiBitmap(ByVal Bitmap As Long, _ - Optional ByVal Flags As FREE_IMAGE_SAVE_OPTIONS) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_CloseMultiBitmap = (FreeImage_CloseMultiBitmapInt(Bitmap, Flags) = 1) - -End Function - -Public Function FreeImage_MovePage(ByVal Bitmap As Long, _ - ByVal TargetPage As Long, _ - ByVal SourcePage As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_MovePage = (FreeImage_MovePageInt(Bitmap, TargetPage, SourcePage) = 1) - -End Function - -Public Function FreeImage_GetLockedPageNumbers(ByVal Bitmap As Long, _ - ByRef PagesPtr As Long, _ - ByRef Count As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_GetLockedPageNumbers = (FreeImage_GetLockedPageNumbersInt(Bitmap, PagesPtr, Count) = 1) - -End Function - -Public Function FreeImage_SaveToMemory(ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Bitmap As Long, _ - ByVal Stream As Long, _ - Optional ByVal Flags As FREE_IMAGE_SAVE_OPTIONS) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_SaveToMemory = (FreeImage_SaveToMemoryInt(Format, Bitmap, Stream, Flags) = 1) - -End Function - -Public Function FreeImage_AcquireMemory(ByVal Stream As Long, _ - ByRef DataPtr As Long, _ - ByRef SizeInBytes As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_AcquireMemory = (FreeImage_AcquireMemoryInt(Stream, DataPtr, SizeInBytes) = 1) - -End Function - -Public Function FreeImage_SeekMemory(ByVal Stream As Long, _ - ByVal Offset As Long, _ - ByVal Origin As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_SeekMemory = (FreeImage_SeekMemoryInt(Stream, Offset, Origin) = 1) - -End Function - -Public Function FreeImage_IsLittleEndian() As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_IsLittleEndian = (FreeImage_IsLittleEndianInt() = 1) - -End Function - -Public Function FreeImage_LookupX11Color(ByVal Color As String, _ - ByRef Red As Long, _ - ByRef Green As Long, _ - ByRef Blue As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_LookupX11Color = (FreeImage_LookupX11ColorInt(Color, Red, Green, Blue) = 1) - -End Function - -Public Function FreeImage_LookupSVGColor(ByVal Color As String, _ - ByRef Red As Long, _ - ByRef Green As Long, _ - ByRef Blue As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_LookupSVGColor = (FreeImage_LookupSVGColorInt(Color, Red, Green, Blue) = 1) - -End Function - -Public Function FreeImage_FindNextMetadata(ByVal hFind As Long, _ - ByRef Tag As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_FindNextMetadata = (FreeImage_FindNextMetadataInt(hFind, Tag) = 1) - -End Function - -Public Function FreeImage_CloneMetadata(ByVal BitmapDst As Long, _ - ByVal BitmapSrc As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_CloneMetadata = (FreeImage_CloneMetadataInt(BitmapDst, BitmapSrc) = 1) - -End Function - -Public Function FreeImage_GetMetadata(ByVal Model As Long, _ - ByVal Bitmap As Long, _ - ByVal Key As String, _ - ByVal Tag As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_GetMetadata = (FreeImage_GetMetadataInt(Model, Bitmap, Key, Tag) = 1) - -End Function - -Public Function FreeImage_SetMetadata(ByVal Model As Long, _ - ByVal Bitmap As Long, _ - ByVal Key As String, _ - ByVal Tag As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_SetMetadata = (FreeImage_SetMetadataInt(Model, Bitmap, Key, Tag) = 1) - -End Function - -Public Function FreeImage_SetMetadataKeyValue(ByVal Model As Long, _ - ByVal Bitmap As Long, _ - ByVal Key As String, _ - ByVal Value As String) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_SetMetadataKeyValue = (FreeImage_SetMetadataKeyValueInt(Model, Bitmap, Key, Value) = 1) - -End Function - -Public Function FreeImage_FlipHorizontal(ByVal Bitmap As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_FlipHorizontal = (FreeImage_FlipHorizontalInt(Bitmap) = 1) - -End Function - -Public Function FreeImage_FlipVertical(ByVal Bitmap As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_FlipVertical = (FreeImage_FlipVerticalInt(Bitmap) = 1) - -End Function - -Public Function FreeImage_JPEGTransform(ByVal SourceFile As String, _ - ByVal DestFile As String, _ - ByVal Operation As FREE_IMAGE_JPEG_OPERATION, _ - Optional ByVal Perfect As Boolean = True) As Boolean - -Dim lPerfect As Long - - ' Thin wrapper function returning a real VB Boolean value - - If (Perfect) Then - lPerfect = 1 - End If - FreeImage_JPEGTransform = (FreeImage_JPEGTransformInt(SourceFile, DestFile, Operation, lPerfect) = 1) - -End Function - -Public Function FreeImage_JPEGTransformU(ByVal SourceFile As String, _ - ByVal DestFile As String, _ - ByVal Operation As FREE_IMAGE_JPEG_OPERATION, _ - Optional ByVal Perfect As Boolean = True) As Boolean - -Dim lPerfect As Long - - ' Thin wrapper function returning a real VB Boolean value - - ' This function is also a thin wrapper to ease the call to an - ' UNICODE function. Since VB's BSTR strings are actually UNICODE - ' strings, we just need to pass the pointer to the string data - ' returned by the (undocumented) function StrPtr(). - - If (Perfect) Then - lPerfect = 1 - End If - FreeImage_JPEGTransformU = (FreeImage_JPEGTransformInt(StrPtr(SourceFile), StrPtr(DestFile), _ - Operation, lPerfect) = 1) - -End Function - -Public Function FreeImage_JPEGCrop(ByVal SourceFile As String, _ - ByVal DestFile As String, _ - ByVal Left As Long, _ - ByVal Top As Long, _ - ByVal Right As Long, _ - ByVal Bottom As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_JPEGCrop = (FreeImage_JPEGCropInt(SourceFile, DestFile, Left, Top, Right, Bottom) = 1) - -End Function - -Public Function FreeImage_JPEGCropU(ByVal SourceFile As String, _ - ByVal DestFile As String, _ - ByVal Left As Long, _ - ByVal Top As Long, _ - ByVal Right As Long, _ - ByVal Bottom As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - ' This function is also a thin wrapper to ease the call to an - ' UNICODE function. Since VB's BSTR strings are actually UNICODE - ' strings, we just need to pass the pointer to the string data - ' returned by the (undocumented) function StrPtr(). - - FreeImage_JPEGCropU = (FreeImage_JPEGCropInt(StrPtr(SourceFile), StrPtr(DestFile), Left, Top, _ - Right, Bottom) = 1) - -End Function - -Public Function FreeImage_JPEGTransformCombined(ByVal SourceFile As String, _ - ByVal DestFile As String, _ - ByVal Operation As FREE_IMAGE_JPEG_OPERATION, _ - ByVal Left As Long, _ - ByVal Top As Long, _ - ByVal Right As Long, _ - ByVal Bottom As Long, _ - Optional ByVal Perfect As Boolean = True) As Boolean - -Dim lPerfect As Long - - ' Thin wrapper function returning a real VB Boolean value - - If (Perfect) Then - lPerfect = 1 - End If - FreeImage_JPEGTransformCombined = (FreeImage_JPEGTransformCombinedInt(SourceFile, DestFile, _ - Operation, Left, Top, Right, Bottom, lPerfect) = 1) - -End Function - -Public Function FreeImage_JPEGTransformCombinedU(ByVal SourceFile As String, _ - ByVal DestFile As String, _ - ByVal Operation As FREE_IMAGE_JPEG_OPERATION, _ - ByVal Left As Long, _ - ByVal Top As Long, _ - ByVal Right As Long, _ - ByVal Bottom As Long, _ - Optional ByVal Perfect As Boolean = True) As Boolean - -Dim lPerfect As Long - - ' Thin wrapper function returning a real VB Boolean value - - ' This function is also a thin wrapper to ease the call to an - ' UNICODE function. Since VB's BSTR strings are actually UNICODE - ' strings, we just need to pass the pointer to the string data - ' returned by the (undocumented) function StrPtr(). - - If (Perfect) Then - lPerfect = 1 - End If - FreeImage_JPEGTransformCombinedU = (FreeImage_JPEGTransformCombinedUInt(StrPtr(SourceFile), _ - StrPtr(DestFile), Operation, Left, Top, Right, Bottom, lPerfect) = 1) - -End Function - -Public Function FreeImage_JPEGTransformCombinedFromMemory(ByVal SourceStream As Long, _ - ByVal DestStream As Long, _ - ByVal Operation As FREE_IMAGE_JPEG_OPERATION, _ - ByVal Left As Long, _ - ByVal Top As Long, _ - ByVal Right As Long, _ - ByVal Bottom As Long, _ - Optional ByVal Perfect As Boolean = True) As Boolean - -Dim lPerfect As Long - - ' Thin wrapper function returning a real VB Boolean value - - If (Perfect) Then - lPerfect = 1 - End If - FreeImage_JPEGTransformCombinedFromMemory = (FreeImage_JPEGTransformCombinedFromMemoryInt(SourceStream, _ - DestStream, Operation, Left, Top, Right, Bottom, lPerfect) = 1) - -End Function - -Public Function FreeImage_AdjustCurve(ByVal Bitmap As Long, _ - ByVal LookupTablePtr As Long, _ - ByVal Channel As FREE_IMAGE_COLOR_CHANNEL) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_AdjustCurve = (FreeImage_AdjustCurveInt(Bitmap, LookupTablePtr, Channel) = 1) - -End Function - -Public Function FreeImage_AdjustGamma(ByVal Bitmap As Long, _ - ByVal Gamma As Double) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_AdjustGamma = (FreeImage_AdjustGammaInt(Bitmap, Gamma) = 1) - -End Function - -Public Function FreeImage_AdjustBrightness(ByVal Bitmap As Long, _ - ByVal Percentage As Double) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_AdjustBrightness = (FreeImage_AdjustBrightnessInt(Bitmap, Percentage) = 1) - -End Function - -Public Function FreeImage_AdjustContrast(ByVal Bitmap As Long, _ - ByVal Percentage As Double) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_AdjustContrast = (FreeImage_AdjustContrastInt(Bitmap, Percentage) = 1) - -End Function - -Public Function FreeImage_Invert(ByVal Bitmap As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_Invert = (FreeImage_InvertInt(Bitmap) = 1) - -End Function - -Public Function FreeImage_GetHistogram(ByVal Bitmap As Long, _ - ByRef HistogramPtr As Long, _ - Optional ByVal Channel As FREE_IMAGE_COLOR_CHANNEL = FICC_BLACK) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_GetHistogram = (FreeImage_GetHistogramInt(Bitmap, HistogramPtr, Channel) = 1) - -End Function - -Public Function FreeImage_AdjustColors(ByVal Bitmap As Long, _ - Optional ByVal Brightness As Double, _ - Optional ByVal Contrast As Double, _ - Optional ByVal Gamma As Double = 1, _ - Optional ByVal Invert As Boolean) As Boolean - -Dim lInvert As Long - - ' Thin wrapper function returning a real VB Boolean value - If (Invert) Then - lInvert = 1 - End If - FreeImage_AdjustColors = (FreeImage_AdjustColorsInt(Bitmap, Brightness, Contrast, Gamma, lInvert) = 1) - -End Function - -Public Function FreeImage_SetChannel(ByVal BitmapDst As Long, _ - ByVal BitmapSrc As Long, _ - ByVal Channel As FREE_IMAGE_COLOR_CHANNEL) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_SetChannel = (FreeImage_SetChannelInt(BitmapDst, BitmapSrc, Channel) = 1) - -End Function - -Public Function FreeImage_SetComplexChannel(ByVal BitmapDst As Long, _ - ByVal BitmapSrc As Long, _ - ByVal Channel As FREE_IMAGE_COLOR_CHANNEL) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_SetComplexChannel = (FreeImage_SetComplexChannelInt(BitmapDst, BitmapSrc, Channel) = 1) - -End Function - -Public Function FreeImage_Paste(ByVal BitmapDst As Long, _ - ByVal BitmapSrc As Long, _ - ByVal Left As Long, _ - ByVal Top As Long, _ - ByVal Alpha As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_Paste = (FreeImage_PasteInt(BitmapDst, BitmapSrc, Left, Top, Alpha) = 1) - -End Function - -Public Function FreeImage_PreMultiplyWithAlpha(ByVal Bitmap As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_PreMultiplyWithAlpha = (FreeImage_PreMultiplyWithAlphaInt(Bitmap) = 1) - -End Function - -Public Function FreeImage_FillBackgroundEx(ByVal Bitmap As Long, _ - ByRef Color As RGBQUAD, _ - Optional ByVal Options As FREE_IMAGE_COLOR_OPTIONS) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_FillBackgroundEx = (FreeImage_FillBackground(Bitmap, Color, Options) = 1) - -End Function - -Public Function FreeImage_FillBackgroundByLong(ByVal Bitmap As Long, _ - ByRef Color As Long, _ - Optional ByVal Options As FREE_IMAGE_COLOR_OPTIONS) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_FillBackgroundByLong = (FreeImage_FillBackground(Bitmap, Color, Options) = 1) - -End Function - -Public Function FreeImage_SetThumbnail(ByVal Bitmap As Long, ByVal Thumbnail As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_SetThumbnail = (FreeImage_SetThumbnailInt(Bitmap, Thumbnail) = 1) - -End Function - -Public Function FreeImage_OpenMultiBitmap(ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Filename As String, _ - Optional ByVal CreateNew As Boolean, _ - Optional ByVal ReadOnly As Boolean, _ - Optional ByVal KeepCacheInMemory As Boolean, _ - Optional ByVal Flags As FREE_IMAGE_LOAD_OPTIONS) As Long - - FreeImage_OpenMultiBitmap = FreeImage_OpenMultiBitmapInt(Format, Filename, IIf(CreateNew, 1, 0), _ - IIf(ReadOnly And Not CreateNew, 1, 0), IIf(KeepCacheInMemory, 1, 0), Flags) - -End Function - -Public Sub FreeImage_UnlockPage(ByVal Bitmap As Long, ByVal PageBitmap As Long, ByVal ApplyChanges As Boolean) - -Dim lApplyChanges As Long - - If (ApplyChanges) Then - lApplyChanges = 1 - End If - Call FreeImage_UnlockPageInt(Bitmap, PageBitmap, lApplyChanges) - -End Sub - -Public Function FreeImage_RotateEx(ByVal Bitmap As Long, _ - ByVal Angle As Double, _ - Optional ByVal ShiftX As Double, _ - Optional ByVal ShiftY As Double, _ - Optional ByVal OriginX As Double, _ - Optional ByVal OriginY As Double, _ - Optional ByVal UseMask As Boolean) As Long - -Dim lUseMask As Long - - If (UseMask) Then - lUseMask = 1 - End If - FreeImage_RotateEx = FreeImage_RotateExInt(Bitmap, Angle, ShiftX, ShiftY, OriginX, OriginY, lUseMask) - -End Function - -Public Function FreeImage_MakeThumbnail(ByVal Bitmap As Long, _ - ByVal MaxPixelSize As Long, _ - Optional ByVal Convert As Boolean) As Long - -Dim lConvert As Long - - If (Convert) Then - lConvert = 1 - End If - FreeImage_MakeThumbnail = FreeImage_MakeThumbnailInt(Bitmap, MaxPixelSize, lConvert) - -End Function - -Public Function FreeImage_GetAdjustColorsLookupTable(ByVal LookupTablePtr As Long, _ - Optional ByVal Brightness As Double, _ - Optional ByVal Contrast As Double, _ - Optional ByVal Gamma As Double, _ - Optional ByVal Invert As Boolean) As Long - -Dim lInvert As Long - - If (Invert) Then - lInvert = 1 - End If - FreeImage_GetAdjustColorsLookupTable = FreeImage_GetAdjustColorsLookupTableInt(LookupTablePtr, _ - Brightness, Contrast, Gamma, lInvert) - -End Function - -Public Function FreeImage_ApplyColorMapping(ByVal Bitmap As Long, _ - ByVal SourceColorsPtr As Long, _ - ByVal DestinationColorsPtr As Long, _ - ByVal Count As Long, _ - Optional ByVal IgnoreAlpha As Boolean = True, _ - Optional ByVal Swap As Boolean) As Long - -Dim lIgnoreAlpha As Long -Dim lSwap As Long - - If (IgnoreAlpha) Then - lIgnoreAlpha = 1 - End If - If (Swap) Then - lSwap = 1 - End If - FreeImage_ApplyColorMapping = FreeImage_ApplyColorMappingInt(Bitmap, SourceColorsPtr, _ - DestinationColorsPtr, Count, lIgnoreAlpha, lSwap) - -End Function - -Public Function FreeImage_SwapColors(ByVal Bitmap As Long, _ - ByRef ColorA As RGBQUAD, _ - ByRef ColorB As RGBQUAD, _ - Optional ByVal IgnoreAlpha As Boolean = True) As Long - -Dim lIgnoreAlpha As Long - - If (IgnoreAlpha) Then - lIgnoreAlpha = 1 - End If - FreeImage_SwapColors = FreeImage_SwapColorsInt(Bitmap, ColorA, ColorB, lIgnoreAlpha) - -End Function - -Public Function FreeImage_SwapColorsByLong(ByVal Bitmap As Long, _ - ByRef ColorA As Long, _ - ByRef ColorB As Long, _ - Optional ByVal IgnoreAlpha As Boolean = True) As Long - -Dim lIgnoreAlpha As Long - - If (IgnoreAlpha) Then - lIgnoreAlpha = 1 - End If - FreeImage_SwapColorsByLong = FreeImage_SwapColorsByLongInt(Bitmap, ColorA, ColorB, _ - lIgnoreAlpha) - -End Function - -Public Function FreeImage_ApplyPaletteIndexMapping(ByVal Bitmap As Long, _ - ByVal SourceIndicesPtr As Long, _ - ByVal DestinationIndicesPtr As Long, _ - ByVal Count As Long, _ - Optional ByVal Swap As Boolean) As Long - -Dim lSwap As Long - - If (Swap) Then - lSwap = 1 - End If - FreeImage_ApplyPaletteIndexMapping = FreeImage_ApplyPaletteIndexMappingInt(Bitmap, SourceIndicesPtr, _ - DestinationIndicesPtr, Count, lSwap) - -End Function - -Public Function FreeImage_ConvertFromRawBits(ByVal BitsPtr As Long, _ - ByVal Width As Long, _ - ByVal Height As Long, _ - ByVal Pitch As Long, _ - ByVal BitsPerPixel As Long, _ - Optional ByVal RedMask As Long, _ - Optional ByVal GreenMask As Long, _ - Optional ByVal BlueMask As Long, _ - Optional ByVal TopDown As Boolean) As Long - -Dim lTopDown As Long - - If (TopDown) Then - lTopDown = 1 - End If - FreeImage_ConvertFromRawBits = FreeImage_ConvertFromRawBitsInt(BitsPtr, Width, Height, Pitch, _ - BitsPerPixel, RedMask, GreenMask, BlueMask, lTopDown) - -End Function - -Public Function FreeImage_ConvertFromRawBitsEx(ByVal CopySource As Boolean, _ - ByVal BitsPtr As Long, _ - ByVal ImageType As FREE_IMAGE_TYPE, _ - ByVal Width As Long, _ - ByVal Height As Long, _ - ByVal Pitch As Long, _ - ByVal BitsPerPixel As Long, _ - Optional ByVal RedMask As Long, _ - Optional ByVal GreenMask As Long, _ - Optional ByVal BlueMask As Long, _ - Optional ByVal TopDown As Boolean) As Long - -Dim lCopySource As Long -Dim lTopDown As Long - - If (CopySource) Then - lCopySource = 1 - End If - If (TopDown) Then - lTopDown = 1 - End If - FreeImage_ConvertFromRawBitsEx = FreeImage_ConvertFromRawBitsExInt(lCopySource, BitsPtr, ImageType, _ - Width, Height, Pitch, BitsPerPixel, RedMask, GreenMask, BlueMask, lTopDown) - -End Function - -Public Sub FreeImage_ConvertToRawBits(ByVal BitsPtr As Long, _ - ByVal Bitmap As Long, _ - ByVal Pitch As Long, _ - ByVal BitsPerPixel As Long, _ - Optional ByVal RedMask As Long, _ - Optional ByVal GreenMask As Long, _ - Optional ByVal BlueMask As Long, _ - Optional ByVal TopDown As Boolean) - -Dim lTopDown As Long - - If (TopDown) Then - lTopDown = 1 - End If - Call FreeImage_ConvertToRawBitsInt(BitsPtr, Bitmap, Pitch, _ - BitsPerPixel, RedMask, GreenMask, BlueMask, lTopDown) - -End Sub - -Public Function FreeImage_ConvertToStandardType(ByVal Bitmap As Long, _ - Optional ByVal ScaleLinear As Boolean = True) As Long - - If (ScaleLinear) Then - FreeImage_ConvertToStandardType = FreeImage_ConvertToStandardTypeInt(Bitmap, 1) - Else - FreeImage_ConvertToStandardType = FreeImage_ConvertToStandardTypeInt(Bitmap, 0) - End If - -End Function - -Public Function FreeImage_ConvertToType(ByVal Bitmap As Long, _ - ByVal DestinationType As FREE_IMAGE_TYPE, _ - Optional ByVal ScaleLinear As Boolean = True) As Long - - If (ScaleLinear) Then - FreeImage_ConvertToType = FreeImage_ConvertToTypeInt(Bitmap, DestinationType, 1) - Else - FreeImage_ConvertToType = FreeImage_ConvertToTypeInt(Bitmap, DestinationType, 0) - End If - -End Function - - - -'-------------------------------------------------------------------------------- -' Color conversion helper functions -'-------------------------------------------------------------------------------- - -Public Function ConvertColor(ByVal Color As Long) As Long - - ' This helper function converts a VB-style color value (like vbRed), which - ' uses the ABGR format into a RGBQUAD compatible color value, using the ARGB - ' format, needed by FreeImage and vice versa. - - ConvertColor = ((Color And &HFF000000) Or _ - ((Color And &HFF&) * &H10000) Or _ - ((Color And &HFF00&)) Or _ - ((Color And &HFF0000) \ &H10000)) - -End Function - -Public Function ConvertOleColor(ByVal Color As OLE_COLOR) As Long - - ' This helper function converts an OLE_COLOR value (like vbButtonFace), which - ' uses the BGR format into a RGBQUAD compatible color value, using the ARGB - ' format, needed by FreeImage. - - ' This function generally ingnores the specified color's alpha value but, in - ' contrast to ConvertColor, also has support for system colors, which have the - ' format &H80bbggrr. - - ' You should not use this function to convert any color provided by FreeImage - ' in ARGB format into a VB-style ABGR color value. Use function ConvertColor - ' instead. - -Dim lColorRef As Long - - If (OleTranslateColor(Color, 0, lColorRef) = 0) Then - ConvertOleColor = ConvertColor(lColorRef) - End If - -End Function - - - -'-------------------------------------------------------------------------------- -' Extended functions derived from FreeImage 3 functions usually dealing -' with arrays -'-------------------------------------------------------------------------------- - -Public Sub FreeImage_UnloadEx(ByRef Bitmap As Long) - - ' Extended version of FreeImage_Unload, which additionally sets the - ' passed Bitmap handle to zero after unloading. - - If (Bitmap <> 0) Then - Call FreeImage_Unload(Bitmap) - Bitmap = 0 - End If - -End Sub - -Public Function FreeImage_GetPaletteEx(ByVal Bitmap As Long) As RGBQUAD() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long - - ' This function returns a VB style array of type RGBQUAD, containing - ' the palette data of the Bitmap. This array provides read and write access - ' to the actual palette data provided by FreeImage. This is done by - ' creating a VB array with an own SAFEARRAY descriptor making the - ' array point to the palette pointer returned by FreeImage_GetPalette(). - - ' This makes you use code like you would in C/C++: - - ' // this code assumes there is a bitmap loaded and - ' // present in a variable called ‘dib’ - ' if(FreeImage_GetBPP(Bitmap) == 8) { - ' // Build a greyscale palette - ' RGBQUAD *pal = FreeImage_GetPalette(Bitmap); - ' for (int i = 0; i < 256; i++) { - ' pal[i].rgbRed = i; - ' pal[i].rgbGreen = i; - ' pal[i].rgbBlue = i; - ' } - - ' As in C/C++ the array is only valid while the DIB is loaded and the - ' palette data remains where the pointer returned by FreeImage_GetPalette - ' has pointed to when this function was called. So, a good thing would - ' be, not to keep the returned array in scope over the lifetime of the - ' Bitmap. Best practise is, to use this function within another routine and - ' assign the return value (the array) to a local variable only. As soon - ' as this local variable goes out of scope (when the calling function - ' returns to it's caller), the array and the descriptor is automatically - ' cleaned up by VB. - - ' This function does not make a deep copy of the palette data, but only - ' wraps a VB array around the FreeImage palette data. So, it can be called - ' frequently "on demand" or somewhat "in place" without a significant - ' performance loss. - - ' To learn more about this technique I recommend reading chapter 2 (Leveraging - ' Arrays) of Matthew Curland's book "Advanced Visual Basic 6" - - ' The parameter 'Bitmap' works according to the FreeImage 3 API documentation. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the FreeImage_DestroyLockedArrayRGBQUAD() function. - - - If (Bitmap) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 4 ' size in bytes of RGBQUAD structure - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetColorsUsed(Bitmap) ' the number of elements in the array is - ' the number of used colors in the Bitmap - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetPalette(Bitmap) ' let the array point to the memory block, the - ' FreeImage palette pointer points to - End With - - ' allocate memory for an array descriptor - ' we cannot use the memory block used by tSA, since it is - ' released when tSA goes out of scope, leaving us with an - ' array with zeroed descriptor - ' we use nearly the same method that VB uses, so VB is able - ' to cleanup the array variable and it's descriptor; the - ' array data is not touched when cleaning up, since both AUTO - ' and FIXEDSIZE flags are set - Call SafeArrayAllocDescriptor(1, lpSA) - - ' copy our own array descriptor over the descriptor allocated - ' by SafeArrayAllocDescriptor; lpSA is a pointer to that memory - ' location - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - - ' the implicit variable named as the function is an array variable in VB - ' make it point to the allocated array descriptor - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetPaletteEx), lpSA, 4) - End If - -End Function - -Public Function FreeImage_GetPaletteExClone(ByVal Bitmap As Long) As RGBQUAD() - -Dim lColors As Long -Dim atPal() As RGBQUAD - - ' This function returns a redundant clone of a Bitmap's palette as a - ' VB style array of type RGBQUAD. - - ' The parameter 'Bitmap' works according to the FreeImage 3 API documentation. - - lColors = FreeImage_GetColorsUsed(Bitmap) - If (lColors > 0) Then - ReDim atPal(lColors - 1) - Call CopyMemory(atPal(0), ByVal FreeImage_GetPalette(Bitmap), lColors * 4) - Call pSwap(ByVal VarPtrArray(atPal), ByVal VarPtrArray(FreeImage_GetPaletteExClone)) - End If - -End Function - -Public Function FreeImage_GetPaletteExLong(ByVal Bitmap As Long) As Long() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long - - ' This function returns a VB style array of type Long, containing - ' the palette data of the Bitmap. This array provides read and write access - ' to the actual palette data provided by FreeImage. This is done by - ' creating a VB array with an own SAFEARRAY descriptor making the - ' array point to the palette pointer returned by FreeImage_GetPalette(). - - ' The function actually returns an array of type RGBQUAD with each - ' element packed into a Long. This is possible, since the RGBQUAD - ' structure is also four bytes in size. Palette data, stored in an - ' array of type Long may be passed ByRef to a function through an - ' optional paremeter. For an example have a look at function - ' FreeImage_ConvertColorDepth() - - ' This makes you use code like you would in C/C++: - - ' // this code assumes there is a bitmap loaded and - ' // present in a variable called ‘dib’ - ' if(FreeImage_GetBPP(Bitmap) == 8) { - ' // Build a greyscale palette - ' RGBQUAD *pal = FreeImage_GetPalette(Bitmap); - ' for (int i = 0; i < 256; i++) { - ' pal[i].rgbRed = i; - ' pal[i].rgbGreen = i; - ' pal[i].rgbBlue = i; - ' } - - ' As in C/C++ the array is only valid while the DIB is loaded and the - ' palette data remains where the pointer returned by FreeImage_GetPalette() - ' has pointed to when this function was called. So, a good thing would - ' be, not to keep the returned array in scope over the lifetime of the - ' Bitmap. Best practise is, to use this function within another routine and - ' assign the return value (the array) to a local variable only. As soon - ' as this local variable goes out of scope (when the calling function - ' returns to it's caller), the array and the descriptor is automatically - ' cleaned up by VB. - - ' This function does not make a deep copy of the palette data, but only - ' wraps a VB array around the FreeImage palette data. So, it can be called - ' frequently "on demand" or somewhat "in place" without a significant - ' performance loss. - - ' To learn more about this technique I recommend reading chapter 2 (Leveraging - ' Arrays) of Matthew Curland's book "Advanced Visual Basic 6" - - ' The parameter 'Bitmap' works according to the FreeImage 3 API documentation. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArray' function. - - - If (Bitmap) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 4 ' size in bytes of RGBQUAD structure - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetColorsUsed(Bitmap) ' the number of elements in the array is - ' the number of used colors in the Bitmap - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetPalette(Bitmap) ' let the array point to the memory block, the - ' FreeImage palette pointer points to - End With - - ' allocate memory for an array descriptor - ' we cannot use the memory block used by tSA, since it is - ' released when tSA goes out of scope, leaving us with an - ' array with zeroed descriptor - ' we use nearly the same method that VB uses, so VB is able - ' to cleanup the array variable and it's descriptor; the - ' array data is not touched when cleaning up, since both AUTO - ' and FIXEDSIZE flags are set - Call SafeArrayAllocDescriptor(1, lpSA) - - ' copy our own array descriptor over the descriptor allocated - ' by SafeArrayAllocDescriptor; lpSA is a pointer to that memory - ' location - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - - ' the implicit variable named as the function is an array variable in VB - ' make it point to the allocated array descriptor - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetPaletteExLong), lpSA, 4) - End If - -End Function - -Public Function FreeImage_GetPaletteExLongClone(ByVal Bitmap As Long) As Long() - -Dim lColors As Long -Dim alPal() As Long - - ' This function returns a redundant clone of a Bitmap's palette as a - ' VB style array of type Long. - - ' The parameter 'Bitmap' works according to the FreeImage 3 API documentation. - - lColors = FreeImage_GetColorsUsed(Bitmap) - If (lColors > 0) Then - ReDim alPal(lColors - 1) - Call CopyMemory(alPal(0), ByVal FreeImage_GetPalette(Bitmap), lColors * 4) - Call pSwap(ByVal VarPtrArray(alPal), ByVal VarPtrArray(FreeImage_GetPaletteExLongClone)) - End If - -End Function - -Public Function FreeImage_SetPalette(ByVal Bitmap As Long, ByRef Palette() As RGBQUAD) As Long - - ' This function sets the palette of a palletised bitmap using a RGBQUAD array. Does - ' nothing on high color bitmaps. - - ' This operation makes a deep copy of the provided palette data so, after this function - ' has returned, changes to the RGBQUAD array are no longer reflected by the bitmap's - ' palette. - - FreeImage_SetPalette = FreeImage_GetColorsUsed(Bitmap) - If (FreeImage_SetPalette > 0) Then - Call CopyMemory(ByVal FreeImage_GetPalette(Bitmap), Palette(0), FreeImage_SetPalette * 4) - End If - -End Function - -Public Function FreeImage_SetPaletteLong(ByVal Bitmap As Long, ByRef Palette() As Long) As Long - - ' This function sets the palette of a palletised bitmap using a RGBQUAD array. Does - ' nothing on high color bitmaps. - - ' This operation makes a deep copy of the provided palette data so, after this function - ' has returned, changes to the Long array are no longer reflected by the bitmap's - ' palette. - - FreeImage_SetPaletteLong = FreeImage_GetColorsUsed(Bitmap) - If (FreeImage_SetPaletteLong > 0) Then - Call CopyMemory(ByVal FreeImage_GetPalette(Bitmap), Palette(0), FreeImage_SetPaletteLong * 4) - End If - -End Function - -Public Function FreeImage_GetTransparencyTableEx(ByVal Bitmap As Long) As Byte() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long - - ' This function returns a VB style Byte array, containing the transparency - ' table of the Bitmap. This array provides read and write access to the actual - ' transparency table provided by FreeImage. This is done by creating a VB array - ' with an own SAFEARRAY descriptor making the array point to the transparency - ' table pointer returned by FreeImage_GetTransparencyTable(). - - ' This makes you use code like you would in C/C++: - - ' // this code assumes there is a bitmap loaded and - ' // present in a variable called ‘dib’ - ' if(FreeImage_GetBPP(Bitmap) == 8) { - ' // Remove transparency information - ' byte *transt = FreeImage_GetTransparencyTable(Bitmap); - ' for (int i = 0; i < 256; i++) { - ' transt[i].rgbRed = 255; - ' } - - ' As in C/C++ the array is only valid while the DIB is loaded and the transparency - ' table remains where the pointer returned by FreeImage_GetTransparencyTable() has - ' pointed to when this function was called. So, a good thing would be, not to keep - ' the returned array in scope over the lifetime of the DIB. Best practise is, to use - ' this function within another routine and assign the return value (the array) to a - ' local variable only. As soon as this local variable goes out of scope (when the - ' calling function returns to it's caller), the array and the descriptor is - ' automatically cleaned up by VB. - - ' This function does not make a deep copy of the transparency table, but only - ' wraps a VB array around the FreeImage transparency table. So, it can be called - ' frequently "on demand" or somewhat "in place" without a significant - ' performance loss. - - ' To learn more about this technique I recommend reading chapter 2 (Leveraging - ' Arrays) of Matthew Curland's book "Advanced Visual Basic 6" - - ' The parameter 'Bitmap' works according to the FreeImage 3 API documentation. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the FreeImage_DestroyLockedArray() function. - - - If (Bitmap) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 1 ' size in bytes of a byte element - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetTransparencyCount(Bitmap) ' the number of elements in the array is - ' equal to the number transparency table entries - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetTransparencyTable(Bitmap) ' let the array point to the memory block, the - ' FreeImage transparency table pointer points to - End With - - ' allocate memory for an array descriptor - ' we cannot use the memory block used by tSA, since it is - ' released when tSA goes out of scope, leaving us with an - ' array with zeroed descriptor - ' we use nearly the same method that VB uses, so VB is able - ' to cleanup the array variable and it's descriptor; the - ' array data is not touched when cleaning up, since both AUTO - ' and FIXEDSIZE flags are set - Call SafeArrayAllocDescriptor(1, lpSA) - - ' copy our own array descriptor over the descriptor allocated - ' by SafeArrayAllocDescriptor(); lpSA is a pointer to that memory - ' location - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - - ' the implicit variable named as the function is an array variable in VB - ' make it point to the allocated array descriptor - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetTransparencyTableEx), lpSA, 4) - End If - -End Function - -Public Function FreeImage_GetTransparencyTableExClone(ByVal Bitmap As Long) As Byte() - -Dim abBuffer() As Byte -Dim lpTransparencyTable As Long -Dim lEntries As Long - - ' This function returns a copy of a DIB's transparency table as VB style - ' array of type Byte. So, the array provides read access only from the DIB's - ' point of view. - - ' The parameter 'Bitmap' works according to the FreeImage 3 API documentation. - - lpTransparencyTable = FreeImage_GetTransparencyTable(Bitmap) - If (lpTransparencyTable) Then - lEntries = FreeImage_GetTransparencyCount(Bitmap) - If (lEntries > 0) Then - ReDim abBuffer(lEntries - 1) - Call CopyMemory(abBuffer(0), ByVal lpTransparencyTable, lEntries) - Call pSwap(ByVal VarPtrArray(abBuffer), ByVal VarPtrArray( _ - FreeImage_GetTransparencyTableExClone)) - End If - End If - -End Function - -Public Sub FreeImage_SetTransparencyTableEx(ByVal Bitmap As Long, _ - ByRef Table() As Byte, _ - Optional ByRef Count As Long = -1) - - ' This function sets a DIB's transparency table to the contents of the - ' parameter table(). When the optional parameter Count is omitted, the - ' number of entries used is taken from the number of elements stored in - ' the array, but will never be never greater than 256. - - ' The parameter 'Bitmap' works according to the FreeImage 3 API documentation. - - If ((Count > UBound(Table) + 1) Or _ - (Count < 0)) Then - Count = UBound(Table) + 1 - End If - - If (Count > 256) Then - Count = 256 - End If - - Call FreeImage_SetTransparencyTable(Bitmap, VarPtr(Table(0)), Count) - -End Sub - -Public Function FreeImage_IsTransparencyTableTransparent(ByVal Bitmap As Long) As Boolean - -Dim abTransTable() As Byte -Dim i As Long - - ' This function checks whether a Bitmap's transparency table contains any transparent - ' colors or not. - - ' When an image has a transparency table and is transparent, what can be tested - ' with 'FreeImage_IsTransparent()', the image still may display opaque when there - ' are no transparent colors defined in the image's transparency table. This - ' function reads the Bitmap's transparency table directly to determine whether - ' there are transparent colors defined or not. - - ' The return value of this function does not relay on the image's transparency - ' setting but only on the image's transparency table - - If (Bitmap) Then - abTransTable = FreeImage_GetTransparencyTableEx(Bitmap) - For i = 0 To UBound(abTransTable) - FreeImage_IsTransparencyTableTransparent = (abTransTable(i) < 255) - If (FreeImage_IsTransparencyTableTransparent) Then - Exit For - End If - Next i - End If - -End Function - -Public Function FreeImage_GetAdjustColorsLookupTableEx(ByRef LookupTable() As Byte, _ - Optional ByVal Brightness As Double, _ - Optional ByVal Contrast As Double, _ - Optional ByVal Gamma As Double = 1, _ - Optional ByVal Invert As Boolean) As Long - - ' This function is an extended wrapper for FreeImage_GetAdjustColorsLookupTable(), which - ' takes a real VB style Byte array LUT() to receive the created lookup table. The LUT() - ' parameter must not be fixed sized or locked, since it is (re-)dimensioned in this - ' function to contain 256 entries. - - ' All parameters work according to the FreeImage 3 API documentation. - - ReDim LookupTable(255) - FreeImage_GetAdjustColorsLookupTableEx = _ - FreeImage_GetAdjustColorsLookupTable(VarPtr(LookupTable(0)), Brightness, Contrast, _ - Gamma, Invert) - -End Function - -Public Function FreeImage_ApplyColorMappingEx(ByVal Bitmap As Long, _ - ByRef SourceColors() As RGBQUAD, _ - ByRef DestinationColors() As RGBQUAD, _ - Optional ByRef Count As Long = -1, _ - Optional ByVal IgnoreAlpha As Boolean = True, _ - Optional ByVal Swap As Boolean) As Long - -Dim nsrc As Long -Dim ndst As Long - - ' This function is an extended wrapper for FreeImage_ApplyColorMapping(), which takes - ' real VB style RGBQUAD arrays for source and destination colors along with an optional - ' ByRef Count parameter. - - ' If 'Count' is omitted upon entry, the number of entries of the smaller of both arrays - ' is used for 'Count' and also passed back to the caller, due to this parameter's ByRef - ' nature. - - ' All other parameters work according to the FreeImage 3 API documentation. - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to map colors on a 'header-only' bitmap.") - End If - - nsrc = UBound(SourceColors) + 1 - ndst = UBound(DestinationColors) + 1 - If (Count = -1) Then - If (nsrc < ndst) Then - Count = nsrc - Else - Count = ndst - End If - Else - If (Count < nsrc) Then - Count = nsrc - End If - If (Count < ndst) Then - Count = ndst - End If - End If - - FreeImage_ApplyColorMappingEx = FreeImage_ApplyColorMapping(Bitmap, _ - VarPtr(SourceColors(0)), VarPtr(DestinationColors(0)), Count, IgnoreAlpha, Swap) - End If - -End Function - -Public Function FreeImage_ApplyPaletteIndexMappingEx(ByVal Bitmap As Long, _ - ByRef SourceIndices() As Byte, _ - ByRef DestinationIndices() As Byte, _ - Optional ByRef Count As Long = -1, _ - Optional ByVal Swap As Boolean) As Long - -Dim nsrc As Long -Dim ndst As Long -Dim lSwap As Long - - ' This function is an extended wrapper for FreeImage_ApplyIndexMapping(), which takes - ' real VB style Byte arrays for source and destination indices along with an optional - ' ByRef count parameter. - - ' If 'Count' is omitted upon entry, the number of entries of the smaller of both arrays - ' is used for 'Count' and also passed back to the caller, due to this parameter's ByRef - ' nature. - - ' All other parameters work according to the FreeImage 3 API documentation. - - - nsrc = UBound(SourceIndices) + 1 - ndst = UBound(DestinationIndices) + 1 - If (Count = -1) Then - If (nsrc < ndst) Then - Count = nsrc - Else - Count = ndst - End If - Else - If (Count < nsrc) Then - Count = nsrc - End If - If (Count < ndst) Then - Count = ndst - End If - End If - - If (Swap) Then - lSwap = 1 - End If - - FreeImage_ApplyPaletteIndexMappingEx = FreeImage_ApplyPaletteIndexMappingInt(Bitmap, _ - VarPtr(SourceIndices(0)), VarPtr(DestinationIndices(0)), Count, lSwap) - -End Function - -Public Function FreeImage_ConvertFromRawBitsArray(ByRef Bits() As Byte, _ - ByVal Width As Long, _ - ByVal Height As Long, _ - ByVal Pitch As Long, _ - ByVal BitsPerPixel As Long, _ - Optional ByVal RedMask As Long, _ - Optional ByVal GreenMask As Long, _ - Optional ByVal BlueMask As Long, _ - Optional ByVal TopDown As Boolean) As Long - - FreeImage_ConvertFromRawBitsArray = FreeImage_ConvertFromRawBits(VarPtr(Bits(0)), Width, Height, Pitch, _ - BitsPerPixel, RedMask, GreenMask, BlueMask, TopDown) - -End Function - -Public Sub FreeImage_ConvertToRawBitsArray(ByRef Bits() As Byte, _ - ByVal Bitmap As Long, _ - ByVal Pitch As Long, _ - ByVal BitsPerPixel As Long, _ - Optional ByVal RedMask As Long, _ - Optional ByVal GreenMask As Long, _ - Optional ByVal BlueMask As Long, _ - Optional ByVal TopDown As Boolean) - -Dim lHeight As Long - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to convert a 'header-only' bitmap.") - End If - - If (Pitch > 0) Then - lHeight = FreeImage_GetHeight(Bitmap) - ReDim Bits((Pitch * lHeight) - 1) - Call FreeImage_ConvertToRawBits(VarPtr(Bits(0)), Bitmap, Pitch, _ - BitsPerPixel, RedMask, GreenMask, BlueMask, TopDown) - End If - End If - -End Sub - -Public Function FreeImage_GetHistogramEx(ByVal Bitmap As Long, _ - Optional ByVal Channel As FREE_IMAGE_COLOR_CHANNEL = FICC_BLACK, _ - Optional ByRef Success As Boolean) As Long() - -Dim alResult() As Long - - ' This function returns a DIB's histogram data as VB style array of - ' type Long. Since histogram data is never modified directly, it seems - ' enough to return a clone of the data and no read/write accessible - ' array wrapped around the actual pointer. - - ' All parameters work according to the FreeImage 3 API documentation. - - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to get histogram of a 'header-only' bitmap.") - End If - - ReDim alResult(255) - Success = (FreeImage_GetHistogramInt(Bitmap, alResult(0), Channel) = 1) - If (Success) Then - Call pSwap(VarPtrArray(FreeImage_GetHistogramEx), VarPtrArray(alResult)) - End If - End If - -End Function - -Public Function FreeImage_AdjustCurveEx(ByVal Bitmap As Long, _ - ByRef LookupTable As Variant, _ - Optional ByVal Channel As FREE_IMAGE_COLOR_CHANNEL = FICC_BLACK) As Boolean - -Dim lpData As Long -Dim lSizeInBytes As Long - - ' This function extends the FreeImage function 'FreeImage_AdjustCurve' - ' to a more VB suitable function. The parameter 'LookupTable' may - ' either be an array of type Byte or may contain the pointer to a memory - ' block, what in VB is always the address of the memory block, since VB - ' actually doesn's support native pointers. - - ' In case of providing the memory block as an array, make sure, that the - ' array contains exactly 256 items. In case of providing an address of a - ' memory block, the size of the memory block is assumed to be 256 bytes - ' and it is up to the caller to ensure that it is large enough. - - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to adjust a 'header-only' bitmap.") - End If - - If (IsArray(LookupTable)) Then - lpData = pGetMemoryBlockPtrFromVariant(LookupTable, lSizeInBytes) - - ElseIf (IsNumeric(LookupTable)) Then - lSizeInBytes = 256 - lpData = CLng(LookupTable) - - End If - - If ((lpData <> 0) And (lSizeInBytes = 256)) Then - FreeImage_AdjustCurveEx = (FreeImage_AdjustCurveInt(Bitmap, lpData, Channel) = 1) - End If - End If - -End Function - -Public Function FreeImage_GetLockedPageNumbersEx(ByVal Bitmap As Long, _ - Optional ByRef Count As Long) As Long() - -Dim lpPages As Long -Dim alResult() As Long - - ' This function extends the FreeImage function FreeImage_GetLockedPageNumbers() - ' to a more VB suitable function. The original FreeImage parameter 'pages', which - ' is a pointer to an array of Long, containing all locked page numbers, was turned - ' into a return value, which is a real VB-style array of type Long. The original - ' Boolean return value, indicating if there are any locked pages, was dropped from - ' this function. The caller has to check the 'Count' parameter, which works according - ' to the FreeImage API documentation. - - ' This function returns an array of Longs, dimensioned from 0 to (Count - 1), that - ' contains the page numbers of all currently locked pages of 'BITMAP', if 'Count' is - ' greater than 0 after the function returns. If 'Count' is 0, there are no pages - ' locked and the function returns an uninitialized array. - - - If (FreeImage_GetLockedPageNumbersInt(Bitmap, lpPages, Count) = 1) Then - ReDim alResult(Count - 1) - Call CopyMemory(alResult(0), ByVal lpPages, Count * 4) - End If - -End Function - -' Memory and Stream functions - -Public Function FreeImage_GetFileTypeFromMemoryEx(ByRef Data As Variant, _ - Optional ByRef SizeInBytes As Long) As FREE_IMAGE_FORMAT - -Dim hStream As Long -Dim lDataPtr As Long - - ' This function extends the FreeImage function FreeImage_GetFileTypeFromMemory() - ' to a more VB suitable function. The parameter data of type Variant my - ' me either an array of type Byte, Integer or Long or may contain the pointer - ' to a memory block, what in VB is always the address of the memory block, - ' since VB actually doesn's support native pointers. - - ' In case of providing the memory block as an array, the SizeInBytes may - ' be omitted, zero or less than zero. Then, the size of the memory block - ' is calculated correctly. When SizeInBytes is given, it is up to the caller - ' to ensure, it is correct. - - ' In case of providing an address of a memory block, SizeInBytes must not - ' be omitted. - - - ' get both pointer and size in bytes of the memory block provided - ' through the Variant parameter 'data'. - lDataPtr = pGetMemoryBlockPtrFromVariant(Data, SizeInBytes) - - ' open the memory stream - hStream = FreeImage_OpenMemoryByPtr(lDataPtr, SizeInBytes) - If (hStream) Then - ' on success, detect image type - FreeImage_GetFileTypeFromMemoryEx = FreeImage_GetFileTypeFromMemory(hStream) - Call FreeImage_CloseMemory(hStream) - Else - FreeImage_GetFileTypeFromMemoryEx = FIF_UNKNOWN - End If - -End Function - -Public Function FreeImage_LoadFromMemoryEx(ByRef Data As Variant, _ - Optional ByVal Flags As FREE_IMAGE_LOAD_OPTIONS, _ - Optional ByRef SizeInBytes As Long, _ - Optional ByRef Format As FREE_IMAGE_FORMAT) As Long - -Dim hStream As Long -Dim lDataPtr As Long - - ' This function loads a FreeImage bitmap from memory that has been passed - ' through parameter 'Data'. This parameter is of type Variant and may actually - ' be an array of type Byte, Integer or Long or may contain the address of an - ' arbitrary block of memory. - - ' The parameter 'SizeInBytes' specifies the size of the passed block of memory - ' in bytes. It may be omitted, if parameter 'Data' contains an array of type Byte, - ' Integer or Long upon entry. In that case, or if 'SizeInBytes' is zero or less - ' than zero, the size is determined directly from the array and also passed back - ' to the caller through parameter 'SizeInBytes'. - - ' The parameter 'Format' is an OUT only parameter that contains the image type - ' of the loaded image after the function returns. - - ' The parameter 'Flags' works according to the FreeImage API documentation. - - - ' get both pointer and size in bytes of the memory block provided - ' through the Variant parameter 'data'. - lDataPtr = pGetMemoryBlockPtrFromVariant(Data, SizeInBytes) - - ' open the memory stream - hStream = FreeImage_OpenMemoryByPtr(lDataPtr, SizeInBytes) - If (hStream) Then - ' on success, detect image type - Format = FreeImage_GetFileTypeFromMemory(hStream) - If (Format <> FIF_UNKNOWN) Then - ' load the image from memory stream only, if known image type - FreeImage_LoadFromMemoryEx = FreeImage_LoadFromMemory(Format, hStream, Flags) - End If - ' close the memory stream - Call FreeImage_CloseMemory(hStream) - End If - -End Function - -Public Function FreeImage_SaveToMemoryEx(ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Bitmap As Long, _ - ByRef Data() As Byte, _ - Optional ByVal Flags As FREE_IMAGE_SAVE_OPTIONS, _ - Optional ByVal UnloadSource As Boolean) As Boolean - -Dim hStream As Long -Dim lpData As Long -Dim lSizeInBytes As Long - - ' This function saves a FreeImage bitmap into memory and returns it through - ' the byte array passed in parameter 'Data()'. It makes a deep copy of the memory - ' stream's byte buffer, into which the image has been saved. The memory stream - ' is closed properly before the function returns. - - ' The provided byte array 'Data()' must not be a fixed sized array. It will be - ' dimensioned to the size required to hold all the memory stream's data. - - ' The parameters 'Format', 'Bitmap' and 'Flags' work according to the FreeImage - ' API documentation. - - ' The optional 'UnloadSource' parameter is for unloading the original image - ' after it has been saved into memory. There is no need to clean up the DIB - ' at the caller's site. - - ' The function returns True on success and False otherwise. - - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to save a 'header-only' bitmap.") - End If - - hStream = FreeImage_OpenMemory() - If (hStream) Then - FreeImage_SaveToMemoryEx = FreeImage_SaveToMemory(Format, Bitmap, hStream, Flags) - If (FreeImage_SaveToMemoryEx) Then - If (FreeImage_AcquireMemoryInt(hStream, lpData, lSizeInBytes)) Then - On Error Resume Next - ReDim Data(lSizeInBytes - 1) - If (Err.Number = ERROR_SUCCESS) Then - On Error GoTo 0 - Call CopyMemory(Data(0), ByVal lpData, lSizeInBytes) - Else - On Error GoTo 0 - FreeImage_SaveToMemoryEx = False - End If - Else - FreeImage_SaveToMemoryEx = False - End If - End If - Call FreeImage_CloseMemory(hStream) - Else - FreeImage_SaveToMemoryEx = False - End If - - If (UnloadSource) Then - Call FreeImage_Unload(Bitmap) - End If - End If - -End Function - -Public Function FreeImage_SaveToMemoryEx2(ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Bitmap As Long, _ - ByRef Data() As Byte, _ - ByRef Stream As Long, _ - Optional ByVal Flags As FREE_IMAGE_SAVE_OPTIONS, _ - Optional ByVal UnloadSource As Boolean) As Boolean - - ' This function saves a FreeImage bitmap into memory and returns it through - ' the byte array passed in parameter 'Data()'. In contrast to function - ' 'FreeImage_SaveToMemoryEx', it does not make a deep copy of the memory - ' stream's byte buffer, but directly wraps the array 'Data()' around the stream's - ' byte buffer by calling function 'FreeImage_AcquireMemoryEx'. As a result, the - ' memory stream must remain valid while the array 'Data()' is in use. In other - ' words, the stream must be maintained by the caller of this function. - - ' The provided byte array 'Data()' must not be a fixed sized array. It will be - ' dimensioned to the size required to hold all the memory stream's data. - - ' To reuse the caller's array variable that was passed through parameter 'Data()' - ' before it goes out of the caller's scope, it must first be destroyed by passing - ' it to the 'FreeImage_DestroyLockedArray' function. - - ' The parameter 'Stream' is an IN/OUT parameter, that keeps track of the memory - ' stream, the VB array 'Data()' is based on. This parameter may contain an - ' already opened FreeImage memory stream upon entry and will contain a valid - ' memory stream when the function returns. It is left up to the caller to close - ' this memory stream correctly. - - ' The array 'Data()' will no longer be valid and accessible after the stream has - ' been closed, so the stream should only be closed after the passed byte array - ' variable goes out of the caller's scope or is reused. - - ' The parameters 'Format', 'Bitmap' and 'Flags' work according to the FreeImage - ' API documentation. - - ' The optional 'UnloadSource' parameter is for unloading the original image - ' after it has been saved to memory. There is no need to clean up the DIB - ' at the caller's site. - - ' The function returns True on success and False otherwise. - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to save a 'header-only' bitmap.") - End If - - If (Stream = 0) Then - Stream = FreeImage_OpenMemory() - End If - If (Stream) Then - FreeImage_SaveToMemoryEx2 = FreeImage_SaveToMemory(Format, Bitmap, Stream, Flags) - If (FreeImage_SaveToMemoryEx2) Then - FreeImage_SaveToMemoryEx2 = FreeImage_AcquireMemoryEx(Stream, Data) - End If - - ' Do not close the memory stream, since the returned array Data() - ' directly points to the stream's data. The stream handle is passed back - ' to the caller through parameter 'Stream'. The caller must close - ' this stream after being done with the array. - Else - FreeImage_SaveToMemoryEx2 = False - End If - - If (UnloadSource) Then - Call FreeImage_Unload(Bitmap) - End If - End If - -End Function - -Public Function FreeImage_AcquireMemoryEx(ByVal Stream As Long, _ - ByRef Data() As Byte, _ - Optional ByRef SizeInBytes As Long) As Boolean - -Dim lpData As Long -Dim tSA As SAVEARRAY1D -Dim lpSA As Long - - ' This function wraps the byte array passed through parameter 'Data()' around the - ' memory acquired from the specified memory stream. After the function returns, - ' the array passed in 'Data()' points directly to the stream's data pointer and so, - ' provides full read and write access to the streams byte buffer. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArray' function. - - - If (Stream) Then - If (FreeImage_AcquireMemoryInt(Stream, lpData, SizeInBytes)) Then - With tSA - .cbElements = 1 ' one element is one byte - .cDims = 1 ' the array has only 1 dimension - .cElements = SizeInBytes ' the number of elements in the array is - ' the size in bytes of the memory block - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = lpData ' let the array point to the memory block - ' received by FreeImage_AcquireMemory - End With - - lpSA = pDeref(VarPtrArray(Data)) - If (lpSA = 0) Then - ' allocate memory for an array descriptor - Call SafeArrayAllocDescriptor(1, lpSA) - Call CopyMemory(ByVal VarPtrArray(Data), lpSA, 4) - Else - Call SafeArrayDestroyData(lpSA) - End If - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - Else - FreeImage_AcquireMemoryEx = False - End If - Else - FreeImage_AcquireMemoryEx = False - End If - -End Function - -Public Function FreeImage_JPEGTransformCombinedFromMemoryEx(ByRef SourceData As Variant, _ - ByRef DestData() As Byte, _ - ByVal Operation As FREE_IMAGE_JPEG_OPERATION, _ - ByVal Left As Long, _ - ByVal Top As Long, _ - ByVal Right As Long, _ - ByVal Bottom As Long, _ - Optional ByRef SourceSizeInBytes As Long, _ - Optional ByVal Perfect As Boolean = True) As Boolean - -Dim hSrcStream As Long -Dim lSrcDataPtr As Long -Dim hDstStream As Long -Dim lDstDataPtr As Long -Dim lDstSizeInBytes As Long -Dim lPerfect As Long -Dim lResult As Long - - ' This function performs a combination of lossless rotation or flipping and - ' lossless crop on a JPEG file. The source file is loaded from the memory - ' provided through parameter 'SourceData' and the result JPEG file is saved - ' to memory accessible by the byte array passed through parameter 'DestData()'. - - ' The source JPEG file is loaded from the memory that has been passed through - ' parameter 'SourceData'. This parameter is of type Variant and may actually - ' be an array of type Byte, Integer or Long or may contain the address of an - ' arbitrary block of memory. - - ' The parameter 'SourceSizeInBytes' specifies the size of the passed block of - ' memory in bytes. It may be omitted, if parameter 'SourceData' contains an array - ' of type Byte, Integer or Long upon entry. In that case, or if 'SizeInBytes' is - ' zero or less than zero, the size is determined directly from the array and also - ' passed back to the caller through parameter 'SourceSizeInBytes'. - - ' The result JPEG file function is saved to memory that is accessible through - ' the byte array passed in parameter 'DestData()' after the function returns. - ' It makes a deep copy of the memory stream's byte buffer, into which the image - ' has been saved. The memory stream is closed properly before the function - ' returns. - - ' The provided byte array 'DestData()' must not be a fixed sized array. It will - ' be dimensioned to the size required to hold all the memory stream's data. - - ' The parameters 'Operation', 'Left', 'Top', 'Right', 'Bottom' and 'Perfect' work - ' according to the FreeImage API documentation. - - - ' get both pointer and size in bytes of the memory block provided - ' through the Variant parameter 'SourceData'. - lSrcDataPtr = pGetMemoryBlockPtrFromVariant(SourceData, SourceSizeInBytes) - - ' open the source memory stream - hSrcStream = FreeImage_OpenMemoryByPtr(lSrcDataPtr, SourceSizeInBytes) - If (hSrcStream) Then - - ' open the destination memory stream - hDstStream = FreeImage_OpenMemory() - If (hDstStream) Then - - If (Perfect) Then - lPerfect = 1 - End If - - ' perform transformations - lResult = FreeImage_JPEGTransformCombinedFromMemoryInt(hSrcStream, hDstStream, _ - Operation, Left, Top, Right, Bottom, lPerfect) - - If (lResult = 1) Then - ' if the transformations succeeded, access the stream's byte buffer - If (FreeImage_AcquireMemoryInt(hDstStream, lDstDataPtr, lDstSizeInBytes)) Then - On Error Resume Next - ' redim the array - ReDim DestData(lDstSizeInBytes - 1) - If (Err.Number = ERROR_SUCCESS) Then - On Error GoTo 0 - ' and make a deep copy of the stream's byte buffer - Call CopyMemory(DestData(0), ByVal lDstDataPtr, lDstSizeInBytes) - Else - On Error GoTo 0 - lResult = 0 - End If - Else - lResult = 0 - End If - End If - - ' close the destination memory stream - Call FreeImage_CloseMemory(hDstStream) - End If - - ' close the source memory stream - Call FreeImage_CloseMemory(hSrcStream) - End If - - FreeImage_JPEGTransformCombinedFromMemoryEx = (lResult = 1) - -End Function - -Public Function FreeImage_JPEGTransformCombinedFromMemoryEx2(ByRef SourceData As Variant, _ - ByRef DestData() As Byte, _ - ByRef DestStream As Long, _ - ByVal Operation As FREE_IMAGE_JPEG_OPERATION, _ - ByVal Left As Long, _ - ByVal Top As Long, _ - ByVal Right As Long, _ - ByVal Bottom As Long, _ - Optional ByRef SourceSizeInBytes As Long, _ - Optional ByVal Perfect As Boolean = True) As Boolean - -Dim hSrcStream As Long -Dim lSrcDataPtr As Long -Dim lPerfect As Long -Dim bResult As Boolean - - ' This function performs a combination of lossless rotation or flipping and - ' lossless crop on a JPEG file. The source file is loaded from the memory - ' provided through parameter 'SourceData' and the result JPEG file is saved - ' to memory accessible by the byte array passed through parameter 'DestData()'. - - ' The source JPEG file is loaded from the memory that has been passed through - ' parameter 'SourceData'. This parameter is of type Variant and may actually - ' be an array of type Byte, Integer or Long or may contain the address of an - ' arbitrary block of memory. - - ' The parameter 'SourceSizeInBytes' specifies the size of the passed block of - ' memory in bytes. It may be omitted, if parameter 'SourceData' contains an array - ' of type Byte, Integer or Long upon entry. In that case, or if 'SizeInBytes' is - ' zero or less than zero, the size is determined directly from the array and also - ' passed back to the caller through parameter 'SourceSizeInBytes'. - - ' The result JPEG file function is saved to memory that is accessible through the - ' the byte array passed in parameter 'DestData()' after the function returns. - ' In contrast to function 'FreeImage_JPEGTransformCombinedFromMemoryEx', it does - ' not make a deep copy of the memory stream's byte buffer, but directly wraps the - ' array 'DestData()' around the stream's byte buffer by calling function - ' 'FreeImage_AcquireMemoryEx'. As a result, the memory stream must remain valid - ' while the array 'Data()' is in use. In other words, the stream must be - ' maintained by the caller of this function. - - ' The provided byte array 'DestData()' must not be a fixed sized array. It will be - ' dimensioned to the size required to hold all the memory stream's data. - - ' To reuse the caller's array variable that was passed through parameter 'DestData()' - ' before it goes out of the caller's scope, it must first be destroyed by passing it - ' to the 'FreeImage_DestroyLockedArray' function. - - ' The parameter 'DestStream' is an IN/OUT parameter, that keeps track of the memory - ' stream, the VB array 'DestData()' is based on. This parameter may contain an - ' already opened FreeImage memory stream upon entry and will contain a valid - ' memory stream when the function returns. It is left up to the caller to close - ' this memory stream correctly. - - ' The array 'DestData()' will no longer be valid and accessible after the stream has - ' been closed, so the stream should only be closed after the passed byte array - ' variable goes out of the caller's scope or is reused. - - ' The parameters 'Operation', 'Left', 'Top', 'Right', 'Bottom' and 'Perfect' work - ' according to the FreeImage API documentation. - - - ' get both pointer and size in bytes of the memory block provided - ' through the Variant parameter 'SourceData'. - lSrcDataPtr = pGetMemoryBlockPtrFromVariant(SourceData, SourceSizeInBytes) - - ' open the source memory stream - hSrcStream = FreeImage_OpenMemoryByPtr(lSrcDataPtr, SourceSizeInBytes) - If (hSrcStream) Then - - If (DestStream = 0) Then - ' open the destination memory stream, only if no valid stream was provided - DestStream = FreeImage_OpenMemory() - End If - - If (DestStream) Then - - If (Perfect) Then - lPerfect = 1 - End If - - ' perform transformations - bResult = (FreeImage_JPEGTransformCombinedFromMemoryInt(hSrcStream, DestStream, _ - Operation, Left, Top, Right, Bottom, lPerfect) = 1) - - If (bResult) Then - ' if the transformations succeeded, access the stream's byte buffer - bResult = FreeImage_AcquireMemoryEx(DestStream, DestData) - End If - - ' Do not close the memory stream, since the returned array DestData() - ' directly points to the stream's data. The stream handle is passed back - ' to the caller through parameter 'DestStream'. The caller must close - ' this stream after being done with the array. - End If - - ' close the source memory stream - Call FreeImage_CloseMemory(hSrcStream) - End If - - FreeImage_JPEGTransformCombinedFromMemoryEx2 = bResult - -End Function - -Public Function FreeImage_ReadMemoryEx(ByRef Buffer As Variant, _ - ByVal Stream As Long, _ - Optional ByRef Count As Long, _ - Optional ByRef Size As Long) As Long - -Dim lBufferPtr As Long -Dim lSizeInBytes As Long -Dim lSize As Long -Dim lCount As Long - - ' This function is a wrapper for 'FreeImage_ReadMemory()' using VB style - ' arrays instead of a void pointer. - - ' The variant parameter 'Buffer' may be a Byte, Integer or Long array or - ' may contain a pointer to a memory block (the memory block's address). - - ' In the latter case, this function behaves exactly like - ' function 'FreeImage_ReadMemory()'. Then, 'Count' and 'Size' must be valid - ' upon entry. - - ' If 'Buffer' is an initialized (dimensioned) array, 'Count' and 'Size' may - ' be omitted. Then, the array's layout is used to determine 'Count' - ' and 'Size'. In that case, any provided value in 'Count' and 'Size' upon - ' entry will override these calculated values as long as they are not - ' exceeding the size of the array in 'Buffer'. - - ' If 'Buffer' is an uninitialized (not yet dimensioned) array of any valid - ' type (Byte, Integer or Long) and, at least 'Count' is specified, the - ' array in 'Buffer' is redimensioned by this function. If 'Buffer' is a - ' fixed-size or otherwise locked array, a runtime error (10) occurs. - ' If 'Size' is omitted, the array's element size is assumed to be the - ' desired value. - - ' As FreeImage's function 'FreeImage_ReadMemory()', this function returns - ' the number of items actually read. - - ' Example: (very freaky...) - ' - ' Dim alLongBuffer() As Long - ' Dim lRet as Long - ' - ' ' now reading 303 integers (2 byte) into an array of Longs - ' lRet = FreeImage_ReadMemoryEx(alLongBuffer, lMyStream, 303, 2) - ' - ' ' now, lRet contains 303 and UBound(alLongBuffer) is 151 since - ' ' we need at least 152 Longs (0..151) to store (303 * 2) = 606 bytes - ' ' so, the higest two bytes of alLongBuffer(151) contain only unset - ' ' bits. Got it? - - ' Remark: This function's parameter order differs from FreeImage's - ' original funtion 'FreeImage_ReadMemory()'! - - If (VarType(Buffer) And vbArray) Then - ' get both pointer and size in bytes of the memory block provided - ' through the Variant parameter 'Buffer'. - lBufferPtr = pGetMemoryBlockPtrFromVariant(Buffer, lSizeInBytes, lSize) - If (lBufferPtr = 0) Then - ' array is not initialized - If (Count > 0) Then - ' only if we have a 'Count' value, redim the array - If (Size <= 0) Then - ' if 'Size' is omitted, use array's element size - Size = lSize - End If - - Select Case lSize - - Case 2 - ' Remark: -Int(-a) == ceil(a); a > 0 - ReDim Buffer(-Int(-Count * Size / 2) - 1) As Integer - - Case 4 - ' Remark: -Int(-a) == ceil(a); a > 0 - ReDim Buffer(-Int(-Count * Size / 4) - 1) As Long - - Case Else - ReDim Buffer((Count * Size) - 1) As Byte - - End Select - lBufferPtr = pGetMemoryBlockPtrFromVariant(Buffer, lSizeInBytes, lSize) - End If - End If - If (lBufferPtr) Then - lCount = lSizeInBytes / lSize - If (Size <= 0) Then - ' use array's natural value for 'Size' when - ' omitted - Size = lSize - End If - If (Count <= 0) Then - ' use array's natural value for 'Count' when - ' omitted - Count = lCount - End If - If ((Size * Count) > (lSize * lCount)) Then - If (Size = lSize) Then - Count = lCount - Else - ' Remark: -Fix(-a) == floor(a); a > 0 - Count = -Fix(-lSizeInBytes / Size) - If (Count = 0) Then - Size = lSize - Count = lCount - End If - End If - End If - FreeImage_ReadMemoryEx = FreeImage_ReadMemory(lBufferPtr, Size, Count, Stream) - End If - - ElseIf (VarType(Buffer) = vbLong) Then - ' if Buffer is a Long, it specifies the address of a memory block - ' then, we do not know anything about its size, so assume that 'Size' - ' and 'Count' are correct and forward these directly to the FreeImage - ' call. - FreeImage_ReadMemoryEx = FreeImage_ReadMemory(CLng(Buffer), Size, Count, Stream) - - End If - -End Function - -Public Function FreeImage_WriteMemoryEx(ByRef Buffer As Variant, _ - ByVal Stream As Long, _ - Optional ByRef Count As Long, _ - Optional ByRef Size As Long) As Long - -Dim lBufferPtr As Long -Dim lSizeInBytes As Long -Dim lSize As Long -Dim lCount As Long - - ' This function is a wrapper for 'FreeImage_WriteMemory()' using VB style - ' arrays instead of a void pointer. - - ' The variant parameter 'Buffer' may be a Byte, Integer or Long array or - ' may contain a pointer to a memory block (the memory block's address). - - ' In the latter case, this function behaves exactly - ' like 'FreeImage_WriteMemory()'. Then, 'Count' and 'Size' must be valid - ' upon entry. - - ' If 'Buffer' is an initialized (dimensioned) array, 'Count' and 'Size' may - ' be omitted. Then, the array's layout is used to determine 'Count' - ' and 'Size'. In that case, any provided value in 'Count' and 'Size' upon - ' entry will override these calculated values as long as they are not - ' exceeding the size of the array in 'Buffer'. - - ' If 'Buffer' is an uninitialized (not yet dimensioned) array of any - ' type, the function will do nothing an returns 0. - - ' Remark: This function's parameter order differs from FreeImage's - ' original funtion 'FreeImage_ReadMemory()'! - - If (VarType(Buffer) And vbArray) Then - ' get both pointer and size in bytes of the memory block provided - ' through the Variant parameter 'Buffer'. - lBufferPtr = pGetMemoryBlockPtrFromVariant(Buffer, lSizeInBytes, lSize) - If (lBufferPtr) Then - lCount = lSizeInBytes / lSize - If (Size <= 0) Then - ' use array's natural value for 'Size' when - ' omitted - Size = lSize - End If - If (Count <= 0) Then - ' use array's natural value for 'Count' when - ' omitted - Count = lCount - End If - If ((Size * Count) > (lSize * lCount)) Then - If (Size = lSize) Then - Count = lCount - Else - ' Remark: -Fix(-a) == floor(a); a > 0 - Count = -Fix(-lSizeInBytes / Size) - If (Count = 0) Then - Size = lSize - Count = lCount - End If - End If - End If - FreeImage_WriteMemoryEx = FreeImage_WriteMemory(lBufferPtr, Size, Count, Stream) - End If - - ElseIf (VarType(Buffer) = vbLong) Then - ' if Buffer is a Long, it specifies the address of a memory block - ' then, we do not know anything about its size, so assume that 'Size' - ' and 'Count' are correct and forward these directly to the FreeImage - ' call. - FreeImage_WriteMemoryEx = FreeImage_WriteMemory(CLng(Buffer), Size, Count, Stream) - - End If - -End Function - -Public Function FreeImage_LoadMultiBitmapFromMemoryEx(ByRef Data As Variant, _ - Optional ByVal Flags As FREE_IMAGE_LOAD_OPTIONS, _ - Optional ByRef SizeInBytes As Long, _ - Optional ByRef Format As FREE_IMAGE_FORMAT) As Long - -Dim hStream As Long -Dim lDataPtr As Long - - ' This function loads a FreeImage multipage bitmap from memory that has been - ' passed through parameter 'Data'. This parameter is of type Variant and may - ' actually be an array of type Byte, Integer or Long or may contain the - ' address of an arbitrary block of memory. - - ' The parameter 'SizeInBytes' specifies the size of the passed block of memory - ' in bytes. It may be omitted, if parameter 'Data' contains an array of type Byte, - ' Integer or Long upon entry. In that case, or if 'SizeInBytes' is zero or less - ' than zero, the size is determined directly from the array and also passed back - ' to the caller through parameter 'SizeInBytes'. - - ' The parameter 'Format' is an OUT only parameter that contains the image type - ' of the loaded image after the function returns. - - ' The parameter 'Flags' works according to the FreeImage API documentation. - - - ' get both pointer and size in bytes of the memory block provided - ' through the Variant parameter 'Data'. - lDataPtr = pGetMemoryBlockPtrFromVariant(Data, SizeInBytes) - - ' open the memory stream - hStream = FreeImage_OpenMemoryByPtr(lDataPtr, SizeInBytes) - If (hStream) Then - ' on success, detect image type - Format = FreeImage_GetFileTypeFromMemory(hStream) - If (Format <> FIF_UNKNOWN) Then - ' load the image from memory stream only, if known image type - FreeImage_LoadMultiBitmapFromMemoryEx = FreeImage_LoadMultiBitmapFromMemory(Format, _ - hStream, Flags) - End If - ' close the memory stream - Call FreeImage_CloseMemory(hStream) - End If - -End Function - -Public Function FreeImage_SaveMultiBitmapToMemoryEx(ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Bitmap As Long, _ - ByRef Data() As Byte, _ - Optional ByVal Flags As FREE_IMAGE_SAVE_OPTIONS, _ - Optional ByVal UnloadSource As Boolean) As Boolean - -Dim hStream As Long -Dim lpData As Long -Dim lSizeInBytes As Long - - ' This function saves a FreeImage multipage bitmap into memory and returns it - ' through the byte array passed in parameter 'Data()'. It makes a deep copy of - ' the memory stream's byte buffer, into which the image has been saved. The - ' memory stream is closed properly before the function returns. - - ' The provided byte array 'Data()' must not be a fixed sized array. It will be - ' dimensioned to the size required to hold all the memory stream's data. - - ' The parameters 'Format', 'Bitmap' and 'Flags' work according to the FreeImage - ' API documentation. - - ' The optional 'UnloadSource' parameter is for unloading the original image - ' after it has been saved into memory. There is no need to clean up the DIB - ' at the caller's site. - - ' The function returns True on success and False otherwise. - - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to save a 'header-only' bitmap.") - End If - - hStream = FreeImage_OpenMemory() - If (hStream) Then - FreeImage_SaveMultiBitmapToMemoryEx = FreeImage_SaveMultiBitmapToMemory(Format, _ - Bitmap, hStream, Flags) - If (FreeImage_SaveMultiBitmapToMemoryEx) Then - If (FreeImage_AcquireMemoryInt(hStream, lpData, lSizeInBytes)) Then - On Error Resume Next - ReDim Data(lSizeInBytes - 1) - If (Err.Number = ERROR_SUCCESS) Then - On Error GoTo 0 - Call CopyMemory(Data(0), ByVal lpData, lSizeInBytes) - Else - On Error GoTo 0 - FreeImage_SaveMultiBitmapToMemoryEx = False - End If - Else - FreeImage_SaveMultiBitmapToMemoryEx = False - End If - End If - Call FreeImage_CloseMemory(hStream) - Else - FreeImage_SaveMultiBitmapToMemoryEx = False - End If - - If (UnloadSource) Then - Call FreeImage_CloseMultiBitmapInt(Bitmap) - End If - End If - -End Function - -Public Function FreeImage_SaveMultiBitmapToMemoryEx2(ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Bitmap As Long, _ - ByRef Data() As Byte, _ - ByRef Stream As Long, _ - Optional ByVal Flags As FREE_IMAGE_SAVE_OPTIONS, _ - Optional ByVal UnloadSource As Boolean) As Boolean - - ' This function saves a FreeImage multipage bitmap into memory and returns it - ' through the byte array passed in parameter 'Data()'. In contrast to function - ' 'FreeImage_SaveToMemoryEx', it does not make a deep copy of the memory - ' stream's byte buffer, but directly wraps the array 'Data()' around the stream's - ' byte buffer by calling function 'FreeImage_AcquireMemoryEx'. As a result, the - ' memory stream must remain valid while the array 'Data()' is in use. In other - ' words, the stream must be maintained by the caller of this function. - - ' The provided byte array 'Data()' must not be a fixed sized array. It will be - ' dimensioned to the size required to hold all the memory stream's data. - - ' To reuse the caller's array variable that was passed through parameter 'Data()' - ' before it goes out of the caller's scope, it must first be destroyed by passing - ' it to the 'FreeImage_DestroyLockedArray' function. - - ' The parameter 'Stream' is an IN/OUT parameter, that keeps track of the memory - ' stream, the VB array 'Data()' is based on. This parameter may contain an - ' already opened FreeImage memory stream upon entry and will contain a valid - ' memory stream when the function returns. It is left up to the caller to close - ' this memory stream correctly. - - ' The array 'Data()' will no longer be valid and accessible after the stream has - ' been closed, so the stream should only be closed after the passed byte array - ' variable goes out of the caller's scope or is reused. - - ' The parameters 'Format', 'Bitmap' and 'Flags' work according to the FreeImage - ' API documentation. - - ' The optional 'UnloadSource' parameter is for unloading the original image - ' after it has been saved to memory. There is no need to clean up the DIB - ' at the caller's site. - - ' The function returns True on success and False otherwise. - - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to save a 'header-only' bitmap.") - End If - - If (Stream = 0) Then - Stream = FreeImage_OpenMemory() - End If - If (Stream) Then - FreeImage_SaveMultiBitmapToMemoryEx2 = _ - FreeImage_SaveMultiBitmapToMemory(Format, Bitmap, Stream, Flags) - If (FreeImage_SaveMultiBitmapToMemoryEx2) Then - FreeImage_SaveMultiBitmapToMemoryEx2 = FreeImage_AcquireMemoryEx(Stream, Data) - End If - - ' Do not close the memory stream, since the returned array Data() - ' directly points to the stream's data. The stream handle is passed back - ' to the caller through parameter 'Stream'. The caller must close - ' this stream after being done with the array. - Else - FreeImage_SaveMultiBitmapToMemoryEx2 = False - End If - - If (UnloadSource) Then - Call FreeImage_CloseMultiBitmapInt(Bitmap) - End If - End If - -End Function - - - -'-------------------------------------------------------------------------------- -' Tag accessing VB friendly helper functions -'-------------------------------------------------------------------------------- - -Public Function FreeImage_CreateTagEx(ByVal Model As FREE_IMAGE_MDMODEL, _ - Optional ByVal Key As String, _ - Optional ByVal TagType As FREE_IMAGE_MDTYPE = FIDT_NOTYPE, _ - Optional ByRef Value As Variant, _ - Optional ByRef Count As Long, _ - Optional ByVal Id As Long) As FREE_IMAGE_TAG - - ' This function is a wrapper for FreeImage_CreateTag() working with - ' the VB friendly FREE_IMAGE_TAG structure. So, the return value is - ' not a pointer to a FITAG structure but a FREE_IMAGE_TAG structure. - - ' In contrast to FreeImage's original FreeImage_CreateTag() function, the - ' parameter 'Model' must be specified, the parameters 'Key', 'TagType', - ' 'Value', 'Count' and 'Id' my be specified. - - ' The 'Model' is needed, since each FREE_IMAGE_TAG structure needs a - ' valid 'Model' member. - - ' All other parameters are optional and enable the caller to specify the tag's - ' values upon tag creation. Any parameter specified, is set to it's corresponding - ' member in the FREE_IMAGE_TAG structure. - - ' The caller should check the returned FREE_IMAGE_TAG structure's 'TagPtr' member. - ' If this function succeeded, the 'TagPtr' member is non zero. A value of zero - ' indicates an error condition sourced from FreeImage_CreateTag(). - - With FreeImage_CreateTagEx - .TagPtr = FreeImage_CreateTag() - If (.TagPtr <> 0) Then - .Model = Model - If (LenB(Key) > 0) Then - .Key = Key - End If - .Type = TagType - .Count = Count - .Id = Id - If (Not IsMissing(Value)) Then - .Value = Value - End If - Call pTagToTagPtr(FreeImage_CreateTagEx) - FreeImage_CreateTagEx = pGetTagFromTagPtr(Model, .TagPtr) - End If - End With - -End Function - -Public Function FreeImage_AppendTag(ByVal Bitmap As Long, _ - ByVal Model As FREE_IMAGE_MDMODEL, _ - Optional ByVal Key As String, _ - Optional ByVal TagType As FREE_IMAGE_MDTYPE = FIDT_NOTYPE, _ - Optional ByRef Value As Variant, _ - Optional ByRef Count As Long, _ - Optional ByVal Id As Long, _ - Optional ByVal OverwriteExisting As Boolean = True) As FREE_IMAGE_TAG - -Dim lpTag As Long - - ' This function is a shortcut wrapper for FreeImage_CreateTagEx() and - ' FreeImage_SetMetadataEx(). It creates a new tag as FreeImage_CreateTagEx() does - ' and appends it to the image's metadata model. - - ' The parameter 'Bitmap' specifies the image, the new tag should be appended to, - ' parameters 'Model', 'Key', 'TagType', 'Value', 'Count' and 'Id' are these, - ' FreeImage_CreateTagEx() has and are just forwarded unchanged. - - ' The boolean parameter 'OverwriteExisting' determines, whether to overwrite or - ' replace an already existing tag with the newly created. If the tag specified - ' by it's model and key already exists and 'OverwriteExisting' is False, an - ' empty FREE_IMAGE_TAG structure is returned. - - ' So, as with FreeImage_CreateTagEx(), the caller should check the returned - ' FREE_IMAGE_TAG structure's 'TagPtr' member. If this function succeeded, the - ' 'TagPtr' member is non zero. A value of zero indicates an error condition - ' sourced from either the FreeImage_CreateTag() function or may result from - ' an already existing tag that should not be overwritten. - - If ((FreeImage_GetMetadataInt(Model, Bitmap, Key, lpTag) = 0) Or _ - (OverwriteExisting)) Then - - FreeImage_AppendTag = FreeImage_CreateTagEx(Model, Key, TagType, Value, Count, Id) - If (FreeImage_AppendTag.TagPtr <> 0) Then - Call FreeImage_SetMetadataEx(Bitmap, FreeImage_AppendTag, Key, Model, True) - End If - End If - -End Function - -Public Function FreeImage_RemoveTag(ByVal Bitmap As Long, _ - ByVal Model As FREE_IMAGE_MDMODEL, _ - ByVal Key As String) As Boolean - - ' This function is a wrapper function, that removes a tag, that is actually - ' part of an image's metadata model. The tag named 'key' of the metadata - ' model specified in parameter 'Model' of the image 'Bitmap' will be removed. - - ' Removing a tag is actually done by calling FreeImage_SetMetadata() with - ' a NULL pointer for 'FITAG *tag' as described in the API documentation. - - ' The function returns the boolean value returned from FreeImage_SetMetadata(), - ' which is always TRUE when removing a tag in this fashion. So, this function's - ' caller has no feedback telling if the tag was really present and removed - ' successfully. - - ' Up to version 3.9.1 of FreeImage, there seems to be a bug in removing an - ' tag from an image's metadata model. Although the removed tag is not accessible - ' through FreeImage_GetMetadata() any more, iterations with - ' Freeimage_FindFirst/NextMetadata() will still return this tag an a NULL - ' pointer. - - ' This bug was reported on the Developers Forum. You can revisit the posting at: - ' http://sourceforge.net/forum/forum.php?thread_id=1536883&forum_id=36111 - - FreeImage_RemoveTag = (FreeImage_SetMetadataInt(Model, Bitmap, Key, 0) <> 0) - -End Function - -Public Function FreeImage_RemoveTagEx(ByVal Bitmap As Long, _ - ByRef Tag As FREE_IMAGE_TAG) As Boolean - - ' This function is a FREE_IMAGE_TAG based wrapper for FreeImage_RemoveTag() - - With Tag - FreeImage_RemoveTagEx = FreeImage_RemoveTag(Bitmap, .Model, .Key) - End With - -End Function - -Public Function FreeImage_TagExists(ByVal Bitmap As Long, _ - ByVal Model As FREE_IMAGE_MDMODEL, _ - Optional ByVal Key As String) As Boolean - -Dim lpTag As Long - - ' This function is a small helper function, returning a boolean value - ' that determines, whether a certain tag specified by metadata model - ' and key exists for an image specified by 'Bitmap'. - - FreeImage_TagExists = (FreeImage_GetMetadataInt(Model, Bitmap, Key, lpTag) <> 0) - -End Function - -Public Function FreeImage_TagExistsEx(ByVal Bitmap As Long, _ - ByRef Tag As FREE_IMAGE_TAG) As Boolean - - ' This function is a FREE_IMAGE_TAG based wrapper for FreeImage_TagExists() - - With Tag - FreeImage_TagExistsEx = FreeImage_TagExists(Bitmap, .Model, .Key) - End With - -End Function - -Public Sub FreeImage_DeleteTagEx(ByRef Tag As FREE_IMAGE_TAG) - - ' This function is a wrapper for FreeImage_DeleteTag() working with - ' the VB friendly FREE_IMAGE_TAG structure. So, the parameter 'Tag' - ' is not a pointer to a FITAG structure but a FREE_IMAGE_TAG structure. - - ' This function deletes the underlaying FreeImage FITAG structure, - ' specified the the member 'TagPtr' of the FREE_IMAGE_TAG structure - ' and also sets all other members of Tag to a null value. - - ' Do not get confused with the wrapper functions FreeImage_RemoveTag() - ' and FreeImage_RemoveTagEx(). These functions remove a tag from an - ' image's metadata model. This function only deletes of frees (a better - ' name would be 'FreeImage_FreeTag') a tag created with - ' FreeImage_CreateTagEx(). Do not delete any tags obtained from any other - ' function. - - With Tag - If (.TagPtr <> 0) Then - Call FreeImage_DeleteTag(.TagPtr) - End If - .TagPtr = 0 - .Count = 0 - .Description = vbNullString - .Id = 0 - .Key = vbNullString - .Length = 0 - .Model = FIMD_NODATA - Erase .Palette - Erase .RationalValue - .StringValue = vbNullString - .Type = FIDT_NOTYPE - .Value = Empty - End With - -End Sub - -Public Function FreeImage_CloneTagEx(ByRef Tag As FREE_IMAGE_TAG, _ - Optional ByVal Model As FREE_IMAGE_MDMODEL = FIMD_NODATA) As FREE_IMAGE_TAG - - ' This function is a thin wrapper for FreeImage_CloneTag() working with - ' the VB friendly FREE_IMAGE_TAG structure. The parameter 'Tag' works - ' according to the FreeImage API documentation expect that Tag is not a - ' pointer to a FITAG structure but a FREE_IMAGE_TAG structure. - - ' The additional optional paremeter 'Model' is needed, since the - ' transformation from a FreeImage FITAG structure to the VB friendly - ' FREE_IMAGE_TAG structure always need the model to be specified. - ' When 'Model' is missing (equal to FREE_IMAGE_TAG), the model to be - ' used is taken from the Tag's member 'Model' itself. - - ' See function FreeImage_FindNextMetadataEx() to learn more about the - ' optional parameter 'Model' - - ' Tags obtained from FreeImage_CloneTagEx() must be deleted with - ' FreeImage_DeleteTagEx() as long as they are not used with - ' FreeImage_SetMetadataEx() with the parameter 'RefreshTag' set to True. - - If (Tag.TagPtr <> 0) Then - If (Model = FIMD_NODATA) Then - Model = Tag.Model - End If - FreeImage_CloneTagEx = pGetTagFromTagPtr(Model, FreeImage_CloneTag(Tag.TagPtr)) - End If - -End Function - -Public Function FreeImage_RemoveMetadataModel(ByVal Bitmap As Long, _ - ByVal Model As FREE_IMAGE_MDMODEL) As Boolean - - ' This function removes a complete metadata model 'Model' from an image specified - ' by 'Bitmap'. - - If (Model <> FIMD_NODATA) Then - FreeImage_RemoveMetadataModel = (FreeImage_SetMetadataInt(Model, Bitmap, vbNullString, 0) <> 0) - End If - -End Function - -Public Function FreeImage_FindFirstMetadataEx(ByVal Model As FREE_IMAGE_MDMODEL, _ - ByVal Bitmap As Long, _ - ByRef Tag As FREE_IMAGE_TAG) As Long - - ' This function is a wrapper for FreeImage_FindFirstMetadata() working with - ' the VB friendly FREE_IMAGE_TAG structure. All parameters 'Bitmap', 'Tag', - ' and 'Model' as the function's return value work according to the - ' FreeImage API documentation expect that Tag is not a pointer to a FITAG - ' structure but a FREE_IMAGE_TAG structure. - - ' Tags obtained from FreeImage_GetMetadataEx() must not be deleted with - ' FreeImage_DeleteTagEx(). - - With Tag - FreeImage_FindFirstMetadataEx = FreeImage_FindFirstMetadata(Model, Bitmap, .TagPtr) - If (FreeImage_FindFirstMetadataEx <> 0) Then - Tag = pGetTagFromTagPtr(Model, .TagPtr) - End If - End With - -End Function - -Public Function FreeImage_FindNextMetadataEx(ByVal hFind As Long, _ - ByRef Tag As FREE_IMAGE_TAG, _ - Optional ByVal Model As FREE_IMAGE_MDMODEL = FIMD_NODATA) As Boolean - - ' This function is a wrapper for FreeImage_FindNextMetadataEx() working with - ' the VB friendly FREE_IMAGE_TAG structure. All parameters 'hFind' and 'Tag' - ' as the function's return value work according to the FreeImage API - ' documentation expect that Tag is not a pointer to a FITAG structure but a - ' FREE_IMAGE_TAG structure. - - ' The additional optional paremeter 'Model' is needed, since the VB friendly - ' FREE_IMAGE_TAG structure also contains the member 'StringValue'. This member - ' is filled with the result of FreeImage_TagToString() which always needs - ' the model to be specified. Since there should be no static oder global - ' variables id the FreeImage VB wrapper, the model must be known each time - ' a FreeImage FITAG structure is converted to a FREE_IMAGE_TAG structure. - ' (A global VB collection could be used to map the hFind to the model, - ' but we don't want any globals here) - - ' So, when 'Model' is missing (equal to FREE_IMAGE_TAG), the model to be used - ' is taken from the Tag's member 'Model' itself. This is useful when using this - ' function in a loop iterating all tags per model (what else would you do - ' with that function?). The Tag's member 'Model' is populated by - ' FreeImage_FindFirstMetadataEx() and remains valid during the whole loop, ready - ' to be used in this function. - - ' Tags obtained from FreeImage_GetMetadataEx() must not be deleted with - ' FreeImage_DeleteTagEx(). - - With Tag - FreeImage_FindNextMetadataEx = (FreeImage_FindNextMetadataInt(hFind, .TagPtr) <> 0) - If (FreeImage_FindNextMetadataEx) Then - If (Model = FIMD_NODATA) Then - Model = .Model - End If - Tag = pGetTagFromTagPtr(Model, .TagPtr) - End If - End With - -End Function - -Public Function FreeImage_GetAllMetadataTags(ByVal Model As FREE_IMAGE_MDMODEL, _ - ByVal Bitmap As Long, _ - ByRef Tag() As FREE_IMAGE_TAG) As Long - -Dim hMD As Long -Dim lpTag As Long -Dim i As Long - - ' This function is a helper function returning (through a ByRef parameter) - ' an array of FREE_IMAGE_TAG structures containing all the image's tags of - ' the metadata model specified by the 'Model' parameter. - - ' The parameter 'Tag()' must be an redimensionable array of FREE_IMAGE_TAG - ' and is redimensioned accordingly. The function returns the number of - ' tags stored in 'Tag()'. - - ' All tags obtained from FreeImage_GetAllMetadataTags() must not be deleted - ' with FreeImage_DeleteTagEx(). - - i = FreeImage_GetMetadataCount(Model, Bitmap) - If (i > 0) Then - ReDim Tag(i - 1) - FreeImage_GetAllMetadataTags = i - i = 0 - hMD = FreeImage_FindFirstMetadata(Model, Bitmap, lpTag) - If (hMD <> 0) Then - Do - Tag(i) = pGetTagFromTagPtr(Model, lpTag) - i = i + 1 - Loop While (FreeImage_FindNextMetadataInt(hMD, lpTag) <> 0) - Call FreeImage_FindCloseMetadata(hMD) - End If - End If - -End Function - -Public Function FreeImage_GetMetadataEx(ByVal Model As FREE_IMAGE_MDMODEL, _ - ByVal Bitmap As Long, _ - ByVal Key As String, _ - ByRef Tag As FREE_IMAGE_TAG) As Boolean - - ' This function is a wrapper for FreeImage_GetMetadata() working with - ' the VB friendly FREE_IMAGE_TAG structure. All parameters 'Bitmap', 'Tag', - ' 'Key' and 'Model' as well as the function's return value work according - ' to the FreeImage API documentation expect that Tag is not a pointer to - ' a FITAG structure but to a FREE_IMAGE_TAG structure. - - ' Tags obtained from FreeImage_GetMetadataEx() must not be deleted with - ' FreeImage_DeleteTagEx(). - - With Tag - If (FreeImage_GetMetadataInt(Model, Bitmap, Key, .TagPtr) <> 0) Then - Tag = pGetTagFromTagPtr(Model, .TagPtr) - FreeImage_GetMetadataEx = True - End If - End With - -End Function - -Public Function FreeImage_SetMetadataEx(ByVal Bitmap As Long, _ - ByRef Tag As FREE_IMAGE_TAG, _ - Optional ByVal Key As String, _ - Optional ByVal Model As FREE_IMAGE_MDMODEL = FIMD_NODATA, _ - Optional ByVal RefreshTag As Boolean) As Boolean - - ' This function is a wrapper for FreeImage_SetMetadata() using the wrapper's - ' VB friendly FREE_IMAGE_TAG structure as an replacement for the original - ' function's pointer to a FITAG structure. - - ' All parameters 'Bitmap', 'Tag', 'Key' and 'Model' as the function's return value - ' work according to the FreeImage API documentation expect that Tag is not a - ' pointer to a FITAG structure but a FREE_IMAGE_TAG structure. - - ' As with FreeImage_SetMetadata(), this function sould only be called with - ' new tags, created with FreeImage_CreateTagEx(), a wrapper function for - ' FreeImage_CreateTag() working with the VB friendly FREE_IMAGE_TAG structure. - - ' Normally, after a newly created tag must be deleted/freed with a call to - ' FreeImage_DeleteTagEx(), a wrapper function for FreeImage_DeleteTag() working - ' with the VB friendly FREE_IMAGE_TAG structure (bored already?), after - ' the tag was appended to an image's metadata model with - ' FreeImage_SetMetadataEx(). But... - - ' There is a wrapper specific additional boolean parameter 'RefreshTag', that - ' is similar to the parameter 'UnloadSource' found in many wrapper functions. - ' When 'RefreshTag' is True upon entry, the tag specified in the 'Tag' - ' parameter is deleted (the underlaying FITAG structure is deleted with - ' FreeImage_DeteleTag() and all other members of the FREE_IMAGE_TAG structure - ' are set to null values) and is reassigned with the tag, that is now part - ' of the image's metadata model. The tag now referenced in the 'Tag' - ' parameter must NOT be deleted any more by the caller of this function, since - ' this tag refers to the actual tag data stored with the image. This is like - ' a FREE_IMAGE_TAG structure obtained from FreeImage_GetMetadata() or - ' FreeImage_FindFirst/NextMetadata(). Any changes made to this FREE_IMAGE_TAG - ' structure may be applied to the image with a later call to - ' FreeImage_UpdateMetadata(). - - - With Tag - If (Model = FIMD_NODATA) Then - Model = .Model - End If - If (LenB(Key) = 0) Then - Key = .Key - End If - If (FreeImage_SetMetadataInt(Model, Bitmap, Key, .TagPtr) <> 0) Then - FreeImage_SetMetadataEx = True - End If - If (RefreshTag) Then - Call FreeImage_DeleteTagEx(Tag) - Call FreeImage_GetMetadataEx(Model, Bitmap, Key, Tag) - End If - End With - -End Function - -Public Function FreeImage_GetImageComment(ByVal Bitmap As Long) As String - -Dim tTag As FREE_IMAGE_TAG - - ' This function is a small wrapper around FreeImage_GetMetadata() that - ' returns the comment of a JPEG, PNG of GIF image. - - If (FreeImage_GetMetadataEx(FIMD_COMMENTS, Bitmap, "Comment", tTag)) Then - FreeImage_GetImageComment = tTag.Value - End If - -End Function - -Public Function FreeImage_SetImageComment(ByVal Bitmap As Long, _ - Optional ByVal Comment As String) As Boolean - -Dim tTag As FREE_IMAGE_TAG - - ' This function is a small wrapper around FreeImage_SetMetadata() that - ' sets the comment of a JPEG, PNG of GIF image. - - If (LenB(Comment) > 0) Then - tTag = FreeImage_AppendTag(Bitmap, FIMD_COMMENTS, "Comment", FIDT_ASCII, Comment) - FreeImage_SetImageComment = (tTag.TagPtr <> 0) - Else - Call FreeImage_RemoveMetadataModel(Bitmap, FIMD_COMMENTS) - FreeImage_SetImageComment = True - End If - -End Function - -Public Function FreeImage_CopyMetadata(ByVal BitmapSrc As Long, _ - ByVal BitmapDst As Long, _ - Optional ByVal ReplaceExisting As Boolean = True, _ - Optional ByVal Model As FREE_IMAGE_MDMODEL = FIMD_NODATA) As Long - -Dim hMDFind As Long -Dim lpTag As Long -Dim strKey As String -Dim bSetTag As Boolean - - ' This derived helper function copies several metadata tags from one - ' image to another. This is useful when cloning images explicitly with - ' FreeImage_Clone() or implicitly with FreeImage_ConvertColorDepth() or - ' with any of the FreeImage_RescaleXXX() functions. Whenever the "same" - ' image is represented by a new 'Bitmap' pointer, the image was internally - ' recreated. All of the data, associated with the image, like metadata, - ' DPI settings or ICC profiles are no more available in the new version of - ' the image. - - ' Setting the DPI for X and Y direction is quite easy with the wrapper - ' functions FreeImage_Get/SetResolutionX/Y(). This function makes it even - ' easier to keep track of all associated metadata tags for a cloned image! - - ' Both parameters 'BitmapSrc' and 'BitmapDst' specify the source and destination - ' image. Metadata is copied from 'BitmapSrc' to 'BitmapDst'. - - ' The optional parameter 'ReplaceExisting' determines whether existing tags - ' should be replaced or not. If there are no tags in 'BitmapDst' it is recommended, - ' to set 'ReplaceExisting' to True (or to omit it, since True is it's default - ' value) for better performance; when set to True, no tests for tag existence - ' in the destination image will be run. - - ' The optional parameter 'Model' may specify a certain metadata model to be - ' copied. If this parameter is omitted or set to any value not defined in the - ' FREE_IMAGE_MDMODEL enumeration, all metadata models will be copied - ' sequentially. - - ' This function returns the number of tags copied or zero when there are no tags - ' in the source image or an error occured. - - ' For the standard use case described above (keeping track of all metadata after - ' an image was cloned) the calling this function boils down to a very short form: - - ' lTagsCopied = FreeImage_CopyMetadata(hDibSrc, hDibDst) - - If ((BitmapSrc <> 0) And (BitmapDst <> 0)) Then - If ((Model >= FIMD_COMMENTS) And (Model <= FIMD_CUSTOM)) Then - hMDFind = FreeImage_FindFirstMetadata(Model, BitmapSrc, lpTag) - If (hMDFind) Then - Do - strKey = pGetStringFromPointerA(pDeref(pDeref(lpTag))) - bSetTag = ReplaceExisting - If (Not bSetTag) Then - bSetTag = (Not FreeImage_TagExists(BitmapDst, Model, strKey)) - End If - If (bSetTag) Then - If (FreeImage_SetMetadataInt(Model, BitmapDst, strKey, lpTag) <> 0) Then - FreeImage_CopyMetadata = FreeImage_CopyMetadata + 1 - End If - End If - Loop While (FreeImage_FindNextMetadata(hMDFind, lpTag)) - Call FreeImage_FindCloseMetadata(hMDFind) - End If - Else - For Model = FIMD_COMMENTS To FIMD_CUSTOM - FreeImage_CopyMetadata = FreeImage_CopyMetadata _ - + FreeImage_CopyMetadata(BitmapSrc, BitmapDst, _ - ReplaceExisting, Model) - Next Model - End If - End If - -End Function - -Public Function FreeImage_CloneMetadataEx(ByVal BitmapSrc As Long, _ - ByVal BitmapDst As Long, _ - Optional ByVal Model As FREE_IMAGE_MDMODEL = FIMD_NODATA) As Long - - ' This derived helper function copies several metadata tags from one - ' image to another. It is very similar to FreeImage_CopyMetadata(). - - ' The main difference is, that this function aims to create exactly the same - ' metadata layout in the destination image. In contrast to - ' FreeImage_CopyMetadata(), this function removes all metadata tags in the - ' desination image that are not part of the metadata set in the source image. - ' So, this function is particularly useful for destination images that may - ' have already some tags associated and you want to make shure, that it will - ' get exactly the same metadata set as the source image. - - ' This function will most likely be used in a end user application and should - ' be invoked through a menu command called: "Set/Apply Metadata From Source Image..." - - ' This function returns the number of tags copied or zero if there are no tags - ' in the source image or an error occured. - - If ((BitmapSrc <> 0) And (BitmapDst <> 0)) Then - If ((Model >= FIMD_COMMENTS) And (Model <= FIMD_CUSTOM)) Then - If (FreeImage_RemoveMetadataModel(BitmapDst, Model)) Then - FreeImage_CloneMetadataEx = FreeImage_CopyMetadata(BitmapSrc, BitmapDst, _ - True, Model) - End If - Else - For Model = FIMD_COMMENTS To FIMD_CUSTOM - FreeImage_CloneMetadataEx = FreeImage_CloneMetadataEx _ - + FreeImage_CloneMetadataEx(BitmapSrc, BitmapDst, _ - Model) - Next Model - End If - End If - -End Function - -Public Function FreeImage_TagFromPointer(ByVal Model As FREE_IMAGE_MDMODEL, _ - ByVal Tag As Long) As FREE_IMAGE_TAG - - ' This is a generic function that returns a VB wrapper Tag - ' structure (FREE_IMAGE_TAG) from a FreeImage FITAG *tag pointer. - - ' This function is still public due to legacy reasons. Since there are - ' functions like 'FreeImage_GetMetadataEx()', 'FreeImage_GetAllMetadataTags()' - ' or 'FreeImage_FindFirst/NextMetadataEx()', this function won't be needed - ' any more in most cases. - - FreeImage_TagFromPointer = pGetTagFromTagPtr(Model, Tag) - -End Function - -Public Function FreeImage_UpdateMetadata(ByRef Tag As FREE_IMAGE_TAG) As Boolean - - ' This function updates any changes made in a FREE_IMAGE_TAG - ' structure. - - FreeImage_UpdateMetadata = pTagToTagPtr(Tag) - -End Function - -Public Function FreeImage_UnsignedLong(ByVal Value As Long) As Variant - - ' This function converts a signed long (VB's Long data type) into - ' an unsigned long (not really supported by VB). - - ' Basically, this function checks, whether the positive range of - ' a signed long is sufficient to hold the value (indeed, it checks - ' the value since the range is obviously constant). If yes, - ' it returns a Variant with subtype Long ('Variant/Long' in VB's - ' watch window). In this case, the function did not make any real - ' changes at all. If not, the value is stored in a Currency variable, - ' which is able to store the whole range of an unsigned long. Then, - ' the function returns a Variant with subtype Currency - ' ('Variant/Currency' in VB's watch window). - - If (Value < 0) Then - Dim curTemp As Currency - Call CopyMemory(curTemp, Value, 4) - FreeImage_UnsignedLong = curTemp * 10000 - Else - FreeImage_UnsignedLong = Value - End If - -End Function - -Public Function FreeImage_UnsignedShort(ByVal Value As Integer) As Variant - - ' This function converts a signed short (VB's Integer data type) into - ' an unsigned short (not really supported by VB). - - ' Basically, this function checks, whether the positive range of - ' a signed short is sufficient to hold the value (indeed, it checks - ' the value since the range is obviously constant). If yes, - ' it returns a Variant with subtype Integer ('Variant/Integer' in VB's - ' watch window). In this case, the function did not make any real - ' changes at all. If not, the value is stored in a Long variable, - ' which is able to store the whole range of an unsigned short. Then, - ' the function returns a Variant with subtype Long - ' ('Variant/Long' in VB's watch window). - - If (Value < 0) Then - Dim lTemp As Long - Call CopyMemory(lTemp, Value, 2) - FreeImage_UnsignedShort = lTemp - Else - FreeImage_UnsignedShort = Value - End If - -End Function - -Public Function FreeImage_CreateRational(ByRef Numerator As Variant, _ - ByRef Denominator As Variant, _ - Optional ByVal NormalizeValue As Boolean = True) As FIRATIONAL - - ' This function creates an unsigned rational (FIDT_RATIONAL) value to be used with - ' FreeImage's metadata models. In the VB wrapper, any rational value is stored in a - ' structure (FIRATIONAL), containing both 'Numerator' and 'Denominator' members. The - ' rational's value is then defined as the fraction Numerator/Denominator. - - ' Both values 'Numerator' and 'Denominator' are actually ULONGs (unsigned longs), a - ' data type not supported by VB (a VB Long variable is always signed). Therefore, - ' 'Numerator' and 'Denominator' are typed as Variant. Whenever the range of a signed - ' long is sufficient to store the value (all values between 0 and 0x7FFFFFFF - ' (2147483647 decimal)), the Variant gets a Long subtype. If not, a Currency subtype is - ' used just to give you the mathematical correct value of the unsigned long. - - ' The optional parameter 'NormalizeValue' controls, whether the resulting fraction - ' should be normalized (cancelled down) or not. - - ' When calling this function, you can use hexadecimal constants for passing unsinged - ' longs via the parameters 'Numerator' and 'Denominator'. - - ' 2147483647 - ' Example: tRational = FreeImage_CreateRational(&HFFFFFFFF, 12345) -> ---------- - ' 12345 - - With FreeImage_CreateRational - .Numerator = FreeImage_UnsignedLong(Numerator) - .Denominator = FreeImage_UnsignedLong(Denominator) - End With - - If (NormalizeValue) Then - Call pNormalizeRational(FreeImage_CreateRational) - End If - -End Function - -Public Function FreeImage_CreateSignedRational(ByRef Numerator As Variant, _ - ByRef Denominator As Variant, _ - Optional ByVal NormalizeValue As Boolean = True) As FIRATIONAL - - ' This function creates a signed rational (FIDT_RATIONAL) value to be used with - ' FreeImage's metadata models. In the VB wrapper, any rational value is stored in a - ' structure (FIRATIONAL), containing both 'Numerator' and 'Denominator' members. The - ' rational's value is then defined as the fraction Numerator/Denominator. - - ' Both values 'Numerator' and 'Denominator' are actually LONGs (signed longs), the - ' same data type as a VB Long. Since, 'Numerator' and 'Denominator' are typed as - ' Variant, all possible values between -2,147,483,648 and + 2,147,483,647 are stored - ' in a Variant with subtype Long (cp. 'FreeImage_CreateRational()'). - - ' The optional parameter 'NormalizeValue' controls, whether the resulting fraction - ' should be normalized (cancelled down) or not. - - ' When calling this function, you can use hexadecimal constants for passing unsinged - ' longs via the parameters 'Numerator' and 'Denominator'. - - ' -1 1 - ' Example: tRational = FreeImage_CreateSignedRational(&HFFFFFFFF, 12345) -> ----- = - ----- - ' 12345 12345 - - With FreeImage_CreateSignedRational - .Numerator = CLng(Numerator) - .Denominator = CLng(Denominator) - End With - - If (NormalizeValue) Then - Call pNormalizeSRational(FreeImage_CreateSignedRational) - End If - -End Function - - - -'-------------------------------------------------------------------------------- -' Derived and hopefully useful functions -'-------------------------------------------------------------------------------- - -' Plugin and filename functions - -Public Function FreeImage_IsExtensionValidForFIF(ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Extension As String, _ - Optional ByVal Compare As VbCompareMethod = vbBinaryCompare) As Boolean - - ' This function tests, whether a given filename extension is valid - ' for a certain image format (fif). - - FreeImage_IsExtensionValidForFIF = (InStr(1, _ - FreeImage_GetFIFExtensionList(Format) & ",", _ - Extension & ",", _ - Compare) > 0) - -End Function - -Public Function FreeImage_IsFilenameValidForFIF(ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Filename As String, _ - Optional ByVal Compare As VbCompareMethod = vbBinaryCompare) As Boolean - -Dim strExtension As String -Dim i As Long - - ' This function tests, whether a given complete filename is valid - ' for a certain image format (fif). - - i = InStrRev(Filename, ".") - If (i > 0) Then - strExtension = Mid$(Filename, i + 1) - FreeImage_IsFilenameValidForFIF = (InStr(1, _ - FreeImage_GetFIFExtensionList(Format) & ",", _ - strExtension & ",", _ - Compare) > 0) - End If - -End Function - -Public Function FreeImage_GetPrimaryExtensionFromFIF(ByVal Format As FREE_IMAGE_FORMAT) As String - -Dim strExtensionList As String -Dim i As Long - - ' This function returns the primary (main or most commonly used?) extension - ' of a certain image format (fif). This is done by returning the first of - ' all possible extensions returned by FreeImage_GetFIFExtensionList(). That - ' assumes, that the plugin returns the extensions in ordered form. If not, - ' in most cases it is even enough, to receive any extension. - - ' This function is primarily used by the function 'SavePictureEx'. - - strExtensionList = FreeImage_GetFIFExtensionList(Format) - i = InStr(strExtensionList, ",") - If (i > 0) Then - FreeImage_GetPrimaryExtensionFromFIF = Left$(strExtensionList, i - 1) - Else - FreeImage_GetPrimaryExtensionFromFIF = strExtensionList - End If - -End Function - -Public Function FreeImage_IsGreyscaleImage(ByVal Bitmap As Long) As Boolean - -Dim atRGB() As RGBQUAD -Dim i As Long - - ' This function returns a boolean value that is true, if the DIB is actually - ' a greyscale image. Here, the only test condition is, that each palette - ' entry must be a grey value, what means that each color component has the - ' same value (red = green = blue). - - ' The FreeImage libraray doesn't offer a function to determine if a DIB is - ' greyscale. The only thing you can do is to use the 'FreeImage_GetColorType' - ' function, that returns either FIC_MINISWHITE or FIC_MINISBLACK for - ' greyscale images. However, a DIB needs to have a ordered greyscale palette - ' (linear ramp or inverse linear ramp) to be judged as FIC_MINISWHITE or - ' FIC_MINISBLACK. DIB's with an unordered palette that are actually (visually) - ' greyscale, are said to be (color-)palletized. That's also true for any 4 bpp - ' image, since it will never have a palette that satifies the tests done - ' in the 'FreeImage_GetColorType' function. - - ' So, there is a chance to omit some color depth conversions, when displaying - ' an image in greyscale fashion. Maybe the problem will be solved in the - ' FreeImage library one day. - - Select Case FreeImage_GetBPP(Bitmap) - - Case 1, 4, 8 - atRGB = FreeImage_GetPaletteEx(Bitmap) - FreeImage_IsGreyscaleImage = True - For i = 0 To UBound(atRGB) - With atRGB(i) - If ((.rgbRed <> .rgbGreen) Or (.rgbRed <> .rgbBlue)) Then - FreeImage_IsGreyscaleImage = False - Exit For - End If - End With - Next i - - End Select - -End Function - -' Bitmap resolution functions - -Public Function FreeImage_GetResolutionX(ByVal Bitmap As Long) As Long - - ' This function gets a DIB's resolution in X-direction measured - ' in 'dots per inch' (DPI) and not in 'dots per meter'. - - FreeImage_GetResolutionX = Int(0.5 + 0.0254 * FreeImage_GetDotsPerMeterX(Bitmap)) - -End Function - -Public Sub FreeImage_SetResolutionX(ByVal Bitmap As Long, ByVal Resolution As Long) - - ' This function sets a DIB's resolution in X-direction measured - ' in 'dots per inch' (DPI) and not in 'dots per meter'. - - Call FreeImage_SetDotsPerMeterX(Bitmap, Int(Resolution / 0.0254 + 0.5)) - -End Sub - -Public Function FreeImage_GetResolutionY(ByVal Bitmap As Long) As Long - - ' This function gets a DIB's resolution in Y-direction measured - ' in 'dots per inch' (DPI) and not in 'dots per meter'. - - FreeImage_GetResolutionY = Int(0.5 + 0.0254 * FreeImage_GetDotsPerMeterY(Bitmap)) - -End Function - -Public Sub FreeImage_SetResolutionY(ByVal Bitmap As Long, ByVal Resolution As Long) - - ' This function sets a DIB's resolution in Y-direction measured - ' in 'dots per inch' (DPI) and not in 'dots per meter'. - - Call FreeImage_SetDotsPerMeterY(Bitmap, Int(Resolution / 0.0254 + 0.5)) - -End Sub - -' ICC Color Profile functions - -Public Function FreeImage_GetICCProfile(ByVal Bitmap As Long) As FIICCPROFILE - - ' This function is a wrapper for the FreeImage_GetICCProfile() function, returning - ' a real FIICCPROFILE structure. - - ' Since the original FreeImage function returns a pointer to the FIICCPROFILE - ' structure (FIICCPROFILE *), as with string returning functions, this wrapper is - ' needed as VB can't declare a function returning a pointer to anything. So, - ' analogous to string returning functions, FreeImage_GetICCProfile() is declared - ' private as FreeImage_GetICCProfileInt() and made publicly available with this - ' wrapper function. - - Call CopyMemory(FreeImage_GetICCProfile, _ - ByVal FreeImage_GetICCProfileInt(Bitmap), _ - LenB(FreeImage_GetICCProfile)) - -End Function - -Public Function FreeImage_GetICCProfileColorModel(ByVal Bitmap As Long) As FREE_IMAGE_ICC_COLOR_MODEL - - ' This function is a thin wrapper around FreeImage_GetICCProfile() returning - ' the color model in which the ICC color profile data is in, if there is actually - ' a ICC color profile available for the Bitmap specified. - - ' If there is NO color profile along with that bitmap, this function returns the color - ' model that should (or must) be used for any color profile data to be assigned to the - ' Bitmap. That depends on the bitmap's color type. - - If (FreeImage_HasICCProfile(Bitmap)) Then - FreeImage_GetICCProfileColorModel = (pDeref(FreeImage_GetICCProfileInt(Bitmap)) _ - And FREE_IMAGE_ICC_COLOR_MODEL_MASK) - Else - ' use FreeImage_GetColorType() to determine, whether this is a CMYK bitmap or not - If (FreeImage_GetColorType(Bitmap) = FIC_CMYK) Then - FreeImage_GetICCProfileColorModel = FIICC_COLOR_MODEL_CMYK - Else - FreeImage_GetICCProfileColorModel = FIICC_COLOR_MODEL_RGB - End If - End If - -End Function - -Public Function FreeImage_GetICCProfileSize(ByVal Bitmap As Long) As Long - - ' This function is a thin wrapper around FreeImage_GetICCProfile() returning - ' only the size in bytes of the ICC profile data for the Bitmap specified or zero, - ' if there is no ICC profile data for the Bitmap. - - FreeImage_GetICCProfileSize = pDeref(FreeImage_GetICCProfileInt(Bitmap) + 4) - -End Function - -Public Function FreeImage_GetICCProfileDataPointer(ByVal Bitmap As Long) As Long - - ' This function is a thin wrapper around FreeImage_GetICCProfile() returning - ' only the pointer (the address) of the ICC profile data for the Bitmap specified, - ' or zero if there is no ICC profile data for the Bitmap. - - FreeImage_GetICCProfileDataPointer = pDeref(FreeImage_GetICCProfileInt(Bitmap) + 8) - -End Function - -Public Function FreeImage_HasICCProfile(ByVal Bitmap As Long) As Boolean - - ' This function is a thin wrapper around FreeImage_GetICCProfile() returning - ' True, if there is an ICC color profile available for the Bitmap specified or - ' returns False otherwise. - - FreeImage_HasICCProfile = (FreeImage_GetICCProfileSize(Bitmap) <> 0) - -End Function - -' Bitmap Info functions - -Public Function FreeImage_GetInfoHeaderEx(ByVal Bitmap As Long) As BITMAPINFOHEADER - -Dim lpInfoHeader As Long - - ' This function is a wrapper around FreeImage_GetInfoHeader() and returns a fully - ' populated BITMAPINFOHEADER structure for a given bitmap. - - lpInfoHeader = FreeImage_GetInfoHeader(Bitmap) - If (lpInfoHeader) Then - Call CopyMemory(FreeImage_GetInfoHeaderEx, ByVal lpInfoHeader, LenB(FreeImage_GetInfoHeaderEx)) - End If - -End Function - -' Image color depth conversion wrapper - -Public Function FreeImage_ConvertColorDepth(ByVal Bitmap As Long, _ - ByVal Conversion As FREE_IMAGE_CONVERSION_FLAGS, _ - Optional ByVal UnloadSource As Boolean, _ - Optional ByVal Threshold As Byte = 128, _ - Optional ByVal DitherMethod As FREE_IMAGE_DITHER = FID_FS, _ - Optional ByVal QuantizeMethod As FREE_IMAGE_QUANTIZE = FIQ_WUQUANT) As Long - -Dim hDIBNew As Long -Dim hDIBTemp As Long -Dim lBPP As Long -Dim bForceLinearRamp As Boolean -Dim lpReservePalette As Long -Dim bAdjustReservePaletteSize As Boolean - - ' This function is an easy-to-use wrapper for color depth conversion, intended - ' to work around some tweaks in the FreeImage library. - - ' The parameters 'Threshold' and 'eDitherMode' control how thresholding or - ' dithering are performed. The 'QuantizeMethod' parameter determines, what - ' quantization algorithm will be used when converting to 8 bit color images. - - ' The 'Conversion' parameter, which can contain a single value or an OR'ed - ' combination of some of the FREE_IMAGE_CONVERSION_FLAGS enumeration values, - ' determines the desired output image format. - - ' The optional 'UnloadSource' parameter is for unloading the original image, so - ' you can "change" an image with this function rather than getting a new DIB - ' pointer. There is no more need for a second DIB variable at the caller's site. - - bForceLinearRamp = ((Conversion And FICF_REORDER_GREYSCALE_PALETTE) = 0) - lBPP = FreeImage_GetBPP(Bitmap) - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to convert a 'header-only' bitmap.") - End If - - Select Case (Conversion And (Not FICF_REORDER_GREYSCALE_PALETTE)) - - Case FICF_MONOCHROME_THRESHOLD - If (lBPP > 1) Then - hDIBNew = FreeImage_Threshold(Bitmap, Threshold) - End If - - Case FICF_MONOCHROME_DITHER - If (lBPP > 1) Then - hDIBNew = FreeImage_Dither(Bitmap, DitherMethod) - End If - - Case FICF_GREYSCALE_4BPP - If (lBPP <> 4) Then - ' If the color depth is 1 bpp and the we don't have a linear ramp palette - ' the bitmap is first converted to an 8 bpp greyscale bitmap with a linear - ' ramp palette and then to 4 bpp. - If ((lBPP = 1) And (FreeImage_GetColorType(Bitmap) = FIC_PALETTE)) Then - hDIBTemp = Bitmap - Bitmap = FreeImage_ConvertToGreyscale(Bitmap) - Call FreeImage_Unload(hDIBTemp) - End If - hDIBNew = FreeImage_ConvertTo4Bits(Bitmap) - Else - ' The bitmap is already 4 bpp but may not have a linear ramp. - ' If we force a linear ramp the bitmap is converted to 8 bpp with a linear ramp - ' and then back to 4 bpp. - If (((Not bForceLinearRamp) And (Not FreeImage_IsGreyscaleImage(Bitmap))) Or _ - (bForceLinearRamp And (FreeImage_GetColorType(Bitmap) = FIC_PALETTE))) Then - hDIBTemp = FreeImage_ConvertToGreyscale(Bitmap) - hDIBNew = FreeImage_ConvertTo4Bits(hDIBTemp) - Call FreeImage_Unload(hDIBTemp) - End If - End If - - Case FICF_GREYSCALE_8BPP - ' Convert, if the bitmap is not at 8 bpp or does not have a linear ramp palette. - If ((lBPP <> 8) Or (((Not bForceLinearRamp) And (Not FreeImage_IsGreyscaleImage(Bitmap))) Or _ - (bForceLinearRamp And (FreeImage_GetColorType(Bitmap) = FIC_PALETTE)))) Then - hDIBNew = FreeImage_ConvertToGreyscale(Bitmap) - End If - - Case FICF_PALLETISED_8BPP - ' note, that the FreeImage library only quantizes 24 bit images - ' do not convert any 8 bit images - If (lBPP <> 8) Then - ' images with a color depth of 24 bits can directly be - ' converted with the FreeImage_ColorQuantize function; - ' other images need to be converted to 24 bits first - If (lBPP = 24) Then - hDIBNew = FreeImage_ColorQuantize(Bitmap, QuantizeMethod) - Else - hDIBTemp = FreeImage_ConvertTo24Bits(Bitmap) - hDIBNew = FreeImage_ColorQuantize(hDIBTemp, QuantizeMethod) - Call FreeImage_Unload(hDIBTemp) - End If - End If - - Case FICF_RGB_15BPP - If (lBPP <> 15) Then - hDIBNew = FreeImage_ConvertTo16Bits555(Bitmap) - End If - - Case FICF_RGB_16BPP - If (lBPP <> 16) Then - hDIBNew = FreeImage_ConvertTo16Bits565(Bitmap) - End If - - Case FICF_RGB_24BPP - If (lBPP <> 24) Then - hDIBNew = FreeImage_ConvertTo24Bits(Bitmap) - End If - - Case FICF_RGB_32BPP - If (lBPP <> 32) Then - hDIBNew = FreeImage_ConvertTo32Bits(Bitmap) - End If - - End Select - - If (hDIBNew) Then - FreeImage_ConvertColorDepth = hDIBNew - If (UnloadSource) Then - Call FreeImage_Unload(Bitmap) - End If - Else - FreeImage_ConvertColorDepth = Bitmap - End If - - End If - -End Function - -Public Function FreeImage_ColorQuantizeEx(ByVal Bitmap As Long, _ - Optional ByVal QuantizeMethod As FREE_IMAGE_QUANTIZE = FIQ_WUQUANT, _ - Optional ByVal UnloadSource As Boolean, _ - Optional ByVal PaletteSize As Long = 256, _ - Optional ByVal ReserveSize As Long, _ - Optional ByRef ReservePalette As Variant = Null) As Long - -Dim hTmp As Long -Dim lpPalette As Long -Dim lBlockSize As Long -Dim lElementSize As Long - - ' This function is a more VB-friendly wrapper around FreeImage_ColorQuantizeEx, - ' which lets you specify the ReservePalette to be used not only as a pointer, but - ' also as a real VB-style array of type Long, where each Long item takes a color - ' in ARGB format (&HAARRGGBB). The native FreeImage function FreeImage_ColorQuantizeEx - ' is declared private and named FreeImage_ColorQuantizeExInt and so hidden from the - ' world outside the wrapper. - - ' In contrast to the FreeImage API documentation, ReservePalette is of type Variant - ' and may either be a pointer to palette data (pointer to an array of type RGBQUAD - ' == VarPtr(atMyPalette(0)) in VB) or an array of type Long, which then must contain - ' the palette data in ARGB format. You can receive palette data as an array Longs - ' from function FreeImage_GetPaletteExLong. - ' Although ReservePalette is of type Variant, arrays of type RGBQUAD can not be - ' passed, as long as RGBQUAD is not declared as a public type in a public object - ' module. So, when dealing with RGBQUAD arrays, you are stuck on VarPtr or may - ' use function FreeImage_GetPalettePtr, which is a more meaningfully named - ' convenience wrapper around VarPtr. - - ' The optional 'UnloadSource' parameter is for unloading the original image, so - ' you can "change" an image with this function rather than getting a new DIB - ' pointer. There is no more need for a second DIB variable at the caller's site. - - ' All other parameters work according to the FreeImage API documentation. - - ' Note: Currently, any provided ReservePalette is only used, if quantize is - ' FIQ_NNQUANT. This seems to be either a bug or an undocumented - ' limitation of the FreeImage library (up to version 3.11.0). - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to quantize a 'header-only' bitmap.") - End If - - If (FreeImage_GetBPP(Bitmap) <> 24) Then - hTmp = Bitmap - Bitmap = FreeImage_ConvertTo24Bits(Bitmap) - If (UnloadSource) Then - Call FreeImage_Unload(hTmp) - End If - UnloadSource = True - End If - - ' adjust PaletteSize - If (PaletteSize < 2) Then - PaletteSize = 2 - ElseIf (PaletteSize > 256) Then - PaletteSize = 256 - End If - - lpPalette = pGetMemoryBlockPtrFromVariant(ReservePalette, lBlockSize, lElementSize) - FreeImage_ColorQuantizeEx = FreeImage_ColorQuantizeExInt(Bitmap, QuantizeMethod, _ - PaletteSize, ReserveSize, lpPalette) - - If (UnloadSource) Then - Call FreeImage_Unload(Bitmap) - End If - End If - -End Function - -Public Function FreeImage_GetPalettePtr(ByRef Palette() As RGBQUAD) As Long - - ' Returns a pointer to an array of RGBQUAD. This is sometimes referred to as - ' a palette. - - FreeImage_GetPalettePtr = VarPtr(Palette(0)) - -End Function - - -' Image Rescale wrapper functions - -Public Function FreeImage_RescaleEx(ByVal Bitmap As Long, _ - Optional ByVal Width As Variant, _ - Optional ByVal Height As Variant, _ - Optional ByVal IsPercentValue As Boolean, _ - Optional ByVal UnloadSource As Boolean, _ - Optional ByVal Filter As FREE_IMAGE_FILTER = FILTER_BICUBIC, _ - Optional ByVal ForceCloneCreation As Boolean) As Long - -Dim lNewWidth As Long -Dim lNewHeight As Long -Dim hDIBNew As Long - - ' This function is a easy-to-use wrapper for rescaling an image with the - ' FreeImage library. It returns a pointer to a new rescaled DIB provided - ' by FreeImage. - - ' The parameters 'Width', 'Height' and 'IsPercentValue' control - ' the size of the new image. Here, the function tries to fake something like - ' overloading known from Java. It depends on the parameter's data type passed - ' through the Variant, how the provided values for width and height are - ' actually interpreted. The following rules apply: - - ' In general, non integer values are either interpreted as percent values or - ' factors, the original image size will be multiplied with. The 'IsPercentValue' - ' parameter controls whether the values are percent values or factors. Integer - ' values are always considered to be the direct new image size, not depending on - ' the original image size. In that case, the 'IsPercentValue' parameter has no - ' effect. If one of the parameters is omitted, the image will not be resized in - ' that direction (either in width or height) and keeps it's original size. It is - ' possible to omit both, but that makes actually no sense. - - ' The following table shows some of possible data type and value combinations - ' that might by used with that function: (assume an original image sized 100x100 px) - - ' Parameter | Values | Values | Values | Values | Values | - ' ---------------------------------------------------------------------- - ' Width | 75.0 | 0.85 | 200 | 120 | 400.0 | - ' Height | 120.0 | 1.3 | 230 | - | 400.0 | - ' IsPercentValue | True | False | d.c. | d.c. | False | <- wrong option? - ' ---------------------------------------------------------------------- - ' Result Size | 75x120 | 85x130 | 200x230 | 120x100 |40000x40000 | - ' Remarks | percent | factor | direct | |maybe not | - ' |what you | - ' |wanted, | - ' |right? | - - ' The optional 'UnloadSource' parameter is for unloading the original image, so - ' you can "change" an image with this function rather than getting a new DIB - ' pointer. There is no more need for a second DIB variable at the caller's site. - - ' As of version 2.0 of the FreeImage VB wrapper, this function and all it's derived - ' functions like FreeImage_RescaleByPixel() or FreeImage_RescaleByPercent(), do NOT - ' return a clone of the image, if the new size desired is the same as the source - ' image's size. That behaviour can be forced by setting the new parameter - ' 'ForceCloneCreation' to True. Then, an image is also rescaled (and so - ' effectively cloned), if the new width and height is exactly the same as the source - ' image's width and height. - - ' Since this diversity may be confusing to VB developers, this function is also - ' callable through three different functions called 'FreeImage_RescaleByPixel', - ' 'FreeImage_RescaleByPercent' and 'FreeImage_RescaleByFactor'. - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to rescale a 'header-only' bitmap.") - End If - - If (Not IsMissing(Width)) Then - Select Case VarType(Width) - - Case vbDouble, vbSingle, vbDecimal, vbCurrency - lNewWidth = FreeImage_GetWidth(Bitmap) * Width - If (IsPercentValue) Then - lNewWidth = lNewWidth / 100 - End If - - Case Else - lNewWidth = Width - - End Select - End If - - If (Not IsMissing(Height)) Then - Select Case VarType(Height) - - Case vbDouble, vbSingle, vbDecimal - lNewHeight = FreeImage_GetHeight(Bitmap) * Height - If (IsPercentValue) Then - lNewHeight = lNewHeight / 100 - End If - - Case Else - lNewHeight = Height - - End Select - End If - - If ((lNewWidth > 0) And (lNewHeight > 0)) Then - If (ForceCloneCreation) Then - hDIBNew = FreeImage_Rescale(Bitmap, lNewWidth, lNewHeight, Filter) - - ElseIf ((lNewWidth <> FreeImage_GetWidth(Bitmap)) Or _ - (lNewHeight <> FreeImage_GetHeight(Bitmap))) Then - hDIBNew = FreeImage_Rescale(Bitmap, lNewWidth, lNewHeight, Filter) - - End If - - ElseIf (lNewWidth > 0) Then - If ((lNewWidth <> FreeImage_GetWidth(Bitmap)) Or _ - (ForceCloneCreation)) Then - lNewHeight = lNewWidth / (FreeImage_GetWidth(Bitmap) / FreeImage_GetHeight(Bitmap)) - hDIBNew = FreeImage_Rescale(Bitmap, lNewWidth, lNewHeight, Filter) - End If - - ElseIf (lNewHeight > 0) Then - If ((lNewHeight <> FreeImage_GetHeight(Bitmap)) Or _ - (ForceCloneCreation)) Then - lNewWidth = lNewHeight * (FreeImage_GetWidth(Bitmap) / FreeImage_GetHeight(Bitmap)) - hDIBNew = FreeImage_Rescale(Bitmap, lNewWidth, lNewHeight, Filter) - End If - - End If - - If (hDIBNew) Then - FreeImage_RescaleEx = hDIBNew - If (UnloadSource) Then - Call FreeImage_Unload(Bitmap) - End If - Else - FreeImage_RescaleEx = Bitmap - End If - End If - -End Function - -Public Function FreeImage_RescaleByPixel(ByVal Bitmap As Long, _ - Optional ByVal WidthInPixels As Long, _ - Optional ByVal HeightInPixels As Long, _ - Optional ByVal UnloadSource As Boolean, _ - Optional ByVal Filter As FREE_IMAGE_FILTER = FILTER_BICUBIC, _ - Optional ByVal ForceCloneCreation As Boolean) As Long - - ' Thin wrapper for function 'FreeImage_RescaleEx' for removing method - ' overload fake. This function rescales the image directly to the size - ' specified by the 'WidthInPixels' and 'HeightInPixels' parameters. - - FreeImage_RescaleByPixel = FreeImage_RescaleEx(Bitmap, WidthInPixels, HeightInPixels, False, _ - UnloadSource, Filter, ForceCloneCreation) - -End Function - -Public Function FreeImage_RescaleByPercent(ByVal Bitmap As Long, _ - Optional ByVal WidthPercentage As Double, _ - Optional ByVal HeightPercentage As Double, _ - Optional ByVal UnloadSource As Boolean, _ - Optional ByVal Filter As FREE_IMAGE_FILTER = FILTER_BICUBIC, _ - Optional ByVal ForceCloneCreation As Boolean) As Long - - ' Thin wrapper for function 'FreeImage_RescaleEx' for removing method - ' overload fake. This function rescales the image by a percent value - ' based on the image's original size. - - FreeImage_RescaleByPercent = FreeImage_RescaleEx(Bitmap, WidthPercentage, HeightPercentage, True, _ - UnloadSource, Filter, ForceCloneCreation) - -End Function - -Public Function FreeImage_RescaleByFactor(ByVal Bitmap As Long, _ - Optional ByVal WidthFactor As Double, _ - Optional ByVal HeightFactor As Double, _ - Optional ByVal UnloadSource As Boolean, _ - Optional ByVal Filter As FREE_IMAGE_FILTER = FILTER_BICUBIC, _ - Optional ByVal ForceCloneCreation As Boolean) As Long - - ' Thin wrapper for function 'FreeImage_RescaleEx' for removing method - ' overload fake. This function rescales the image by a factor - ' based on the image's original size. - - FreeImage_RescaleByFactor = FreeImage_RescaleEx(Bitmap, WidthFactor, HeightFactor, False, _ - UnloadSource, Filter, ForceCloneCreation) - -End Function - -' Painting functions - -Public Function FreeImage_PaintDC(ByVal hDC As Long, _ - ByVal Bitmap As Long, _ - Optional ByVal XDst As Long, _ - Optional ByVal YDst As Long, _ - Optional ByVal XSrc As Long, _ - Optional ByVal YSrc As Long, _ - Optional ByVal Width As Long, _ - Optional ByVal Height As Long) As Long - - ' This function draws a FreeImage DIB directly onto a device context (DC). There - ' are many (selfexplaining?) parameters that control the visual result. - - ' Parameters 'XDst' and 'YDst' specify the point where the output should - ' be painted and 'XSrc', 'YSrc', 'Width' and 'Height' span a rectangle - ' in the source image 'Bitmap' that defines the area to be painted. - - ' If any of parameters 'Width' and 'Height' is zero, it is transparently substituted - ' by the width or height of teh bitmap to be drawn, resprectively. - - If ((hDC <> 0) And (Bitmap <> 0)) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to paint a 'header-only' bitmap.") - End If - - If (Width = 0) Then - Width = FreeImage_GetWidth(Bitmap) - End If - - If (Height = 0) Then - Height = FreeImage_GetHeight(Bitmap) - End If - - FreeImage_PaintDC = SetDIBitsToDevice(hDC, XDst, YDst - YSrc, Width, Height, XSrc, YSrc, 0, _ - Height, FreeImage_GetBits(Bitmap), FreeImage_GetInfo(Bitmap), DIB_RGB_COLORS) - End If - -End Function - -Public Function FreeImage_PaintDCEx(ByVal hDC As Long, _ - ByVal Bitmap As Long, _ - Optional ByVal XDst As Long, _ - Optional ByVal YDst As Long, _ - Optional ByVal WidthDst As Long, _ - Optional ByVal HeightDst As Long, _ - Optional ByVal XSrc As Long, _ - Optional ByVal YSrc As Long, _ - Optional ByVal WidthSrc As Long, _ - Optional ByVal HeightSrc As Long, _ - Optional ByVal DrawMode As DRAW_MODE = DM_DRAW_DEFAULT, _ - Optional ByVal RasterOperator As RASTER_OPERATOR = ROP_SRCCOPY, _ - Optional ByVal StretchMode As STRETCH_MODE = SM_COLORONCOLOR) As Long - -Dim eLastStretchMode As STRETCH_MODE - - ' This function draws a FreeImage DIB directly onto a device context (DC). There - ' are many (selfexplaining?) parameters that control the visual result. - - ' The main difference of this function compared to the 'FreeImage_PaintDC' is, - ' that this function supports both mirroring and stretching of the image to be - ' painted and so, is somewhat slower than 'FreeImage_PaintDC'. - - If ((hDC <> 0) And (Bitmap <> 0)) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to paint a 'header-only' bitmap.") - End If - - eLastStretchMode = GetStretchBltMode(hDC) - Call SetStretchBltMode(hDC, StretchMode) - - If (WidthSrc = 0) Then - WidthSrc = FreeImage_GetWidth(Bitmap) - End If - If (WidthDst = 0) Then - WidthDst = WidthSrc - End If - - If (HeightSrc = 0) Then - HeightSrc = FreeImage_GetHeight(Bitmap) - End If - If (HeightDst = 0) Then - HeightDst = HeightSrc - End If - - If (DrawMode And DM_MIRROR_VERTICAL) Then - YDst = YDst + HeightDst - HeightDst = -HeightDst - End If - - If (DrawMode And DM_MIRROR_HORIZONTAL) Then - XDst = XDst + WidthDst - WidthDst = -WidthDst - End If - - Call StretchDIBits(hDC, XDst, YDst, WidthDst, HeightDst, XSrc, YSrc, WidthSrc, HeightSrc, _ - FreeImage_GetBits(Bitmap), FreeImage_GetInfo(Bitmap), DIB_RGB_COLORS, _ - RasterOperator) - - ' restore last mode - Call SetStretchBltMode(hDC, eLastStretchMode) - End If - -End Function - -Public Function FreeImage_PaintTransparent(ByVal hDC As Long, _ - ByVal Bitmap As Long, _ - Optional ByVal XDst As Long = 0, _ - Optional ByVal YDst As Long = 0, _ - Optional ByVal WidthDst As Long, _ - Optional ByVal HeightDst As Long, _ - Optional ByVal XSrc As Long = 0, _ - Optional ByVal YSrc As Long = 0, _ - Optional ByVal WidthSrc As Long, _ - Optional ByVal HeightSrc As Long, _ - Optional ByVal Alpha As Byte = 255) As Long - -Dim lpPalette As Long -Dim bIsTransparent As Boolean - - ' This function paints a device independent bitmap to any device context and - ' thereby honors any transparency information associated with the bitmap. - ' Furthermore, through the 'Alpha' parameter, an overall transparency level - ' may be specified. - - ' For palletised images, any color set to be transparent in the transparency - ' table, will be transparent. For high color images, only 32-bit images may - ' have any transparency information associated in their alpha channel. Only - ' these may be painted with transparency by this function. - - ' Since this is a wrapper for the Windows GDI function AlphaBlend(), 31-bit - ' images, containing alpha (or per-pixel) transparency, must be 'premultiplied' - ' for alpha transparent regions to actually show transparent. See MSDN help - ' on the AlphaBlend() function. - - ' FreeImage also offers a function to premultiply 32-bit bitmaps with their alpha - ' channel, according to the needs of AlphaBlend(). Have a look at function - ' FreeImage_PreMultiplyWithAlpha(). - - ' Overall transparency level may be specified for all bitmaps in all color - ' depths supported by FreeImage. If needed, bitmaps are transparently converted - ' to 32-bit and unloaded after the paint operation. This is also true for palletised - ' bitmaps. - - ' Parameters 'hDC' and 'Bitmap' seem to be very self-explanatory. All other parameters - ' are optional. The group of '*Dest*' parameters span a rectangle on the destination - ' device context, used as drawing area for the bitmap. If these are omitted, the - ' bitmap will be drawn starting at position 0,0 in the bitmap's actual size. - ' The group of '*Src*' parameters span a rectangle on the source bitmap, used as - ' cropping area for the paint operation. If both rectangles differ in size in any - ' direction, the part of the image actually painted is stretched for to fit into - ' the drawing area. If any of the parameters '*Width' or '*Height' are omitted, - ' the bitmap's actual size (width or height) will be used. - - ' The 'Alpha' parameter specifies the overall transparency. It takes values in the - ' range from 0 to 255. Using 0 will paint the bitmap fully transparent, 255 will - ' paint the image fully opaque. The 'Alpha' value controls, how the non per-pixel - ' portions of the image will be drawn. - - If ((hDC <> 0) And (Bitmap <> 0)) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to paint a 'header-only' bitmap.") - End If - - ' get image width if not specified - If (WidthSrc = 0) Then - WidthSrc = FreeImage_GetWidth(Bitmap) - End If - If (WidthDst = 0) Then - WidthDst = WidthSrc - End If - - ' get image height if not specified - If (HeightSrc = 0) Then - HeightSrc = FreeImage_GetHeight(Bitmap) - End If - If (HeightDst = 0) Then - HeightDst = HeightSrc - End If - - lpPalette = FreeImage_GetPalette(Bitmap) - If (lpPalette) Then - - Dim lPaletteSize As Long - Dim alPalOrg(255) As Long - Dim alPalMod(255) As Long - Dim alPalMask(255) As Long - Dim abTT() As Byte - Dim i As Long - - lPaletteSize = FreeImage_GetColorsUsed(Bitmap) * 4 - Call CopyMemory(alPalOrg(0), ByVal lpPalette, lPaletteSize) - Call CopyMemory(alPalMod(0), ByVal lpPalette, lPaletteSize) - abTT = FreeImage_GetTransparencyTableEx(Bitmap) - - If ((Alpha = 255) And _ - (HeightDst >= HeightSrc) And (WidthDst >= WidthSrc)) Then - - ' create a mask palette and a modified version of the - ' original palette - For i = 0 To UBound(abTT) - If (abTT(i) = 0) Then - alPalMask(i) = &HFFFFFFFF ' white - alPalMod(i) = &H0 ' black - bIsTransparent = True - End If - Next i - - If (Not bIsTransparent) Then - - ' if there is no transparency in the image, paint it with - ' a single SRCCOPY - Call StretchDIBits(hDC, _ - XDst, YDst, WidthDst, HeightDst, _ - XSrc, YSrc, WidthSrc, HeightSrc, _ - FreeImage_GetBits(Bitmap), _ - FreeImage_GetInfo(Bitmap), _ - DIB_RGB_COLORS, SRCCOPY) - Else - - ' set mask palette and paint with SRCAND - Call CopyMemory(ByVal lpPalette, alPalMask(0), lPaletteSize) - Call StretchDIBits(hDC, _ - XDst, YDst, WidthDst, HeightDst, _ - XSrc, YSrc, WidthSrc, HeightSrc, _ - FreeImage_GetBits(Bitmap), _ - FreeImage_GetInfo(Bitmap), _ - DIB_RGB_COLORS, SRCAND) - - ' set mask modified and paint with SRCPAINT - Call CopyMemory(ByVal lpPalette, alPalMod(0), lPaletteSize) - Call StretchDIBits(hDC, _ - XDst, YDst, WidthDst, HeightDst, _ - XSrc, YSrc, WidthSrc, HeightSrc, _ - FreeImage_GetBits(Bitmap), _ - FreeImage_GetInfo(Bitmap), _ - DIB_RGB_COLORS, SRCPAINT) - - ' restore original palette - Call CopyMemory(ByVal lpPalette, alPalOrg(0), lPaletteSize) - End If - - ' we are done, do not paint with AlphaBlend() any more - Bitmap = 0 - Else - - ' create a premultiplied palette - ' since we have no real per pixel transparency in a palletized - ' image, we only need to set all transparent colors to zero. - For i = 0 To UBound(abTT) - If (abTT(i) = 0) Then - alPalMod(i) = 0 - End If - Next i - - ' set premultiplied palette and convert to 32 bits - Call CopyMemory(ByVal lpPalette, alPalMod(0), lPaletteSize) - Bitmap = FreeImage_ConvertTo32Bits(Bitmap) - - ' restore original palette - Call CopyMemory(ByVal lpPalette, alPalOrg(0), lPaletteSize) - End If - End If - - If (Bitmap) Then - Dim hMemDC As Long - Dim hBitmap As Long - Dim hBitmapOld As Long - Dim tBF As BLENDFUNCTION - Dim lBF As Long - - hMemDC = CreateCompatibleDC(0) - If (hMemDC) Then - hBitmap = FreeImage_GetBitmap(Bitmap, hMemDC) - hBitmapOld = SelectObject(hMemDC, hBitmap) - - With tBF - .BlendOp = AC_SRC_OVER - .SourceConstantAlpha = Alpha - If (FreeImage_GetBPP(Bitmap) = 32) Then - .AlphaFormat = AC_SRC_ALPHA - End If - End With - Call CopyMemory(lBF, tBF, 4) - - Call AlphaBlend(hDC, XDst, YDst, WidthDst, HeightDst, _ - hMemDC, XSrc, YSrc, WidthSrc, HeightSrc, _ - lBF) - - Call SelectObject(hMemDC, hBitmapOld) - Call DeleteObject(hBitmap) - Call DeleteDC(hMemDC) - If (lpPalette) Then - Call FreeImage_Unload(Bitmap) - End If - End If - End If - End If - -End Function - - -'-------------------------------------------------------------------------------- -' Pixel access functions -'-------------------------------------------------------------------------------- - -Public Function FreeImage_GetBitsEx(ByVal Bitmap As Long) As Byte() - -Dim tSA As SAVEARRAY2D -Dim lpSA As Long - - ' This function returns a two dimensional Byte array containing a DIB's - ' data-bits. This is done by wrapping a true VB array around the memory - ' block the returned pointer of FreeImage_GetBits() is pointing to. So, the - ' array returned provides full read and write acces to the image's data. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the FreeImage_DestroyLockedArray() function. - - If (Bitmap) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 1 ' size in bytes per array element - .cDims = 2 ' the array has 2 dimensions - .cElements1 = FreeImage_GetHeight(Bitmap) ' the number of elements in y direction (height of Bitmap) - .cElements2 = FreeImage_GetPitch(Bitmap) ' the number of elements in x direction (byte width of Bitmap) - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetBits(Bitmap) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' allocate memory for an array descriptor - ' we cannot use the memory block used by tSA, since it is - ' released when tSA goes out of scope, leaving us with an - ' array with zeroed descriptor - ' we use nearly the same method that VB uses, so VB is able - ' to cleanup the array variable and it's descriptor; the - ' array data is not touched when cleaning up, since both AUTO - ' and FIXEDSIZE flags are set - Call SafeArrayAllocDescriptor(2, lpSA) - - ' copy our own array descriptor over the descriptor allocated - ' by SafeArrayAllocDescriptor; lpSA is a pointer to that memory - ' location - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - - ' the implicit variable named like the function is an array - ' variable in VB - ' make it point to the allocated array descriptor - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetBitsEx), lpSA, 4) - End If - -End Function - -Public Function FreeImage_GetBitsExRGBTRIPLE(ByVal Bitmap As Long) As RGBTRIPLE() - -Dim tSA As SAVEARRAY2D -Dim lpSA As Long - - ' This function returns a two dimensional RGBTRIPLE array containing a DIB's - ' data-bits. This is done by wrapping a true VB array around the memory - ' block the returned pointer of 'FreeImage_GetBits' is pointing to. So, the - ' array returned provides full read and write acces to the image's data. - - ' This function only works with 24 bpp images and, since each FreeImage scanline - ' is aligned to a 32-bit boundary, only if the image's width in pixels multiplied - ' by three modulo four is zero. That means, that the image layout in memory must - ' "naturally" be aligned to a 32-bit boundary, since arrays do not support padding. - - ' So, the function only returns an initialized array, if this equotion is true: - ' (((ImageWidthPixels * 3) Mod 4) = 0) - - ' In other words, this is true for all images with no padding. - - ' For instance, only images with these widths will be suitable for this function: - ' 100, 104, 108, 112, 116, 120, 124, ... - - ' Have a look at the wrapper function 'FreeImage_GetScanlinesRGBTRIPLE()' to have - ' a way to work around that limitation. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArray' function. - - If (Bitmap) Then - - If (FreeImage_GetBPP(Bitmap) = 24) Then - If (((FreeImage_GetWidth(Bitmap) * 3) Mod 4) = 0) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 3 ' size in bytes per array element - .cDims = 2 ' the array has 2 dimensions - .cElements1 = FreeImage_GetHeight(Bitmap) ' the number of elements in y direction (height of Bitmap) - .cElements2 = FreeImage_GetWidth(Bitmap) ' the number of elements in x direction (byte width of Bitmap) - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetBits(Bitmap) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' allocate memory for an array descriptor - ' we cannot use the memory block used by tSA, since it is - ' released when tSA goes out of scope, leaving us with an - ' array with zeroed descriptor - ' we use nearly the same method that VB uses, so VB is able - ' to cleanup the array variable and it's descriptor; the - ' array data is not touched when cleaning up, since both AUTO - ' and FIXEDSIZE flags are set - Call SafeArrayAllocDescriptor(2, lpSA) - - ' copy our own array descriptor over the descriptor allocated - ' by SafeArrayAllocDescriptor; lpSA is a pointer to that memory - ' location - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - - ' the implicit variable named like the function is an array - ' variable in VB - ' make it point to the allocated array descriptor - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetBitsExRGBTRIPLE), lpSA, 4) - Else - - ' we could throw an error here - End If - Else - - ' we could throw an error here - End If - End If - -End Function - -Public Function FreeImage_GetBitsExRGBQUAD(ByVal Bitmap As Long) As RGBQUAD() - -Dim tSA As SAVEARRAY2D -Dim lpSA As Long - - ' This function returns a two dimensional RGBQUAD array containing a DIB's - ' data-bits. This is done by wrapping a true VB array around the memory - ' block the returned pointer of 'FreeImage_GetBits' is pointing to. So, the - ' array returned provides full read and write acces to the image's data. - - ' This function only works with 32 bpp images. Since each scanline must - ' "naturally" start at a 32-bit boundary if each pixel uses 32 bits, there - ' are no padding problems like these known with 'FreeImage_GetBitsExRGBTRIPLE', - ' so, this function is suitable for all 32 bpp images of any size. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArray' function. - - If (Bitmap) Then - - If (FreeImage_GetBPP(Bitmap) = 32) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 4 ' size in bytes per array element - .cDims = 2 ' the array has 2 dimensions - .cElements1 = FreeImage_GetHeight(Bitmap) ' the number of elements in y direction (height of Bitmap) - .cElements2 = FreeImage_GetWidth(Bitmap) ' the number of elements in x direction (byte width of Bitmap) - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetBits(Bitmap) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' allocate memory for an array descriptor - ' we cannot use the memory block used by tSA, since it is - ' released when tSA goes out of scope, leaving us with an - ' array with zeroed descriptor - ' we use nearly the same method that VB uses, so VB is able - ' to cleanup the array variable and it's descriptor; the - ' array data is not touched when cleaning up, since both AUTO - ' and FIXEDSIZE flags are set - Call SafeArrayAllocDescriptor(2, lpSA) - - ' copy our own array descriptor over the descriptor allocated - ' by SafeArrayAllocDescriptor; lpSA is a pointer to that memory - ' location - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - - ' the implicit variable named like the function is an array - ' variable in VB - ' make it point to the allocated array descriptor - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetBitsExRGBQUAD), lpSA, 4) - Else - - ' we could throw an error here - End If - End If - -End Function - -Public Function FreeImage_GetScanLinesRGBTRIPLE(ByVal Bitmap As Long, _ - ByRef Scanlines As ScanLinesRGBTRIBLE, _ - Optional ByVal Reverse As Boolean) As Long -Dim lHeight As Long -Dim i As Long - - ' still undocumented - ' for now, have a look at function FreeImage_GetBitsExRGBTRIPLE() - - If (Bitmap) Then - If (FreeImage_GetImageType(Bitmap) = FIT_BITMAP) Then - If (FreeImage_GetBPP(Bitmap) = 24) Then - - lHeight = FreeImage_GetHeight(Bitmap) - ReDim Scanlines.Scanline(lHeight - 1) - For i = 0 To lHeight - 1 - If (Not Reverse) Then - Scanlines.Scanline(i).Data = FreeImage_GetScanLineBITMAP24(Bitmap, i) - Else - Scanlines.Scanline(i).Data = FreeImage_GetScanLineBITMAP24(Bitmap, lHeight - i - 1) - End If - Next i - End If - End If - End If - - FreeImage_GetScanLinesRGBTRIPLE = lHeight - -End Function - -Public Function FreeImage_GetScanLineEx(ByVal Bitmap As Long, _ - ByVal Scanline As Long) As Byte() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long - - ' This function returns a one dimensional Byte array containing a whole - ' scanline's data-bits. This is done by wrapping a true VB array around - ' the memory block the returned pointer of 'FreeImage_GetScanline' is - ' pointing to. So, the array returned provides full read and write acces - ' to the image's data. - - ' This is the most generic function of a complete function set dealing with - ' scanline data, since this function returns an array of type Byte. It is - ' up to the caller of the function to interpret these bytes correctly, - ' according to the results of FreeImage_GetBPP and FreeImage_GetImageType. - - ' You may consider using any of the non-generic functions named - ' 'FreeImage_GetScanLineXXX', that return an array of proper type, according - ' to the images bit depth and type. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArray' function. - - If (Bitmap) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 1 ' size in bytes per array element - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetLine(Bitmap) ' the number of elements in the array - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetScanline(Bitmap, _ - Scanline) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' allocate memory for an array descriptor - ' we cannot use the memory block used by tSA, since it is - ' released when tSA goes out of scope, leaving us with an - ' array with zeroed descriptor - ' we use nearly the same method that VB uses, so VB is able - ' to cleanup the array variable and it's descriptor; the - ' array data is not touched when cleaning up, since both AUTO - ' and FIXEDSIZE flags are set - Call SafeArrayAllocDescriptor(1, lpSA) - - ' copy our own array descriptor over the descriptor allocated - ' by SafeArrayAllocDescriptor; lpSA is a pointer to that memory - ' location - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - - ' the implicit variable named like the function is an array - ' variable in VB - ' make it point to the allocated array descriptor - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetScanLineEx), lpSA, 4) - End If - -End Function - -Public Function FreeImage_GetScanLineBITMAP8(ByVal Bitmap As Long, _ - ByVal Scanline As Long) As Byte() - - ' This function returns a one dimensional Byte array containing a whole - ' scanline's data-bits of a 8 bit bitmap image. This is done by wrapping - ' a true VB array around the memory block the returned pointer of - ' 'FreeImage_GetScanline' is pointing to. So, the array returned provides - ' full read and write acces to the image's data. - - ' This function is just a thin wrapper for 'FreeImage_GetScanLineEx' but - ' includes checking of the image's bit depth and type, as all of the - ' non-generic scanline functions do. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArray' function. - - If (FreeImage_GetImageType(Bitmap) = FIT_BITMAP) Then - Select Case FreeImage_GetBPP(Bitmap) - - Case 1, 4, 8 - FreeImage_GetScanLineBITMAP8 = FreeImage_GetScanLineEx(Bitmap, Scanline) - - End Select - End If - -End Function - -Public Function FreeImage_GetScanLineBITMAP16(ByVal Bitmap As Long, _ - ByVal Scanline As Long) As Integer() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long - - ' This function returns a one dimensional Integer array containing a whole - ' scanline's data-bits of a 16 bit bitmap image. This is done by wrapping - ' a true VB array around the memory block the returned pointer of - ' 'FreeImage_GetScanline' is pointing to. So, the array returned provides - ' full read and write acces to the image's data. - - ' The function includes checking of the image's bit depth and type and - ' returns a non-initialized array if 'Bitmap' is an image of improper type. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArray' function. - - If (FreeImage_GetImageType(Bitmap) = FIT_BITMAP) Then - If (FreeImage_GetBPP(Bitmap) = 16) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 2 ' size in bytes per array element - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetWidth(Bitmap) ' the number of elements in the array - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetScanline(Bitmap, _ - Scanline) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' For a complete source code documentation have a - ' look at the function 'FreeImage_GetScanLineEx' - Call SafeArrayAllocDescriptor(1, lpSA) - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetScanLineBITMAP16), lpSA, 4) - End If - End If - -End Function - -Public Function FreeImage_GetScanLineBITMAP24(ByVal Bitmap As Long, _ - ByVal Scanline As Long) As RGBTRIPLE() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long - - ' This function returns a one dimensional RGBTRIPLE array containing a whole - ' scanline's data-bits of a 24 bit bitmap image. This is done by wrapping - ' a true VB array around the memory block the returned pointer of - ' 'FreeImage_GetScanline' is pointing to. So, the array returned provides - ' full read and write acces to the image's data. - - ' The function includes checking of the image's bit depth and type and - ' returns a non-initialized array if 'Bitmap' is an image of improper type. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArrayRGBTRIPLE' function. - - If (FreeImage_GetImageType(Bitmap) = FIT_BITMAP) Then - If (FreeImage_GetBPP(Bitmap) = 24) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 3 ' size in bytes per array element - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetWidth(Bitmap) ' the number of elements in the array - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetScanline(Bitmap, _ - Scanline) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' For a complete source code documentation have a - ' look at the function 'FreeImage_GetScanLineEx' - Call SafeArrayAllocDescriptor(1, lpSA) - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetScanLineBITMAP24), lpSA, 4) - End If - End If - -End Function - -Public Function FreeImage_GetScanLineBITMAP32(ByVal Bitmap As Long, _ - ByVal Scanline As Long) As RGBQUAD() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long - - ' This function returns a one dimensional RGBQUAD array containing a whole - ' scanline's data-bits of a 32 bit bitmap image. This is done by wrapping - ' a true VB array around the memory block the returned pointer of - ' 'FreeImage_GetScanline' is pointing to. So, the array returned provides - ' full read and write acces to the image's data. - - ' The function includes checking of the image's bit depth and type and - ' returns a non-initialized array if 'Bitmap' is an image of improper type. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArrayRGBQUAD' function. - - If (FreeImage_GetImageType(Bitmap) = FIT_BITMAP) Then - If (FreeImage_GetBPP(Bitmap) = 32) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 4 ' size in bytes per array element - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetWidth(Bitmap) ' the number of elements in the array - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetScanline(Bitmap, _ - Scanline) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' For a complete source code documentation have a - ' look at the function 'FreeImage_GetScanLineEx' - Call SafeArrayAllocDescriptor(1, lpSA) - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetScanLineBITMAP32), lpSA, 4) - End If - End If - -End Function - -Public Function FreeImage_GetScanLineINT16(ByVal Bitmap As Long, _ - ByVal Scanline As Long) As Integer() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long -Dim eImageType As FREE_IMAGE_TYPE - - ' This function returns a one dimensional Integer array containing a whole - ' scanline's data-bits of a FIT_INT16 or FIT_UINT16 image. This is done - ' by wrapping a true VB array around the memory block the returned pointer - ' of 'FreeImage_GetScanline' is pointing to. So, the array returned - ' provides full read and write acces to the image's data. - - ' The function includes checking of the image's bit depth and type and - ' returns a non-initialized array if 'Bitmap' is an image of improper type. - - ' Since VB does not distinguish between signed and unsigned data types, both - ' image types FIT_INT16 and FIT_UINT16 are handled with this function. If 'Bitmap' - ' specifies an image of type FIT_UINT16, it is up to the caller to treat the - ' array's Integers as unsigned, although VB knows signed Integers only. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArray' function. - - eImageType = FreeImage_GetImageType(Bitmap) - If ((eImageType = FIT_INT16) Or _ - (eImageType = FIT_UINT16)) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 2 ' size in bytes per array element - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetWidth(Bitmap) ' the number of elements in the array - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetScanline(Bitmap, _ - Scanline) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' For a complete source code documentation have a - ' look at the function 'FreeImage_GetScanLineEx' - Call SafeArrayAllocDescriptor(1, lpSA) - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetScanLineINT16), lpSA, 4) - End If - -End Function - -Public Function FreeImage_GetScanLineINT32(ByVal Bitmap As Long, _ - ByVal Scanline As Long) As Long() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long -Dim eImageType As FREE_IMAGE_TYPE - - ' This function returns a one dimensional Long array containing a whole - ' scanline's data-bits of a FIT_INT32 or FIT_UINT32 image. This is done - ' by wrapping a true VB array around the memory block the returned pointer - ' of 'FreeImage_GetScanline' is pointing to. So, the array returned - ' provides full read and write acces to the image's data. - - ' The function includes checking of the image's bit depth and type and - ' returns a non-initialized array if 'Bitmap' is an image of improper type. - - ' Since VB does not distinguish between signed and unsigned data types, both - ' image types FIT_INT32 and FIT_UINT32 are handled with this function. If 'Bitmap' - ' specifies an image of type FIT_UINT32, it is up to the caller to treat the - ' array's Longs as unsigned, although VB knows signed Longs only. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArray' function. - - eImageType = FreeImage_GetImageType(Bitmap) - If ((eImageType = FIT_INT32) Or _ - (eImageType = FIT_UINT32)) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 4 ' size in bytes per array element - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetWidth(Bitmap) ' the number of elements in the array - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetScanline(Bitmap, _ - Scanline) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' For a complete source code documentation have a - ' look at the function 'FreeImage_GetScanLineEx' - Call SafeArrayAllocDescriptor(1, lpSA) - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetScanLineINT32), lpSA, 4) - End If - -End Function - -Public Function FreeImage_GetScanLineFLOAT(ByVal Bitmap As Long, _ - ByVal Scanline As Long) As Single() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long -Dim eImageType As FREE_IMAGE_TYPE - - ' This function returns a one dimensional Single array containing a whole - ' scanline's data-bits of a FIT_FLOAT image. This is done by wrapping - ' a true VB array around the memory block the returned pointer of - ' 'FreeImage_GetScanline' is pointing to. So, the array returned provides - ' full read and write acces to the image's data. - - ' The function includes checking of the image's bit depth and type and - ' returns a non-initialized array if 'Bitmap' is an image of improper type. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArray' function. - - eImageType = FreeImage_GetImageType(Bitmap) - If (eImageType = FIT_FLOAT) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 4 ' size in bytes per array element - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetWidth(Bitmap) ' the number of elements in the array - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetScanline(Bitmap, _ - Scanline) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' For a complete source code documentation have a - ' look at the function 'FreeImage_GetScanLineEx' - Call SafeArrayAllocDescriptor(1, lpSA) - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetScanLineFLOAT), lpSA, 4) - End If - -End Function - -Public Function FreeImage_GetScanLineDOUBLE(ByVal Bitmap As Long, _ - ByVal Scanline As Long) As Double() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long -Dim eImageType As FREE_IMAGE_TYPE - - ' This function returns a one dimensional Double array containing a whole - ' scanline's data-bits of a FIT_DOUBLE image. This is done by wrapping - ' a true VB array around the memory block the returned pointer of - ' 'FreeImage_GetScanline' is pointing to. So, the array returned provides - ' full read and write acces to the image's data. - - ' The function includes checking of the image's bit depth and type and - ' returns a non-initialized array if 'Bitmap' is an image of improper type. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArray' function. - - eImageType = FreeImage_GetImageType(Bitmap) - If (eImageType = FIT_DOUBLE) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 8 ' size in bytes per array element - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetWidth(Bitmap) ' the number of elements in the array - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetScanline(Bitmap, _ - Scanline) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' For a complete source code documentation have a - ' look at the function 'FreeImage_GetScanLineEx' - Call SafeArrayAllocDescriptor(1, lpSA) - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetScanLineDOUBLE), lpSA, 4) - End If - -End Function - -Public Function FreeImage_GetScanLineCOMPLEX(ByVal Bitmap As Long, _ - ByVal Scanline As Long) As FICOMPLEX() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long -Dim eImageType As FREE_IMAGE_TYPE - - ' This function returns a one dimensional FICOMPLEX array containing a whole - ' scanline's data-bits of a FIT_COMPLEX image. This is done by wrapping - ' a true VB array around the memory block the returned pointer of - ' 'FreeImage_GetScanline' is pointing to. So, the array returned provides - ' full read and write acces to the image's data. - - ' The function includes checking of the image's bit depth and type and - ' returns a non-initialized array if 'Bitmap' is an image of improper type. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArrayFICOMPLEX' function. - - eImageType = FreeImage_GetImageType(Bitmap) - If (eImageType = FIT_COMPLEX) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 16 ' size in bytes per array element - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetWidth(Bitmap) ' the number of elements in the array - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetScanline(Bitmap, _ - Scanline) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' For a complete source code documentation have a - ' look at the function 'FreeImage_GetScanLineEx' - Call SafeArrayAllocDescriptor(1, lpSA) - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetScanLineCOMPLEX), lpSA, 4) - End If - -End Function - -Public Function FreeImage_GetScanLineRGB16(ByVal Bitmap As Long, _ - ByVal Scanline As Long) As FIRGB16() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long -Dim eImageType As FREE_IMAGE_TYPE - - ' This function returns a one dimensional FIRGB16 array containing a whole - ' scanline's data-bits of a FIT_RGB16 image. This is done by wrapping - ' a true VB array around the memory block the returned pointer of - ' 'FreeImage_GetScanline' is pointing to. So, the array returned provides - ' full read and write acces to the image's data. - - ' The function includes checking of the image's bit depth and type and - ' returns a non-initialized array if 'Bitmap' is an image of improper type. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArrayFIRGB16' function. - - eImageType = FreeImage_GetImageType(Bitmap) - If (eImageType = FIT_RGB16) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 6 ' size in bytes per array element - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetWidth(Bitmap) ' the number of elements in the array - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetScanline(Bitmap, _ - Scanline) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' For a complete source code documentation have a - ' look at the function 'FreeImage_GetScanLineEx' - Call SafeArrayAllocDescriptor(1, lpSA) - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetScanLineRGB16), lpSA, 4) - End If - -End Function - -Public Function FreeImage_GetScanLineRGBA16(ByVal Bitmap As Long, _ - ByVal Scanline As Long) As FIRGBA16() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long -Dim eImageType As FREE_IMAGE_TYPE - - ' This function returns a one dimensional FIRGBA16 array containing a whole - ' scanline's data-bits of a FIT_RGBA16 image. This is done by wrapping - ' a true VB array around the memory block the returned pointer of - ' 'FreeImage_GetScanline' is pointing to. So, the array returned provides - ' full read and write acces to the image's data. - - ' The function includes checking of the image's bit depth and type and - ' returns a non-initialized array if 'Bitmap' is an image of improper type. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArrayFIRGBA16' function. - - eImageType = FreeImage_GetImageType(Bitmap) - If (eImageType = FIT_RGBA16) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 8 ' size in bytes per array element - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetWidth(Bitmap) ' the number of elements in the array - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetScanline(Bitmap, _ - Scanline) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' For a complete source code documentation have a - ' look at the function 'FreeImage_GetScanLineEx' - Call SafeArrayAllocDescriptor(1, lpSA) - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetScanLineRGBA16), lpSA, 4) - End If - -End Function - -Public Function FreeImage_GetScanLineRGBF(ByVal Bitmap As Long, _ - ByVal Scanline As Long) As FIRGBF() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long -Dim eImageType As FREE_IMAGE_TYPE - - ' This function returns a one dimensional FIRGBF array containing a whole - ' scanline's data-bits of a FIT_RGBF image. This is done by wrapping - ' a true VB array around the memory block the returned pointer of - ' 'FreeImage_GetScanline' is pointing to. So, the array returned provides - ' full read and write acces to the image's data. - - ' The function includes checking of the image's bit depth and type and - ' returns a non-initialized array if 'Bitmap' is an image of improper type. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArrayFIRGBF' function. - - eImageType = FreeImage_GetImageType(Bitmap) - If (eImageType = FIT_RGBF) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 12 ' size in bytes per array element - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetWidth(Bitmap) ' the number of elements in the array - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetScanline(Bitmap, _ - Scanline) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' For a complete source code documentation have a - ' look at the function 'FreeImage_GetScanLineEx' - Call SafeArrayAllocDescriptor(1, lpSA) - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetScanLineRGBF), lpSA, 4) - End If - -End Function - -Public Function FreeImage_GetScanLineRGBAF(ByVal Bitmap As Long, _ - ByVal Scanline As Long) As FIRGBAF() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long -Dim eImageType As FREE_IMAGE_TYPE - - ' This function returns a one dimensional FIRGBAF array containing a whole - ' scanline's data-bits of a FIT_RGBAF image. This is done by wrapping - ' a true VB array around the memory block the returned pointer of - ' 'FreeImage_GetScanline' is pointing to. So, the array returned provides - ' full read and write acces to the image's data. - - ' The function includes checking of the image's bit depth and type and - ' returns a non-initialized array if 'Bitmap' is an image of improper type. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArrayFIRGBAF' function. - - eImageType = FreeImage_GetImageType(Bitmap) - If (eImageType = FIT_RGBAF) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 12 ' size in bytes per array element - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetWidth(Bitmap) ' the number of elements in the array - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetScanline(Bitmap, _ - Scanline) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' For a complete source code documentation have a - ' look at the function 'FreeImage_GetScanLineEx' - Call SafeArrayAllocDescriptor(1, lpSA) - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetScanLineRGBAF), lpSA, 4) - End If - -End Function - -'-------------------------------------------------------------------------------- -' HBITMAP conversion functions -'-------------------------------------------------------------------------------- - -Public Function FreeImage_GetBitmap(ByVal Bitmap As Long, _ - Optional ByVal hDC As Long, _ - Optional ByVal UnloadSource As Boolean) As Long - -Dim bReleaseDC As Boolean -Dim ppvBits As Long - - ' This function returns an HBITMAP created by the CreateDIBSection() function which - ' in turn has the same color depth as the original DIB. A reference DC may be provided - ' through the 'hDC' parameter. The desktop DC will be used, if no reference DC is - ' specified. - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to create a bitmap from a 'header-only' bitmap.") - End If - - If (hDC = 0) Then - hDC = GetDC(0) - bReleaseDC = True - End If - If (hDC) Then - FreeImage_GetBitmap = CreateDIBSection(hDC, FreeImage_GetInfo(Bitmap), _ - DIB_RGB_COLORS, ppvBits, 0, 0) - If ((FreeImage_GetBitmap <> 0) And (ppvBits <> 0)) Then - Call CopyMemory(ByVal ppvBits, ByVal FreeImage_GetBits(Bitmap), _ - FreeImage_GetHeight(Bitmap) * FreeImage_GetPitch(Bitmap)) - End If - If (UnloadSource) Then - Call FreeImage_Unload(Bitmap) - End If - If (bReleaseDC) Then - Call ReleaseDC(0, hDC) - End If - End If - End If - -End Function - -Public Function FreeImage_GetBitmapForDevice(ByVal Bitmap As Long, _ - Optional ByVal hDC As Long, _ - Optional ByVal UnloadSource As Boolean) As Long - -Dim bReleaseDC As Boolean - - ' This function returns an HBITMAP created by the CreateDIBitmap() function which - ' in turn has always the same color depth as the reference DC, which may be provided - ' through the 'hDC' parameter. The desktop DC will be used, if no reference DC is - ' specified. - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to create a bitmap from a 'header-only' bitmap.") - End If - - If (hDC = 0) Then - hDC = GetDC(0) - bReleaseDC = True - End If - If (hDC) Then - FreeImage_GetBitmapForDevice = _ - CreateDIBitmap(hDC, FreeImage_GetInfoHeader(Bitmap), CBM_INIT, _ - FreeImage_GetBits(Bitmap), FreeImage_GetInfo(Bitmap), _ - DIB_RGB_COLORS) - If (UnloadSource) Then - Call FreeImage_Unload(Bitmap) - End If - If (bReleaseDC) Then - Call ReleaseDC(0, hDC) - End If - End If - End If - -End Function - -'-------------------------------------------------------------------------------- -' OlePicture conversion functions -'-------------------------------------------------------------------------------- - -Public Function FreeImage_GetOlePicture(ByVal Bitmap As Long, _ - Optional ByVal hDC As Long, _ - Optional ByVal UnloadSource As Boolean) As IPicture - -Dim hBitmap As Long -Dim tPicDesc As PictDesc -Dim tGuid As Guid -Dim cPictureDisp As IPictureDisp - - ' This function creates a VB Picture object (OlePicture) from a FreeImage DIB. - ' The original image need not remain valid nor loaded after the VB Picture - ' object has been created. - - ' The optional parameter 'hDC' determines the device context (DC) used for - ' transforming the device independent bitmap (DIB) to a device dependent - ' bitmap (DDB). This device context's color depth is responsible for this - ' transformation. This parameter may be null or omitted. In that case, the - ' windows desktop's device context will be used, what will be the desired - ' way in almost any cases. - - ' The optional 'UnloadSource' parameter is for unloading the original image - ' after the OlePicture has been created, so you can easily "switch" from a - ' FreeImage DIB to a VB Picture object. There is no need to unload the DIB - ' at the caller's site if this argument is True. - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to create a picture from a 'header-only' bitmap.") - End If - - hBitmap = FreeImage_GetBitmapForDevice(Bitmap, hDC, UnloadSource) - If (hBitmap) Then - ' fill tPictDesc structure with necessary parts - With tPicDesc - .cbSizeofStruct = Len(tPicDesc) - ' the vbPicTypeBitmap constant is not available in VBA environemnts - .picType = 1 'vbPicTypeBitmap - .hImage = hBitmap - End With - - ' fill in IDispatch Interface ID - With tGuid - .Data1 = &H20400 - .Data4(0) = &HC0 - .Data4(7) = &H46 - End With - - ' create a picture object - Call OleCreatePictureIndirect(tPicDesc, tGuid, True, cPictureDisp) - Set FreeImage_GetOlePicture = cPictureDisp - End If - End If - -End Function - -Public Function FreeImage_GetOlePictureIcon(ByVal hIcon As Long) As IPicture - -Dim tPicDesc As PictDesc -Dim tGuid As Guid -Dim cPictureDisp As IPictureDisp - - ' This function creates a VB Picture object (OlePicture) of type picTypeIcon - ' from FreeImage hIcon handle. The hIcon handle need not remain valid nor loaded - ' after the VB Picture object has been created. - - ' The optional 'UnloadSource' parameter is for destroying the hIcon image - ' after the OlePicture has been created, so you can easiely "switch" from a - ' hIcon handle to a VB Picture object. There is no need to unload the hIcon - ' at the caller's site if this argument is True. - - If (hIcon) Then - ' fill tPictDesc structure with necessary parts - With tPicDesc - .cbSizeofStruct = 12 - ' the vbPicTypeIcon constant is not available in VBA environemnts - .picType = 3 'vbPicTypeIcon - .hImage = hIcon - End With - - ' fill in IDispatch Interface ID - With tGuid - .Data1 = &H20400 - .Data4(0) = &HC0 - .Data4(7) = &H46 - End With - - ' create a picture object - Call OleCreatePictureIndirect(tPicDesc, tGuid, True, cPictureDisp) - Set FreeImage_GetOlePictureIcon = cPictureDisp - End If - -End Function - -Public Function FreeImage_GetOlePictureThumbnail(ByVal Bitmap As Long, _ - ByVal MaxPixelSize As Long, _ - Optional ByVal hDC As Long, _ - Optional ByVal UnloadSource As Boolean) As IPicture - -Dim hDIBThumbnail As Long - - ' This function is a IOlePicture aware wrapper for FreeImage_MakeThumbnail(). It - ' returns a VB Picture object instead of a FreeImage DIB. - - ' The optional 'UnloadSource' parameter is for unloading the original image - ' after the OlePicture has been created, so you can easiely "switch" from a - ' FreeImage DIB to a VB Picture object. There is no need to clean up the DIB - ' at the caller's site. - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to create a thumbnail picture from a 'header-only' bitmap.") - End If - - hDIBThumbnail = FreeImage_MakeThumbnail(Bitmap, MaxPixelSize) - Set FreeImage_GetOlePictureThumbnail = FreeImage_GetOlePicture(hDIBThumbnail, hDC, True) - - If (UnloadSource) Then - Call FreeImage_Unload(Bitmap) - End If - End If - -End Function - -Public Function FreeImage_CreateFromOlePicture(ByRef Picture As IPicture) As Long - -Dim hBitmap As Long -Dim tBM As BITMAP_API -Dim hDIB As Long -Dim hDC As Long -Dim lResult As Long -Dim nColors As Long -Dim lpInfo As Long - - ' Creates a FreeImage DIB from a VB Picture object (OlePicture). This function - ' returns a pointer to the DIB as, for instance, the FreeImage function - ' 'FreeImage_Load' does. So, this could be a real replacement for 'FreeImage_Load' - ' when working with VB Picture objects. - - If (Not Picture Is Nothing) Then - hBitmap = Picture.Handle - If (hBitmap) Then - lResult = GetObjectAPI(hBitmap, Len(tBM), tBM) - If (lResult) Then - hDIB = FreeImage_Allocate(tBM.bmWidth, _ - tBM.bmHeight, _ - tBM.bmBitsPixel) - If (hDIB) Then - ' The GetDIBits function clears the biClrUsed and biClrImportant BITMAPINFO - ' members (dont't know why). So we save these infos below. - ' This is needed for palletized images only. - nColors = FreeImage_GetColorsUsed(hDIB) - - hDC = GetDC(0) - lResult = GetDIBits(hDC, hBitmap, 0, _ - FreeImage_GetHeight(hDIB), _ - FreeImage_GetBits(hDIB), _ - FreeImage_GetInfo(hDIB), _ - DIB_RGB_COLORS) - If (lResult) Then - FreeImage_CreateFromOlePicture = hDIB - If (nColors) Then - ' restore BITMAPINFO members - ' FreeImage_GetInfo(Bitmap)->biClrUsed = nColors; - ' FreeImage_GetInfo(Bitmap)->biClrImportant = nColors; - lpInfo = FreeImage_GetInfo(hDIB) - Call CopyMemory(ByVal lpInfo + 32, nColors, 4) - Call CopyMemory(ByVal lpInfo + 36, nColors, 4) - End If - Else - Call FreeImage_Unload(hDIB) - End If - Call ReleaseDC(0, hDC) - End If - End If - End If - End If - -End Function - -Public Function FreeImage_CreateFromDC(ByVal hDC As Long, _ - Optional ByRef hBitmap As Long) As Long - -Dim tBM As BITMAP_API -Dim hDIB As Long -Dim lResult As Long -Dim nColors As Long -Dim lpInfo As Long - - ' Creates a FreeImage DIB from a Device Context/Compatible Bitmap. This - ' function returns a pointer to the DIB as, for instance, 'FreeImage_Load()' - ' does. So, this could be a real replacement for FreeImage_Load() or - ' 'FreeImage_CreateFromOlePicture()' when working with DCs and BITMAPs directly - - ' The 'hDC' parameter specifies a window device context (DC), the optional - ' parameter 'hBitmap' may specify a handle to a memory bitmap. When 'hBitmap' is - ' omitted, the bitmap currently selected into the given DC is used to create - ' the DIB. - - ' When 'hBitmap' is not missing but NULL (0), the function uses the DC's currently - ' selected bitmap. This bitmap's handle is stored in the ('ByRef'!) 'hBitmap' parameter - ' and so, is avaliable at the caller's site when the function returns. - - ' The DIB returned by this function is a copy of the image specified by 'hBitmap' or - ' the DC's current bitmap when 'hBitmap' is missing. The 'hDC' and also the 'hBitmap' - ' remain untouched in this function, there will be no objects destroyed or freed. - ' The caller is responsible to destroy or free the DC and BITMAP if necessary. - - ' first, check whether we got a hBitmap or not - If (hBitmap = 0) Then - ' if not, the parameter may be missing or is NULL so get the - ' DC's current bitmap - hBitmap = GetCurrentObject(hDC, OBJ_BITMAP) - End If - - lResult = GetObjectAPI(hBitmap, Len(tBM), tBM) - If (lResult) Then - hDIB = FreeImage_Allocate(tBM.bmWidth, _ - tBM.bmHeight, _ - tBM.bmBitsPixel) - If (hDIB) Then - ' The GetDIBits function clears the biClrUsed and biClrImportant BITMAPINFO - ' members (dont't know why). So we save these infos below. - ' This is needed for palletized images only. - nColors = FreeImage_GetColorsUsed(hDIB) - - lResult = GetDIBits(hDC, hBitmap, 0, _ - FreeImage_GetHeight(hDIB), _ - FreeImage_GetBits(hDIB), _ - FreeImage_GetInfo(hDIB), _ - DIB_RGB_COLORS) - - If (lResult) Then - FreeImage_CreateFromDC = hDIB - If (nColors) Then - ' restore BITMAPINFO members - ' FreeImage_GetInfo(Bitmap)->biClrUsed = nColors; - ' FreeImage_GetInfo(Bitmap)->biClrImportant = nColors; - lpInfo = FreeImage_GetInfo(hDIB) - Call CopyMemory(ByVal lpInfo + 32, nColors, 4) - Call CopyMemory(ByVal lpInfo + 36, nColors, 4) - End If - Else - Call FreeImage_Unload(hDIB) - End If - End If - End If - -End Function - -Public Function FreeImage_CreateFromImageContainer(ByRef Container As Object, _ - Optional ByVal IncludeDrawings As Boolean) As Long - - ' Creates a FreeImage DIB from a VB container control that has at least a - ' 'Picture' property. This function returns a pointer to the DIB as, for - ' instance, 'FreeImage_Load()' does. So, this could be a real replacement for - ' FreeImage_Load() or 'FreeImage_CreateFromOlePicture()' when working with - ' image hosting controls like Forms or PictureBoxes. - - ' The 'IncludeDrawings' parameter controls whether drawings, drawn with VB - ' methods like 'Container.Print()', 'Container.Line(x1, y1)-(x2, y2)' or - ' 'Container.Circle(x, y), radius' as the controls 'BackColor' should be included - ' into the newly created DIB. However, this only works, with control's that - ' have their 'AutoRedraw' property set to 'True'. - - ' To get the control's picture as well as it's BackColor and custom drawings, - ' this function uses the control's 'Image' property instead of the 'Picture' - ' property. - - ' This function treats Forms and PictureBox controls explicitly, since the - ' property sets and behaviours of these controls are publicly known. For any - ' other control, the function checks for the existence of an 'Image' and - ' 'AutoRedraw' property. If these are present and 'IncludeDrawings' is 'True', - ' the function uses the control's 'Image' property instead of the 'Picture' - ' property. This my be the case for UserControls. In any other case, the function - ' uses the control's 'Picture' property if present. If none of these properties - ' is present, a runtime error (5) is generated. - - ' Most of this function is actually implemented in the wrapper's private helper - ' function 'pGetIOlePictureFromContainer'. - - If (Not Container Is Nothing) Then - FreeImage_CreateFromImageContainer = FreeImage_CreateFromOlePicture( _ - pGetIOlePictureFromContainer(Container, _ - IncludeDrawings)) - End If - -End Function - -Public Function FreeImage_CreateFromScreen(Optional ByVal hWnd As Long, _ - Optional ByVal ClientAreaOnly As Boolean) As Long - -Dim hDC As Long -Dim lWidth As Long -Dim lHeight As Long -Dim hMemDC As Long -Dim hMemBMP As Long -Dim hMemOldBMP As Long -Dim tR As RECT - - ' Creates a FreeImage DIB from the screen which may either be the whole - ' desktop/screen or a certain window. A certain window may be specified - ' by it's window handle through the 'hWnd' parameter. By omitting this - ' parameter, the whole screen/desktop window will be captured. - - If (hWnd = 0) Then - hWnd = GetDesktopWindow() - hDC = GetDCEx(hWnd, 0, 0) - ' get desktop's width and height - lWidth = GetDeviceCaps(hDC, HORZRES) - lHeight = GetDeviceCaps(hDC, VERTRES) - - ElseIf (ClientAreaOnly) Then - ' get window's client area DC - hDC = GetDCEx(hWnd, 0, 0) - Call GetClientRect(hWnd, tR) - lWidth = tR.Right - lHeight = tR.Bottom - - Else - ' get window DC - hDC = GetDCEx(hWnd, 0, DCX_WINDOW) - Call GetWindowRect(hWnd, tR) - lWidth = tR.Right - tR.Left - lHeight = tR.Bottom - tR.Top - - End If - - ' create compatible memory DC and bitmap - hMemDC = CreateCompatibleDC(hDC) - hMemBMP = CreateCompatibleBitmap(hDC, lWidth, lHeight) - ' select compatible bitmap - hMemOldBMP = SelectObject(hMemDC, hMemBMP) - ' blit bits - Call BitBlt(hMemDC, 0, 0, lWidth, lHeight, hDC, 0, 0, SRCCOPY Or CAPTUREBLT) - - ' create FreeImage Bitmap from memory DC - FreeImage_CreateFromScreen = FreeImage_CreateFromDC(hMemDC, hMemBMP) - - ' clean up - Call SelectObject(hMemDC, hMemOldBMP) - Call DeleteObject(hMemBMP) - Call DeleteDC(hMemDC) - Call ReleaseDC(hWnd, hDC) - -End Function - -'-------------------------------------------------------------------------------- -' Microsoft Office / VBA PictureData supporting functions -'-------------------------------------------------------------------------------- - -Public Function FreeImage_GetPictureData(ByVal Bitmap As Long, _ - Optional ByVal UnloadSource As Boolean) As Byte() - -Const SIZE_OF_LONG = 4 -Const SIZE_OF_BITMAPINFOHEADER = 40 - -Dim abResult() As Byte -Dim lHeaderSize As Long -Dim lPaletteSize As Long -Dim lImageSize As Long -Dim lpInfo As Long -Dim lOffset As Long - - ' This function creates an Office PictureData Byte array from a FreeImage DIB. - ' The original image must not remain valid nor loaded after the PictureData - ' array has been created. - - ' The optional 'UnloadSource' parameter is for unloading the original image - ' after the PictureData Byte array has been created, so you can easily "switch" - ' from a FreeImage DIB to an Office PictureData Byte array. There is no need to - ' unload the DIB at the caller's site if this argument is True. - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to create a PictureData array from a 'header-only' bitmap.") - End If - - If (FreeImage_HasRGBMasks(Bitmap)) Then - lHeaderSize = 3 * SIZE_OF_LONG - End If - lHeaderSize = lHeaderSize + SIZE_OF_BITMAPINFOHEADER - lImageSize = FreeImage_GetHeight(Bitmap) * FreeImage_GetPitch(Bitmap) - lPaletteSize = FreeImage_GetColorsUsed(Bitmap) * 4 - - ReDim abResult(lHeaderSize + lPaletteSize + lImageSize - 1) - - ' Copy the BITMAPINFOHEADER into the result array. - lpInfo = FreeImage_GetInfo(Bitmap) - Call CopyMemory(abResult(0), ByVal lpInfo, lHeaderSize) - lOffset = lOffset + lHeaderSize - - If (lPaletteSize > 0) Then - ' Copy the image's palette (if any) into the result array. - Call CopyMemory(abResult(lOffset), ByVal FreeImage_GetPalette(Bitmap), lPaletteSize) - lOffset = lOffset + lPaletteSize - End If - - ' Copy the image's bits into the result array. - Call CopyMemory(abResult(lOffset), ByVal FreeImage_GetBits(Bitmap), lImageSize) - - Call pSwap(ByVal VarPtrArray(abResult), ByVal VarPtrArray(FreeImage_GetPictureData)) - - If (UnloadSource) Then - Call FreeImage_Unload(Bitmap) - End If - End If - -End Function - -Public Function FreeImage_CreateFromPictureData(ByRef PictureData() As Byte) As Long - -Dim tBMIH As BITMAPINFOHEADER -Dim lLength As Long -Dim hDIB As Long -Dim lPaletteSize As Long -Dim lOffset As Long -Dim alMasks() As Long - - ' Creates a FreeImage DIB from an Office PictureData Byte array. This function - ' returns a pointer to the DIB as, for instance, the FreeImage function - ' 'FreeImage_Load' does. So, this could be a real replacement for 'FreeImage_Load' - ' when working with PictureData arrays. - - lLength = UBound(PictureData) + 1 - If (lLength > Len(tBMIH)) Then - Call CopyMemory(tBMIH, PictureData(0), Len(tBMIH)) - With tBMIH - If (.biSize = 40) Then - lOffset = 40 - Select Case .biBitCount - - Case 0 - - Case 1, 4, 8 - If (.biClrUsed = 0) Then - lPaletteSize = 2 ^ .biBitCount * 4 - Else - lPaletteSize = .biClrUsed * 4 - End If - hDIB = FreeImage_Allocate(.biWidth, .biHeight, .biBitCount) - Call CopyMemory(ByVal FreeImage_GetPalette(hDIB), _ - PictureData(lOffset), lPaletteSize) - lOffset = lOffset + lPaletteSize - - Case 16 - If (.biCompression = BI_BITFIELDS) Then - ReDim alMasks(2) - Call CopyMemory(alMasks(0), PictureData(lOffset), 12) - lOffset = lOffset + 12 - hDIB = FreeImage_Allocate(.biWidth, .biHeight, .biBitCount, _ - alMasks(0), alMasks(1), alMasks(2)) - Else - hDIB = FreeImage_Allocate(.biWidth, .biHeight, .biBitCount, _ - FI16_555_RED_MASK, FI16_555_GREEN_MASK, FI16_555_BLUE_MASK) - End If - - Case 24, 32 - hDIB = FreeImage_Allocate(.biWidth, .biHeight, .biBitCount) - - End Select - - If (hDIB) Then - Call CopyMemory(ByVal FreeImage_GetBits(hDIB), _ - PictureData(lOffset), lLength - lOffset) - FreeImage_CreateFromPictureData = hDIB - End If - Else - ' ERROR: invalid or unsupported PictureData array - End If - End With - Else - ' ERROR: invalid or unsupported PictureData array - End If - -End Function - -Public Function FreeImage_CreateMask(ByVal hDIB As Long, _ - Optional ByVal eMaskCreationOptions As FREE_IMAGE_MASK_CREATION_OPTION_FLAGS = MCOF_CREATE_MASK_IMAGE, _ - Optional ByVal lBitDepth As Long = 1, _ - Optional ByVal eMaskOptions As FREE_IMAGE_MASK_FLAGS = FIMF_MASK_FULL_TRANSPARENCY, _ - Optional ByVal vntMaskColors As Variant, _ - Optional ByVal eMaskColorsFormat As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB, _ - Optional ByVal lColorTolerance As Long, _ - Optional ByVal lciMaskColorDst As Long = vbWhite, _ - Optional ByVal eMaskColorDstFormat As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB, _ - Optional ByVal lciUnmaskColorDst As Long = vbBlack, _ - Optional ByVal eUnmaskColorDstFormat As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB, _ - Optional ByVal vlciMaskColorSrc As Variant, _ - Optional ByVal eMaskColorSrcFormat As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB, _ - Optional ByVal vlciUnmaskColorSrc As Variant, _ - Optional ByVal eUnmaskColorSrcFormat As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB) As Long - -Dim hDIBResult As Long -Dim lBitDepthSrc As Long -Dim lWidth As Long -Dim lHeight As Long - -Dim bMaskColors As Boolean -Dim bMaskTransparency As Boolean -Dim bMaskFullTransparency As Boolean -Dim bMaskAlphaTransparency As Boolean -Dim bInvertMask As Boolean -Dim bHaveMaskColorSrc As Boolean -Dim bHaveUnmaskColorSrc As Boolean -Dim bCreateMaskImage As Boolean -Dim bModifySourceImage As Boolean -Dim alcMaskColors() As Long -Dim lMaskColorsMaxIndex As Long - -Dim lciMaskColorSrc As Long -Dim lciUnmaskColorSrc As Long - -Dim alPaletteSrc() As Long -Dim abTransparencyTableSrc() As Byte -Dim abBitsBSrc() As Byte -Dim atBitsTSrc As ScanLinesRGBTRIBLE -Dim atBitsQSrc() As RGBQUAD -Dim abBitValues(7) As Byte -Dim abBitMasks(7) As Byte -Dim abBitShifts(7) As Byte - -Dim atPaletteDst() As RGBQUAD -Dim abBitsBDst() As Byte -Dim atBitsTDst As ScanLinesRGBTRIBLE -Dim atBitsQDst() As RGBQUAD - -Dim bMaskPixel As Boolean -Dim x As Long -Dim x2 As Long -Dim lPixelIndex As Long -Dim y As Long -Dim i As Long - - 'TODO: comment this function - - ' check for a proper bit depth of the destination (mask) image - If ((hDIB) And ((lBitDepth = 1) Or _ - (lBitDepth = 4) Or _ - (lBitDepth = 8) Or _ - (lBitDepth = 24) Or _ - (lBitDepth = 32))) Then - - If (Not FreeImage_HasPixels(hDIB)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to create a mask image from a 'header-only' bitmap.") - End If - - ' check for a proper bit depth of the source image - lBitDepthSrc = FreeImage_GetBPP(hDIB) - If ((lBitDepthSrc = 4) Or _ - (lBitDepthSrc = 8) Or _ - (lBitDepthSrc = 24) Or _ - (lBitDepthSrc = 32)) Then - - - ' get some information from eMaskCreationOptions - bCreateMaskImage = (eMaskCreationOptions And MCOF_CREATE_MASK_IMAGE) - bModifySourceImage = (eMaskCreationOptions And MCOF_MODIFY_SOURCE_IMAGE) - - - If (bCreateMaskImage) Then - - ' check mask color format - If (eMaskColorDstFormat And FICFF_COLOR_BGR) Then - ' if mask color is in BGR format, convert to RGB format - lciMaskColorDst = FreeImage_SwapColorLong(lciMaskColorDst) - - ElseIf (eMaskColorDstFormat And FICFF_COLOR_PALETTE_INDEX) Then - ' if mask color is specified as palette index, check, whether the - ' source image is a palletized image - Select Case lBitDepthSrc - - Case 1 - lciMaskColorDst = FreeImage_GetPaletteExLong(hDIB)(lciMaskColorDst And &H1) - - Case 4 - lciMaskColorDst = FreeImage_GetPaletteExLong(hDIB)(lciMaskColorDst And &HF) - - Case 8 - lciMaskColorDst = FreeImage_GetPaletteExLong(hDIB)(lciMaskColorDst And &HFF) - - End Select - End If - - ' check unmask color format - If (eUnmaskColorDstFormat And FICFF_COLOR_BGR) Then - ' if unmask color is in BGR format, convert to RGB format - lciUnmaskColorDst = FreeImage_SwapColorLong(lciUnmaskColorDst) - - ElseIf (eUnmaskColorDstFormat And FICFF_COLOR_PALETTE_INDEX) Then - ' if unmask color is specified as palette index, check, whether the - ' source image is a palletized image - Select Case lBitDepthSrc - - Case 1 - lciUnmaskColorDst = FreeImage_GetPaletteExLong(hDIB)(lciUnmaskColorDst And &H1) - - Case 4 - lciUnmaskColorDst = FreeImage_GetPaletteExLong(hDIB)(lciUnmaskColorDst And &HF) - - Case 8 - lciUnmaskColorDst = FreeImage_GetPaletteExLong(hDIB)(lciUnmaskColorDst And &HFF) - - End Select - End If - End If - - - If (bModifySourceImage) Then - - ' check, whether source image can be modified - bHaveMaskColorSrc = (Not IsMissing(vlciMaskColorSrc)) - bHaveUnmaskColorSrc = (Not IsMissing(vlciUnmaskColorSrc)) - - Select Case lBitDepthSrc - - Case 4, 8 - If (bHaveMaskColorSrc) Then - - ' get mask color as Long - lciMaskColorSrc = vlciMaskColorSrc - - If (eMaskColorSrcFormat And FICFF_COLOR_PALETTE_INDEX) Then - If (lBitDepthSrc = 4) Then - lciMaskColorSrc = (lciMaskColorSrc And &HF) - Else - lciMaskColorSrc = (lciMaskColorSrc And &HFF) - End If - Else - If (eMaskColorSrcFormat And FICFF_COLOR_BGR) Then - lciMaskColorSrc = FreeImage_SwapColorLong(lciMaskColorSrc, True) - End If - lciMaskColorSrc = FreeImage_SearchPalette(hDIB, lciMaskColorSrc) - bHaveMaskColorSrc = (lciMaskColorSrc <> -1) - End If - End If - - If (bHaveUnmaskColorSrc) Then - - ' get unmask color as Long - lciUnmaskColorSrc = vlciUnmaskColorSrc - - If (eUnmaskColorSrcFormat And FICFF_COLOR_PALETTE_INDEX) Then - If (lBitDepthSrc = 4) Then - lciUnmaskColorSrc = (lciUnmaskColorSrc And &HF) - Else - lciUnmaskColorSrc = (lciUnmaskColorSrc And &HFF) - End If - Else - If (eUnmaskColorSrcFormat And FICFF_COLOR_BGR) Then - lciUnmaskColorSrc = FreeImage_SwapColorLong(lciUnmaskColorSrc, True) - End If - lciUnmaskColorSrc = FreeImage_SearchPalette(hDIB, lciUnmaskColorSrc) - bHaveUnmaskColorSrc = (lciUnmaskColorSrc <> -1) - End If - End If - - ' check, if source image still can be modified in any way - bModifySourceImage = (bHaveMaskColorSrc Or bHaveUnmaskColorSrc) - - Case 24, 32 - If (bHaveMaskColorSrc) Then - - ' get mask color as Long - lciMaskColorSrc = vlciMaskColorSrc - - If (eMaskColorSrcFormat And FICFF_COLOR_BGR) Then - lciMaskColorSrc = FreeImage_SwapColorLong(lciMaskColorSrc, (lBitDepthSrc = 24)) - End If - End If - - If (bHaveUnmaskColorSrc) Then - - ' get unmask color as Long - lciUnmaskColorSrc = vlciUnmaskColorSrc - - If (eUnmaskColorSrcFormat And FICFF_COLOR_BGR) Then - lciUnmaskColorSrc = FreeImage_SwapColorLong(lciUnmaskColorSrc, (lBitDepthSrc = 24)) - End If - End If - - End Select - - End If - - - If ((bModifySourceImage) Or (bCreateMaskImage)) Then - - ' get some information from eMaskOptions - - ' check for inverse mask - bInvertMask = (eMaskOptions And FIMF_MASK_INVERSE_MASK) - - ' check for mask colors - bMaskColors = (eMaskOptions And FIMF_MASK_COLOR_TRANSPARENCY) - bMaskColors = bMaskColors And (Not IsMissing(vntMaskColors)) - If (bMaskColors) Then - ' validate specified mask colors; all mask colors are transferred to - ' an internal array of type Long - If (Not IsArray(vntMaskColors)) Then - ' color masking is only done when the single mask color is - ' a numeric (color) value - bMaskColors = IsNumeric(vntMaskColors) - If (bMaskColors) Then - ' this is not an array of mask colors but only a single - ' color; this is also transferred into an internal array - lMaskColorsMaxIndex = 0 - ReDim alcMaskColors(lMaskColorsMaxIndex) - alcMaskColors(lMaskColorsMaxIndex) = vntMaskColors - End If - Else - ' transfer all valid color values (numeric) into an internal - ' array - ReDim alcMaskColors(UBound(vntMaskColors)) - For i = LBound(vntMaskColors) To UBound(vntMaskColors) - bMaskColors = (IsNumeric(vntMaskColors(i))) - If (Not bMaskColors) Then - Exit For - Else - alcMaskColors(lMaskColorsMaxIndex) = vntMaskColors(i) - lMaskColorsMaxIndex = lMaskColorsMaxIndex + 1 - End If - Next i - If (bMaskColors) Then - lMaskColorsMaxIndex = lMaskColorsMaxIndex - 1 - End If - End If - End If - - ' check for transparency options - If ((FreeImage_IsTransparent(hDIB)) Or _ - ((eMaskOptions And FIMF_MASK_FORCE_TRANSPARENCY) > 0)) Then - bMaskFullTransparency = (eMaskOptions And FIMF_MASK_FULL_TRANSPARENCY) - bMaskAlphaTransparency = (eMaskOptions And FIMF_MASK_ALPHA_TRANSPARENCY) - bMaskTransparency = (bMaskFullTransparency Or bMaskAlphaTransparency) - End If - - ' get image dimension - lWidth = FreeImage_GetWidth(hDIB) - lHeight = FreeImage_GetHeight(hDIB) - - ' create proper accessors for the source image - Select Case lBitDepthSrc - - Case 4, 8 - ' images with a bit depth of 4 or 8 bits will both be - ' read through a byte array - abBitsBSrc = FreeImage_GetBitsEx(hDIB) - ' depending on where to get the transparency information from, - ' a palette or a transpareny table will be needed - If (bMaskColors) Then - alPaletteSrc = FreeImage_GetPaletteExLong(hDIB) - End If - If (bMaskTransparency) Then - abTransparencyTableSrc = FreeImage_GetTransparencyTableExClone(hDIB) - End If - - ' for 4 bit source images - If (lBitDepthSrc = 4) Then - ' two additional arrays need to be filled with values - ' to mask and shift nibbles to bytes - ' index 0 stands for the high nibble of the byte - abBitMasks(0) = &HF0 - abBitShifts(0) = &H10 ' a shift to right is implemented - ' as division in VB - ' index 1 stands for the low nibble of the byte - abBitMasks(1) = &HF - abBitShifts(1) = &H1 ' no shift needed for low nibble - End If - - Case 24 - ' images with a depth of 24 bits could not be used - ' through a two dimensional array in most cases, so get - ' an array of individual scanlines (see remarks concerning - ' pitch at function 'FreeImage_GetBitsExRGBTriple()') - Call FreeImage_GetScanLinesRGBTRIPLE(hDIB, atBitsTSrc) - - Case 32 - atBitsQSrc = FreeImage_GetBitsExRGBQUAD(hDIB) - - End Select - - - ' create mask image if needed - If (bCreateMaskImage) Then - - ' create mask image - hDIBResult = FreeImage_Allocate(lWidth, lHeight, lBitDepth) - ' if destination bit depth is 8 or below, a proper palette will - ' be needed, so create a palette where the unmask color is at - ' index 0 and the mask color is at index 1 - If (lBitDepth <= 8) Then - atPaletteDst = FreeImage_GetPaletteEx(hDIBResult) - Call CopyMemory(atPaletteDst(0), lciUnmaskColorDst, 4) - Call CopyMemory(atPaletteDst(1), lciMaskColorDst, 4) - End If - - ' create proper accessors for the new mask image - Select Case lBitDepth - - Case 1 - abBitsBDst = FreeImage_GetBitsEx(hDIBResult) - x = 1 - For i = 7 To 0 Step -1 - abBitValues(i) = x - x = x * 2 - Next i - - Case 4 - abBitsBDst = FreeImage_GetBitsEx(hDIBResult) - abBitValues(0) = &H10 - abBitValues(1) = &H1 - - Case 8 - abBitsBDst = FreeImage_GetBitsEx(hDIBResult) - - Case 24 - ' images with a depth of 24 bits could not be used - ' through a two dimensional array in most cases, so get - ' an array of individual scanlines (see remarks concerning - ' pitch at function 'FreeImage_GetBitsExRGBTriple()') - Call FreeImage_GetScanLinesRGBTRIPLE(hDIBResult, atBitsTDst) - - Case 32 - atBitsQDst = FreeImage_GetBitsExRGBQUAD(hDIBResult) - - End Select - End If - - ' walk the hole image - For y = 0 To lHeight - 1 - For x = 0 To lWidth - 1 - - ' should transparency information be considered to create - ' the mask? - If (bMaskTransparency) Then - - Select Case lBitDepthSrc - - Case 4 - x2 = x \ 2 - lPixelIndex = (abBitsBSrc(x2, y) And abBitMasks(x Mod 2)) \ abBitShifts(x Mod 2) - bMaskPixel = (abTransparencyTableSrc(lPixelIndex) = 0) - If (Not bMaskPixel) Then - bMaskPixel = ((abTransparencyTableSrc(lPixelIndex) < 255) And _ - (bMaskAlphaTransparency)) - End If - - Case 8 - bMaskPixel = (abTransparencyTableSrc(abBitsBSrc(x, y)) = 0) - If (Not bMaskPixel) Then - bMaskPixel = ((abTransparencyTableSrc(abBitsBSrc(x, y)) < 255) And _ - (bMaskAlphaTransparency)) - End If - - Case 24 - ' no transparency information in 24 bit images - ' reset bMaskPixel - bMaskPixel = False - - Case 32 - bMaskPixel = (atBitsQSrc(x, y).rgbReserved = 0) - If (Not bMaskPixel) Then - bMaskPixel = ((atBitsQSrc(x, y).rgbReserved < 255) And _ - (bMaskAlphaTransparency)) - End If - - End Select - Else - ' clear 'bMaskPixel' if no transparency information was checked - ' since the flag might be still True from the last loop - bMaskPixel = False - End If - - ' should color information be considered to create the mask? - ' do this only if the current pixel is not yet part of the mask - If ((bMaskColors) And (Not bMaskPixel)) Then - - Select Case lBitDepthSrc - - Case 4 - x2 = x \ 2 - lPixelIndex = (abBitsBSrc(x2, y) And abBitMasks(x Mod 2)) \ abBitShifts(x Mod 2) - If (eMaskColorsFormat And FICFF_COLOR_PALETTE_INDEX) Then - For i = 0 To lMaskColorsMaxIndex - If (lColorTolerance = 0) Then - bMaskPixel = (lPixelIndex = alcMaskColors(i)) - Else - bMaskPixel = (FreeImage_CompareColorsLongLong( _ - alPaletteSrc(lPixelIndex), _ - alPaletteSrc(alcMaskColors(i)), _ - lColorTolerance, _ - FICFF_COLOR_RGB, FICFF_COLOR_RGB) = 0) - End If - If (bMaskPixel) Then - Exit For - End If - Next i - Else - For i = 0 To lMaskColorsMaxIndex - bMaskPixel = (FreeImage_CompareColorsLongLong( _ - alPaletteSrc(lPixelIndex), _ - alcMaskColors(i), lColorTolerance, _ - FICFF_COLOR_RGB, _ - (eMaskColorsFormat And FICFF_COLOR_FORMAT_ORDER_MASK)) = 0) - If (bMaskPixel) Then - Exit For - End If - Next i - End If - - Case 8 - If (eMaskColorsFormat And FICFF_COLOR_PALETTE_INDEX) Then - For i = 0 To lMaskColorsMaxIndex - If (lColorTolerance = 0) Then - bMaskPixel = (abBitsBSrc(x, y) = alcMaskColors(i)) - Else - bMaskPixel = (FreeImage_CompareColorsLongLong( _ - alPaletteSrc(abBitsBSrc(x, y)), _ - alPaletteSrc(alcMaskColors(i)), _ - lColorTolerance, _ - FICFF_COLOR_RGB, FICFF_COLOR_RGB) = 0) - End If - If (bMaskPixel) Then - Exit For - End If - Next i - Else - For i = 0 To lMaskColorsMaxIndex - bMaskPixel = (FreeImage_CompareColorsLongLong( _ - alPaletteSrc(abBitsBSrc(x, y)), _ - alcMaskColors(i), lColorTolerance, _ - FICFF_COLOR_RGB, _ - (eMaskColorsFormat And FICFF_COLOR_FORMAT_ORDER_MASK)) = 0) - If (bMaskPixel) Then - Exit For - End If - Next i - End If - - Case 24 - For i = 0 To lMaskColorsMaxIndex - bMaskPixel = (FreeImage_CompareColorsRGBTRIPLELong( _ - atBitsTSrc.Scanline(y).Data(x), _ - alcMaskColors(i), lColorTolerance, _ - (eMaskColorsFormat And FICFF_COLOR_FORMAT_ORDER_MASK)) = 0) - If (bMaskPixel) Then - Exit For - End If - Next i - - Case 32 - For i = 0 To lMaskColorsMaxIndex - bMaskPixel = (FreeImage_CompareColorsRGBQUADLong( _ - atBitsQSrc(x, y), _ - alcMaskColors(i), lColorTolerance, _ - (eMaskColorsFormat And FICFF_COLOR_FORMAT_ORDER_MASK)) = 0) - If (bMaskPixel) Then - Exit For - End If - Next i - - End Select - - End If - - ' check whether a mask image needs to be created - If (bCreateMaskImage) Then - - ' write current pixel to destination (mask) image - Select Case lBitDepth - - Case 1 - x2 = x \ 8 - If ((bMaskPixel) Xor (bInvertMask)) Then - abBitsBDst(x2, y) = abBitsBDst(x2, y) Or abBitValues(x Mod 8) - End If - - Case 4 - x2 = x \ 2 - If ((bMaskPixel) Xor (bInvertMask)) Then - abBitsBDst(x2, y) = abBitsBDst(x2, y) Or abBitValues(x Mod 2) - End If - - Case 8 - If ((bMaskPixel) Xor (bInvertMask)) Then - abBitsBDst(x, y) = 1 - End If - - Case 24 - If ((bMaskPixel) Xor (bInvertMask)) Then - Call CopyMemory(atBitsTDst.Scanline(y).Data(x), lciMaskColorDst, 3) - Else - Call CopyMemory(atBitsTDst.Scanline(y).Data(x), lciUnmaskColorDst, 3) - End If - - Case 32 - If ((bMaskPixel) Xor (bInvertMask)) Then - Call CopyMemory(atBitsQDst(x, y), lciMaskColorDst, 4) - Else - Call CopyMemory(atBitsQDst(x, y), lciUnmaskColorDst, 4) - End If - - End Select - End If - - ' check whether a source image needs to be modified - If (bModifySourceImage) Then - - Select Case lBitDepthSrc - - Case 4 - x2 = x \ 2 - If ((bMaskPixel) Xor (bInvertMask)) Then - If (bHaveMaskColorSrc) Then - abBitsBSrc(x2, y) = _ - (abBitsBSrc(x2, y) And (Not abBitMasks(x Mod 2))) Or _ - (lciMaskColorSrc * abBitShifts(x Mod 2)) - End If - ElseIf (bHaveUnmaskColorSrc) Then - abBitsBSrc(x2, y) = _ - (abBitsBSrc(x2, y) And (Not abBitMasks(x Mod 2))) Or _ - (lciUnmaskColorSrc * abBitShifts(x Mod 2)) - End If - - Case 8 - If ((bMaskPixel) Xor (bInvertMask)) Then - If (bHaveMaskColorSrc) Then - abBitsBSrc(x, y) = lciMaskColorSrc - End If - ElseIf (bHaveUnmaskColorSrc) Then - abBitsBSrc(x, y) = lciUnmaskColorSrc - End If - - Case 24 - If ((bMaskPixel) Xor (bInvertMask)) Then - If (bHaveMaskColorSrc) Then - Call CopyMemory(atBitsTSrc.Scanline(y).Data(x), lciMaskColorSrc, 3) - End If - ElseIf (bHaveUnmaskColorSrc) Then - Call CopyMemory(atBitsTSrc.Scanline(y).Data(x), lciUnmaskColorSrc, 3) - End If - - Case 32 - If ((bMaskPixel) Xor (bInvertMask)) Then - If (bHaveMaskColorSrc) Then - Call CopyMemory(atBitsQSrc(x, y), lciMaskColorSrc, 4) - End If - ElseIf (bHaveUnmaskColorSrc) Then - Call CopyMemory(atBitsQSrc(x, y), lciUnmaskColorSrc, 4) - End If - - End Select - End If - - Next x - Next y - End If - End If - End If - - FreeImage_CreateMask = hDIBResult - -End Function - -Public Function FreeImage_CreateMaskImage(ByVal hDIB As Long, _ - Optional ByVal lBitDepth As Long = 1, _ - Optional ByVal eMaskOptions As FREE_IMAGE_MASK_FLAGS = FIMF_MASK_FULL_TRANSPARENCY, _ - Optional ByVal vntMaskColors As Variant, _ - Optional ByVal eMaskColorsFormat As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB, _ - Optional ByVal lColorTolerance As Long, _ - Optional ByVal lciMaskColor As Long = vbWhite, _ - Optional ByVal eMaskColorFormat As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB, _ - Optional ByVal lciUnmaskColor As Long = vbBlack, _ - Optional ByVal eUnmaskColorFormat As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB) As Long - - 'TODO: comment this function - - FreeImage_CreateMaskImage = FreeImage_CreateMask(hDIB, MCOF_CREATE_MASK_IMAGE, _ - lBitDepth, eMaskOptions, _ - vntMaskColors, eMaskColorsFormat, _ - lColorTolerance, _ - lciMaskColor, eMaskColorFormat, _ - lciUnmaskColor, eUnmaskColorFormat) - -End Function - -Public Function FreeImage_CreateSimpleBWMaskImage(ByVal hDIB As Long, _ - Optional ByVal lBitDepth As Long = 1, _ - Optional ByVal eMaskOptions As FREE_IMAGE_MASK_FLAGS = FIMF_MASK_FULL_TRANSPARENCY, _ - Optional ByVal vntMaskColors As Variant, _ - Optional ByVal eMaskColorsFormat As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB, _ - Optional ByVal lColorTolerance As Long) As Long - - 'TODO: comment this function - - FreeImage_CreateSimpleBWMaskImage = FreeImage_CreateMask(hDIB, MCOF_CREATE_MASK_IMAGE, _ - lBitDepth, eMaskOptions, _ - vntMaskColors, eMaskColorsFormat, _ - lColorTolerance, _ - vbWhite, FICFF_COLOR_RGB, _ - vbBlack, FICFF_COLOR_RGB) - -End Function - -Public Function FreeImage_CreateMaskInPlace(ByVal hDIB As Long, _ - Optional ByVal lBitDepth As Long = 1, _ - Optional ByVal eMaskOptions As FREE_IMAGE_MASK_FLAGS = FIMF_MASK_FULL_TRANSPARENCY, _ - Optional ByVal vntMaskColors As Variant, _ - Optional ByVal eMaskColorsFormat As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB, _ - Optional ByVal lColorTolerance As Long, _ - Optional ByVal vlciMaskColor As Variant, _ - Optional ByVal eMaskColorFormat As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB, _ - Optional ByVal vlciUnmaskColor As Variant, _ - Optional ByVal eUnmaskColorFormat As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB) As Long - - 'TODO: comment this function - - FreeImage_CreateMaskInPlace = FreeImage_CreateMask(hDIB, MCOF_MODIFY_SOURCE_IMAGE, _ - lBitDepth, eMaskOptions, _ - vntMaskColors, eMaskColorsFormat, _ - lColorTolerance, _ - , , , , _ - vlciMaskColor, eMaskColorFormat, _ - vlciUnmaskColor, eUnmaskColorFormat) - -End Function - -Public Function FreeImage_CreateSimpleBWMaskInPlace(ByVal hDIB As Long, _ - Optional ByVal lBitDepth As Long = 1, _ - Optional ByVal eMaskOptions As FREE_IMAGE_MASK_FLAGS = FIMF_MASK_FULL_TRANSPARENCY, _ - Optional ByVal vntMaskColors As Variant, _ - Optional ByVal eMaskColorsFormat As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB, _ - Optional ByVal lColorTolerance As Long) As Long - - 'TODO: comment this function - - FreeImage_CreateSimpleBWMaskInPlace = FreeImage_CreateMask(hDIB, MCOF_MODIFY_SOURCE_IMAGE, _ - lBitDepth, eMaskOptions, _ - vntMaskColors, eMaskColorsFormat, _ - lColorTolerance, _ - , , , , _ - vbWhite, FICFF_COLOR_RGB, _ - vbBlack, FICFF_COLOR_RGB) - -End Function - -Public Function FreeImage_CreateMaskColors(ParamArray MaskColors() As Variant) As Variant - - ' this is just a FreeImage signed function that emulates VB's - ' builtin Array() function, that makes a variant array from - ' a ParamArray; so, a caller of the FreeImage_CreateMask() function - ' can specify all mask colors inline in the call statement - - ' hDibMask = FreeImage_CreateMask(hDib, 1, FIMF_MASK_COLOR_TRANSPARENCY, _ - ' FreeImage_CreateMaskColors(vbRed, vbGreen, vbBlack), _ - ' FICFF_COLOR_BGR, .... ) - - ' keep in mind, that VB colors (vbRed, vbBlue, etc.) are OLE colors that have - ' BRG format - - FreeImage_CreateMaskColors = MaskColors - -End Function - -Public Function FreeImage_SwapColorLong(ByVal Color As Long, _ - Optional ByVal IgnoreAlpha As Boolean) As Long - - ' This function swaps both color components Red (R) and Blue (B) in either - ' and RGB or BGR format color value stored in a Long value. This function is - ' used to convert from a RGB to a BGR color value and vice versa. - - If (Not IgnoreAlpha) Then - FreeImage_SwapColorLong = ((Color And &HFF000000) Or _ - ((Color And &HFF&) * &H10000) Or _ - (Color And &HFF00&) Or _ - ((Color And &HFF0000) \ &H10000)) - Else - FreeImage_SwapColorLong = (((Color And &HFF&) * &H10000) Or _ - (Color And &HFF00&) Or _ - ((Color And &HFF0000) \ &H10000)) - End If - -End Function - -Public Function FreeImage_CompareColorsLongLong(ByVal ColorA As Long, _ - ByVal ColorB As Long, _ - Optional ByVal Tolerance As Long, _ - Optional ByVal ColorTypeA As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_ARGB, _ - Optional ByVal ColorTypeB As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_ARGB) As Long - -Dim bFormatEqual As Boolean -Dim bAlphaEqual As Boolean - - ' This function compares two colors that both are specified as a 32 bit Long - ' value. - - ' Use both parameters 'ColorTypeA' and 'ColorTypeB' to specify each color's - ' format and 'Tolerance' to specify the matching tolerance. - - ' The function returns the result of the mathematical substraction - ' ColorA - ColorB, so if both colors are equal, the function returns NULL (0) - ' and any other value if both colors are different. Alpha transparency is taken into - ' account only if both colors are said to have an alpha transparency component by - ' both parameters 'ColorTypeA' and 'ColorTypeB'. If at least one of both colors - ' has no alpha transparency component, the comparison only includes the bits for - ' the red, green and blue component. - - ' The matching tolerance is applied to each color component (red, green, blue and - ' alpha) separately. So, when 'Tolerance' contains a value greater than zero, the - ' function returns NULL (0) when either both colors are exactly the same or the - ' differences of each corresponding color components are smaller or equal than - ' the given tolerance value. - - - If (((ColorTypeA And FICFF_COLOR_PALETTE_INDEX) Or _ - (ColorTypeB And FICFF_COLOR_PALETTE_INDEX)) = 0) Then - - bFormatEqual = ((ColorTypeA And FICFF_COLOR_FORMAT_ORDER_MASK) = _ - (ColorTypeB And FICFF_COLOR_FORMAT_ORDER_MASK)) - - bAlphaEqual = ((ColorTypeA And FICFF_COLOR_HAS_ALPHA) And _ - (ColorTypeB And FICFF_COLOR_HAS_ALPHA)) - - If (bFormatEqual) Then - If (bAlphaEqual) Then - FreeImage_CompareColorsLongLong = ColorA - ColorB - Else - FreeImage_CompareColorsLongLong = (ColorA And &HFFFFFF) - (ColorB And &HFFFFFF) - End If - Else - If (bAlphaEqual) Then - FreeImage_CompareColorsLongLong = ColorA - ((ColorB And &HFF000000) Or _ - ((ColorB And &HFF&) * &H10000) Or _ - (ColorB And &HFF00&) Or _ - ((ColorB And &HFF0000) \ &H10000)) - Else - FreeImage_CompareColorsLongLong = (ColorA And &HFFFFFF) - _ - (((ColorB And &HFF&) * &H10000) Or _ - (ColorB And &HFF00&) Or _ - ((ColorB And &HFF0000) \ &H10000)) - End If - End If - - If ((Tolerance > 0) And (FreeImage_CompareColorsLongLong <> 0)) Then - If (bFormatEqual) Then - If (Abs(((ColorA \ &H10000) And &HFF) - ((ColorB \ &H10000) And &HFF)) <= Tolerance) Then - If (Abs(((ColorA \ &H100) And &HFF) - ((ColorB \ &H100) And &HFF)) <= Tolerance) Then - If (Abs((ColorA And &HFF) - (ColorB And &HFF)) <= Tolerance) Then - If (bAlphaEqual) Then - If (Abs(((ColorA \ &H1000000) And &HFF) - _ - ((ColorB \ &H1000000) And &HFF)) <= Tolerance) Then - FreeImage_CompareColorsLongLong = 0 - End If - Else - FreeImage_CompareColorsLongLong = 0 - End If - End If - End If - End If - Else - If (Abs(((ColorA \ &H10000) And &HFF) - (ColorB And &HFF)) <= Tolerance) Then - If (Abs(((ColorA \ &H100) And &HFF) - ((ColorB \ &H100) And &HFF)) <= Tolerance) Then - If (Abs((ColorA And &HFF) - ((ColorB \ &H10000) And &HFF)) <= Tolerance) Then - If (bAlphaEqual) Then - If (Abs(((ColorA \ &H1000000) And &HFF) - _ - ((ColorB \ &H1000000) And &HFF)) <= Tolerance) Then - FreeImage_CompareColorsLongLong = 0 - End If - Else - FreeImage_CompareColorsLongLong = 0 - End If - End If - End If - End If - End If - End If - End If - -End Function - -Public Function FreeImage_CompareColorsRGBTRIPLELong(ByRef ColorA As RGBTRIPLE, _ - ByVal ColorB As Long, _ - Optional ByVal Tolerance As Long, _ - Optional ByVal ColorTypeB As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB) As Long - -Dim lcColorA As Long - - ' This is a function derived from 'FreeImage_CompareColorsLongLong()' to make color - ' comparisons between two colors whereby one color is provided as RGBTRIPLE and the - ' other color is provided as Long value. - - ' Have a look at the documentation of 'FreeImage_CompareColorsLongLong()' to learn - ' more about color comparisons. - - Call CopyMemory(lcColorA, ColorA, 3) - FreeImage_CompareColorsRGBTRIPLELong = FreeImage_CompareColorsLongLong(lcColorA, ColorB, _ - Tolerance, FICFF_COLOR_RGB, ColorTypeB) - -End Function - -Public Function FreeImage_CompareColorsRGBQUADLong(ByRef ColorA As RGBQUAD, _ - ByVal ColorB As Long, _ - Optional ByVal Tolerance As Long, _ - Optional ByVal ColorTypeB As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_ARGB) As Long - -Dim lcColorA As Long - - ' This is a function derived from 'FreeImage_CompareColorsLongLong()' to make color - ' comparisons between two colors whereby one color is provided as RGBQUAD and the - ' other color is provided as Long value. - - ' Have a look at the documentation of 'FreeImage_CompareColorsLongLong()' to learn - ' more about color comparisons. - - Call CopyMemory(lcColorA, ColorA, 4) - FreeImage_CompareColorsRGBQUADLong = FreeImage_CompareColorsLongLong(lcColorA, ColorB, _ - Tolerance, FICFF_COLOR_ARGB, ColorTypeB) - -End Function - -Public Function FreeImage_SearchPalette(ByVal Bitmap As Long, _ - ByVal Color As Long, _ - Optional ByVal Tolerance As Long, _ - Optional ByVal ColorType As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB, _ - Optional ByVal TransparencyState As FREE_IMAGE_TRANSPARENCY_STATE_FLAGS = FITSF_IGNORE_TRANSPARENCY) As Long - -Dim abTransparencyTable() As Byte -Dim alPalette() As Long -Dim i As Long - - ' This function searches an image's color palette for a certain color specified as a - ' 32 bit Long value in either RGB or BGR format. - - ' A search tolerance may be specified in the 'Tolerance' parameter. - - ' If no transparency tabe was found for the specified image, transparency information will - ' be ignored during the search. Then, the function behaves as if FITSF_IGNORE_TRANSPARENCY - ' was specified for parameter TransparencyState. - - ' Use the 'TransparencyState' parameter to control, how the transparency state of - ' the found palette entry affects the result. These values may be used: - - ' FITSF_IGNORE_TRANSPARENCY: Returns the index of the first palette entry which - ' matches the red, green and blue components. - ' - ' FITSF_NONTRANSPARENT: Returns the index of the first palette entry which - ' matches the red, green and blue components and is - ' nontransparent (fully opaque). - ' - ' FITSF_TRANSPARENT: Returns the index of the first palette entry which - ' matches the red, green and blue components and is - ' fully transparent. - ' - ' FITSF_INCLUDE_ALPHA_TRANSPARENCY: Returns the index of the first palette entry which - ' matches the red, green and blue components as well - ' as the alpha transparency. - - ' When alpha transparency should be included in the palette search ('FITSF_INCLUDE_ALPHA_TRANSPARENCY'), - ' the alpha transparency of the color searched is taken from the left most byte of 'Color' - ' (Color is either in format ARGB or ABGR). The the alpha transparency of the palette entry - ' actually comes from the image's transparency table rather than from the palette, since palettes - ' do not contain transparency information. - - If (FreeImage_GetImageType(Bitmap) = FIT_BITMAP) Then - Select Case FreeImage_GetColorType(Bitmap) - - Case FIC_PALETTE, FIC_MINISBLACK, FIC_MINISWHITE - FreeImage_SearchPalette = -1 - alPalette = FreeImage_GetPaletteExLong(Bitmap) - If (FreeImage_GetTransparencyCount(Bitmap) > UBound(alPalette)) Then - abTransparencyTable = FreeImage_GetTransparencyTableExClone(Bitmap) - Else - TransparencyState = FITSF_IGNORE_TRANSPARENCY - End If - For i = 0 To UBound(alPalette) - If (FreeImage_CompareColorsLongLong(Color, alPalette(i), _ - Tolerance, _ - ColorType, FICFF_COLOR_RGB) = 0) Then - Select Case TransparencyState - - Case FITSF_IGNORE_TRANSPARENCY - FreeImage_SearchPalette = i - Exit For - - Case FITSF_NONTRANSPARENT - If (abTransparencyTable(i) = 255) Then - FreeImage_SearchPalette = i - Exit For - End If - - Case FITSF_TRANSPARENT - If (abTransparencyTable(i) = 0) Then - FreeImage_SearchPalette = i - Exit For - End If - - Case FITSF_INCLUDE_ALPHA_TRANSPARENCY - If (abTransparencyTable(i) = ((Color And &HFF000000) \ 1000000)) Then - FreeImage_SearchPalette = i - Exit For - End If - - End Select - End If - Next i - - Case Else - FreeImage_SearchPalette = -1 - - End Select - Else - FreeImage_SearchPalette = -1 - End If - -End Function - -Public Function FreeImage_GetIcon(ByVal hDIB As Long, _ - Optional ByVal eTransparencyOptions As FREE_IMAGE_ICON_TRANSPARENCY_OPTION_FLAGS = ITOF_USE_DEFAULT_TRANSPARENCY, _ - Optional ByVal lciTransparentColor As Long, _ - Optional ByVal eTransparentColorType As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB, _ - Optional ByVal hDC As Long, _ - Optional ByVal UnloadSource As Boolean) As Long - -Dim tIconInfo As ICONINFO -Dim bReleaseDC As Boolean -Dim bModifySourceImage As Boolean -Dim eMaskFlags As FREE_IMAGE_MASK_FLAGS -Dim lBitDepth As Long -Dim bPixelIndex As Byte -Dim hDIBSrc As Long -Dim hDIBMask As Long -Dim hBMPMask As Long -Dim hBmp As Long - - ' The optional 'UnloadSource' parameter is for unloading the original image - ' after the OlePicture has been created, so you can easiely "switch" from a - ' FreeImage DIB to a VB Picture object. There is no need to clean up the DIB - ' at the caller's site. - - If (hDIB) Then - - If (Not FreeImage_HasPixels(hDIB)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to create an icon from a 'header-only' bitmap.") - End If - - lBitDepth = FreeImage_GetBPP(hDIB) - - ' check whether the image supports transparency - Select Case lBitDepth - - Case 4, 8 - If (eTransparencyOptions And ITOF_USE_TRANSPARENCY_INFO) Then - If (FreeImage_IsTransparent(hDIB)) Then - eMaskFlags = FIMF_MASK_FULL_TRANSPARENCY - ElseIf (eTransparencyOptions And ITOF_FORCE_TRANSPARENCY_INFO) Then - If (FreeImage_IsTransparencyTableTransparent(hDIB)) Then - eMaskFlags = (FIMF_MASK_FULL_TRANSPARENCY And _ - FIMF_MASK_FORCE_TRANSPARENCY) - End If - End If - End If - If ((eMaskFlags = FIMF_MASK_NONE) And _ - (eTransparencyOptions And ITOF_USE_COLOR_TRANSPARENCY)) Then - - eMaskFlags = FIMF_MASK_COLOR_TRANSPARENCY - - Select Case (eTransparencyOptions And ITOF_USE_COLOR_BITMASK) - - Case ITOF_USE_COLOR_TOP_LEFT_PIXEL - Call FreeImage_GetPixelIndex(hDIB, _ - 0, FreeImage_GetHeight(hDIB) - 1, _ - bPixelIndex) - lciTransparentColor = bPixelIndex - eTransparentColorType = FICFF_COLOR_PALETTE_INDEX - - Case ITOF_USE_COLOR_TOP_RIGHT_PIXEL - Call FreeImage_GetPixelIndex(hDIB, _ - FreeImage_GetWidth(hDIB) - 1, FreeImage_GetHeight(hDIB) - 1, _ - bPixelIndex) - lciTransparentColor = bPixelIndex - eTransparentColorType = FICFF_COLOR_PALETTE_INDEX - - Case ITOF_USE_COLOR_BOTTOM_LEFT_PIXEL - Call FreeImage_GetPixelIndex(hDIB, _ - 0, 0, _ - bPixelIndex) - lciTransparentColor = bPixelIndex - eTransparentColorType = FICFF_COLOR_PALETTE_INDEX - - Case ITOF_USE_COLOR_BOTTOM_RIGHT_PIXEL - Call FreeImage_GetPixelIndex(hDIB, _ - FreeImage_GetWidth(hDIB) - 1, 0, _ - bPixelIndex) - lciTransparentColor = bPixelIndex - eTransparentColorType = FICFF_COLOR_PALETTE_INDEX - - End Select - End If - - bModifySourceImage = True - - Case 24, 32 - If ((lBitDepth = 32) And _ - (eTransparencyOptions And ITOF_USE_TRANSPARENCY_INFO)) Then - If (FreeImage_IsTransparent(hDIB)) Then - eMaskFlags = FIMF_MASK_FULL_TRANSPARENCY - End If - End If - If ((eMaskFlags = FIMF_MASK_NONE) And _ - (eTransparencyOptions And ITOF_USE_COLOR_TRANSPARENCY)) Then - - eMaskFlags = FIMF_MASK_COLOR_TRANSPARENCY - - Select Case (eTransparencyOptions And ITOF_USE_COLOR_BITMASK) - - Case ITOF_USE_COLOR_TOP_LEFT_PIXEL - Call FreeImage_GetPixelColorByLong(hDIB, _ - FreeImage_GetHeight(hDIB) - 1, 0, _ - lciTransparentColor) - eTransparentColorType = FICFF_COLOR_RGB - - Case ITOF_USE_COLOR_TOP_RIGHT_PIXEL - Call FreeImage_GetPixelColorByLong(hDIB, _ - FreeImage_GetHeight(hDIB) - 1, FreeImage_GetWidth(hDIB) - 1, _ - lciTransparentColor) - eTransparentColorType = FICFF_COLOR_RGB - - Case ITOF_USE_COLOR_BOTTOM_LEFT_PIXEL - Call FreeImage_GetPixelColorByLong(hDIB, _ - 0, 0, _ - lciTransparentColor) - eTransparentColorType = FICFF_COLOR_RGB - - Case ITOF_USE_COLOR_BOTTOM_RIGHT_PIXEL - Call FreeImage_GetPixelColorByLong(hDIB, _ - 0, FreeImage_GetWidth(hDIB) - 1, _ - lciTransparentColor) - eTransparentColorType = FICFF_COLOR_RGB - - End Select - End If - - bModifySourceImage = (lBitDepth = 24) - - End Select - - - If (bModifySourceImage) Then - hDIBSrc = FreeImage_Clone(hDIB) - hDIBMask = FreeImage_CreateMask(hDIBSrc, MCOF_CREATE_AND_MODIFY, _ - 1, eMaskFlags, _ - lciTransparentColor, eTransparentColorType, _ - , , , , , _ - FreeImage_SearchPalette(hDIBSrc, 0, , , _ - FITSF_NONTRANSPARENT), _ - FICFF_COLOR_PALETTE_INDEX) - Else - hDIBSrc = hDIB - hDIBMask = FreeImage_CreateMaskImage(hDIB, 1, FIMF_MASK_FULL_TRANSPARENCY) - End If - - If (hDC = 0) Then - hDC = GetDC(0) - bReleaseDC = True - End If - - hBmp = CreateDIBitmap(hDC, _ - FreeImage_GetInfoHeader(hDIBSrc), _ - CBM_INIT, _ - FreeImage_GetBits(hDIBSrc), _ - FreeImage_GetInfo(hDIBSrc), _ - DIB_RGB_COLORS) - - - hBMPMask = CreateDIBitmap(hDC, _ - FreeImage_GetInfoHeader(hDIBMask), _ - CBM_INIT, _ - FreeImage_GetBits(hDIBMask), _ - FreeImage_GetInfo(hDIBMask), _ - DIB_RGB_COLORS) - - If (bModifySourceImage) Then - Call FreeImage_Unload(hDIBSrc) - End If - - If (UnloadSource) Then - Call FreeImage_Unload(hDIB) - End If - - - If ((hBmp <> 0) And (hBMPMask <> 0)) Then - - With tIconInfo - .fIcon = True - .hBmMask = hBMPMask - .hbmColor = hBmp - End With - - FreeImage_GetIcon = CreateIconIndirect(tIconInfo) - End If - - If (bReleaseDC) Then - Call ReleaseDC(0, hDC) - End If - End If - -End Function - -Public Function FreeImage_AdjustPictureBox(ByRef Control As Object, _ - Optional ByVal Mode As FREE_IMAGE_ADJUST_MODE = AM_DEFAULT, _ - Optional ByVal Filter As FREE_IMAGE_FILTER = FILTER_BICUBIC) As IPicture - -Dim tR As RECT -Dim hDIB As Long -Dim hDIBTemp As Long -Dim lNewWidth As Long -Dim lNewHeight As Long - -Const vbObjectOrWithBlockVariableNotSet As Long = 91 - - ' This function adjusts an already loaded picture in a VB PictureBox - ' control in size. This is done by converting the picture to a Bitmap - ' by FreeImage_CreateFromOlePicture. After resizing the Bitmap it is - ' converted back to a Ole Picture object and re-assigned to the - ' PictureBox control. - - ' The Control paramater is actually of type Object so any object or control - ' providing Picture, hWnd, Width and Height properties can be used instead - ' of a PictureBox control - - ' This may be useful when using compile time provided images in VB like - ' logos or backgrounds that need to be resized during runtime. Using - ' FreeImage's sophisticated rescaling methods is a much better aproach - ' than using VB's stretchable Image control. - - ' One reason for resizing a usually fixed size logo or background image - ' may be the following scenario: - - ' When running on a Windows machine using smaller or bigger fonts (what can - ' be configured in the control panel by using different dpi fonts), the - ' operation system automatically adjusts the sizes of Forms, Labels, - ' TextBoxes, Frames and even PictureBoxes. So, the hole VB application is - ' perfectly adapted to these font metrics with the exception of compile time - ' provided images. Although the PictureBox control is resized, the containing - ' image remains untouched. This problem could be solved with this function. - - ' This function is also wrapped by the function 'AdjustPicture', giving you - ' a more VB common function name. - - - If (Not Control Is Nothing) Then - Call GetClientRect(Control.hWnd, tR) - If ((tR.Right <> Control.Picture.Width) Or _ - (tR.Bottom <> Control.Picture.Height)) Then - hDIB = FreeImage_CreateFromOlePicture(Control.Picture) - If (hDIB) Then - If (Mode = AM_ADJUST_OPTIMAL_SIZE) Then - If (Control.Picture.Width >= Control.Picture.Height) Then - Mode = AM_ADJUST_WIDTH - Else - Mode = AM_ADJUST_HEIGHT - End If - End If - - Select Case Mode - - Case AM_STRECH - lNewWidth = tR.Right - lNewHeight = tR.Bottom - - Case AM_ADJUST_WIDTH - lNewWidth = tR.Right - lNewHeight = lNewWidth / (Control.Picture.Width / Control.Picture.Height) - - Case AM_ADJUST_HEIGHT - lNewHeight = tR.Bottom - lNewWidth = lNewHeight * (Control.Picture.Width / Control.Picture.Height) - - End Select - - hDIBTemp = hDIB - hDIB = FreeImage_Rescale(hDIB, lNewWidth, lNewHeight, Filter) - Call FreeImage_Unload(hDIBTemp) - Set Control.Picture = FreeImage_GetOlePicture(hDIB, , True) - Set FreeImage_AdjustPictureBox = Control.Picture - End If - End If - Else - Call Err.Raise(vbObjectOrWithBlockVariableNotSet) - End If - -End Function - -Public Function AdjustPicture(ByRef Control As Object, _ - Optional ByRef Mode As FREE_IMAGE_ADJUST_MODE = AM_DEFAULT, _ - Optional ByRef Filter As FREE_IMAGE_FILTER = FILTER_BICUBIC) As IPicture - - ' This function is a more VB friendly signed wrapper for - ' the FreeImage_AdjustPictureBox function. - - Set AdjustPicture = FreeImage_AdjustPictureBox(Control, Mode, Filter) - -End Function - -Public Function FreeImage_LoadEx(ByVal Filename As String, _ - Optional ByVal Options As FREE_IMAGE_LOAD_OPTIONS, _ - Optional ByVal Width As Variant, _ - Optional ByVal Height As Variant, _ - Optional ByVal InPercent As Boolean, _ - Optional ByVal Filter As FREE_IMAGE_FILTER, _ - Optional ByRef Format As FREE_IMAGE_FORMAT) As Long - -Const vbInvalidPictureError As Long = 481 - - ' The function provides all image formats, the FreeImage library can read. The - ' image format is determined from the image file to load, the optional parameter - ' 'Format' is an OUT parameter that will contain the image format that has - ' been loaded. - - ' The parameters 'Width', 'Height', 'InPercent' and 'Filter' make it possible - ' to "load" the image in a resized version. 'Width', 'Height' specify the desired - ' width and height, 'Filter' determines, what image filter should be used - ' on the resizing process. - - ' The parameters 'Width', 'Height', 'InPercent' and 'Filter' map directly to the - ' according parameters of the 'FreeImage_RescaleEx' function. So, read the - ' documentation of the 'FreeImage_RescaleEx' for a complete understanding of the - ' usage of these parameters. - - - Format = FreeImage_GetFileType(Filename) - If (Format <> FIF_UNKNOWN) Then - If (FreeImage_FIFSupportsReading(Format)) Then - FreeImage_LoadEx = FreeImage_Load(Format, Filename, Options) - If (FreeImage_LoadEx) Then - - If ((Not IsMissing(Width)) Or _ - (Not IsMissing(Height))) Then - FreeImage_LoadEx = FreeImage_RescaleEx(FreeImage_LoadEx, Width, Height, _ - InPercent, True, Filter) - End If - Else - Call Err.Raise(vbInvalidPictureError) - End If - Else - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "FreeImage Library plugin '" & FreeImage_GetFormatFromFIF(Format) & "' " & _ - "does not support reading.") - End If - Else - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "The file specified has an unknown image format.") - End If - -End Function - -Public Function LoadPictureEx(Optional ByRef Filename As Variant, _ - Optional ByRef Options As FREE_IMAGE_LOAD_OPTIONS, _ - Optional ByRef Width As Variant, _ - Optional ByRef Height As Variant, _ - Optional ByRef InPercent As Boolean, _ - Optional ByRef Filter As FREE_IMAGE_FILTER, _ - Optional ByRef Format As FREE_IMAGE_FORMAT) As IPicture - -Dim hDIB As Long - - ' This function is an extended version of the VB method 'LoadPicture'. As - ' the VB version it takes a filename parameter to load the image and throws - ' the same errors in most cases. - - ' This function now is only a thin wrapper for the FreeImage_LoadEx() wrapper - ' function (as compared to releases of this wrapper prior to version 1.8). So, - ' have a look at this function's discussion of the parameters. - - ' However, we do mask out the FILO_LOAD_NOPIXELS load option, since this - ' function shall create a VB Picture object, which does not support - ' FreeImage's header-only loading option. - - - If (Not IsMissing(Filename)) Then - hDIB = FreeImage_LoadEx(Filename, (Options And (Not FILO_LOAD_NOPIXELS)), _ - Width, Height, InPercent, Filter, Format) - Set LoadPictureEx = FreeImage_GetOlePicture(hDIB, , True) - End If - -End Function - -Public Function FreeImage_SaveEx(ByVal Bitmap As Long, _ - ByVal Filename As String, _ - Optional ByVal Format As FREE_IMAGE_FORMAT = FIF_UNKNOWN, _ - Optional ByVal Options As FREE_IMAGE_SAVE_OPTIONS, _ - Optional ByVal ColorDepth As FREE_IMAGE_COLOR_DEPTH, _ - Optional ByVal Width As Variant, _ - Optional ByVal Height As Variant, _ - Optional ByVal InPercent As Boolean, _ - Optional ByVal Filter As FREE_IMAGE_FILTER = FILTER_BICUBIC, _ - Optional ByVal UnloadSource As Boolean) As Boolean - -Dim hDIBRescale As Long -Dim bConvertedOnRescale As Boolean -Dim bIsNewDIB As Boolean -Dim lBPP As Long -Dim lBPPOrg As Long -Dim strExtension As String - - ' This function is an easy to use replacement for FreeImage's FreeImage_Save() - ' function which supports inline size- and color conversions as well as an - ' auto image format detection algorithm that determines the desired image format - ' by the given filename. An even more sophisticated algorithm may auto-detect - ' the proper color depth for a explicitly given or auto-detected image format. - - ' The function provides all image formats, and save options, the FreeImage - ' library can write. The optional parameter 'Format' may contain the desired - ' image format. When omitted, the function tries to get the image format from - ' the filename extension. - - ' The optional parameter 'ColorDepth' may contain the desired color depth for - ' the saved image. This can be either any value of the FREE_IMAGE_COLOR_DEPTH - ' enumeration or the value FICD_AUTO what is the default value of the parameter. - ' When 'ColorDepth' is FICD_AUTO, the function tries to get the most suitable - ' color depth for the specified image format if the image's current color depth - ' is not supported by the specified image format. Therefore, the function - ' firstly reduces the color depth step by step until a proper color depth is - ' found since an incremention would only increase the file's size with no - ' quality benefit. Only when there is no lower color depth is found for the - ' image format, the function starts to increase the color depth. - - ' Keep in mind that an explicitly specified color depth that is not supported - ' by the image format results in a runtime error. For example, when saving - ' a 24 bit image as GIF image, a runtime error occurs. - - ' The function checks, whether the given filename has a valid extension or - ' not. If not, the "primary" extension for the used image format will be - ' appended to the filename. The parameter 'Filename' remains untouched in - ' this case. - - ' To learn more about the "primary" extension, read the documentation for - ' the 'FreeImage_GetPrimaryExtensionFromFIF' function. - - ' The parameters 'Width', 'Height', 'InPercent' and 'Filter' make it possible - ' to save the image in a resized version. 'Width', 'Height' specify the desired - ' width and height, 'Filter' determines, what image filter should be used - ' on the resizing process. Since FreeImage_SaveEx relies on FreeImage_RescaleEx, - ' please refer to the documentation of FreeImage_RescaleEx to learn more - ' about these four parameters. - - ' The optional 'UnloadSource' parameter is for unloading the saved image, so - ' you can save and unload an image with this function in one operation. - ' CAUTION: at current, the image is unloaded, even if the image was not - ' saved correctly! - - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to save 'header-only' bitmaps.") - End If - - If ((Not IsMissing(Width)) Or _ - (Not IsMissing(Height))) Then - - lBPP = FreeImage_GetBPP(Bitmap) - hDIBRescale = FreeImage_RescaleEx(Bitmap, Width, Height, InPercent, UnloadSource, Filter) - bIsNewDIB = (hDIBRescale <> Bitmap) - Bitmap = hDIBRescale - bConvertedOnRescale = (lBPP <> FreeImage_GetBPP(Bitmap)) - End If - - If (Format = FIF_UNKNOWN) Then - Format = FreeImage_GetFIFFromFilename(Filename) - End If - If (Format <> FIF_UNKNOWN) Then - If ((FreeImage_FIFSupportsWriting(Format)) And _ - (FreeImage_FIFSupportsExportType(Format, FIT_BITMAP))) Then - - If (Not FreeImage_IsFilenameValidForFIF(Format, Filename)) Then - strExtension = "." & FreeImage_GetPrimaryExtensionFromFIF(Format) - End If - - ' check color depth - If (ColorDepth <> FICD_AUTO) Then - ' mask out bit 1 (0x02) for the case ColorDepth is FICD_MONOCHROME_DITHER (0x03) - ' FREE_IMAGE_COLOR_DEPTH values are true bit depths in general expect FICD_MONOCHROME_DITHER - ' by masking out bit 1, 'FreeImage_FIFSupportsExportBPP()' tests for bitdepth 1 - ' what is correct again for dithered images. - ColorDepth = (ColorDepth And (Not &H2)) - If (Not FreeImage_FIFSupportsExportBPP(Format, ColorDepth)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "FreeImage Library plugin '" & FreeImage_GetFormatFromFIF(Format) & "' " & _ - "is unable to write images with a color depth " & _ - "of " & ColorDepth & " bpp.") - - ElseIf (FreeImage_GetBPP(Bitmap) <> ColorDepth) Then - Bitmap = FreeImage_ConvertColorDepth(Bitmap, ColorDepth, (UnloadSource Or bIsNewDIB)) - bIsNewDIB = True - - End If - Else - - If (lBPP = 0) Then - lBPP = FreeImage_GetBPP(Bitmap) - End If - - If (Not FreeImage_FIFSupportsExportBPP(Format, lBPP)) Then - lBPPOrg = lBPP - Do - lBPP = pGetPreviousColorDepth(lBPP) - Loop While ((Not FreeImage_FIFSupportsExportBPP(Format, lBPP)) Or _ - (lBPP = 0)) - If (lBPP = 0) Then - lBPP = lBPPOrg - Do - lBPP = pGetNextColorDepth(lBPP) - Loop While ((Not FreeImage_FIFSupportsExportBPP(Format, lBPP)) Or _ - (lBPP = 0)) - End If - - If (lBPP <> 0) Then - Bitmap = FreeImage_ConvertColorDepth(Bitmap, lBPP, (UnloadSource Or bIsNewDIB)) - bIsNewDIB = True - End If - - ElseIf (bConvertedOnRescale) Then - ' restore original color depth - ' always unload current DIB here, since 'bIsNewDIB' is True - Bitmap = FreeImage_ConvertColorDepth(Bitmap, lBPP, True) - - End If - End If - - FreeImage_SaveEx = FreeImage_Save(Format, Bitmap, Filename & strExtension, Options) - If ((bIsNewDIB) Or (UnloadSource)) Then - Call FreeImage_Unload(Bitmap) - End If - Else - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "FreeImage Library plugin '" & FreeImage_GetFormatFromFIF(Format) & "' " & _ - "is unable to write images of the image format requested.") - End If - Else - ' unknown image format error - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unknown image format. Neither an explicit image format " & _ - "was specified nor any known image format was determined " & _ - "from the filename specified.") - End If - End If - -End Function - -Public Function SavePictureEx(ByRef Picture As IPicture, _ - ByRef Filename As String, _ - Optional ByRef Format As FREE_IMAGE_FORMAT, _ - Optional ByRef Options As FREE_IMAGE_SAVE_OPTIONS, _ - Optional ByRef ColorDepth As FREE_IMAGE_COLOR_DEPTH, _ - Optional ByRef Width As Variant, _ - Optional ByRef Height As Variant, _ - Optional ByRef InPercent As Boolean, _ - Optional ByRef Filter As FREE_IMAGE_FILTER = FILTER_BICUBIC) As Boolean - -Dim hDIB As Long - -Const vbObjectOrWithBlockVariableNotSet As Long = 91 -Const vbInvalidPictureError As Long = 481 - - ' This function is an extended version of the VB method 'SavePicture'. As - ' the VB version it takes a Picture object and a filename parameter to - ' save the image and throws the same errors in most cases. - - ' This function now is only a thin wrapper for the FreeImage_SaveEx() wrapper - ' function (as compared to releases of this wrapper prior to version 1.8). So, - ' have a look at this function's discussion of the parameters. - - - If (Not Picture Is Nothing) Then - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - SavePictureEx = FreeImage_SaveEx(hDIB, Filename, Format, Options, _ - ColorDepth, Width, Height, InPercent, _ - FILTER_BICUBIC, True) - Else - Call Err.Raise(vbInvalidPictureError) - End If - Else - Call Err.Raise(vbObjectOrWithBlockVariableNotSet) - End If - -End Function - -Public Function SaveImageContainerEx(ByRef Container As Object, _ - ByRef Filename As String, _ - Optional ByVal IncludeDrawings As Boolean, _ - Optional ByRef Format As FREE_IMAGE_FORMAT, _ - Optional ByRef Options As FREE_IMAGE_SAVE_OPTIONS, _ - Optional ByRef ColorDepth As FREE_IMAGE_COLOR_DEPTH, _ - Optional ByRef Width As Variant, _ - Optional ByRef Height As Variant, _ - Optional ByRef InPercent As Boolean, _ - Optional ByRef Filter As FREE_IMAGE_FILTER = FILTER_BICUBIC) As Long - - ' This function is an extended version of the VB method 'SavePicture'. As - ' the VB version it takes an image hosting control and a filename parameter to - ' save the image and throws the same errors in most cases. - - ' This function merges the functionality of both wrapper functions - ' 'SavePictureEx()' and 'FreeImage_CreateFromImageContainer()'. Basically this - ' function is identical to 'SavePictureEx' expect that is does not take a - ' IOlePicture (IPicture) object but a VB image hosting container control. - - ' Please, refer to each of this two function's inline documentation for a - ' more detailed description. - - Call SavePictureEx(pGetIOlePictureFromContainer(Container, IncludeDrawings), _ - Filename, Format, Options, ColorDepth, Width, Height, InPercent, Filter) - -End Function - -Public Function FreeImage_OpenMultiBitmapEx(ByVal Filename As String, _ - Optional ByVal ReadOnly As Boolean, _ - Optional ByVal KeepCacheInMemory As Boolean, _ - Optional ByVal Flags As FREE_IMAGE_LOAD_OPTIONS, _ - Optional ByRef Format As FREE_IMAGE_FORMAT) As Long - - Format = FreeImage_GetFileType(Filename) - If (Format <> FIF_UNKNOWN) Then - Select Case Format - - Case FIF_TIFF, FIF_GIF, FIF_ICO - FreeImage_OpenMultiBitmapEx = FreeImage_OpenMultiBitmap(Format, Filename, False, _ - ReadOnly, KeepCacheInMemory, Flags) - - Case Else - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "FreeImage Library plugin '" & FreeImage_GetFormatFromFIF(Format) & "' " & _ - "does not have any support for multi-page bitmaps.") - End Select - Else - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "The file specified has an unknown image format.") - End If - -End Function - -Public Function FreeImage_CreateMultiBitmapEx(ByVal Filename As String, _ - Optional ByVal KeepCacheInMemory As Boolean, _ - Optional ByVal Flags As FREE_IMAGE_LOAD_OPTIONS, _ - Optional ByRef Format As FREE_IMAGE_FORMAT) As Long - - If (Format = FIF_UNKNOWN) Then - Format = FreeImage_GetFIFFromFilename(Filename) - End If - - If (Format <> FIF_UNKNOWN) Then - Select Case Format - - Case FIF_TIFF, FIF_GIF, FIF_ICO - FreeImage_CreateMultiBitmapEx = FreeImage_OpenMultiBitmap(Format, Filename, True, _ - False, KeepCacheInMemory, Flags) - - Case Else - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "FreeImage Library plugin '" & _ - FreeImage_GetFormatFromFIF(Format) & "' " & _ - "does not have any support for multi-page bitmaps.") - End Select - Else - ' unknown image format error - Call Err.Raise(5, _ - "MFreeImage", _ - Error$(5) & vbCrLf & vbCrLf & _ - "Unknown image format. Neither an explicit image format " & _ - "was specified nor any known image format was determined " & _ - "from the filename specified.") - End If - -End Function - - - -'-------------------------------------------------------------------------------- -' OlePicture aware toolkit, rescale and conversion functions -'-------------------------------------------------------------------------------- - -Public Function FreeImage_RescaleIOP(ByRef Picture As IPicture, _ - Optional ByVal Width As Variant, _ - Optional ByVal Height As Variant, _ - Optional ByVal IsPercentValue As Boolean, _ - Optional ByVal Filter As FREE_IMAGE_FILTER = FILTER_BICUBIC, _ - Optional ByVal ForceCloneCreation As Boolean) As IPicture - -Dim hDIB As Long - - ' IOlePicture based wrapper for wrapper function FreeImage_RescaleEx() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - hDIB = FreeImage_RescaleEx(hDIB, Width, Height, IsPercentValue, _ - True, Filter, ForceCloneCreation) - Set FreeImage_RescaleIOP = FreeImage_GetOlePicture(hDIB, , True) - End If - -End Function - -Public Function FreeImage_RescaleByPixelIOP(ByRef Picture As IPicture, _ - Optional ByVal WidthInPixels As Long, _ - Optional ByVal HeightInPixels As Long, _ - Optional ByVal Filter As FREE_IMAGE_FILTER = FILTER_BICUBIC, _ - Optional ByVal ForceCloneCreation As Boolean) As IPicture - - ' Thin wrapper for function 'FreeImage_RescaleExIOP' for removing method - ' overload fake. This function rescales the image directly to the size - ' specified by the 'WidthInPixels' and 'HeightInPixels' parameters. - - Set FreeImage_RescaleByPixelIOP = FreeImage_RescaleIOP(Picture, WidthInPixels, HeightInPixels, _ - False, Filter, ForceCloneCreation) - -End Function - -Public Function FreeImage_RescaleByPercentIOP(ByRef Picture As IPicture, _ - Optional ByVal WidthPercentage As Double, _ - Optional ByVal HeightPercentage As Double, _ - Optional ByVal Filter As FREE_IMAGE_FILTER = FILTER_BICUBIC, _ - Optional ByVal ForceCloneCreation As Boolean) As IPicture - - ' Thin wrapper for function 'FreeImage_RescaleExIOP' for removing method - ' overload fake. This function rescales the image by a percent value - ' based on the image's original size. - - Set FreeImage_RescaleByPercentIOP = FreeImage_RescaleIOP(Picture, WidthPercentage, HeightPercentage, _ - True, Filter, ForceCloneCreation) - -End Function - -Public Function FreeImage_RescaleByFactorIOP(ByRef Picture As IPicture, _ - Optional ByVal WidthFactor As Double, _ - Optional ByVal HeightFactor As Double, _ - Optional ByVal Filter As FREE_IMAGE_FILTER = FILTER_BICUBIC, _ - Optional ByVal ForceCloneCreation As Boolean) As IPicture - - ' Thin wrapper for function 'FreeImage_RescaleExIOP' for removing method - ' overload fake. This function rescales the image by a factor - ' based on the image's original size. - - Set FreeImage_RescaleByFactorIOP = FreeImage_RescaleIOP(Picture, WidthFactor, HeightFactor, _ - False, Filter, ForceCloneCreation) - -End Function - -Public Function FreeImage_MakeThumbnailIOP(ByRef Picture As IPicture, _ - ByVal MaxPixelSize As Long, _ - Optional ByVal Convert As Boolean) As IPicture - -Dim hDIB As Long -Dim hDIBThumbnail As Long - - ' IOlePicture based wrapper for wrapper function FreeImage_MakeThumbnail() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - hDIBThumbnail = FreeImage_MakeThumbnail(hDIB, MaxPixelSize, Convert) - If (hDIBThumbnail) Then - Set FreeImage_MakeThumbnailIOP = FreeImage_GetOlePicture(hDIBThumbnail, , True) - End If - Call FreeImage_Unload(hDIB) - End If - -End Function - -Public Function FreeImage_ConvertColorDepthIOP(ByRef Picture As IPicture, _ - ByVal Conversion As FREE_IMAGE_CONVERSION_FLAGS, _ - Optional ByVal Threshold As Byte = 128, _ - Optional ByVal DitherMethod As FREE_IMAGE_DITHER = FID_FS, _ - Optional ByVal QuantizeMethod As FREE_IMAGE_QUANTIZE = FIQ_WUQUANT) As IPicture - -Dim hDIB As Long - - ' IOlePicture based wrapper for wrapper function FreeImage_ConvertColorDepth() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - hDIB = FreeImage_ConvertColorDepth(hDIB, Conversion, True, Threshold, _ - DitherMethod, QuantizeMethod) - Set FreeImage_ConvertColorDepthIOP = FreeImage_GetOlePicture(hDIB, , True) - End If - -End Function - -Public Function FreeImage_ColorQuantizeExIOP(ByRef Picture As IPicture, _ - Optional ByVal QuantizeMethod As FREE_IMAGE_QUANTIZE = FIQ_WUQUANT, _ - Optional ByVal PaletteSize As Long = 256, _ - Optional ByVal ReserveSize As Long, _ - Optional ByRef ReservePalette As Variant = Null) As IPicture - -Dim hDIB As Long - - ' IOlePicture based wrapper for wrapper function FreeImage_ColorQuantizeEx() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - hDIB = FreeImage_ColorQuantizeEx(hDIB, QuantizeMethod, True, PaletteSize, _ - ReserveSize, ReservePalette) - Set FreeImage_ColorQuantizeExIOP = FreeImage_GetOlePicture(hDIB, , True) - End If - -End Function - -Public Function FreeImage_RotateClassicIOP(ByRef Picture As IPicture, _ - ByVal Angle As Double) As IPicture - -Dim hDIB As Long -Dim hDIBNew As Long - - ' IOlePicture based wrapper for FreeImage function FreeImage_RotateClassic() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - Select Case FreeImage_GetBPP(hDIB) - - Case 1, 8, 24, 32 - hDIBNew = FreeImage_RotateClassic(hDIB, Angle) - Set FreeImage_RotateClassicIOP = FreeImage_GetOlePicture(hDIBNew, , True) - - End Select - Call FreeImage_Unload(hDIB) - End If - -End Function - -Public Function FreeImage_RotateIOP(ByRef Picture As IPicture, _ - ByVal Angle As Double, _ - Optional ByVal ColorPtr As Long) As IPicture - -Dim hDIB As Long -Dim hDIBNew As Long - - ' IOlePicture based wrapper for FreeImage function FreeImage_Rotate() - - ' The optional ColorPtr parameter takes a pointer to (e.g. the address of) an - ' RGB color value. So, all these assignments are valid for ColorPtr: - ' - ' Dim tColor As RGBQUAD - ' - ' VarPtr(tColor) - ' VarPtr(&H33FF80) - ' VarPtr(vbWhite) ' However, the VB color constants are in BGR format! - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - Select Case FreeImage_GetBPP(hDIB) - - Case 1, 8, 24, 32 - hDIBNew = FreeImage_Rotate(hDIB, Angle, ByVal ColorPtr) - Set FreeImage_RotateIOP = FreeImage_GetOlePicture(hDIBNew, , True) - - End Select - Call FreeImage_Unload(hDIB) - End If - -End Function - -Public Function FreeImage_RotateExIOP(ByRef Picture As IPicture, _ - ByVal Angle As Double, _ - Optional ByVal ShiftX As Double, _ - Optional ByVal ShiftY As Double, _ - Optional ByVal OriginX As Double, _ - Optional ByVal OriginY As Double, _ - Optional ByVal UseMask As Boolean) As IPicture - -Dim hDIB As Long -Dim hDIBNew As Long - - ' IOlePicture based wrapper for FreeImage function FreeImage_RotateEx() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - Select Case FreeImage_GetBPP(hDIB) - - Case 8, 24, 32 - hDIBNew = FreeImage_RotateEx(hDIB, Angle, ShiftX, ShiftY, OriginX, OriginY, UseMask) - Set FreeImage_RotateExIOP = FreeImage_GetOlePicture(hDIBNew, , True) - - End Select - Call FreeImage_Unload(hDIB) - End If - -End Function - -Public Function FreeImage_FlipHorizontalIOP(ByRef Picture As IPicture) As IPicture - -Dim hDIB As Long - - ' IOlePicture based wrapper for FreeImage function FreeImage_FlipHorizontal() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - Call FreeImage_FlipHorizontalInt(hDIB) - Set FreeImage_FlipHorizontalIOP = FreeImage_GetOlePicture(hDIB, , True) - End If - -End Function - -Public Function FreeImage_FlipVerticalIOP(ByRef Picture As IPicture) As IPicture - -Dim hDIB As Long - - ' IOlePicture based wrapper for FreeImage function FreeImage_FlipVertical() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - Call FreeImage_FlipVerticalInt(hDIB) - Set FreeImage_FlipVerticalIOP = FreeImage_GetOlePicture(hDIB, , True) - End If - -End Function - -Public Function FreeImage_AdjustCurveIOP(ByRef Picture As IPicture, _ - ByRef LookupTable As Variant, _ - Optional ByVal Channel As FREE_IMAGE_COLOR_CHANNEL = FICC_BLACK) As IPicture - -Dim hDIB As Long - - ' IOlePicture based wrapper for FreeImage function FreeImage_AdjustCurve() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - Select Case FreeImage_GetBPP(hDIB) - - Case 8, 24, 32 - Call FreeImage_AdjustCurveEx(hDIB, LookupTable, Channel) - Set FreeImage_AdjustCurveIOP = FreeImage_GetOlePicture(hDIB, , True) - - End Select - End If - -End Function - -Public Function FreeImage_AdjustGammaIOP(ByRef Picture As IPicture, _ - ByVal Gamma As Double) As IPicture - -Dim hDIB As Long - - ' IOlePicture based wrapper for FreeImage function FreeImage_AdjustGamma() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - Select Case FreeImage_GetBPP(hDIB) - - Case 8, 24, 32 - Call FreeImage_AdjustGammaInt(hDIB, Gamma) - Set FreeImage_AdjustGammaIOP = FreeImage_GetOlePicture(hDIB, , True) - - End Select - End If - -End Function - -Public Function FreeImage_AdjustBrightnessIOP(ByRef Picture As IPicture, _ - ByVal Percentage As Double) As IPicture - -Dim hDIB As Long - - ' IOlePicture based wrapper for FreeImage function FreeImage_AdjustBrightness() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - Select Case FreeImage_GetBPP(hDIB) - - Case 8, 24, 32 - Call FreeImage_AdjustBrightnessInt(hDIB, Percentage) - Set FreeImage_AdjustBrightnessIOP = FreeImage_GetOlePicture(hDIB, , True) - - End Select - End If - -End Function - -Public Function FreeImage_AdjustContrastIOP(ByRef Picture As IPicture, _ - ByVal Percentage As Double) As IPicture - -Dim hDIB As Long - - ' IOlePicture based wrapper for FreeImage function FreeImage_AdjustContrast() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - Select Case FreeImage_GetBPP(hDIB) - - Case 8, 24, 32 - Call FreeImage_AdjustContrastInt(hDIB, Percentage) - Set FreeImage_AdjustContrastIOP = FreeImage_GetOlePicture(hDIB, , True) - - End Select - End If - -End Function - -Public Function FreeImage_InvertIOP(ByRef Picture As IPicture) As IPicture - -Dim hDIB As Long - - ' IOlePicture based wrapper for FreeImage function FreeImage_Invert() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - Call FreeImage_InvertInt(hDIB) - Set FreeImage_InvertIOP = FreeImage_GetOlePicture(hDIB, , True) - End If - -End Function - -Public Function FreeImage_GetChannelIOP(ByRef Picture As IPicture, _ - ByVal Channel As FREE_IMAGE_COLOR_CHANNEL) As IPicture - -Dim hDIB As Long -Dim hDIBNew As Long - - ' IOlePicture based wrapper for FreeImage function FreeImage_GetChannel() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - Select Case FreeImage_GetBPP(hDIB) - - Case 24, 32 - hDIBNew = FreeImage_GetChannel(hDIB, Channel) - Set FreeImage_GetChannelIOP = FreeImage_GetOlePicture(hDIBNew, , True) - - End Select - Call FreeImage_Unload(hDIB) - End If - -End Function - -Public Function FreeImage_SetChannelIOP(ByRef Picture As IPicture, _ - ByVal BitmapSrc As Long, _ - ByVal Channel As FREE_IMAGE_COLOR_CHANNEL) As IPicture - -Dim hDIB As Long - - ' IOlePicture based wrapper for FreeImage function FreeImage_SetChannel() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - Select Case FreeImage_GetBPP(hDIB) - - Case 24, 32 - If (FreeImage_SetChannel(hDIB, BitmapSrc, Channel)) Then - Set FreeImage_SetChannelIOP = FreeImage_GetOlePicture(hDIB, , True) - End If - - End Select - Call FreeImage_Unload(hDIB) - End If - -End Function - -Public Function FreeImage_CopyIOP(ByRef Picture As IPicture, _ - ByVal Left As Long, _ - ByVal Top As Long, _ - ByVal Right As Long, _ - ByVal Bottom As Long) As IPicture - -Dim hDIB As Long -Dim hDIBNew As Long - - ' IOlePicture based wrapper for FreeImage function FreeImage_Copy() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - hDIBNew = FreeImage_Copy(hDIB, Left, Top, Right, Bottom) - Call FreeImage_Unload(hDIB) - Set FreeImage_CopyIOP = FreeImage_GetOlePicture(hDIBNew, , True) - End If - -End Function - -Public Function FreeImage_PasteIOP(ByRef PictureDst As IPicture, _ - ByRef PictureSrc As IPicture, _ - ByVal Left As Long, _ - ByVal Top As Long, _ - ByVal Alpha As Long, _ - Optional ByVal KeepOriginalDestImage As Boolean) As IPicture - -Dim hDIBDst As Long -Dim hDIBSrc As Long - - ' IOlePicture based wrapper for FreeImage function FreeImage_Paste() - - hDIBDst = FreeImage_CreateFromOlePicture(PictureDst) - If (hDIBDst) Then - hDIBSrc = FreeImage_CreateFromOlePicture(PictureSrc) - If (hDIBSrc) Then - If FreeImage_Paste(hDIBDst, hDIBSrc, Left, Top, Alpha) Then - Set FreeImage_PasteIOP = FreeImage_GetOlePicture(hDIBDst, , True) - If (Not KeepOriginalDestImage) Then - Set PictureDst = FreeImage_PasteIOP - End If - End If - Call FreeImage_Unload(hDIBSrc) - End If - End If - -End Function - -Public Function FreeImage_CompositeIOP(ByRef Picture As IPicture, _ - Optional ByVal UseFileBackColor As Boolean, _ - Optional ByVal AppBackColor As OLE_COLOR, _ - Optional ByRef BackgroundPicture As IPicture) As IPicture - -Dim hDIB As Long -Dim hDIBbg As Long -Dim hDIBResult As Long -Dim lUseFileBackColor As Long - - ' IOlePicture based wrapper for FreeImage function FreeImage_Composite() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - - If (UseFileBackColor) Then - lUseFileBackColor = 1 - End If - - hDIBbg = FreeImage_CreateFromOlePicture(BackgroundPicture) - - hDIBResult = FreeImage_Composite(hDIB, lUseFileBackColor, ConvertColor(AppBackColor), hDIBbg) - If (hDIBResult) Then - Set FreeImage_CompositeIOP = FreeImage_GetOlePicture(hDIBResult, , True) - End If - - Call FreeImage_Unload(hDIB) - If (hDIBbg) Then - Call FreeImage_Unload(hDIBbg) - End If - End If - -End Function - - -'-------------------------------------------------------------------------------- -' VB-coded Toolkit functions -'-------------------------------------------------------------------------------- - -Public Function FreeImage_GetColorizedPalette(ByVal Color As OLE_COLOR, _ - Optional ByVal SplitValue As Variant = 0.5) As RGBQUAD() - -Dim atPalette(255) As RGBQUAD -Dim lSplitIndex As Long -Dim lSplitIndexInv As Long -Dim lRed As Long -Dim lGreen As Long -Dim lBlue As Long -Dim i As Long - - ' compute the split index - Select Case VarType(SplitValue) - - Case vbByte, vbInteger, vbLong - lSplitIndex = SplitValue - - Case vbDouble, vbSingle, vbDecimal - lSplitIndex = 256 * SplitValue - - Case Else - lSplitIndex = 128 - - End Select - - ' check ranges of split index - If (lSplitIndex < 0) Then - lSplitIndex = 0 - ElseIf (lSplitIndex > 255) Then - lSplitIndex = 255 - End If - lSplitIndexInv = 256 - lSplitIndex - - ' extract color components red, green and blue - lRed = (Color And &HFF) - lGreen = ((Color \ &H100&) And &HFF) - lBlue = ((Color \ &H10000) And &HFF) - - For i = 0 To lSplitIndex - 1 - With atPalette(i) - .rgbRed = (lRed / lSplitIndex) * i - .rgbGreen = (lGreen / lSplitIndex) * i - .rgbBlue = (lBlue / lSplitIndex) * i - End With - Next i - For i = lSplitIndex To 255 - With atPalette(i) - .rgbRed = lRed + ((255 - lRed) / lSplitIndexInv) * (i - lSplitIndex) - .rgbGreen = lGreen + ((255 - lGreen) / lSplitIndexInv) * (i - lSplitIndex) - .rgbBlue = lBlue + ((255 - lBlue) / lSplitIndexInv) * (i - lSplitIndex) - End With - Next i - - FreeImage_GetColorizedPalette = atPalette - -End Function - -Public Function FreeImage_Colorize(ByVal Bitmap As Long, _ - ByVal Color As OLE_COLOR, _ - Optional ByVal SplitValue As Variant = 0.5) As Long - - If (Bitmap) Then - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to colorize a 'header-only' bitmap.") - End If - FreeImage_Colorize = FreeImage_ConvertToGreyscale(Bitmap) - Call FreeImage_SetPalette(FreeImage_Colorize, _ - FreeImage_GetColorizedPalette(Color, SplitValue)) - End If - -End Function - -Public Function FreeImage_Sepia(ByVal Bitmap As Long, _ - Optional ByVal SplitValue As Variant = 0.5) As Long - - FreeImage_Sepia = FreeImage_Colorize(Bitmap, &H658AA2, SplitValue) ' RGB(162, 138, 101) - -End Function - - -'-------------------------------------------------------------------------------- -' Compression functions wrappers -'-------------------------------------------------------------------------------- - -Public Function FreeImage_ZLibCompressEx(ByRef Target As Variant, _ - Optional ByRef TargetSize As Long, _ - Optional ByRef Source As Variant, _ - Optional ByVal SourceSize As Long, _ - Optional ByVal Offset As Long) As Long - -Dim lSourceDataPtr As Long -Dim lTargetDataPtr As Long -Dim bTargetCreated As Boolean - - ' This function is a more VB friendly wrapper for compressing data with - ' the 'FreeImage_ZLibCompress' function. - - ' The parameter 'Target' may either be a VB style array of Byte, Integer - ' or Long or a pointer to a memory block. If 'Target' is a pointer to a - ' memory block (when it contains an address), 'TargetSize' must be - ' specified and greater than zero. If 'Target' is an initialized array, - ' the whole array will be used to store compressed data when 'TargetSize' - ' is missing or below or equal to zero. If 'TargetSize' is specified, only - ' the first TargetSize bytes of the array will be used. - ' In each case, all rules according to the FreeImage API documentation - ' apply, what means that the target buffer must be at least 0.1% greater - ' than the source buffer plus 12 bytes. - ' If 'Target' is an uninitialized array, the contents of 'TargetSize' - ' will be ignored and the size of the array 'Target' will be handled - ' internally. When the function returns, 'Target' will be initialized - ' as an array of Byte and sized correctly to hold all the compressed - ' data. - - ' Nearly all, that is true for the parameters 'Target' and 'TargetSize', - ' is also true for 'Source' and 'SourceSize', expect that 'Source' should - ' never be an uninitialized array. In that case, the function returns - ' immediately. - - ' The optional parameter 'Offset' may contain a number of bytes to remain - ' untouched at the beginning of 'Target', when an uninitialized array is - ' provided through 'Target'. When 'Target' is either a pointer or an - ' initialized array, 'Offset' will be ignored. This parameter is currently - ' used by 'FreeImage_ZLibCompressVB' to store the length of the uncompressed - ' data at the first four bytes of 'Target'. - - - ' get the pointer and the size in bytes of the source - ' memory block - lSourceDataPtr = pGetMemoryBlockPtrFromVariant(Source, SourceSize) - If (lSourceDataPtr) Then - ' when we got a valid pointer, get the pointer and the size in bytes - ' of the target memory block - lTargetDataPtr = pGetMemoryBlockPtrFromVariant(Target, TargetSize) - If (lTargetDataPtr = 0) Then - ' if 'Target' is a null pointer, we will initialized it as an array - ' of bytes; here we will take 'Offset' into account - ReDim Target(SourceSize + Int(SourceSize * 0.1) + _ - 12 + Offset) As Byte - ' get pointer and size in bytes (will never be a null pointer) - lTargetDataPtr = pGetMemoryBlockPtrFromVariant(Target, TargetSize) - ' adjust according to 'Offset' - lTargetDataPtr = lTargetDataPtr + Offset - TargetSize = TargetSize - Offset - bTargetCreated = True - End If - - ' compress source data - FreeImage_ZLibCompressEx = FreeImage_ZLibCompress(lTargetDataPtr, _ - TargetSize, _ - lSourceDataPtr, _ - SourceSize) - - ' the function returns the number of bytes needed to store the - ' compressed data or zero on failure - If (FreeImage_ZLibCompressEx) Then - If (bTargetCreated) Then - ' when we created the array, we need to adjust it's size - ' according to the length of the compressed data - ReDim Preserve Target(FreeImage_ZLibCompressEx - 1 + Offset) - End If - End If - End If - -End Function - -Public Function FreeImage_ZLibUncompressEx(ByRef Target As Variant, _ - Optional ByRef TargetSize As Long, _ - Optional ByRef Source As Variant, _ - Optional ByVal SourceSize As Long) As Long - -Dim lSourceDataPtr As Long -Dim lTargetDataPtr As Long - - ' This function is a more VB friendly wrapper for compressing data with - ' the 'FreeImage_ZLibUncompress' function. - - ' The parameter 'Target' may either be a VB style array of Byte, Integer - ' or Long or a pointer to a memory block. If 'Target' is a pointer to a - ' memory block (when it contains an address), 'TargetSize' must be - ' specified and greater than zero. If 'Target' is an initialized array, - ' the whole array will be used to store uncompressed data when 'TargetSize' - ' is missing or below or equal to zero. If 'TargetSize' is specified, only - ' the first TargetSize bytes of the array will be used. - ' In each case, all rules according to the FreeImage API documentation - ' apply, what means that the target buffer must be at least as large, to - ' hold all the uncompressed data. - ' Unlike the function 'FreeImage_ZLibCompressEx', 'Target' can not be - ' an uninitialized array, since the size of the uncompressed data can - ' not be determined by the ZLib functions, but must be specified by a - ' mechanism outside the FreeImage compression functions' scope. - - ' Nearly all, that is true for the parameters 'Target' and 'TargetSize', - ' is also true for 'Source' and 'SourceSize'. - - - ' get the pointer and the size in bytes of the source - ' memory block - lSourceDataPtr = pGetMemoryBlockPtrFromVariant(Source, SourceSize) - If (lSourceDataPtr) Then - ' when we got a valid pointer, get the pointer and the size in bytes - ' of the target memory block - lTargetDataPtr = pGetMemoryBlockPtrFromVariant(Target, TargetSize) - If (lTargetDataPtr) Then - ' if we do not have a null pointer, uncompress the data - FreeImage_ZLibUncompressEx = FreeImage_ZLibUncompress(lTargetDataPtr, _ - TargetSize, _ - lSourceDataPtr, _ - SourceSize) - End If - End If - -End Function - -Public Function FreeImage_ZLibGZipEx(ByRef Target As Variant, _ - Optional ByRef TargetSize As Long, _ - Optional ByRef Source As Variant, _ - Optional ByVal SourceSize As Long, _ - Optional ByVal Offset As Long) As Long - -Dim lSourceDataPtr As Long -Dim lTargetDataPtr As Long -Dim bTargetCreated As Boolean - - ' This function is a more VB friendly wrapper for compressing data with - ' the 'FreeImage_ZLibGZip' function. - - ' The parameter 'Target' may either be a VB style array of Byte, Integer - ' or Long or a pointer to a memory block. If 'Target' is a pointer to a - ' memory block (when it contains an address), 'TargetSize' must be - ' specified and greater than zero. If 'Target' is an initialized array, - ' the whole array will be used to store compressed data when 'TargetSize' - ' is missing or below or equal to zero. If 'TargetSize' is specified, only - ' the first TargetSize bytes of the array will be used. - ' In each case, all rules according to the FreeImage API documentation - ' apply, what means that the target buffer must be at least 0.1% greater - ' than the source buffer plus 24 bytes. - ' If 'Target' is an uninitialized array, the contents of 'TargetSize' - ' will be ignored and the size of the array 'Target' will be handled - ' internally. When the function returns, 'Target' will be initialized - ' as an array of Byte and sized correctly to hold all the compressed - ' data. - - ' Nearly all, that is true for the parameters 'Target' and 'TargetSize', - ' is also true for 'Source' and 'SourceSize', expect that 'Source' should - ' never be an uninitialized array. In that case, the function returns - ' immediately. - - ' The optional parameter 'Offset' may contain a number of bytes to remain - ' untouched at the beginning of 'Target', when an uninitialized array is - ' provided through 'Target'. When 'Target' is either a pointer or an - ' initialized array, 'Offset' will be ignored. This parameter is currently - ' used by 'FreeImage_ZLibGZipVB' to store the length of the uncompressed - ' data at the first four bytes of 'Target'. - - - ' get the pointer and the size in bytes of the source - ' memory block - lSourceDataPtr = pGetMemoryBlockPtrFromVariant(Source, SourceSize) - If (lSourceDataPtr) Then - ' when we got a valid pointer, get the pointer and the size in bytes - ' of the target memory block - lTargetDataPtr = pGetMemoryBlockPtrFromVariant(Target, TargetSize) - If (lTargetDataPtr = 0) Then - ' if 'Target' is a null pointer, we will initialized it as an array - ' of bytes; here we will take 'Offset' into account - ReDim Target(SourceSize + Int(SourceSize * 0.1) + _ - 24 + Offset) As Byte - ' get pointer and size in bytes (will never be a null pointer) - lTargetDataPtr = pGetMemoryBlockPtrFromVariant(Target, TargetSize) - ' adjust according to 'Offset' - lTargetDataPtr = lTargetDataPtr + Offset - TargetSize = TargetSize - Offset - bTargetCreated = True - End If - - ' compress source data - FreeImage_ZLibGZipEx = FreeImage_ZLibGZip(lTargetDataPtr, _ - TargetSize, _ - lSourceDataPtr, _ - SourceSize) - - ' the function returns the number of bytes needed to store the - ' compressed data or zero on failure - If (FreeImage_ZLibGZipEx) Then - If (bTargetCreated) Then - ' when we created the array, we need to adjust it's size - ' according to the length of the compressed data - ReDim Preserve Target(FreeImage_ZLibGZipEx - 1 + Offset) - End If - End If - End If - -End Function - -Public Function FreeImage_ZLibCRC32Ex(ByVal CRC As Long, _ - Optional ByRef Source As Variant, _ - Optional ByVal SourceSize As Long) As Long - -Dim lSourceDataPtr As Long - - ' This function is a more VB friendly wrapper for compressing data with - ' the 'FreeImage_ZLibCRC32' function. - - ' The parameter 'Source' may either be a VB style array of Byte, Integer - ' or Long or a pointer to a memory block. If 'Source' is a pointer to a - ' memory block (when it contains an address), 'SourceSize' must be - ' specified and greater than zero. If 'Source' is an initialized array, - ' the whole array will be used to calculate the new CRC when 'SourceSize' - ' is missing or below or equal to zero. If 'SourceSize' is specified, only - ' the first SourceSize bytes of the array will be used. - - - ' get the pointer and the size in bytes of the source - ' memory block - lSourceDataPtr = pGetMemoryBlockPtrFromVariant(Source, SourceSize) - If (lSourceDataPtr) Then - ' if we do not have a null pointer, calculate the CRC including 'crc' - FreeImage_ZLibCRC32Ex = FreeImage_ZLibCRC32(CRC, _ - lSourceDataPtr, _ - SourceSize) - End If - -End Function - -Public Function FreeImage_ZLibGUnzipEx(ByRef Target As Variant, _ - Optional ByRef TargetSize As Long, _ - Optional ByRef Source As Variant, _ - Optional ByVal SourceSize As Long) As Long - -Dim lSourceDataPtr As Long -Dim lTargetDataPtr As Long - - ' This function is a more VB friendly wrapper for compressing data with - ' the 'FreeImage_ZLibGUnzip' function. - - ' The parameter 'Target' may either be a VB style array of Byte, Integer - ' or Long or a pointer to a memory block. If 'Target' is a pointer to a - ' memory block (when it contains an address), 'TargetSize' must be - ' specified and greater than zero. If 'Target' is an initialized array, - ' the whole array will be used to store uncompressed data when 'TargetSize' - ' is missing or below or equal to zero. If 'TargetSize' is specified, only - ' the first TargetSize bytes of the array will be used. - ' In each case, all rules according to the FreeImage API documentation - ' apply, what means that the target buffer must be at least as large, to - ' hold all the uncompressed data. - ' Unlike the function 'FreeImage_ZLibGZipEx', 'Target' can not be - ' an uninitialized array, since the size of the uncompressed data can - ' not be determined by the ZLib functions, but must be specified by a - ' mechanism outside the FreeImage compression functions' scope. - - ' Nearly all, that is true for the parameters 'Target' and 'TargetSize', - ' is also true for 'Source' and 'SourceSize'. - - - ' get the pointer and the size in bytes of the source - ' memory block - lSourceDataPtr = pGetMemoryBlockPtrFromVariant(Source, SourceSize) - If (lSourceDataPtr) Then - ' when we got a valid pointer, get the pointer and the size in bytes - ' of the target memory block - lTargetDataPtr = pGetMemoryBlockPtrFromVariant(Target, TargetSize) - If (lTargetDataPtr) Then - ' if we do not have a null pointer, uncompress the data - FreeImage_ZLibGUnzipEx = FreeImage_ZLibGUnzip(lTargetDataPtr, _ - TargetSize, _ - lSourceDataPtr, _ - SourceSize) - End If - End If - -End Function - -Public Function FreeImage_ZLibCompressVB(ByRef Data() As Byte, _ - Optional ByVal IncludeSize As Boolean = True) As Byte() - -Dim lOffset As Long -Dim lArrayDataPtr As Long - - ' This function is another, even more VB friendly wrapper for the FreeImage - ' 'FreeImage_ZLibCompress' function, that uses the 'FreeImage_ZLibCompressEx' - ' function. This function is very easy to use, since it deals only with VB - ' style Byte arrays. - - ' The parameter 'Data()' is a Byte array, providing the uncompressed source - ' data, that will be compressed. - - ' The optional parameter 'IncludeSize' determines whether the size of the - ' uncompressed data should be stored in the first four bytes of the returned - ' byte buffer containing the compressed data or not. When 'IncludeSize' is - ' True, the size of the uncompressed source data will be stored. This works - ' in conjunction with the corresponding 'FreeImage_ZLibUncompressVB' function. - - ' The function returns a VB style Byte array containing the compressed data. - - - ' start population the memory block with compressed data - ' at offset 4 bytes, when the unclompressed size should - ' be included - If (IncludeSize) Then - lOffset = 4 - End If - - Call FreeImage_ZLibCompressEx(FreeImage_ZLibCompressVB, , Data, , lOffset) - - If (IncludeSize) Then - ' get the pointer actual pointing to the array data of - ' the Byte array 'FreeImage_ZLibCompressVB' - lArrayDataPtr = pDeref(pDeref(VarPtrArray(FreeImage_ZLibCompressVB)) + 12) - - ' copy uncompressed size into the first 4 bytes - Call CopyMemory(ByVal lArrayDataPtr, UBound(Data) + 1, 4) - End If - -End Function - -Public Function FreeImage_ZLibUncompressVB(ByRef Data() As Byte, _ - Optional ByVal SizeIncluded As Boolean = True, _ - Optional ByVal SizeNeeded As Long) As Byte() - -Dim abBuffer() As Byte - - ' This function is another, even more VB friendly wrapper for the FreeImage - ' 'FreeImage_ZLibUncompress' function, that uses the 'FreeImage_ZLibUncompressEx' - ' function. This function is very easy to use, since it deals only with VB - ' style Byte arrays. - - ' The parameter 'Data()' is a Byte array, providing the compressed source - ' data that will be uncompressed either withthe size of the uncompressed - ' data included or not. - - ' When the optional parameter 'SizeIncluded' is True, the function assumes, - ' that the first four bytes contain the size of the uncompressed data as a - ' Long value. In that case, 'SizeNeeded' will be ignored. - - ' When the size of the uncompressed data is not included in the buffer 'Data()' - ' containing the compressed data, the optional parameter 'SizeNeeded' must - ' specify the size in bytes needed to hold all the uncompressed data. - - ' The function returns a VB style Byte array containing the uncompressed data. - - - If (SizeIncluded) Then - ' get uncompressed size from the first 4 bytes and allocate - ' buffer accordingly - Call CopyMemory(SizeNeeded, Data(0), 4) - ReDim abBuffer(SizeNeeded - 1) - Call FreeImage_ZLibUncompressEx(abBuffer, , VarPtr(Data(4)), UBound(Data) - 3) - Call pSwap(VarPtrArray(FreeImage_ZLibUncompressVB), VarPtrArray(abBuffer)) - - ElseIf (SizeNeeded) Then - ' no size included in compressed data, so just forward the - ' call to 'FreeImage_ZLibUncompressEx' and trust on SizeNeeded - ReDim abBuffer(SizeNeeded - 1) - Call FreeImage_ZLibUncompressEx(abBuffer, , Data) - Call pSwap(VarPtrArray(FreeImage_ZLibUncompressVB), VarPtrArray(abBuffer)) - - End If - -End Function - -Public Function FreeImage_ZLibGZipVB(ByRef Data() As Byte, _ - Optional ByVal IncludeSize As Boolean = True) As Byte() - -Dim lOffset As Long -Dim lArrayDataPtr As Long - - ' This function is another, even more VB friendly wrapper for the FreeImage - ' 'FreeImage_ZLibGZip' function, that uses the 'FreeImage_ZLibGZipEx' - ' function. This function is very easy to use, since it deals only with VB - ' style Byte arrays. - - ' The parameter 'Data()' is a Byte array, providing the uncompressed source - ' data that will be compressed. - - ' The optional parameter 'IncludeSize' determines whether the size of the - ' uncompressed data should be stored in the first four bytes of the returned - ' byte buffer containing the compressed data or not. When 'IncludeSize' is - ' True, the size of the uncompressed source data will be stored. This works - ' in conjunction with the corresponding 'FreeImage_ZLibGUnzipVB' function. - - ' The function returns a VB style Byte array containing the compressed data. - - - ' start population the memory block with compressed data - ' at offset 4 bytes, when the unclompressed size should - ' be included - If (IncludeSize) Then - lOffset = 4 - End If - - Call FreeImage_ZLibGZipEx(FreeImage_ZLibGZipVB, , Data, , lOffset) - - If (IncludeSize) Then - ' get the pointer actual pointing to the array data of - ' the Byte array 'FreeImage_ZLibCompressVB' - lArrayDataPtr = pDeref(pDeref(VarPtrArray(FreeImage_ZLibGZipVB)) + 12) - - ' copy uncompressed size into the first 4 bytes - Call CopyMemory(ByVal lArrayDataPtr, UBound(Data) + 1, 4) - End If - -End Function - -Public Function FreeImage_ZLibGUnzipVB(ByRef Data() As Byte, _ - Optional ByVal SizeIncluded As Boolean = True, _ - Optional ByVal SizeNeeded As Long) As Byte() - -Dim abBuffer() As Byte - - ' This function is another, even more VB friendly wrapper for the FreeImage - ' 'FreeImage_ZLibGUnzip' function, that uses the 'FreeImage_ZLibGUnzipEx' - ' function. This function is very easy to use, since it deals only with VB - ' style Byte arrays. - - ' The parameter 'Data()' is a Byte array, providing the compressed source - ' data that will be uncompressed either withthe size of the uncompressed - ' data included or not. - - ' When the optional parameter 'SizeIncluded' is True, the function assumes, - ' that the first four bytes contain the size of the uncompressed data as a - ' Long value. In that case, 'SizeNeeded' will be ignored. - - ' When the size of the uncompressed data is not included in the buffer 'Data()' - ' containing the compressed data, the optional parameter 'SizeNeeded' must - ' specify the size in bytes needed to hold all the uncompressed data. - - ' The function returns a VB style Byte array containing the uncompressed data. - - - If (SizeIncluded) Then - ' get uncompressed size from the first 4 bytes and allocate - ' buffer accordingly - Call CopyMemory(SizeNeeded, Data(0), 4) - ReDim abBuffer(SizeNeeded - 1) - Call FreeImage_ZLibGUnzipEx(abBuffer, , VarPtr(Data(4)), UBound(Data) - 3) - Call pSwap(VarPtrArray(FreeImage_ZLibGUnzipVB), VarPtrArray(abBuffer)) - - ElseIf (SizeNeeded) Then - ' no size included in compressed data, so just forward the - ' call to 'FreeImage_ZLibUncompressEx' and trust on SizeNeeded - ReDim abBuffer(SizeNeeded - 1) - Call FreeImage_ZLibGUnzipEx(abBuffer, , Data) - Call pSwap(VarPtrArray(FreeImage_ZLibGUnzipVB), VarPtrArray(abBuffer)) - - End If - -End Function - - -'-------------------------------------------------------------------------------- -' Public functions to destroy custom safearrays -'-------------------------------------------------------------------------------- - -Public Function FreeImage_DestroyLockedArray(ByRef Data As Variant) As Long - -Dim lpArrayPtr As Long - - ' This function destroys an array, that was self created with a custom - ' array descriptor of type ('fFeatures' member) 'FADF_AUTO Or FADF_FIXEDSIZE'. - ' Such arrays are returned by mostly all of the array-dealing wrapper - ' functions. Since these should not destroy the actual array data, when - ' going out of scope, they are craeted as 'FADF_FIXEDSIZE'.' - - ' So, VB sees them as fixed or temporarily locked, when you try to manipulate - ' the array's dimensions. There will occur some strange effects, you should - ' know about: - - ' 1. When trying to 'ReDim' the array, this run-time error will occur: - ' Error #10, 'This array is fixed or temporarily locked' - - ' 2. When trying to assign another array to the array variable, this - ' run-time error will occur: - ' Error #13, 'Type mismatch' - - ' 3. The 'Erase' statement has no effect on the array - - ' Although VB clears up these arrays correctly, when the array variable - ' goes out of scope, you have to destroy the array manually, when you want - ' to reuse the array variable in current scope. - - ' For an example assume, that you want do walk all scanlines in an image: - - ' For i = 0 To FreeImage_GetHeight(Bitmap) - ' - ' ' assign scanline-array to array variable - ' abByte = FreeImage_GetScanLineEx(Bitmap, i) - ' - ' ' do some work on it... - ' - ' ' destroy the array (only the array, not the actual data) - ' Call FreeImage_DestroyLockedArray(dbByte) - ' Next i - - ' The function returns zero on success and any other value on failure - - ' !! Attention !! - ' This function uses a Variant parameter for passing the array to be - ' destroyed. Since VB does not allow to pass an array of non public - ' structures through a Variant parameter, this function can not be used - ' with arrays of cutom type. - - ' You will get this compiler error: "Only public user defined types defined - ' in public object modules can be used as parameters or return types for - ' public procedures of class modules or as fields of public user defined types" - - ' So, there is a function in the wrapper called 'FreeImage_DestroyLockedArrayByPtr' - ' that takes a pointer to the array variable which can be used to work around - ' that VB limitation and furthermore can be used for any of these self-created - ' arrays. To get the array variable's pointer, a declared version of the - ' VB 'VarPtr' function can be used which works for all types of arrays expect - ' String arrays. Declare this function like this in your code: - - ' Private Declare Function VarPtrArray Lib "msvbvm60.dll" Alias "VarPtr" ( _ - ByRef Ptr() As Any) As Long - - ' Then an array could be destroyed by calling the 'FreeImage_DestroyLockedArrayByPtr' - ' function like this: - - ' lResult = FreeImage_DestroyLockedArrayByPtr(VarPtrArray(MyLockedArray)) - - ' Additionally there are some handy wrapper functions available, one for each - ' commonly used structure in FreeImage like RGBTRIPLE, RGBQUAD, FICOMPLEX etc. - - - ' Currently, these functions do return 'FADF_AUTO Or FADF_FIXEDSIZE' arrays - ' that must be destroyed using this or any of it's derived functions: - - ' FreeImage_GetPaletteEx() with FreeImage_DestroyLockedArrayRGBQUAD() - ' FreeImage_GetPaletteLong() with FreeImage_DestroyLockedArray() - ' FreeImage_SaveToMemoryEx2() with FreeImage_DestroyLockedArray() - ' FreeImage_AcquireMemoryEx() with FreeImage_DestroyLockedArray() - ' FreeImage_GetScanLineEx() with FreeImage_DestroyLockedArray() - ' FreeImage_GetScanLineBITMAP8() with FreeImage_DestroyLockedArray() - ' FreeImage_GetScanLineBITMAP16() with FreeImage_DestroyLockedArray() - ' FreeImage_GetScanLineBITMAP24() with FreeImage_DestroyLockedArrayRGBTRIPLE() - ' FreeImage_GetScanLineBITMAP32() with FreeImage_DestroyLockedArrayRGBQUAD() - ' FreeImage_GetScanLineINT16() with FreeImage_DestroyLockedArray() - ' FreeImage_GetScanLineINT32() with FreeImage_DestroyLockedArray() - ' FreeImage_GetScanLineFLOAT() with FreeImage_DestroyLockedArray() - ' FreeImage_GetScanLineDOUBLE() with FreeImage_DestroyLockedArray() - ' FreeImage_GetScanLineCOMPLEX() with FreeImage_DestroyLockedArrayFICOMPLEX() - ' FreeImage_GetScanLineRGB16() with FreeImage_DestroyLockedArrayFIRGB16() - ' FreeImage_GetScanLineRGBA16() with FreeImage_DestroyLockedArrayFIRGBA16() - ' FreeImage_GetScanLineRGBF() with FreeImage_DestroyLockedArrayFIRGBF() - ' FreeImage_GetScanLineRGBAF() with FreeImage_DestroyLockedArrayFIRGBAF() - - - ' ensure, this is an array - If (VarType(Data) And vbArray) Then - - ' data is a VB array, what means a SAFEARRAY in C/C++, that is - ' passed through a ByRef Variant variable, that is a pointer to - ' a VARIANTARG structure - - ' the VARIANTARG structure looks like this: - - ' typedef struct tagVARIANT VARIANTARG; - ' struct tagVARIANT - ' { - ' Union - ' { - ' struct __tagVARIANT - ' { - ' VARTYPE vt; - ' WORD wReserved1; - ' WORD wReserved2; - ' WORD wReserved3; - ' Union - ' { - ' [...] - ' SAFEARRAY *parray; // used when not VT_BYREF - ' [...] - ' SAFEARRAY **pparray; // used when VT_BYREF - ' [...] - - ' the data element (SAFEARRAY) has an offset of 8, since VARTYPE - ' and WORD both have a length of 2 bytes; the pointer to the - ' VARIANTARG structure is the VarPtr of the Variant variable in VB - - ' getting the contents of the data element (in C/C++: *(data + 8)) - lpArrayPtr = pDeref(VarPtr(Data) + 8) - - ' call the 'FreeImage_DestroyLockedArrayByPtr' function to destroy - ' the array properly - Call FreeImage_DestroyLockedArrayByPtr(lpArrayPtr) - Else - - FreeImage_DestroyLockedArray = -1 - End If - -End Function - -Public Function FreeImage_DestroyLockedArrayByPtr(ByVal ArrayPtr As Long) As Long - -Dim lpSA As Long - - ' This function destroys a self-created array with a custom array - ' descriptor by a pointer to the array variable. - - ' dereference the pointer once (in C/C++: *ArrayPtr) - lpSA = pDeref(ArrayPtr) - ' now 'lpSA' is a pointer to the actual SAFEARRAY structure - ' and could be a null pointer when the array is not initialized - ' then, we have nothing to do here but return (-1) to indicate - ' an "error" - If (lpSA) Then - - ' destroy the array descriptor - Call SafeArrayDestroyDescriptor(lpSA) - - ' make 'lpSA' a null pointer, that is an uninitialized array; - ' keep in mind, that we here use 'ArrayPtr' as a ByVal argument, - ' since 'ArrayPtr' is a pointer to lpSA (the address of lpSA); - ' we need to zero these four bytes, 'ArrayPtr' points to - Call CopyMemory(ByVal ArrayPtr, 0&, 4) - Else - - ' the array is already uninitialized, so return an "error" value - FreeImage_DestroyLockedArrayByPtr = -1 - End If - -End Function - -Public Function FreeImage_DestroyLockedArrayRGBTRIPLE(ByRef Data() As RGBTRIPLE) As Long - - ' This function is a thin wrapper for 'FreeImage_DestroyLockedArrayByPtr' - ' for destroying arrays of type 'RGBTRIPLE'. - - FreeImage_DestroyLockedArrayRGBTRIPLE = FreeImage_DestroyLockedArrayByPtr(VarPtrArray(Data)) - -End Function - -Public Function FreeImage_DestroyLockedArrayRGBQUAD(ByRef Data() As RGBQUAD) As Long - - ' This function is a thin wrapper for 'FreeImage_DestroyLockedArrayByPtr' - ' for destroying arrays of type 'RGBQUAD'. - - FreeImage_DestroyLockedArrayRGBQUAD = FreeImage_DestroyLockedArrayByPtr(VarPtrArray(Data)) - -End Function - -Public Function FreeImage_DestroyLockedArrayFICOMPLEX(ByRef Data() As FICOMPLEX) As Long - - ' This function is a thin wrapper for 'FreeImage_DestroyLockedArrayByPtr' - ' for destroying arrays of type 'FICOMPLEX'. - - FreeImage_DestroyLockedArrayFICOMPLEX = FreeImage_DestroyLockedArrayByPtr(VarPtrArray(Data)) - -End Function - -Public Function FreeImage_DestroyLockedArrayFIRGB16(ByRef Data() As FIRGB16) As Long - - ' This function is a thin wrapper for 'FreeImage_DestroyLockedArrayByPtr' - ' for destroying arrays of type 'FIRGB16'. - - FreeImage_DestroyLockedArrayFIRGB16 = FreeImage_DestroyLockedArrayByPtr(VarPtrArray(Data)) - -End Function - -Public Function FreeImage_DestroyLockedArrayFIRGBA16(ByRef Data() As FIRGBA16) As Long - - ' This function is a thin wrapper for 'FreeImage_DestroyLockedArrayByPtr' - ' for destroying arrays of type 'FIRGBA16'. - - FreeImage_DestroyLockedArrayFIRGBA16 = FreeImage_DestroyLockedArrayByPtr(VarPtrArray(Data)) - -End Function - -Public Function FreeImage_DestroyLockedArrayFIRGBF(ByRef Data() As FIRGBF) As Long - - ' This function is a thin wrapper for 'FreeImage_DestroyLockedArrayByPtr' - ' for destroying arrays of type 'FIRGBF'. - - FreeImage_DestroyLockedArrayFIRGBF = FreeImage_DestroyLockedArrayByPtr(VarPtrArray(Data)) - -End Function - -Public Function FreeImage_DestroyLockedArrayFIRGBAF(ByRef Data() As FIRGBAF) As Long - - ' This function is a thin wrapper for 'FreeImage_DestroyLockedArrayByPtr' - ' for destroying arrays of type 'FIRGBAF'. - - FreeImage_DestroyLockedArrayFIRGBAF = FreeImage_DestroyLockedArrayByPtr(VarPtrArray(Data)) - -End Function - - - -'-------------------------------------------------------------------------------- -' Private IOlePicture related helper functions -'-------------------------------------------------------------------------------- - -Private Function pGetIOlePictureFromContainer(ByRef Container As Object, _ - Optional ByVal IncludeDrawings As Boolean) As IPicture - - ' Returns a VB IOlePicture object (IPicture) from a VB image hosting control. - ' See the inline documentation of function 'FreeImage_CreateFromImageContainer' - ' for a detailed description of this helper function. - - If (Not Container Is Nothing) Then - - Select Case TypeName(Container) - - Case "PictureBox", "Form" - If (IncludeDrawings) Then - If (Not Container.AutoRedraw) Then - Call Err.Raise(5, _ - "MFreeImage", _ - Error$(5) & vbCrLf & vbCrLf & _ - "Custom drawings can only be included into the DIB when " & _ - "the container's 'AutoRedraw' property is set to True.") - Exit Function - End If - Set pGetIOlePictureFromContainer = Container.Image - Else - Set pGetIOlePictureFromContainer = Container.Picture - End If - - Case Else - - Dim bHasPicture As Boolean - Dim bHasImage As Boolean - Dim bIsAutoRedraw As Boolean - - On Error Resume Next - bHasPicture = (Container.Picture <> 0) - bHasImage = (Container.Image <> 0) - bIsAutoRedraw = Container.AutoRedraw - On Error GoTo 0 - - If ((IncludeDrawings) And _ - (bHasImage) And _ - (bIsAutoRedraw)) Then - Set pGetIOlePictureFromContainer = Container.Image - - ElseIf (bHasPicture) Then - Set pGetIOlePictureFromContainer = Container.Picture - - Else - Call Err.Raise(5, _ - "MFreeImage", _ - Error$(5) & vbCrLf & vbCrLf & _ - "Cannot create DIB from container control. Container " & _ - "control has no 'Picture' property.") - - End If - - End Select - - End If - -End Function - - - -'-------------------------------------------------------------------------------- -' Private image and color helper functions -'-------------------------------------------------------------------------------- - -Private Function pGetPreviousColorDepth(ByVal bpp As Long) As Long - - ' This function returns the 'previous' color depth of a given - ' color depth. Here, 'previous' means the next smaller color - ' depth. - - Select Case bpp - - Case 32 - pGetPreviousColorDepth = 24 - - Case 24 - pGetPreviousColorDepth = 16 - - Case 16 - pGetPreviousColorDepth = 15 - - Case 15 - pGetPreviousColorDepth = 8 - - Case 8 - pGetPreviousColorDepth = 4 - - Case 4 - pGetPreviousColorDepth = 1 - - End Select - -End Function - -Private Function pGetNextColorDepth(ByVal bpp As Long) As Long - - ' This function returns the 'next' color depth of a given - ' color depth. Here, 'next' means the next greater color - ' depth. - - Select Case bpp - - Case 1 - pGetNextColorDepth = 4 - - Case 4 - pGetNextColorDepth = 8 - - Case 8 - pGetNextColorDepth = 15 - - Case 15 - pGetNextColorDepth = 16 - - Case 16 - pGetNextColorDepth = 24 - - Case 24 - pGetNextColorDepth = 32 - - End Select - -End Function - - - -'-------------------------------------------------------------------------------- -' Private metadata helper functions -'-------------------------------------------------------------------------------- - -Private Function pGetTagFromTagPtr(ByVal Model As FREE_IMAGE_MDMODEL, _ - ByVal TagPtr As Long) As FREE_IMAGE_TAG - -Dim tTag As FITAG -Dim lTemp As Long -Dim i As Long - - ' This function converts data stored in a real FreeImage tag - ' pointer (FITAG **tag) into a VB friendly structure FREE_IMAGE_TAG. - - If (TagPtr <> 0) Then - - ' this is like (only like!) tTag tag = (FITAG) TagPtr; in C/C++ - ' we copy Len(tTag) bytes from the address in TagPtr in to a - ' private FITAG structure tTag so we have easy access to all - ' FITAG members - Call CopyMemory(tTag, ByVal pDeref(TagPtr), Len(tTag)) - - With pGetTagFromTagPtr - - ' first fill all members expect 'Value' in our - ' VB friendly FREE_IMAGE_TAG structure - - ' since we use this VB friendly FREE_IMAGE_TAG structure - ' for later tag modification too, we also need to store the - ' tag model and the pointer to the actual FreeImage FITAG - ' structure - .Model = Model - .TagPtr = TagPtr - - ' although FITAG's 'count' and 'length' members are - ' unsigned longs, we do not expect values greater - ' than 2,147,483,647, so we store them in normal VB - ' signed longs - .Count = tTag.Count - .Length = tTag.Length - - ' strings are stored as pointers to the actual string - ' data in FITAG - .Description = pGetStringFromPointerA(tTag.Description) - .Key = pGetStringFromPointerA(tTag.Key) - - ' FITAG's 'id' and 'type' members are unsigned shorts; - ' first of all 'id' may exceed the range of a signed - ' short (Integer data type in VB), so we store them in - ' signed longs and use CopyMemory for to keep the - ' unsigned bit layout - Call CopyMemory(.Id, tTag.Id, 2) - Call CopyMemory(.Type, tTag.Type, 2) - - ' StringValue is the result of FreeImage_TagToString(); we - ' also store this tag representation in our structure - .StringValue = FreeImage_TagToString(Model, TagPtr) - - ' now comes the hard part, getting the tag's value - - Select Case .Type - - Case FIDT_BYTE, _ - FIDT_UNDEFINED - If (.Count > 1) Then - Dim abBytes() As Byte - ' for a byte array, just redim a VB Byte array and - ' copy Count bytes from the pointer - ReDim abBytes(.Count - 1) - Call CopyMemory(abBytes(0), ByVal tTag.Value, .Count) - .Value = abBytes - Else - ' copy a single byte into a Long and assign - ' with CByte() - Call CopyMemory(lTemp, ByVal tTag.Value, 1) - .Value = CByte(lTemp) - End If - - Case FIDT_ASCII - ' for an ASCII string, 'value' is just a pointer to the - ' string's actual data - .Value = pGetStringFromPointerA(tTag.Value) - - Case FIDT_SHORT - Dim iTemp As Integer - If (.Count > 1) Then - ' for a unsigned long array, first redim Value to - ' proper size - ReDim .Value(.Count - 1) - ' iterate over all items - For i = 0 To .Count - 1 - ' copy each value into a Long and - ' assign with FreeImage_UnsignedShort() to the - ' corresponding item in the (Variant) Value array - Call CopyMemory(iTemp, ByVal tTag.Value + i * 2, 2) - .Value(i) = FreeImage_UnsignedShort(iTemp) - Next i - Else - ' copy a single byte into a Long and assign - ' with FreeImgage_UnsignedShort() - Call CopyMemory(iTemp, ByVal tTag.Value, 2) - ' this works although FreeImage_UnsignedShort() takes - ' an Integer parameter since lTemp was 0 before and - ' we copied only 2 bytes so, VB's implicit conversion - ' to Integer will never produce an overflow - .Value = FreeImage_UnsignedShort(iTemp) - End If - - Case FIDT_LONG, _ - FIDT_IFD - If (.Count > 1) Then - ' for a unsigned long array, first redim Value to - ' proper size - ReDim .Value(.Count - 1) - ' iterate over all items - For i = 0 To .Count - 1 - ' copy each value into a (signed) Long and - ' assign with FreeImage_UnsignedLong() to the - ' corresponding item in the (Variant) Value array - Call CopyMemory(lTemp, ByVal tTag.Value + i * 4, 4) - .Value(i) = FreeImage_UnsignedLong(lTemp) - Next i - Else - ' copy a single unsigned long into a (signed) Long and - ' assign with FreeImage_UnsignedLong() - Call CopyMemory(lTemp, ByVal tTag.Value, 2) - .Value = FreeImage_UnsignedLong(lTemp) - End If - - Case FIDT_RATIONAL, _ - FIDT_SRATIONAL - ' rational values are always stored in the FREE_IMAGE_TAG - ' structure's FIRATIONAL array 'RationalValue' so, allocate - ' enough space in both the 'Value' and 'RationalValue' - ' members to hold 'Count' items - ReDim .Value(.Count - 1) - ReDim .RationalValue(.Count - 1) - For i = 0 To .Count - 1 - ' iterate over all items - With .RationalValue(i) - ' for each item, copy both numerator and denominator - ' into a (signed) Long and assign it to the corresponding - ' member of the FIRATIONAL structure so, we first assume - ' havinge a signed rational (FIDT_SRATIONAL) here - Call CopyMemory(lTemp, ByVal tTag.Value + i * 8, 4) - .Numerator = lTemp - Call CopyMemory(lTemp, ByVal tTag.Value + i * 8 + 4, 4) - .Denominator = lTemp - End With - ' if we have an unsigned rational (FIDT_RATIONAL), convert - ' numerator and denominator - If (.Type = FIDT_RATIONAL) Then - ' convert with FreeImage_UnsignedLong() - With .RationalValue(i) - .Numerator = FreeImage_UnsignedLong(.Numerator) - .Denominator = FreeImage_UnsignedLong(.Denominator) - End With - ' normalze the unsigned rational value - Call pNormalizeRational(.RationalValue(i)) - Else - ' normalze the signed rational value - Call pNormalizeSRational(.RationalValue(i)) - End If - ' store the current fraction's value (maybe only approximated) in - ' the 'Value' member of the FREE_IMAGE_TAG structure, if the - ' denominator is not zero - If (.RationalValue(i).Denominator <> 0) Then - .Value(i) = .RationalValue(i).Numerator / .RationalValue(i).Denominator - End If - Next i - - Case FIDT_SBYTE - If (.Count > 1) Then - ' for a signed byte array, first redim Value to - ' proper size - ReDim .Value(.Count - 1) - ' iterate over all items - For i = 0 To .Count - 1 - ' copy each signed byte value into a Long and - ' check, whether it is negative (bit 7 set) - Call CopyMemory(lTemp, ByVal tTag.Value, 1) - If (lTemp And 128) Then - ' if negative, calculate the negative value - ' and store it in an Integer - .Value(i) = CInt(-256 - (Not (lTemp - 1))) - Else - ' if positive, assign to Value as byte - .Value(i) = CByte(lTemp) - End If - Next i - Else - ' copy a single signed byte into a Long and - ' check, whether it is negative (bit 7 set) - Call CopyMemory(lTemp, ByVal tTag.Value, 1) - If (lTemp And 128) Then - ' if negative, calculate the negative value - ' and store it in an Integer - .Value = CInt(-256 - (Not (lTemp - 1))) - Else - ' if positive, assign to Value as byte - .Value = CByte(lTemp) - End If - End If - - Case FIDT_SSHORT - If (.Count > 1) Then - Dim aiSShorts() As Integer - ' for a signed short array, just redim a VB Integer array and - ' copy Count bytes from the pointer - ReDim aiSShorts(.Count - 1) - Call CopyMemory(aiSShorts(0), ByVal tTag.Value, .Count * 2) - .Value = aiSShorts - Else - ' copy a single signed short into a Long and assign - ' with CInt() - Call CopyMemory(lTemp, ByVal tTag.Value, 2) - .Value = CInt(lTemp) - End If - - Case FIDT_SLONG - If (.Count > 1) Then - Dim alSLongs() As Long - ' for a signed long array, just redim a VB Long array and - ' copy Count bytes from the pointer - ReDim alSLongs(.Count - 1) - Call CopyMemory(alSLongs(0), ByVal tTag.Value, .Count * 4) - .Value = alSLongs - Else - ' copy a single signed long into a Long and assign - ' directly - Call CopyMemory(lTemp, ByVal tTag.Value, 4) - .Value = lTemp - End If - - Case FIDT_FLOAT - If (.Count > 1) Then - Dim asngFloats() As Single - ' for a float array, just redim a VB Single array and - ' copy Count bytes from the pointer - ReDim asngFloats(.Count - 1) - Call CopyMemory(asngFloats(0), ByVal tTag.Value, .Count * 4) - .Value = asngFloats - Else - Dim sngFloat As Single - ' copy a single float into a Single and assign - ' directly - Call CopyMemory(sngFloat, ByVal tTag.Value, 4) - .Value = sngFloat - End If - - Case FIDT_DOUBLE - If (.Count > 1) Then - Dim adblDoubles() As Double - ' for a double array, just redim a VB Double array and - ' copy Count bytes from the pointer - ReDim adblDoubles(.Count - 1) - Call CopyMemory(adblDoubles(0), ByVal tTag.Value, .Count * 8) - .Value = adblDoubles - Else - Dim dblDouble As Double - ' copy a single double into a Double and assign - ' directly - Call CopyMemory(dblDouble, ByVal tTag.Value, 8) - .Value = dblDouble - End If - - Case FIDT_PALETTE - ' copy 'Count' palette entries (RGBQUAD) form the value - ' pointer into the proper dimensioned array of RGBQUAD - ReDim .Palette(.Count - 1) - For i = 0 To .Count - 1 - Call CopyMemory(.Palette(i), ByVal tTag.Value + i * 4, 4) - Next i - - End Select - - End With - End If - -End Function - -Private Sub pNormalizeRational(ByRef Value As FIRATIONAL) - -Dim vntCommon As Long - - ' This function normalizes an unsigned fraction stored in a FIRATIONAL - ' structure by cancelling down the fraction. This is commonly done - ' by dividing both numerator and denominator by their greates - ' common divisor (gcd). - ' Does nothing if any of numerator and denominator is 1 or 0. - - With Value - If ((.Numerator <> 1) And (.Denominator <> 1) And _ - (.Numerator <> 0) And (.Denominator <> 0)) Then - vntCommon = gcd(.Numerator, .Denominator) - If (vntCommon <> 1) Then - ' convert values back to an unsigned long (may - ' result in a subtype Currency if the range of the - ' VB Long is insufficient for storing the value!) - .Numerator = FreeImage_UnsignedLong(.Numerator / vntCommon) - .Denominator = FreeImage_UnsignedLong(.Denominator / vntCommon) - End If - End If - End With - -End Sub - -Private Sub pNormalizeSRational(ByRef Value As FIRATIONAL) - -Dim lCommon As Long - - ' This function normalizes a signed fraction stored in a FIRATIONAL - ' structure by cancelling down the fraction. This is commonly done - ' by dividing both numerator and denominator by their greates - ' common divisor (gcd). - ' Does nothing if any of numerator and denominator is 1 or 0. - - With Value - If ((.Numerator <> 1) And (.Denominator <> 1) And _ - (.Numerator <> 0) And (.Denominator <> 0)) Then - lCommon = gcd(.Numerator, .Denominator) - If (lCommon <> 1) Then - ' using the CLng() function for not to get - ' a subtype Double here - .Numerator = CLng(.Numerator / lCommon) - .Denominator = CLng(.Denominator / lCommon) - End If - End If - - ' adjust the position of the negative sign if one is present: - ' it should preceed the numerator, not the denominator - If (.Denominator < 0) Then - .Denominator = -.Denominator - .Numerator = -.Numerator - End If - End With - -End Sub - -Private Function gcd(ByVal a As Variant, ByVal b As Variant) As Variant - -Dim vntTemp As Variant - - ' calculate greatest common divisor - - Do While (b) - vntTemp = b - ' calculate b = a % b (modulo) - ' this could be just: - ' b = a Mod b - ' but VB's Mod operator fails for unsigned - ' long values stored in currency variables - ' so, we use the mathematical definition of - ' the modulo operator taken from Wikipedia. - b = a - floor(a / b) * b - a = vntTemp - Loop - gcd = a - -End Function - -Private Function floor(ByRef a As Variant) As Variant - - ' This is a VB version of the floor() function. - If (a < 0) Then - floor = VBA.Int(a) - Else - floor = -VBA.Fix(-a) - End If - -End Function - -Private Function pTagToTagPtr(ByRef Tag As FREE_IMAGE_TAG) As Boolean - -Dim tTagSave As FITAG -Dim lpTag As Long -Dim abValueBuffer() As Byte -Dim lLength As Long -Dim lCount As Long - - ' This function converts tag data stored in a VB friendly structure - ' FREE_IMAGE_TAG into a real FreeImage tag pointer (FITAG **tag). - - ' This function is called, whenever tag data should be updated for an - ' image, since the FreeImage's tag pointer remains valid during the - ' whole lifetime of a DIB. So, changes written to that pointer (or - ' even better, the FITAG structure at the address, the pointer points - ' to), are real updates to the image's tag. - - With Tag - - lpTag = pDeref(.TagPtr) - - ' save current (FITAG) tag for an optional 'undo' operation - ' invoked on failure - Call CopyMemory(tTagSave, ByVal lpTag, Len(tTagSave)) - - ' set tag id - Call CopyMemory(ByVal lpTag + 8, .Id, 2) - ' set tag type - Call CopyMemory(ByVal lpTag + 10, .Type, 2) - ' set tag key (use native FreeImage function to handle - ' memory allocation) - Call FreeImage_SetTagKey(.TagPtr, .Key) - - ' here, we update the tag's value - ' generally, we create a plain byte buffer containing all the - ' value's data and use FreeImage_SetTagValue() with the - ' const void *value pointer set to the byte buffer's address. - - ' the variable abValueBuffer is our byte buffer that is, - ' depending on the FreeImage tag data type, allocated and filled - ' accordingly - ' The variables 'lLength' and 'lCount' are set up correctly for - ' each data type and will be filled into the FITAG structure - ' before calling FreeImage_SetTagValue(); after all, the VB - ' Tag structure's (FREE_IMAGE_TAG) 'Count' and 'Length' members - ' are updated with 'lLength' and 'lCount'. - - Select Case .Type - - Case FIDT_ASCII - ' use StrConv() to get an ASCII byte array from a VB String (BSTR) - abValueBuffer = StrConv(.Value, vbFromUnicode) - ' according to FreeImage's source code, both 'count' and 'length' - ' must be the length of the string - lCount = Len(.Value) - lLength = lCount - - Case FIDT_PALETTE - ' ensure, that there are at least 'Count' entries in the - ' palette array - lCount = .Count - If (UBound(.Palette) + 1 < lCount) Then - ' if not, adjust Count - lCount = UBound(.Palette) + 1 - End If - ' 4 bytes per element - lLength = lCount * 4 - ' allocate buffer and copy data from Palatte array - ReDim abValueBuffer(lLength - 1) - Call CopyMemory(abValueBuffer(0), .Palette(LBound(.Palette)), lLength) - - Case FIDT_RATIONAL, _ - FIDT_SRATIONAL - ' we use a helper function to get a byte buffer for any type of - ' rational value - lCount = pGetRationalValueBuffer(.RationalValue, abValueBuffer) - If (lCount > .Count) Then - lCount = .Count - End If - ' eight bytes per element (2 longs) - lLength = lCount * 8 - - Case Else - ' we use a helper function to get a byte buffer for any other type - lCount = pGetValueBuffer(.Value, .Type, lLength, abValueBuffer) - If (lCount > .Count) Then - lCount = .Count - End If - ' lLength was used as an OUT parameter when calling pGetValueBuffer - ' it now contains the size of one element in bytes so, multiply with - ' lCount to get the total length - lLength = lLength * lCount - - End Select - - ' set tag length - Call CopyMemory(ByVal lpTag + 16, lLength, 4) - ' set tag count - Call CopyMemory(ByVal lpTag + 12, lCount, 4) - - If (FreeImage_SetTagValue(.TagPtr, VarPtr(abValueBuffer(0))) <> 0) Then - - ' update Tag's members - ' update Count - .Count = lCount - ' update Length - .Length = lLength - ' update StringValue - .StringValue = FreeImage_TagToString(.Model, .TagPtr) - pTagToTagPtr = True - Else - - ' restore saved (FITAG) tag values on failure - Call CopyMemory(ByVal lpTag, tTagSave, Len(tTagSave)) - End If - - End With - -End Function - -Private Function pGetValueBuffer(ByRef Value As Variant, _ - ByVal MetaDataVarType As FREE_IMAGE_MDTYPE, _ - ByRef ElementSize As Long, _ - ByRef Buffer() As Byte) As Long - -Dim lElementCount As Long -Dim bIsArray As Boolean -Dim abValueBuffer(7) As Byte -Dim cBytes As Long -Dim i As Long - - ' This function copies any value provided in the Variant 'Value' - ' parameter into the byte array Buffer. 'Value' may contain an - ' array as well. The values in the byte buffer are aligned to fit - ' the FreeImage data type for tag values specified in - ' 'MetaDataVarType'. For integer values, it does not matter, in - ' which VB data type the values are provided. For example, it is - ' possible to transform a provided byte array into a unsigned long - ' array. - - ' The parameter 'ElementSize' is an OUT value, providing the actual - ' size per element in the byte buffer in bytes to the caller. - - ' This function works for the types FIDT_BYTE, FIDT_SHORT, FIDT_LONG, - ' FIDT_SBYTE , FIDT_SSHORT, FIDT_SLONG, FIDT_FLOAT, FIDT_DOUBLE - ' and FIDT_IFD - - ElementSize = pGetElementSize(MetaDataVarType) - If (Not IsArray(Value)) Then - lElementCount = 1 - Else - On Error Resume Next - lElementCount = UBound(Value) - LBound(Value) + 1 - On Error GoTo 0 - bIsArray = True - End If - - If (lElementCount > 0) Then - ReDim Buffer((lElementCount * ElementSize) - 1) - - If (Not bIsArray) Then - cBytes = pGetVariantAsByteBuffer(Value, abValueBuffer) - If (cBytes > ElementSize) Then - cBytes = ElementSize - End If - Call CopyMemory(Buffer(0), abValueBuffer(0), cBytes) - Else - For i = LBound(Value) To UBound(Value) - cBytes = pGetVariantAsByteBuffer(Value(i), abValueBuffer) - If (cBytes > ElementSize) Then - cBytes = ElementSize - End If - Call CopyMemory(Buffer(0 + (i * ElementSize)), abValueBuffer(0), cBytes) - Next i - End If - - pGetValueBuffer = lElementCount - End If - -End Function - -Private Function pGetRationalValueBuffer(ByRef RationalValues() As FIRATIONAL, _ - ByRef Buffer() As Byte) As Long - -Dim lElementCount As Long -Dim abValueBuffer(7) As Byte -Dim cBytes As Long -Dim i As Long - - ' This function copies a number of elements from the FIRATIONAL array - ' 'RationalValues' into the byte buffer 'Buffer'. - - ' From the caller's point of view, this function is the same as - ' 'pGetValueBuffer', except, it only works for arrays of FIRATIONAL. - - ' This function works for the types FIDT_RATIONAL and FIDT_SRATIONAL. - - lElementCount = UBound(RationalValues) - LBound(RationalValues) + 1 - ReDim Buffer(lElementCount * 8 + 1) - - For i = LBound(RationalValues) To UBound(RationalValues) - cBytes = pGetVariantAsByteBuffer(RationalValues(i).Numerator, abValueBuffer) - If (cBytes > 4) Then - cBytes = 4 - End If - Call CopyMemory(Buffer(0 + (i * 8)), abValueBuffer(0), cBytes) - - cBytes = pGetVariantAsByteBuffer(RationalValues(i).Denominator, abValueBuffer) - If (cBytes > 4) Then - cBytes = 4 - End If - Call CopyMemory(Buffer(4 + (i * 8)), abValueBuffer(0), cBytes) - Next i - - pGetRationalValueBuffer = lElementCount - -End Function - -Private Function pGetVariantAsByteBuffer(ByRef Value As Variant, _ - ByRef Buffer() As Byte) As Long - -Dim lLength As Long - - ' This function fills a byte buffer 'Buffer' with data taken - ' from a Variant parameter. Depending on the Variant's type and, - ' width, it copies N (lLength) bytes into the buffer starting - ' at the buffer's first byte at Buffer(0). The function returns - ' the number of bytes copied. - - ' It is much easier to assign the Variant to a variable of - ' the proper native type first, since gathering a Variant's - ' actual value is a hard job to implement for each subtype. - - Select Case VarType(Value) - - Case vbByte - Buffer(0) = Value - lLength = 1 - - Case vbInteger - Dim iInteger As Integer - iInteger = Value - lLength = 2 - Call CopyMemory(Buffer(0), iInteger, lLength) - - Case vbLong - Dim lLong As Long - lLong = Value - lLength = 4 - Call CopyMemory(Buffer(0), lLong, lLength) - - Case vbCurrency - Dim cCurrency As Currency - ' since the Currency data type is a so called scaled - ' integer, we have to divide by 10.000 first to get the - ' proper bit layout. - cCurrency = Value / 10000 - lLength = 8 - Call CopyMemory(Buffer(0), cCurrency, lLength) - - Case vbSingle - Dim sSingle As Single - sSingle = Value - lLength = 4 - Call CopyMemory(Buffer(0), sSingle, lLength) - - Case vbDouble - Dim dblDouble As Double - dblDouble = Value - lLength = 8 - Call CopyMemory(Buffer(0), dblDouble, lLength) - - End Select - - pGetVariantAsByteBuffer = lLength - -End Function - -Private Function pGetElementSize(ByVal vt As FREE_IMAGE_MDTYPE) As Long - - ' This function returns the width in bytes for any of the - ' FreeImage metadata tag data types. - - Select Case vt - - Case FIDT_BYTE, _ - FIDT_SBYTE, _ - FIDT_UNDEFINED, _ - FIDT_ASCII - pGetElementSize = 1 - - Case FIDT_SHORT, _ - FIDT_SSHORT - pGetElementSize = 2 - - Case FIDT_LONG, _ - FIDT_SLONG, _ - FIDT_FLOAT, _ - FIDT_PALETTE, _ - FIDT_IFD - pGetElementSize = 4 - - Case Else - pGetElementSize = 8 - - End Select - -End Function - - - -'-------------------------------------------------------------------------------- -' Private pointer manipulation helper functions -'-------------------------------------------------------------------------------- - -Private Function pGetStringFromPointerA(ByRef Ptr As Long) As String - -Dim abBuffer() As Byte -Dim lLength As Long - - ' This function creates and returns a VB BSTR variable from - ' a C/C++ style string pointer by making a redundant deep - ' copy of the string's characters. - - If (Ptr) Then - ' get the length of the ANSI string pointed to by ptr - lLength = lstrlen(Ptr) - If (lLength) Then - ' copy characters to a byte array - ReDim abBuffer(lLength - 1) - Call CopyMemory(abBuffer(0), ByVal Ptr, lLength) - ' convert from byte array to unicode BSTR - pGetStringFromPointerA = StrConv(abBuffer, vbUnicode) - End If - End If - -End Function - -Private Function pDeref(ByVal Ptr As Long) As Long - - ' This function dereferences a pointer and returns the - ' contents as it's return value. - - ' in C/C++ this would be: - ' return *(ptr); - - Call CopyMemory(pDeref, ByVal Ptr, 4) - -End Function - -Private Sub pSwap(ByVal lpSrc As Long, _ - ByVal lpDst As Long) - -Dim lpTmp As Long - - ' This function swaps two DWORD memory blocks pointed to - ' by lpSrc and lpDst, whereby lpSrc and lpDst are actually - ' no pointer types but contain the pointer's address. - - ' in C/C++ this would be: - ' void pSwap(int lpSrc, int lpDst) { - ' int tmp = *(int*)lpSrc; - ' *(int*)lpSrc = *(int*)lpDst; - ' *(int*)lpDst = tmp; - ' } - - Call CopyMemory(lpTmp, ByVal lpSrc, 4) - Call CopyMemory(ByVal lpSrc, ByVal lpDst, 4) - Call CopyMemory(ByVal lpDst, lpTmp, 4) - -End Sub - -Private Function pGetMemoryBlockPtrFromVariant(ByRef Data As Variant, _ - Optional ByRef SizeInBytes As Long, _ - Optional ByRef ElementSize As Long) As Long - - ' This function returns the pointer to the memory block provided through - ' the Variant parameter 'data', which could be either a Byte, Integer or - ' Long array or the address of the memory block itself. In the last case, - ' the parameter 'SizeInBytes' must not be omitted or zero, since it's - ' correct value (the size of the memory block) can not be determined by - ' the address only. So, the function fails, if 'SizeInBytes' is omitted - ' or zero and 'data' is not an array but contains a Long value (the address - ' of a memory block) by returning Null. - - ' If 'data' contains either a Byte, Integer or Long array, the pointer to - ' the actual array data is returned. The parameter 'SizeInBytes' will - ' be adjusted correctly, if it was less or equal zero upon entry. - - ' The function returns Null (zero) if there was no supported memory block - ' provided. - - ' do we have an array? - If (VarType(Data) And vbArray) Then - Select Case (VarType(Data) And (Not vbArray)) - - Case vbByte - ElementSize = 1 - pGetMemoryBlockPtrFromVariant = pGetArrayPtrFromVariantArray(Data) - If (pGetMemoryBlockPtrFromVariant) Then - If (SizeInBytes <= 0) Then - SizeInBytes = (UBound(Data) + 1) - - ElseIf (SizeInBytes > (UBound(Data) + 1)) Then - SizeInBytes = (UBound(Data) + 1) - - End If - End If - - Case vbInteger - ElementSize = 2 - pGetMemoryBlockPtrFromVariant = pGetArrayPtrFromVariantArray(Data) - If (pGetMemoryBlockPtrFromVariant) Then - If (SizeInBytes <= 0) Then - SizeInBytes = (UBound(Data) + 1) * 2 - - ElseIf (SizeInBytes > ((UBound(Data) + 1) * 2)) Then - SizeInBytes = (UBound(Data) + 1) * 2 - - End If - End If - - Case vbLong - ElementSize = 4 - pGetMemoryBlockPtrFromVariant = pGetArrayPtrFromVariantArray(Data) - If (pGetMemoryBlockPtrFromVariant) Then - If (SizeInBytes <= 0) Then - SizeInBytes = (UBound(Data) + 1) * 4 - - ElseIf (SizeInBytes > ((UBound(Data) + 1) * 4)) Then - SizeInBytes = (UBound(Data) + 1) * 4 - - End If - End If - - End Select - Else - ElementSize = 1 - If ((VarType(Data) = vbLong) And _ - (SizeInBytes >= 0)) Then - pGetMemoryBlockPtrFromVariant = Data - End If - End If - -End Function - -Private Function pGetArrayPtrFromVariantArray(ByRef Data As Variant) As Long - -Dim eVarType As VbVarType -Dim lDataPtr As Long - - ' This function returns a pointer to the first array element of - ' a VB array (SAFEARRAY) that is passed through a Variant type - ' parameter. (Don't try this at home...) - - ' cache VarType in variable - eVarType = VarType(Data) - - ' ensure, this is an array - If (eVarType And vbArray) Then - - ' data is a VB array, what means a SAFEARRAY in C/C++, that is - ' passed through a ByRef Variant variable, that is a pointer to - ' a VARIANTARG structure - - ' the VARIANTARG structure looks like this: - - ' typedef struct tagVARIANT VARIANTARG; - ' struct tagVARIANT - ' { - ' Union - ' { - ' struct __tagVARIANT - ' { - ' VARTYPE vt; - ' WORD wReserved1; - ' WORD wReserved2; - ' WORD wReserved3; - ' Union - ' { - ' [...] - ' SAFEARRAY *parray; // used when not VT_BYREF - ' [...] - ' SAFEARRAY **pparray; // used when VT_BYREF - ' [...] - - ' the data element (SAFEARRAY) has an offset of 8, since VARTYPE - ' and WORD both have a length of 2 bytes; the pointer to the - ' VARIANTARG structure is the VarPtr of the Variant variable in VB - - ' getting the contents of the data element (in C/C++: *(data + 8)) - lDataPtr = pDeref(VarPtr(Data) + 8) - - ' dereference the pointer again (in C/C++: *(lDataPtr)) - lDataPtr = pDeref(lDataPtr) - - ' test, whether 'lDataPtr' now is a Null pointer - ' in that case, the array is not yet initialized and so we can't dereference - ' it another time since we have no permisson to acces address 0 - - ' the contents of 'lDataPtr' may be Null now in case of an uninitialized - ' array; then we can't access any of the SAFEARRAY members since the array - ' variable doesn't event point to a SAFEARRAY structure, so we will return - ' the null pointer - - If (lDataPtr) Then - ' the contents of lDataPtr now is a pointer to the SAFEARRAY structure - - ' the SAFEARRAY structure looks like this: - - ' typedef struct FARSTRUCT tagSAFEARRAY { - ' unsigned short cDims; // Count of dimensions in this array. - ' unsigned short fFeatures; // Flags used by the SafeArray - ' // routines documented below. - ' #if defined(WIN32) - ' unsigned long cbElements; // Size of an element of the array. - ' // Does not include size of - ' // pointed-to data. - ' unsigned long cLocks; // Number of times the array has been - ' // locked without corresponding unlock. - ' #Else - ' unsigned short cbElements; - ' unsigned short cLocks; - ' unsigned long handle; // Used on Macintosh only. - ' #End If - ' void HUGEP* pvData; // Pointer to the data. - ' SAFEARRAYBOUND rgsabound[1]; // One bound for each dimension. - ' } SAFEARRAY; - - ' since we live in WIN32, the pvData element has an offset - ' of 12 bytes from the base address of the structure, - ' so dereference the pvData pointer, what indeed is a pointer - ' to the actual array (in C/C++: *(lDataPtr + 12)) - lDataPtr = pDeref(lDataPtr + 12) - End If - - ' return this value - pGetArrayPtrFromVariantArray = lDataPtr - - ' a more shorter form of this function would be: - ' (doesn't work for uninitialized arrays, but will likely crash!) - 'pGetArrayPtrFromVariantArray = pDeref(pDeref(pDeref(VarPtr(data) + 8)) + 12) - End If - -End Function - - -#If (False) Then - -' Enum STRETCH_MODE -Const STRETCH_MODE = 1 -Const SM_BLACKONWHITE = 1 -Const SM_WHITEONBLACK = 1 -Const SM_COLORONCOLOR = 1 - -' Enum RASTER_OPERATOR -Const RASTER_OPERATOR = 1 -Const ROP_SRCAND = 1 -Const ROP_SRCCOPY = 1 -Const ROP_SRCERASE = 1 -Const ROP_SRCINVERT = 1 -Const ROP_SRCPAINT = 1 - -' Enum DRAW_MODE -Const DRAW_MODE = 1 -Const DM_DRAW_DEFAULT = 1 -Const DM_MIRROR_NONE = 1 -Const DM_MIRROR_VERTICAL = 1 -Const DM_MIRROR_HORIZONTAL = 1 -Const DM_MIRROR_BOTH = 1 - -' Enum HISTOGRAM_ORIENTATION -Const HISTOGRAM_ORIENTATION = 1 -Const HOR_TOP_DOWN = 1 -Const HOR_BOTTOM_UP = 1 - -' Enum FREE_IMAGE_ICC_COLOR_MODEL -Const FREE_IMAGE_ICC_COLOR_MODEL = 1 -Const FIICC_COLOR_MODEL_RGB = 1 -Const FIICC_COLOR_MODEL_CMYK = 1 - -' Enum FREE_IMAGE_FORMAT -Const FREE_IMAGE_FORMAT = 1 -Const FIF_UNKNOWN = 1 -Const FIF_BMP = 1 -Const FIF_ICO = 1 -Const FIF_JPEG = 1 -Const FIF_JNG = 1 -Const FIF_KOALA = 1 -Const FIF_LBM = 1 -Const FIF_IFF = 1 -Const FIF_MNG = 1 -Const FIF_PBM = 1 -Const FIF_PBMRAW = 1 -Const FIF_PCD = 1 -Const FIF_PCX = 1 -Const FIF_PGM = 1 -Const FIF_PGMRAW = 1 -Const FIF_PNG = 1 -Const FIF_PPM = 1 -Const FIF_PPMRAW = 1 -Const FIF_RAS = 1 -Const FIF_TARGA = 1 -Const FIF_TIFF = 1 -Const FIF_WBMP = 1 -Const FIF_PSD = 1 -Const FIF_CUT = 1 -Const FIF_XBM = 1 -Const FIF_XPM = 1 -Const FIF_DDS = 1 -Const FIF_GIF = 1 -Const FIF_HDR = 1 -Const FIF_FAXG3 = 1 -Const FIF_SGI = 1 -Const FIF_EXR = 1 -Const FIF_J2K = 1 -Const FIF_JP2 = 1 -Const FIF_PFM = 1 -Const FIF_PICT = 1 -Const FIF_RAW = 1 -Const FIF_WEBP = 1 -Const FIF_JXR = 1 - -' Enum FREE_IMAGE_LOAD_OPTIONS -Const FREE_IMAGE_LOAD_OPTIONS = 1 -Const FILO_LOAD_NOPIXELS = 1 -Const FILO_LOAD_DEFAULT = 1 -Const FILO_GIF_DEFAULT = 1 -Const FILO_GIF_LOAD256 = 1 -Const FILO_GIF_PLAYBACK = 1 -Const FILO_ICO_DEFAULT = 1 -Const FILO_ICO_MAKEALPHA = 1 -Const FILO_JPEG_DEFAULT = 1 -Const FILO_JPEG_FAST = 1 -Const FILO_JPEG_ACCURATE = 1 -Const FILO_JPEG_CMYK = 1 -Const FILO_JPEG_EXIFROTATE = 1 -Const FILO_JPEG_GREYSCALE = 1 -Const FILO_PCD_DEFAULT = 1 -Const FILO_PCD_BASE = 1 -Const FILO_PCD_BASEDIV4 = 1 -Const FILO_PCD_BASEDIV16 = 1 -Const FILO_PNG_DEFAULT = 1 -Const FILO_PNG_IGNOREGAMMA = 1 -Const FILO_PSD_CMYK = 1 -Const FILO_PSD_LAB = 1 -Const FILO_RAW_DEFAULT = 1 -Const FILO_RAW_PREVIEW = 1 -Const FILO_RAW_DISPLAY = 1 -Const FILO_RAW_HALFSIZE = 1 -Const FILO_TARGA_DEFAULT = 1 -Const FILO_TARGA_LOAD_RGB888 = 1 -Const FISO_TIFF_DEFAULT = 1 -Const FISO_TIFF_CMYK = 1 - -' Enum FREE_IMAGE_SAVE_OPTIONS -Const FREE_IMAGE_SAVE_OPTIONS = 1 -Const FISO_SAVE_DEFAULT = 1 -Const FISO_BMP_DEFAULT = 1 -Const FISO_BMP_SAVE_RLE = 1 -Const FISO_EXR_DEFAULT = 1 -Const FISO_EXR_FLOAT = 1 -Const FISO_EXR_NONE = 1 -Const FISO_EXR_ZIP = 1 -Const FISO_EXR_PIZ = 1 -Const FISO_EXR_PXR24 = 1 -Const FISO_EXR_B44 = 1 -Const FISO_EXR_LC = 1 -Const FISO_JPEG_DEFAULT = 1 -Const FISO_JPEG_QUALITYSUPERB = 1 -Const FISO_JPEG_QUALITYGOOD = 1 -Const FISO_JPEG_QUALITYNORMAL = 1 -Const FISO_JPEG_QUALITYAVERAGE = 1 -Const FISO_JPEG_QUALITYBAD = 1 -Const FISO_JPEG_PROGRESSIVE = 1 -Const FISO_JPEG_SUBSAMPLING_411 = 1 -Const FISO_JPEG_SUBSAMPLING_420 = 1 -Const FISO_JPEG_SUBSAMPLING_422 = 1 -Const FISO_JPEG_SUBSAMPLING_444 = 1 -Const FISO_JPEG_OPTIMIZE = 1 -Const FISO_JPEG_BASELINE = 1 -Const FISO_PNG_Z_BEST_SPEED = 1 -Const FISO_PNG_Z_DEFAULT_COMPRESSION = 1 -Const FISO_PNG_Z_BEST_COMPRESSION = 1 -Const FISO_PNG_Z_NO_COMPRESSION = 1 -Const FISO_PNG_INTERLACED = 1 -Const FISO_PNM_DEFAULT = 1 -Const FISO_PNM_SAVE_RAW = 1 -Const FISO_PNM_SAVE_ASCII = 1 -Const FISO_TARGA_SAVE_RLE = 1 -Const FISO_TIFF_DEFAULT = 1 -Const FISO_TIFF_CMYK = 1 -Const FISO_TIFF_PACKBITS = 1 -Const FISO_TIFF_DEFLATE = 1 -Const FISO_TIFF_ADOBE_DEFLATE = 1 -Const FISO_TIFF_NONE = 1 -Const FISO_TIFF_CCITTFAX3 = 1 -Const FISO_TIFF_CCITTFAX4 = 1 -Const FISO_TIFF_LZW = 1 -Const FISO_TIFF_JPEG = 1 -Const FISO_TIFF_LOGLUV = 1 -Const FISO_WEBP_LOSSLESS = 1 -Const FISO_JXR_LOSSLESS = 1 -Const FISO_JXR_PROGRESSIVE = 1 - -' Enum FREE_IMAGE_TYPE -Const FREE_IMAGE_TYPE = 1 -Const FIT_UNKNOWN = 1 -Const FIT_BITMAP = 1 -Const FIT_UINT16 = 1 -Const FIT_INT16 = 1 -Const FIT_UINT32 = 1 -Const FIT_INT32 = 1 -Const FIT_FLOAT = 1 -Const FIT_DOUBLE = 1 -Const FIT_COMPLEX = 1 -Const FIT_RGB16 = 1 -Const FIT_RGBA16 = 1 -Const FIT_RGBF = 1 -Const FIT_RGBAF = 1 - -' Enum FREE_IMAGE_COLOR_TYPE -Const FREE_IMAGE_COLOR_TYPE = 1 -Const FIC_MINISWHITE = 1 -Const FIC_MINISBLACK = 1 -Const FIC_RGB = 1 -Const FIC_PALETTE = 1 -Const FIC_RGBALPHA = 1 -Const FIC_CMYK = 1 - -' Enum FREE_IMAGE_QUANTIZE -Const FREE_IMAGE_QUANTIZE = 1 -Const FIQ_WUQUANT = 1 -Const FIQ_NNQUANT = 1 - -' Enum FREE_IMAGE_DITHER -Const FREE_IMAGE_DITHER = 1 -Const FID_FS = 1 -Const FID_BAYER4x4 = 1 -Const FID_BAYER8x8 = 1 -Const FID_CLUSTER6x6 = 1 -Const FID_CLUSTER8x8 = 1 -Const FID_CLUSTER16x16 = 1 -Const FID_BAYER16x16 = 1 - -' Enum FREE_IMAGE_JPEG_OPERATION -Const FREE_IMAGE_JPEG_OPERATION = 1 -Const FIJPEG_OP_NONE = 1 -Const FIJPEG_OP_FLIP_H = 1 -Const FIJPEG_OP_FLIP_V = 1 -Const FIJPEG_OP_TRANSPOSE = 1 -Const FIJPEG_OP_TRANSVERSE = 1 -Const FIJPEG_OP_ROTATE_90 = 1 -Const FIJPEG_OP_ROTATE_180 = 1 -Const FIJPEG_OP_ROTATE_270 = 1 - -' Enum FREE_IMAGE_TMO -Const FREE_IMAGE_TMO = 1 -Const FITMO_DRAGO03 = 1 -Const FITMO_REINHARD05 = 1 -Const FITMO_FATTAL02 = 1 - -' Enum FREE_IMAGE_FILTER -Const FREE_IMAGE_FILTER = 1 -Const FILTER_BOX = 1 -Const FILTER_BICUBIC = 1 -Const FILTER_BILINEAR = 1 -Const FILTER_BSPLINE = 1 -Const FILTER_CATMULLROM = 1 -Const FILTER_LANCZOS3 = 1 - -' Enum FREE_IMAGE_COLOR_CHANNEL -Const FREE_IMAGE_COLOR_CHANNEL = 1 -Const FICC_RGB = 1 -Const FICC_RED = 1 -Const FICC_GREEN = 1 -Const FICC_BLUE = 1 -Const FICC_ALPHA = 1 -Const FICC_BLACK = 1 -Const FICC_REAL = 1 -Const FICC_IMAG = 1 -Const FICC_MAG = 1 -Const FICC_PHASE = 1 - -' Enum FREE_IMAGE_MDTYPE -Const FREE_IMAGE_MDTYPE = 1 -Const FIDT_NOTYPE = 1 -Const FIDT_BYTE = 1 -Const FIDT_ASCII = 1 -Const FIDT_SHORT = 1 -Const FIDT_LONG = 1 -Const FIDT_RATIONAL = 1 -Const FIDT_SBYTE = 1 -Const FIDT_UNDEFINED = 1 -Const FIDT_SSHORT = 1 -Const FIDT_SLONG = 1 -Const FIDT_SRATIONAL = 1 -Const FIDT_FLOAT = 1 -Const FIDT_DOUBLE = 1 -Const FIDT_IFD = 1 -Const FIDT_PALETTE = 1 - -' Enum FREE_IMAGE_MDMODEL -Const FREE_IMAGE_MDMODEL = 1 -Const FIMD_NODATA = 1 -Const FIMD_COMMENTS = 1 -Const FIMD_EXIF_MAIN = 1 -Const FIMD_EXIF_EXIF = 1 -Const FIMD_EXIF_GPS = 1 -Const FIMD_EXIF_MAKERNOTE = 1 -Const FIMD_EXIF_INTEROP = 1 -Const FIMD_IPTC = 1 -Const FIMD_XMP = 1 -Const FIMD_GEOTIFF = 1 -Const FIMD_ANIMATION = 1 -Const FIMD_CUSTOM = 1 -Const FIMD_EXIF_RAW = 1 - -' Enum FREE_IMAGE_FRAME_DISPOSAL_METHODS -Const FREE_IMAGE_FRAME_DISPOSAL_METHODS = 1 -Const FIFD_GIF_DISPOSAL_UNSPECIFIED = 1 -Const FIFD_GIF_DISPOSAL_LEAVE = 1 -Const FIFD_GIF_DISPOSAL_BACKGROUND = 1 -Const FIFD_GIF_DISPOSAL_PREVIOUS = 1 - -' Enum FREE_IMAGE_COLOR_OPTIONS -Const FREE_IMAGE_COLOR_OPTIONS = 1 -Const FI_COLOR_IS_RGB_COLOR = 1 -Const FI_COLOR_IS_RGBA_COLOR = 1 -Const FI_COLOR_FIND_EQUAL_COLOR = 1 -Const FI_COLOR_ALPHA_IS_INDEX = 1 - -' Enum FREE_IMAGE_CONVERSION_FLAGS -Const FREE_IMAGE_CONVERSION_FLAGS = 1 -Const FICF_MONOCHROME = 1 -Const FICF_MONOCHROME_THRESHOLD = 1 -Const FICF_MONOCHROME_DITHER = 1 -Const FICF_GREYSCALE_4BPP = 1 -Const FICF_PALLETISED_8BPP = 1 -Const FICF_GREYSCALE_8BPP = 1 -Const FICF_GREYSCALE = 1 -Const FICF_RGB_15BPP = 1 -Const FICF_RGB_16BPP = 1 -Const FICF_RGB_24BPP = 1 -Const FICF_RGB_32BPP = 1 -Const FICF_RGB_ALPHA = 1 -Const FICF_KEEP_UNORDERED_GREYSCALE_PALETTE = 1 -Const FICF_REORDER_GREYSCALE_PALETTE = 1 - -' Enum FREE_IMAGE_COLOR_DEPTH -Const FREE_IMAGE_COLOR_DEPTH = 1 -Const FICD_AUTO = 1 -Const FICD_MONOCHROME = 1 -Const FICD_MONOCHROME_THRESHOLD = 1 -Const FICD_MONOCHROME_DITHER = 1 -Const FICD_1BPP = 1 -Const FICD_4BPP = 1 -Const FICD_8BPP = 1 -Const FICD_15BPP = 1 -Const FICD_16BPP = 1 -Const FICD_24BPP = 1 -Const FICD_32BPP = 1 - -' Enum FREE_IMAGE_ADJUST_MODE -Const FREE_IMAGE_ADJUST_MODE = 1 -Const AM_STRECH = 1 -Const AM_DEFAULT = 1 -Const AM_ADJUST_BOTH = 1 -Const AM_ADJUST_WIDTH = 1 -Const AM_ADJUST_HEIGHT = 1 -Const AM_ADJUST_OPTIMAL_SIZE = 1 - -' Enum FREE_IMAGE_MASK_FLAGS -Const FREE_IMAGE_MASK_FLAGS = 1 -Const FIMF_MASK_NONE = 1 -Const FIMF_MASK_FULL_TRANSPARENCY = 1 -Const FIMF_MASK_ALPHA_TRANSPARENCY = 1 -Const FIMF_MASK_COLOR_TRANSPARENCY = 1 -Const FIMF_MASK_FORCE_TRANSPARENCY = 1 -Const FIMF_MASK_INVERSE_MASK = 1 - -' Enum FREE_IMAGE_MASK_CREATION_OPTION_FLAGS -Const FREE_IMAGE_MASK_CREATION_OPTION_FLAGS = 1 -Const MCOF_CREATE_MASK_IMAGE = 1 -Const MCOF_MODIFY_SOURCE_IMAGE = 1 -Const MCOF_CREATE_AND_MODIFY = 1 - -' Enum FREE_IMAGE_TRANSPARENCY_STATE_FLAGS -Const FREE_IMAGE_TRANSPARENCY_STATE_FLAGS = 1 -Const FITSF_IGNORE_TRANSPARENCY = 1 -Const FITSF_NONTRANSPARENT = 1 -Const FITSF_TRANSPARENT = 1 -Const FITSF_INCLUDE_ALPHA_TRANSPARENCY = 1 - -' Enum FREE_IMAGE_ICON_TRANSPARENCY_OPTION_FLAGS -Const FREE_IMAGE_ICON_TRANSPARENCY_OPTION_FLAGS = 1 -Const ITOF_NO_TRANSPARENCY = 1 -Const ITOF_USE_TRANSPARENCY_INFO = 1 -Const ITOF_USE_TRANSPARENCY_INFO_ONLY = 1 -Const ITOF_USE_COLOR_TRANSPARENCY = 1 -Const ITOF_USE_COLOR_TRANSPARENCY_ONLY = 1 -Const ITOF_USE_TRANSPARENCY_INFO_OR_COLOR = 1 -Const ITOF_USE_DEFAULT_TRANSPARENCY = 1 -Const ITOF_USE_COLOR_TOP_LEFT_PIXEL = 1 -Const ITOF_USE_COLOR_FIRST_PIXEL = 1 -Const ITOF_USE_COLOR_TOP_RIGHT_PIXEL = 1 -Const ITOF_USE_COLOR_BOTTOM_LEFT_PIXEL = 1 -Const ITOF_USE_COLOR_BOTTOM_RIGHT_PIXEL = 1 -Const ITOF_USE_COLOR_SPECIFIED = 1 -Const ITOF_FORCE_TRANSPARENCY_INFO = 1 - -#End If diff --git a/#ThirdParty/FreeImage/Wrapper/VB6/mfreeimage/WhatsNew_VB.txt b/#ThirdParty/FreeImage/Wrapper/VB6/mfreeimage/WhatsNew_VB.txt deleted file mode 100644 index f71652e..0000000 --- a/#ThirdParty/FreeImage/Wrapper/VB6/mfreeimage/WhatsNew_VB.txt +++ /dev/null @@ -1,666 +0,0 @@ -What's New for FreeImage VB Wrapper - -* : fixed -- : removed -! : changed -+ : added - -August 08, 2014 - 2.24 (3.16.0) -- [Carsten Klein] removed declaration of Win32 API function FillMemory -+ [Carsten Klein] added load flag RAW_UNPROCESSED and corresponding FILO_RAW_UNPROCESSED -+ [Carsten Klein] added function FreeImage_SetMetadataKeyValue -! [Carsten Klein] changed name of function FreeImage_ConvertFromRawBitsEx to FreeImage_ConvertFromRawBitsArray: naming conflict with new C/C++ function FreeImage_ConvertFromRawBitsEx -! [Carsten Klein] changed name of function FreeImage_ConvertToRawBitsEx to FreeImage_ConvertToRawBitsArray: no naming conflict, but tried to keep To and From functions together -+ [Carsten Klein] added function FreeImage_ConvertFromRawBitsEx - -March 17, 2014 - 2.22 (3.16.0) -* [Carsten Klein] renamed parameter 'Perfect' to 'Bottom' of functions FreeImage_JPEGCrop[U] to match native function declaration -! [Carsten Klein] changed default value of optional parameter 'Perfect' to True for functions FreeImage_JPEGTransform[U] -* [Carsten Klein] renamed function FreeImage_ApplyIndexMapping[Ex] to FreeImage_ApplyPaletteIndexMapping[Ex] (declarations and implementations) -+ [Carsten Klein] added functions FreeImage_JPEGTransformCombined[U] (declarations and implementations) -+ [Carsten Klein] added function FreeImage_JPEGTransformCombinedFromMemory (declarations and implementations) -+ [Carsten Klein] added wrapper functions FreeImage_JPEGTransformCombinedFromMemoryEx[2] working with more VB compatible memory representations (Variant and Byte array) -! [Carsten Klein] enhanced documentation of extended memory stream functions FreeImage_[Load|Save][MultiBitmap][From|To]MemoryEx[2] - -March 10, 2014 - 2.21 (3.16.0) -+ [Carsten Klein] added support for the new JPEG-XR image format - -October 10, 2013 - 2.20 (3.16.0) -* [Carsten Klein] prevented a potential 'Division by zero' error in private helper function pGetTagFromTagPtr. Thanks to Bob Weiss for pointing that out. -+ [Carsten Klein] added support for the new Google WebP image format -! [Carsten Klein] refactored and centralized all VB6 IDE tweaking constant definitions into one single '#If False' block at the end of the file -! [Carsten Klein] changed constants FREEIMAGE_MINOR_VERSION and FREEIMAGE_RELEASE_SERIAL to match current version 3.16.0 -- [Carsten Klein] removed change log entries from source file MFreeImage.bas -- [Carsten Klein] removed block 'General notes' form source file MFreeImage.bas - -March 14, 2013 - 2.19 (3.15.4) -* [Jřrgen Hartmann] fixed coordinate calculation in FreeImage_PaintDCEx applied for horizontal and/or vertical mirroring, which now works correctly for all XDst and YDst coordinates. - -November 13, 2012 - 2.18 (3.15.4) -+ [Carsten Klein] added function declaration FreeImage_HasRGBMasksInt and a real VB Boolean returning function FreeImage_HasRGBMasks. -- [Carsten Klein] removed members red, green and blue from BITMAPINFOHEADER struct: these were intended for debugging purposes only and could couse a GPF in FreeImage_GetInfoHeaderEx. -* [Carsten Klein] fixed a bug in FreeImage_GetPictureData introduced in version 2.17. -* [Carsten Klein] fixed a bug with declaration of FreeImage_Rotate: added default value 0 for Optional ByRef ... As Any parameter 'Color'. - -October 1, 2012 - 2.17 (3.15.4) -- [Carsten Klein] removed temporary workaround for 16-bit standard type bitmaps introduced in version 2.15, which temporarily stored RGB masks directly after the BITMAPINFO structure, when creating a HBITMAP. -* [Carsten Klein] fixed a potential overflow bug in both pNormalizeRational and pNormalizeSRational: these now do nothing if any of numerator and denominator is either 1 or 0 (zero). -+ [Carsten Klein] added load flag JPEG_GREYSCALE as well as the enum constant FILO_JPEG_GREYSCALE. -! [Carsten Klein] changed constant FREEIMAGE_RELEASE_SERIAL to 4 to match current version 3.15.4 - -March 19, 2012 - 2.16 (3.15.3) -! [Carsten Klein] changed constant FREEIMAGE_RELEASE_SERIAL to 3 to match current version 3.15.3 - -March 12, 2012 - 2.15 (3.15.2) -+ [Carsten Klein] added function FreeImage_ConvertToUINT16. -+ [Carsten Klein] added function FreeImage_ConvertToRGB16. -+ [Carsten Klein] added function FreeImage_GetThumbnail. -+ [Carsten Klein] added function declaration FreeImage_SetThumbnailInt and a real VB Boolean returning function FreeImage_SetThumbnail. -+ [Carsten Klein] added RAW_HALFSIZE load flag as well as the enum constant FILO_RAW_HALFSIZE. -+ [Carsten Klein] added wrapper function FreeImage_GetPictureData, which returns a byte array suitable for assigning to an Office image control's PictureData property. -+ [Carsten Klein] added wrapper function FreeImage_CreateFromPictureData, which creates a FreeImage bitmap from a PictureData byte array. -+ [Carsten Klein] added new save flag JPEG_BASELINE (also added FISO_JPEG_BASELINE to enumeration FREE_IMAGE_SAVE_OPTIONS). -+ [Carsten Klein] added a workaround for providing valid BITMAPINFO structures for non 555 16-bpp images to Windows API functions like CreateDIBSection, CreateDIBBitmap, StretchDIBits or SetDIBitsToDevice. -! [Carsten Klein] changed constants FREEIMAGE_MINOR_VERSION and FREEIMAGE_RELEASE_SERIAL: set to 15 and 2 respectively to match current version 3.15.2 - -March 13, 2011 - 2.14 (3.14.1) -* [Glenn Thorpe] fixed a typo error with the call to FreeImage_HasPixels inside FreeImage_CreateMask. - -August 11, 2010 - 2.13 (3.14.1) -+ [Carsten Klein] added PSD load flags PSD_CMYK and PSD_LAB as well as the enum constants FILO_PSD_CYMK and FILO_PSD_LAB. -+ [Carsten Klein] added TIFF_LOGLUV save flag as well as the enum constant FISO_TIFF_LOGLUV. - -July 20, 2010 - 2.12 (3.14.1) -+ [Carsten Klein] added support for the new EXIF_RAW metadata model by adding enum constant FIMD_EXIF_RAW. -+ [Carsten Klein] added the new FIF_LOAD_NOPIXELS flag as well as the enum constant FILO_LOAD_NOPIXELS. -+ [Carsten Klein] added function declaration FreeImage_HasPixelsInt and a real VB Boolean returning function FreeImage_HasPixels. -+ [Carsten Klein] added function declaration FreeImage_FIFSupportsNoPixelsInt and a real VB Boolean returning function FreeImage_FIFSupportsNoPixels. - -June 20, 2010 - 2.11 (3.14.0) -+ [Carsten Klein] added new save flag JPEG_OPTIMIZE (also added FISO_JPEG_OPTIMIZE to enumeration FREE_IMAGE_SAVE_OPTIONS). - -April 20, 2010 - 2.10 (3.14.0) -+ [Carsten Klein] added new save flag TARGA_SAVE_RLE (also added FISO_TARGA_SAVE_RLE to enumeration FREE_IMAGE_SAVE_OPTIONS). -! [Carsten Klein] changed constants FREEIMAGE_MINOR_VERSION and FREEIMAGE_RELEASE_SERIAL: set to 14 and 0 respectively to match current version 3.14.0 -+ [Carsten Klein] added function FreeImage_ConvertToFloat. -+ [Carsten Klein] added function FreeImage_SaveMultiBitmapToMemory. -+ [Carsten Klein] added wrapper functions FreeImage_SaveMultiBitmapToMemoryEx and FreeImage_SaveMultiBitmapToMemoryEx2. -+ [Carsten Klein] added wrapper function FreeImage_OpenMultiBitmapEx, which only opens existing files, but has support for automatic image format detection. -+ [Carsten Klein] added wrapper function FreeImage_CreateMultiBitmapEx, which only creates new (empty) multi-page bitmaps with support for automatic image format detection. -* [Carsten Klein] fixed a bug in FreeImage_LoadEx: now uses the file specified for format detection rather than the filename extension. -+ [Carsten Klein] improved error messages in function FreeImage_LoadEx. -* [Carsten Klein] fixed a bug in FreeImage_AcquireMemoryEx: no more crashes when passing an uninitialized array. -+ [Carsten Klein] added thin wrapper functions, enabling proper handling of Boolean parameters: -+ added wrapper function FreeImage_OpenMultiBitmap -+ added wrapper function FreeImage_UnlockPage -+ added wrapper function FreeImage_RotateEx -+ added wrapper function FreeImage_MakeThumbnail -+ added wrapper function FreeImage_GetAdjustColorsLookupTable -+ added wrapper function FreeImage_ApplyColorMapping -+ added wrapper function FreeImage_SwapColors -+ added wrapper function FreeImage_SwapColorsByLong -+ added wrapper function FreeImage_ApplyIndexMapping -+ added wrapper function FreeImage_SetTransparent -+ added wrapper function FreeImage_ConvertFromRawBits -+ added wrapper function FreeImage_ConvertToRawBits -+ added wrapper function FreeImage_ConvertToStandardType -+ added wrapper function FreeImage_ConvertToType -! [Carsten Klein] changed the parameter names of most functions. -! [Carsten Klein] changed signature of functions FreeImage_ConvertFromRawBits and FreeImage_ConvertToRawBits: 'ByRef Bits As Long' is now 'ByVal BitsPtr As Long'. -+ [Carsten Klein] added wrapper functions FreeImage_ConvertFromRawBitsEx and FreeImage_ConvertToRawBitsEx. -* [Carsten Klein] fixed a bug in declaration of function FreeImage_TmoReinhard05Ex: parameters 'Adaption' and 'ColorCorrection' are now passed by value. -- [Carsten Klein] removed half-implemented function FreeImage_SetChannelEx. -+ [Carsten Klein] added wrapper function FreeImage_SetChannelIOP. -- [Carsten Klein] removed needless default values of optional parameters. -- [Carsten Klein] removed function declaration FreeImage_CompositeByLong: replaced by declaration FreeImage_Composite. -! [Carsten Klein] changed function declaration FreeImage_Composite: application back color is now passed as ByRef ... As Any and so takes both RGBQUAD and Long valus. -+ [Carsten Klein] added wrapper function FreeImage_UnloadEx, which additionally sets the ByRef-passed Bitmap handle to zero after unloading. -+ [Carsten Klein] added wrapper functions ConvertColor and ConvertOleColor to convert VB-style BGR colors into RGB color values. - -February 9, 2010 - 2.9.1 (3.13.1) -* [Carsten Klein] fixed a bug in FreeImage_GetBackgroundColorAsLong: parameter 'bkcolor' is now properly passed ByRef. - -February 9, 2010 - 2.9 (3.13.1) -* [Carsten Klein] fixed a syntax typo - -February 8, 2010 - 2.8 (3.13.1) -* [Mike Weir] fixed a bug in function FreeImage_ApplyColorMappingEx: now properly includes all specified mapping entries -* [Carsten Klein] fixed a bug in function FreeImage_ApplyIndexMappingEx: now properly includes all specified mapping entries -* [Mike Weir] fixed a bug in function FreeImage_RescaleEx: now also rescales the image, if either the new width or height matches the image's current size -* [WinAnd / Carsten Klein] fixed a bug in function FreeImage_GetTransparencyTableExClone: returns an uninitialized array if there is no transparency table -* [WinAnd / Carsten Klein] fixed a bug in function FreeImage_SearchPalette: no longer crashes if there is no transparency table - -December 21, 2009 - 2.7 (3.13.1) -! [Carsten Klein] changed constant FREEIMAGE_RELEASE_SERIAL: set to 1 to match current version 3.13.1 - -December 18, 2009 - 2.6 (3.13.0) -- [Carsten Klein] removed usage of constants vbPicTypeBitmap and vbPicTypeIcon: these are not available in VBA environments like Excel, Access or Outlook. - -September 08, 2009 - 2.5 (3.13.0) -! [Carsten Klein] changed constant FREEIMAGE_MINOR_VERSION: set to 13 to match current version 3.13.0 -+ [Carsten Klein] added load flag constant JPEG_EXIFROTATE and new member FILO_JPEG_EXIFROTATE to enumeration FREE_IMAGE_LOAD_OPTIONS. -+ [Carsten Klein] added support for the PFM image format. -+ [Carsten Klein] added support for the PICT and RAW image formats. -+ [Carsten Klein] added UNICODE functions FreeImage_JPEGTransformU and FreeImage_JPEGCropU. -+ [Carsten Klein] added enumeration FREE_IMAGE_COLOR_OPTIONS, which contains options to specify colors, used with FreeImage_FillBackground and FreeImage_EnlargeCanvas. -+ [Carsten Klein] added function FreeImage_FillBackground: although this returns BOOL in C/C++, the VB version only returns a Long. -+ [Carsten Klein] added wrapper functions FreeImage_FillBackgroundEx and FreeImage_FillBackgroundByLong, taking an RGBQUAD and a Long 'Color' argument respectively and return a true VB Boolean. -+ [Carsten Klein] added function FreeImage_EnlargeCanvas. -+ [Carsten Klein] added functions FreeImage_AllocateEx and FreeImage_AllocateExT. -+ [Carsten Klein] added function FreeImage_TmoReinhard05Ex. -+ [Carsten Klein] added function FreeImage_Rotate. -+ [Carsten Klein] added wrapper function FreeImage_RotateIOP. - -March 18, 2009 - 2.4.2 (3.11.0) -+ [Carsten Klein] added enumeration FREE_IMAGE_FRAME_DISPOSAL_METHODS, which provides the frame disposal options needed to create animated GIF files. - -July 29, 2008 - 2.4.1 (3.11.0) -* [Carsten Klein] minor documentation updates -! [Carsten Klein] renamed member FICF_PALETTISED_8BPP of enumeration FREE_IMAGE_CONVERSION_FLAGS into FICF_PALLETISED_8BPP. - -June 30, 2008 - 2.4 (3.11.0) -* [Carsten Klein] fixed some minor issues in FreeImage_PaintTransparent() - -June 06, 2008 - 2.3 (3.11.0) -+ [Carsten Klein] added new compression flags to the JPEG and PNG plugins -! [Carsten Klein] renamed wrapper function FreeImage_CloneMetadata() to FreeImage_CloneMetadataEx(): now, there is a native function called FreeImage_CloneMetadata(). -+ [Carsten Klein] added private and internal function declaration for FreeImage_CloneMetadata() along with it's public Boolean returning wrapper function. -- [Carsten Klein] removed the FreeImage_ColorQuantizeEx() stuff from both functions FreeImage_ConvertColorDepth() and FreeImage_ConvertColorDepthIOP(): removed parameters PaletteSize, ReserveSize and ReservePalette. -- [Carsten Klein] changed declaration of FreeImage_ColorQuantizeEx() to be a internal function private to the wrapper with an 'Int' appendix. -+ [Carsten Klein] added two more VB-friendly public wrapper functions FreeImage_ColorQuantizeEx() and FreeImage_ColorQuantizeExIOP(). -+ [Carsten Klein] added wrapper function FreeImage_GetPalettePtr(): gets the pointer to a specified array of RGBQUADs: intended to be used together with any of the ColorQuantizeEx functions. -! [Carsten Klein] changed constant FREEIMAGE_MINOR_VERSION: set to 11 to match current version 3.11.0 - -December 14, 2007 - 2.2.1 (3.10.0) -+ [Carsten Klein] added constants for member 'biCompression' in BITMAPINFOHEADER struct -+ [Carsten Klein] added wrapper function FreeImage_GetInfoHeaderEx(), which returns a fully populated BITMAPINFOHEADER struct for a bitmap. -* [Carsten Klein] fixed a bug in FreeImage_GetFileTypeFromMemoryEx(): now calls FreeImage_CloseMemory() releasing the hStream to prevent memory leaks. -+ [Carsten Klein] added wrapper function FreeImage_GetColorizedPalette(): returns a colorized greyscale palettte. -+ [Carsten Klein] added wrapper function FreeImage_Colorize(): applies a colorized greyscale palettte obtained from FreeImage_GetColorizedPalette() to a bitmap. -+ [Carsten Klein] added wrapper function FreeImage_Sepia(): calls FreeImage_Colorize() with proper parameters to apply a so called sepia palette to a bitmap. - -December 12, 2007 - 2.2 (3.10.0) -* [Carsten Klein] Fixed a small bug in FreeImage_PaintTransparent, which now calls function FreeImage_ConvertTo32Bits instead of FreeImage_ConvertTo32Bits2. - -November 15, 2007 - 2.1 (3.10.0) -* [Carsten Klein] adjusted page numbers of the API documentation in FreeImage function declarations to match FreeImage 3.10.0 API documentation -- [Carsten Klein] removed parameter 'bUnloadSource' from function FreeImage_GetOlePictureIcon(): an hIcon should not be destroyed if OleCreatePictureIndirect() is called with fOwn = True. -! [Carsten Klein] refactored FreeImage_GetOlePicture(): now relies on FreeImage_GetBitmap(). - -November 10, 2007 - 2.0.8 (3.10.0) -! [Carsten Klein] changed declaration of FreeImage_SetOutputMessage(): now points transparently to the __stdcall version of this function in the library. -+ [Carsten Klein] added function declaraton for FreeImage_MultigridPoissonSolver(). -+ [Carsten Klein] added function declaraton for FreeImage_GetTransparentIndex() and FreeImage_SetTransparentIndex(). -+ [Carsten Klein] added private and internal function declaraton for FreeImage_AdjustColors() along with it's public Boolean returning wrapper function. -+ [Carsten Klein] added function declaraton for FreeImage_GetAdjustColorsLookupTable(). -+ [Carsten Klein] added wrapper function FreeImage_GetAdjustColorsLookupTableEx(): this takes a real VB style Byte array ton receive the lookup table created. -+ [Carsten Klein] added function declaraton for FreeImage_ApplyColorMapping(). -+ [Carsten Klein] added wrapper function FreeImage_ApplyColorMappingEx(): this takes a real VB style RGBQUAD array. -+ [Carsten Klein] added function declaratons for FreeImage_SwapColors() and FreeImage_SwapColorsByLong(). -+ [Carsten Klein] added function declaraton for FreeImage_ApplyIndexMapping(). -+ [Carsten Klein] added wrapper function FreeImage_ApplyIndexMappingEx(): this takes a real VB style Byte array. -+ [Carsten Klein] added function declaraton for FreeImage_SwapPaletteIndices(). - -November 05, 2007 - 2.0.7 (3.10.0) -+ [Carsten Klein] added 4 bit color depth to both function pGetNextColorDepth() and pGetPrevousColorDepth() -- [Carsten Klein] removed member FICF_PREPARE_RESCALE from enumeration FREE_IMAGE_CONVERSION_FLAGS -- [Carsten Klein] removed all references to FICF_PREPARE_RESCALE: Converting color depth before rescaling an image is no longer performed by the wrapper. Since FreeImage now transparently converts color depth on rescaling, doing this in the wrapper is no longer needed. -! [Carsten Klein] refactored wrapper function FreeImage_ConvertColorDepth(): removed case FICF_PREPARE_RESCALE; is now more similar to C# wrapper's version of this function. -! [Carsten Klein] refactored wrapper function FreeImage_SaveEx(): removed case FICF_PREPARE_RESCALE; is now more similar to C# wrapper's version of this function. - -September 14, 2007 - 2.0.6 (3.10.0) -+ [Carsten Klein] added function declaration and Boolean wrapper function for FreeImage_PreMultiplyWithAlpha(). - -July 26, 2007 - 2.0.5 (3.10.0) -+ [Carsten Klein] added wrapper function FreeImage_GetBitmap(): returns an HBITMAP created by the CreateDIBSection() function and so has the same color depth as the original DIB. -+ [Carsten Klein] added wrapper function FreeImage_GetBitmapForDevice(): returns an HBITMAP created by the CreateDIBitmap() function and so has the same color depth as the specified reference DC or as the desktop, if the 'hDC' parameter was omitted. -- [Carsten Klein] removed function declaration for GetWindowDC(): this function is no longer used. -* [Carsten Klein] fixed a bug in wrapper function FreeImage_IsExtensionValidForFIF(): string comparison now includes a comma. -* [Carsten Klein] fixed a bug in wrapper function FreeImage_IsFilenameValidForFIF(): string comparison now includes a comma. - -July 25, 2007 - 2.0.4 (3.10.0) -* [Carsten Klein] fixed a bug in function FreeImage_GetPaletteExClone(): now actually returns the palette as RGBQUAD array plus some other minor improvements -+ [Carsten Klein] added wrapper function FreeImage_GetPaletteExLongClone(): this function returns a VB style Byte array that is only wrapped around FreeImage's pointer to a DIB's transparency table. -+ [Carsten Klein] added wrapper function FreeImage_GetTransparencyTableEx(): this function returns a VB style Byte array that is only wrapped around FreeImage's pointer to a DIB's transparency table. -! [Carsten Klein] changed name of wrapper function FreeImage_GetTransparencyTableEx(): this function is now named FreeImage_GetTransparencyTableExClone(), since it actually returns a clone (deep copy) of an image's transparency table (compare with FreeImage_GetPaletteExClone()). -+ [Carsten Klein] added wrapper function FreeImage_SetPalette(): sets an image's palette through a VB style RGBQUAD array. -+ [Carsten Klein] added wrapper function FreeImage_SetPaletteLong(): sets an image's palette through a VB style Long array. -+ [Carsten Klein] added function declaration for CreateDIBsection() -+ [Carsten Klein] added function declaration for DeleteDC() -* [Carsten Klein] fixed a bug in wrapper function FreeImage_CreateFromScreen(): now the memory DC is deleted with the DeleteDC() function and no longer with the DeleteObject() function. - -July 05, 2007 - 2.0.3 (3.10.0) -+ [Carsten Klein] added wrapper function FreeImage_GetFileTypeFromMemoryEx(): more VB friendly version of FreeImage_GetFileTypeFromMemory() which may take an array rather than a FIMEMORY stream. - -May 21, 2007 - 2.0.2 (3.10.0) -! [Carsten Klein] changed constant FREEIMAGE_MINOR_VERSION: set to 10 to match current version 3.10.0 -! [Carsten Klein] changed constant FREEIMAGE_RELEASE_SERIAL: set to 0 to match current version 3.10.0 -+ [Carsten Klein] added image format constants FIF_EXR, FIF_J2K and FIF_JP2 to enumeration FREE_IMAGE_FORMAT. -+ [Carsten Klein] added tone mapping operator constant FITMO_FATTAL02 to enumeration FREE_IMAGE_TMO. -+ [Carsten Klein] added save option constants J2K_DEFAULT and JP2_DEFAULT for JPEG2000 format. -+ [Carsten Klein] added save option constants EXR_DEFAULT, EXR_FLOAT, EXR_NONE, EXR_ZIP, EXR_PIZ, EXR_PXR24, EXR_B44 and EXR_LC for EXR format. -+ [Carsten Klein] added save option constants for EXR format to enumeration FREE_IMAGE_SAVE_OPTIONS. -+ [Carsten Klein] added declared function FreeImage_TmoFattal02(): adds support for Gradient domain high dynamic range compression (R. Fattal, 2002) - -February 24, 2007 - 2.0.1 (3.9.3) -* [Carsten Klein] fixed a bug in function FreeImage_CreateFromScreen(): now size of image created is according to window to be captured if parameter 'hwnd' <> 0. -+ [Carsten Klein] added parameter 'bClientAreaOnly' to function FreeImage_CreateFromScreen(). -+ [Carsten Klein] added blitting option 'CAPTUREBLT' when calling function BitBlt() in function FreeImage_CreateFromScreen(). -- [Carsten Klein] removed unused variable 'hDIB' from functions FreeImage_CreateFromScreen() and FreeImage_LoadEx(). Thanks to Bruce Rusk for pointing that out. - -February 16, 2007 - 2.0 (3.9.3) -! [Carsten Klein] changed constant FREEIMAGE_RELEASE_SERIAL: set to 3 to match current version 3.9.3 -! [Carsten Klein] changed JPEG load/save flag option values: changed constants and both enumerations FREE_IMAGE_LOAD_OPTIONS and FREE_IMAGE_SAVE_OPTIONS. -+ [Carsten Klein] added ICC Color Profile support: -! changed signature of declared function FreeImage_GetICCProfile(): is now declared 'Private' and suffixed with '...Int()'. -+ added wrapper function FreeImage_GetICCProfile(): is the public wrapper function for private function FreeImage_GetICCProfileInt(), returing a real FIICCPROFILE structure. -+ added constant FREE_IMAGE_ICC_COLOR_MODEL_MASK. -+ added enumeration FREE_IMAGE_ICC_COLOR_MODEL. -+ added wrapper function FreeImage_GetICCProfileColorModel(): returns the color profile's color model (FIICCPROFILE.flags member). -+ added wrapper function FreeImage_GetICCProfileSize(): returns the color profile data's size in bytes. -+ added wrapper function FreeImage_GetICCProfileDataPointer(): returns the pointer to the color profile data. -+ added wrapper function FreeImage_HasICCProfile(): returns whether a color profile is available for a dib or not. -! [Carsten Klein] changed behaviour of wrapper function FreeImage_RescaleEx() and all it's derived functions: no clone is returned if the actual and desired image size are the same. -+ [Carsten Klein] added parameter 'bForceCloneCreation' to wrapper function FreeImage_RescaleEx() and all it's derived functions. - -January 09, 2007 - 1.9.4 (3.9.2) -! [Carsten Klein] changed scope of declared function FreeImage_GetFileTypeUInt(): is now private according to all other '...Int' functions wrapped by a VB-friendly function. -! [Carsten Klein] changed scope of declared function FreeImage_GetFIFFromFilenameUInt(): is now private according to all other '...Int' functions wrapped by a VB-friendly function. -! [Carsten Klein] changed signature of declared functions FreeImage_GetBackgroundColorInt() and FreeImage_SetBackgroundColorInt(): now both have a 'ByRef bkcolor As RGBQUAD' parameter instead of 'ByVal bkcolor As Long'. -+ [Carsten Klein] added declared functions FreeImage_GetBackgroundColorAsLongInt(): this has a 'ByRef bkcolor As Long' parameter and provides the background color as a Long value. -+ [Carsten Klein] added declared functions FreeImage_SetBackgroundColorAsLongInt(): this has a 'ByRef bkcolor As Long' parameter and takes the background color as a Long value. -! [Carsten Klein] changed signature of wrapper functions FreeImage_GetBackgroundColor() and FreeImage_SetBackgroundColor(): now both have a 'ByRef bkcolor As RGBQUAD' parameter instead of 'ByVal bkcolor As Long'. -+ [Carsten Klein] added wrapper functions FreeImage_GetBackgroundColorAsLong() and FreeImage_SetBackgroundColorAsLong(): both have a 'ByRef bkcolor As Long' parameter and so offer getting and setting the background color through a Long value. -+ [Carsten Klein] added wrapper functions FreeImage_GetBackgroundColorEx() and FreeImage_SetBackgroundColorEx(): both both take 4 ByRef Byte parameters 'Alpha', 'Red', 'Green' and 'Blue', one for each color component. - -January 05, 2007 - 1.9.3 (3.9.2) -+ [Carsten Klein] added wrapper function FreeImage_GetLockedPageNumbersEx(): this returns a real VB-style array of Longs containing the page numbers of all locked pages. - -January 02, 2007 - 1.9.2 (3.9.2) -* [Carsten Klein] fixed a bug in inline description of function FreeImage_GetPaletteEx(): now tells to use function FreeImage_DestroyLockedArrayRGBQUAD() to free an array returned by this function. -* [Carsten Klein] fixed some minor bugs in inline documentation. -* [Carsten Klein] fixed a serious bug in function FreeImage_SaveEx(): parameter 'bUnloadSource' is now interpreted correctly under all circumstances. -* [Carsten Klein] fixed some minor issues in function FreeImage_SaveEx(). - -December 29, 2006 - 1.9.1 (3.9.2) -+ [Carsten Klein] added enumeration item FID_BAYER16x16: now supports Bayer ordered dispersed dot dithering (order 4 dithering matrix). - -October 31, 2006 - 1.9 (3.9.2) -* [Carsten Klein] adjusted page numbers of the API documentation in header comments in FreeImage function declarations to match FreeImage 3.9.2 API documentation -! [Carsten Klein] changed constant FREEIMAGE_RELEASE_SERIAL: set to 2 to match current version 3.9.2 -+ [Carsten Klein] added function declaration for FreeImage_JPEGCrop(): added both declaration and Boolean returning wrapper function. -! [Carsten Klein] changed data type of all occurences of parameter 'Flags' from Long to either FREE_IMAGE_LOAD_OPTIONS or FREE_IMAGE_SAVE_OPTIONS enum. This is true for declared funcitons as well as for wrapper functions. -+ [Carsten Klein] added function declaration for FreeImage_LoadMultiBitmapFromMemory(). -+ [Carsten Klein] added wrapper function FreeImage_LoadMultiBitmapFromMemoryEx(): this is dealing with a VB style array (SAFEARRAY) like FreeImage_LoadFromMemoryEx() does. - -October 30, 2006 - 1.8 (3.9.1) -* [Carsten Klein] fixed a memory leak in wrapper function SavePictureEx(). Thanks to Roogames for reporting that bug. -! [Carsten Klein] changed return type of wrapper function SavePictureEx() to Boolean. -+ [Carsten Klein] added wrapper function FreeImage_SaveEx() which brings all the features, as there are inline size- and color conversion and format guessing, so far only known from SavePictureEx() for DIBs. -! [Carsten Klein] changed wrapper function SavePictureEx(): now this is only a thin wrapper for function FreeImage_SaveEx(). -+ [Carsten Klein] added enumeration FREE_IMAGE_LOAD_OPTIONS. -- [Carsten Klein] refactored enumeration FREE_IMAGE_SAVE_OPTIONS: removed unnecessary items from enumeration. -! [Carsten Klein] changed wrapper function LoadPictureEx(): added parameter 'Options' (enum FREE_IMAGE_LOAD_OPTIONS) to specify image loading options (called 'flags' in FreeImage). -+ [Carsten Klein] added wrapper function FreeImage_LoadEx() which brings all the features, as there are inline size- and color conversion and format guessing, so far only known from LoadPictureEx() for DIBs. -! [Carsten Klein] changed wrapper function LoadPictureEx(): now this is only a thin wrapper for function FreeImage_LoadEx(). - -October 13, 2006 - 1.7.2 (3.9.1) -+ [Carsten Klein] added User32 function GetDesktopWindow() -+ added User32 function GetWindowDC() -- [Carsten Klein] removed unused constants DI_MASK, DI_IMAGE and DI_NORMAL -+ added GDI32 function GetDeviceCaps() with constants HORZRES and VERTRES -+ added GDI32 function SelectObject() -+ added GDI32 function DeleteObject() -+ added GDI32 function CreateCompatibleBitmap() -+ added GDI32 function CreateCompatibleDC() -+ added GDI32 function BitBlt() -+ [Carsten Klein] added wrapper function FreeImage_CreateFromScreen(): this function lets you capture the whole screen or any certain window - -October 10, 2006 - 1.7.1 (3.9.1) -! [Carsten Klein] changed parameter name 'Page' into 'hPageDib' in declared function FreeImage_UnlockPage(). 'hPageDib' must be the (dib-)handle obtained from FreeImage_LockPage() and not the page number. Now, the declaration is less confusing. Thanks to Ender Wiggin. - -August 4, 2006 - 1.7 (3.9.1) -* [Carsten Klein] fixed a bug in pGetTagFromTagPtr(): removed overflow error when converting unsigned short tags (FIDT_SHORT) with values between 32768 and 65535. Thanks to André Hendriks. -! [Carsten Klein] changed constant FREEIMAGE_RELEASE_SERIAL: set to 1 to match current version 3.9.1 - -July 17, 2006 - 1.6 (3.9.0) -+ [Carsten Klein] added more public wrapper functions for tag copying and cloning: -+ added function FreeImage_CopyMetadata() -+ added function FreeImage_CloneMetadata() -- [Carsten Klein] removed dead API functions, dead structures and dead variables -* [Carsten Klein] fixed a bug in FreeImage_ConvertColorDepth(): now color images are converted to 24 bits when used with FICF_PREPARE_RESCALE, all others to 8 bit - -July 16, 2006 - 1.5.6 (3.9.0) -+ [Carsten Klein] added more public wrapper functions for VB friendly tag access: these functions deal with a FREE_IMAGE_TAG structure instead of FreeImage's Tag pointer. -+ added function FreeImage_SetMetadataEx() -+ added function FreeImage_CreateTagEx() -+ added function FreeImage_AppendTag() -+ added function FreeImage_RemoveTag() -+ added function FreeImage_RemoveTagEx() -+ added function FreeImage_TagExists() -+ added function FreeImage_TagExistsEx() -+ added function FreeImage_DeleteTagEx() -+ added function FreeImage_CloneTagEx() -+ added function FreeImage_RemoveMetadataModel() -+ added function FreeImage_UpdateMetadata() -+ added function FreeImage_UnsignedLong() -+ added function FreeImage_UnsignedShort() -+ added function FreeImage_CreateRational() -+ added function FreeImage_CreateSignedRational() -+ added function FreeImage_GetImageComment() -+ added function FreeImage_SetImageComment() -+ [Carsten Klein] added some private helper functions to leverage tag updating: -+ added helper function pTagToTagPtr() -+ added helper function pGetValueBuffer() -+ added helper function pGetRationalValueBuffer() -+ added helper function pGetVariantAsByteBuffer() -+ added helper function pGetElementSize() - -July 5, 2006 - 1.5.5 (3.9.0) -! [Carsten Klein] changed function signature of FreeImage_FindNextMetadataEx(): optional parameter 'Model' is now present; see the function's inline documentation - -June 30, 2006 - 1.5.4 (3.9.0) -* [Carsten Klein] fixed bug in functions creating a FreeImage DIB from a windows hBitmap: workaround for palettized bitmaps is now implemented -* fixed function FreeImage_CreateFromOLEPicture() -* fixed function FreeImage_CreateFromDC() - -June 22, 2006 - 1.5.3 (3.9.0) -! [Carsten Klein] changed function declaration of FreeImage_GetMetadataInt(): parameter 'model' is now 'ByVal' and Tag is a Long pointer -! [Carsten Klein] changed function declaration of FreeImage_SetMetadataInt(): parameter 'model' is now 'ByVal' and Tag is a Long pointer -! [Carsten Klein] changed function declaration of FreeImage_GetMetadata(): parameter Tag is a Long pointer now -! [Carsten Klein] changed function declaration of FreeImage_SetMetadata(): parameter Tag is a Long pointer now -+ [Carsten Klein] added function declarations for tag creation and destruction: -+ added declaration for function FreeImage_CreateTag() -+ added declaration for procedure FreeImage_DeleteTag() -+ added declaration for function FreeImage_CloneTag() -+ [Carsten Klein] added new items to structure FREE_IMAGE_TAG: -+ added item 'Model As FREE_IMAGE_MDMODEL' -+ added item 'TagPtr As Long' -+ [Carsten Klein] added wrapper functions for more VB friendly Tag access: these functions deal with a FREE_IMAGE_TAG structure instead of FreeImage's Tag pointer. -+ added function FreeImage_FindFirstMetadataEx() -+ added function FreeImage_FindNextMetadataEx() -+ added function FreeImage_GetAllMetadataTags() -+ added function FreeImage_GetMetadataEx() -* [Carsten Klein] fixed and adjusted page numbers of the API documentation in header comments in FreeImage function declarations -- [Carsten Klein] removed workaround for thresholding and dithering non-MINISBLACK 8 bit images in function FreeImage_ConvertColorDepth(): was fixed in FreeImage 3.9.0 -* [Carsten Klein] fixed all pending issues in function FreeImage_PaintDC(): is now in production state - -June 14, 2006 - 1.5.2 (3.9.0) -! [Carsten Klein] changed signature of function FreeImage_CreateMask() -+ [Carsten Klein] added function FreeImage_CreateMaskImage(): this creates a monochrome mask from a source image -+ [Carsten Klein] added function FreeImage_CreateMaskInPlace(): this creates a monochrome mask from a source image -+ [Carsten Klein] added enumeration FREE_IMAGE_ICON_TRANSPARENCY_OPTION_FLAGS -+ [Carsten Klein] added wrapper function FreeImage_CreateSimpleBWMaskImage(): wrapper for FreeImage_CreateMaskImage() with reduced number of parameters; creates a b/w mask -+ [Carsten Klein] added wrapper function FreeImage_CreateSimpleBWMaskInPlace(): wrapper for FreeImage_CreateMaskInPlace() with reduced number of parameters; creates a b/w mask -+ [Carsten Klein] added function declaration for FreeImage_MakeThumbnail() -+ [Carsten Klein] added function for FreeImage_GetOlePictureThumbnail() -+ [Carsten Klein] added function for FreeImage_MakeThumbnailIOP() -+ [Carsten Klein] documented function FreeImage_ReadMemoryEx() -+ [Carsten Klein] documented function FreeImage_WriteMemoryEx() -! [Carsten Klein] divided FreeImage_TagFromPointer into an interface only function with a private helper function pGetTagFromTagPtr(): -+ added helper function pGetTagFromTagPtr() -! [Carsten Klein] added private helper functions to leverage the FIDT_RATIONAL and FIDT_SRATIONAL data type: -+ added helper function pNormalizeRational() -+ added helper function pNormalizeSRational() -+ added helper function gcd() -+ added helper function floor() -! [Carsten Klein] changed name of structure 'FITAG_int' to 'FITAG': is now as in FreeImage library -! [Carsten Klein] changed name of structure 'FITAG' to 'FREE_IMAGE_TAG': this new structure plays an important role in the wrapper's new VB friendly tag accessing concept -! [Carsten Klein] changed function declaration of FreeImage_GetMetadataCount(): parameter 'model' is now 'ByVal' -! [Carsten Klein] changed function declaration of FreeImage_TagToString(): parameter 'model' is now 'ByVal' and function returns a Long -! [Carsten Klein] renamed function declaration of FreeImage_TagToString() to FreeImage_TagToStringInt(): function is now Private and wrapped by a VB String returning function -+ [Carsten Klein] added wrapper function FreeImage_TagToString() returning a real VB String -+ [Carsten Klein] added structure FIRATIONAL: structure to hold an image tag's rational value -+ [Carsten Klein] added new items to structure FREE_IMAGE_TAG: -+ added item 'StringValue As String' -+ added item 'Palette() As RGBQUAD' -+ added item 'RationalValue() As FIRATIONAL' - -June 13, 2006 - 1.5.1 (3.9.0) -! [Carsten Klein] changed version constant 'FREEIMAGE_MINOR_VERSION' to 9 to meet version 3.9.0 -* [Carsten Klein] fixed and adjusted page numbers of the API documentation in header comments in FreeImage function declarations to match FreeImage 3.9.0 API documentation -+ [Carsten Klein] added function declaration for new Memory I/O functions in 3.9.0 -+ added declaration FreeImage_ReadMemory() -+ added declaration FreeImage_WriteMemory() -! [Carsten Klein] changed/added optional parameter 'element_size' to private function pGetMemoryBlockPtrFromVariant(): caller now can get size in bytes one array element -+ [Carsten Klein] added wrapper functions for new Memory I/O functions in 3.9.0 -+ added function FreeImage_ReadMemoryEx() -+ added function FreeImage_WriteMemoryEx() -+ [Carsten Klein] added constants and updated enumerations for new 3.9.0 file formats 'FAXG3' and 'SGI' -+ [Carsten Klein] added Windows GDI icon related declarations: -+ added function declaration for CreateIconIndirect() -+ added function declaration for DestroyIcon() -+ added structure ICONINFO -+ [Carsten Klein] added function FreeImage_GetIcon(): returns a hIcon handle -+ [Carsten Klein] added function FreeImage_GetOlePictureIcon(): returns a VB Picture object of type vbPicTypeIcon -+ [Carsten Klein] added enumeration FREE_IMAGE_MASK_FLAGS -+ [Carsten Klein] added function FreeImage_CreateMaskColors(): returns an array filled with items from an argument list; synonym for VB's Array() function -+ [Carsten Klein] added enumeration FREE_IMAGE_teMask(): this creates a monochrome mask from a source image -+ [Carsten Klein] added function FreeImage_CreaMASK_CREATION_OPTION_FLAGS - -June 12, 2006 - 1.5 (3.8.0) -* [Carsten Klein] fixed bug in wrapper function FreeImage_PaintDCEx(): now handles boolean test correctly: 'If ((hDC <> 0) And (hDIB <> 0)) Then -> Thanks to ender_wiggin for reporting that bug. -+ [Carsten Klein] added private function pGetIOlePictureFromContainer(): used to get IPicture from image hosting control (Form, PictureBox) including custom drawings -+ [Carsten Klein] added wrapper function FreeImage_CreateFromImageContainer(): used to create FreeImage DIB from image hosting control (Form, PictureBox) including custom drawings -+ [Carsten Klein] added wrapper function SaveImageContainerEx(): derivate of wrapper function 'SavePictureEx()': saves content of image hosting control (Form, PictureBox) including custom drawings - -February 27, 2006 - 1.4.8 (3.8.0) -+ [Carsten Klein] added inline documentation for these wrapper functions: -+ documented function FreeImage_CompareColorsLongLong() -+ documented function FreeImage_CompareColorsRGBTRIPLELong() -+ documented function FreeImage_CompareColorsRGBQUADLong() -+ documented function FreeImage_SearchPalette() -! [Carsten Klein] changed and updated general remarks in section "General notes on implementation and design" -! [Carsten Klein] changed all function declarations of FreeImage functions that return a BOOL in C/C++: see "Functions returning Booleans" in section "General notes on implementation and design" -! [Carsten Klein] changed all function signatures of functions that are derived from or extend FreeImage BOOL functions: see "Functions returning Booleans" in section "General notes on implementation and design" -+ [Carsten Klein] added wrapper functions for all FreeImage functions that return a BOOL in C/C++: see "Functions returning Booleans" in section "General notes on implementation and design" -+ [Carsten Klein] added wrapper function FreeImage_CreateFromDC(): creates an DIB from a DC. Thanks to Evan (wxforecaster) for this suggestion. -+ [Carsten Klein] added declaration of GDI function GetCurrentObject() and constant OBJ_BITMAP -+ [Carsten Klein] added wrapper function FreeImage_IsAvailable(): used to test for existence of FreeImage Library (FreeImage.dll) - -February 9, 2006 - 1.4.7 (3.8.0) -+ [Carsten Klein] added private helper function pGetPreviousColorDepth() -+ [Carsten Klein] added private helper function pGetNextColorDepth() -! [Carsten Klein] changed/extended signature of wrapper function SavePictureEx(): now includes a parameter 'ColorDepth' -+ [Carsten Klein] added enumeration FREE_IMAGE_COLOR_DEPTH -+ [Carsten Klein] added error handling capabilities to wrapper function SavePictureEx() -+ [Carsten Klein] added/updated inline documentation of wrapper function SavePictureEx() - -October 31, 2005 - 1.4.6 (3.8.0) -+ [Carsten Klein] added wrapper function FreeImage_SwapColorLong(): this converts from a RGB to a BGR color value stored in a Long and vice versa - -October 27, 2005 - 1.4.5 (3.8.0) -+ [Carsten Klein] added function FreeImage_IsTransparencyTableTransparent(): checks for transparency directly on the transparency table - -October 13, 2005 - 1.4.4 (3.8.0) -+ [Carsten Klein] added some functions to compare colors in different formats and with tolerance: -+ added function FreeImage_CompareColorsLongLong() -+ added function FreeImage_CompareColorsRGBTRIPLELong() -+ added function FreeImage_CompareColorsRGBQUADLong() -+ [Carsten Klein] added enumeration FREE_IMAGE_COLOR_FORMAT_FLAGS -+ [Carsten Klein] added enumeration FREE_IMAGE_TRANSPARENCY_STATE_FLAGS -+ [Carsten Klein] added function FreeImage_SearchPalette(): to search the palette index for a given color - -October 13, 2005 - 1.4.3 (3.8.0) -+ [Carsten Klein] added additional function declaration FreeImage_SetPixelColorByLong(): now color values may be provided in a long value -+ [Carsten Klein] added additional function declaration FreeImage_GetPixelColorByLong(): now color values may be received in a long value -+ [Carsten Klein] added function FreeImage_SetPixelColorEx(): color values may be provided by four different byte values -+ [Carsten Klein] added function FreeImage_GetPixelColorEx(): color values are returned through four different byte values - -October 11, 2005 - 1.4.2 (3.8.0) -* [Carsten Klein] fixed bug in wrapper function FreeImage_GetBitsExRGBQUAD(): now tests for and works with 32 bit images - -October 10, 2005 - 1.4.1 (3.8.0) -* [Carsten Klein] fixed serious bug in FreeImage_GetBitsEx...() functions: created custom array descriptor now really has two dimensions -* fixed wrapper function FreeImage_GetBitsEx() -* fixed wrapper function FreeImage_GetBitsExRGBTRIPLE() -* fixed wrapper function FreeImage_GetBitsExRGBQUAD() - -September 9, 2005 - 1.4 (3.8.0) -! [Carsten Klein] changed wrapper function FreeImage_ConvertColorDepth(): now uses FreeImage_ConvertToGreyscale -+ [Carsten Klein] added version numbers to change log -+ [Carsten Klein] added comments to IOlePicture aware toolkit and conversion functions -* [Carsten Klein] fixed and adjusted page numbers of the API documentation in header comments in FreeImage function declarations - -September 8, 2005 - 1.3.5 -! [Carsten Klein] changed version constant 'FREEIMAGE_MINOR_VERSION' to 8 to meet version 3.8.0 -+ [Carsten Klein] added function declarations for UNICODE dealing functions with additional token 'Int' appended: -+ added function FreeImage_LoadUInt() -+ added function FreeImage_SaveUInt() -+ added function FreeImage_GetFileTypeUInt() -+ added function FreeImage_GetFIFFromFilenameUInt() -+ [Carsten Klein] added wrapper functions to ease the use of UNICODE dealing functions: -+ added function FreeImage_LoadU() -+ added function FreeImage_SaveU() -+ added function FreeImage_GetFileTypeU() -+ added function FreeImage_GetFIFFromFilenameU() -+ [Carsten Klein] added function declaration for FreeImage_ConvertToGreyscale() - -July 18, 2005 - 1.3.4 -! [Carsten Klein] changed inline comments in these wrapper functions: -! changed FreeImage_GetBitsEx(): mixed up width and height in SAFEAARAY creation -! changed FreeImage_GetBitsExRGBTRIPLE(): mixed up width and height in SAFEAARAY creation -! changed FreeImage_GetBitsExRGBQUAD(): mixed up width and height in SAFEAARAY creation -+ [Carsten Klein] added wrapper function FreeImage_GetScanLinesRGBTRIPLE(): - -June 30, 2005 - 1.3.3 -+ [Carsten Klein] added Kernel32 function FillMemory() - -June 24, 2005 - 1.3.2 -+ [Carsten Klein] added pixel access functions FreeImage_GetBitsExRGBTRIPLE() and FreeImage_GetBitsExRGBQUAD() -+ [Carsten Klein] added IOlePicture based wrapper function FreeImage_ConvertColorDepthIOP() -+ [Carsten Klein] added IOlePicture based wrapper functions for FreeImage_RescaleIOP(): -+ added function FreeImage_FreeImage_RescaleByPixelIOP() -+ added function FreeImage_FreeImage_RescaleByPercentIOP() -+ added function FreeImage_FreeImage_RescaleByFactorIOP() -+ [Carsten Klein] added IOlePicture based wrapper function FreeImage_RescaleIOP() -* [Carsten Klein] fixed a bug in FreeImage_GetOlePicture(): now OlePictures returned through IPicture may be used directly by other functions accepting IPicture types without any assignment to IPictureDisp - -June 24, 2005 - 1.3.1 -! [Carsten Klein] changed inproper function declaration of function FreeImage_AdjustCurve(): now parameter 'LUT' is passed ByVal -+ [Carsten Klein] added wrapper function FreeImage_AdjustCurveEx() -+ [Carsten Klein] added IOlePicture based wrapper functions for FreeImage toolkit functions: -+ added function FreeImage_RotateClassicIOP() -+ added function FreeImage_RotateExIOP() -+ added function FreeImage_FlipHorizontalIOP() -+ added function FreeImage_FlipVerticalIOP() -+ added function FreeImage_AdjustCurveIOP() -+ added function FreeImage_AdjustGammaIOP() -+ added function FreeImage_AdjustBrightnessIOP() -+ added function FreeImage_AdjustContrastIOP() -+ added function FreeImage_InvertIOP() -+ added function FreeImage_GetChannelIOP() -+ added function FreeImage_CopyIOP() -+ added function FreeImage_PasteIOP() - -June 22, 2005 - 1.3 -+ [Carsten Klein] added inline comments and documentation for pixel access functions - -June 18, 2005 - 1.2.9 -+ [Carsten Klein] added function FreeImage_GetBitsEx() -+ [Carsten Klein] added structure SAFEARRAY2D to create 2 dimensional custom arrays -+ [Carsten Klein] added function declarations for converting scanlines to 4 bpp: -+ added declaration for FreeImage_ConvertLine1To4() -+ added declaration for FreeImage_ConvertLine8To4() -+ added declaration for FreeImage_ConvertLine16To4_555() -+ added declaration for FreeImage_ConvertLine16To4_565() -+ added declaration for FreeImage_ConvertLine24To4() -+ added declaration for FreeImage_ConvertLine32To4() - -June 16, 2005 - 1.2.8 -! [Carsten Klein] changed inproper function declaration for all functions FreeImage_ConvertLineXXXX(): now parameters 'target' and 'Source' are passed ByVal - -June 15, 2005 - 1.2.7 -+ [Carsten Klein] added function FreeImage_DestroyLockedArrayByPtr() to destroy a locked array by it's pointer (VB can't pass a array of structures through a Variant type) -+ [Carsten Klein] added some wrapper functions for FreeImage_DestroyLockedArrayByPtr() for common FreeImage structures: -+ added function FreeImage_DestroyLockedArrayRGBTRIPLE() -+ added function FreeImage_DestroyLockedArrayRGBQUAD() -+ added function FreeImage_DestroyLockedArrayFICOMPLEX() -+ added function FreeImage_DestroyLockedArrayFIRGB16() -+ added function FreeImage_DestroyLockedArrayFIRGBA16() -+ added function FreeImage_DestroyLockedArrayFIRGBF() -+ added function FreeImage_DestroyLockedArrayFIRGBAF() -+ [Carsten Klein] added functions to return scanlines as VB style arrays in all supported FreeImage formats: -+ added function FreeImage_GetScanLineBITMAP8() -+ added function FreeImage_GetScanLineBITMAP16() -+ added function FreeImage_GetScanLineBITMAP24() -+ added function FreeImage_GetScanLineBITMAP32() -+ added function FreeImage_GetScanLineINT16() -+ added function FreeImage_GetScanLineINT32() -+ added function FreeImage_GetScanLineFLOAT() -+ added function FreeImage_GetScanLineDOUBLE() -+ added function FreeImage_GetScanLineCOMPLEX() -+ added function FreeImage_GetScanLineRGB16() -+ added function FreeImage_GetScanLineRGBA16() -+ added function FreeImage_GetScanLineRGBF() -+ added function FreeImage_GetScanLineRGBAF() - -June 14, 2005 - 1.2.6 -! [Carsten Klein] updated documentation on array-dealing functions using arrays with custom array descriptors -+ [Carsten Klein] added function FreeImage_DestroyLockedArray() to destroy a self created array 'FADF_AUTO Or FADF_FIXEDSIZE' array -+ [Carsten Klein] added function FreeImage_GetPaletteExLong() to return palette data in an array of type Long -+ [Carsten Klein] added parameters 'lPaletteSize', 'vntReservePalette' and 'lReserveSize' to FreeImage_ConvertColorDepth() - -June 13, 2005 - 1.2.5 -* [Carsten Klein] fixed a bug in helper function pGetMemoryBlockPtrFromVariant(): now 'size_in_bytes' will never exceed the size of an array provided - -June 12, 2005 - 1.2.4 -+ [Carsten Klein] added ZLib compression function wrappers dealing with VB style arrays: -+ added function FreeImage_ZLibCompressVB() -+ added function FreeImage_ZLibUncompressVB() -+ added function FreeImage_ZLibGZipVB() -+ added function FreeImage_ZLibGUnzipVB() - -June 10, 2005 - 1.2.3 -+ [Carsten Klein] added ZLib compression function wrappers dealing with VB style arrays: -+ added function FreeImage_ZLibCompressEx() -+ added function FreeImage_ZLibUncompressEx() -+ added function FreeImage_ZLibGZipEx() -+ added function FreeImage_ZLibCRC32Ex() -+ added function FreeImage_ZLibGUnzipEx() -+ [Carsten Klein] added more VB friendly ZLib compression function wrappers: -+ added function FreeImage_ZLibCompressVB() -+ added function FreeImage_ZLibUncompressVB() -+ added function FreeImage_ZLibGZipVB() -+ added function FreeImage_ZLibGUnzipVB() -! [Carsten Klein] fixed wrong function declaration of functions FreeImage_ZLibGUnzip(): alias was '_FreeImage_ZLibZlibGUnzip@16' (double ZLib) -! [Carsten Klein] fixed function pGetArrayPtrFromVariantArray() that now can deal with uninitialized arrays -! fixed function pGetMemoryBlockPtrFromVariant() that now can deal with uninitialized arrays -! [Carsten Klein] fixed wrong function declaration of functions FreeImage_AdjustBrightness(): ...@8 -> ...@12 -! fixed wrong function declaration of functions FreeImage_AdjustContrast(): ...@8 -> ...@12 -! fixed wrong function declaration of functions FreeImage_AdjustGamma(): ...@8 -> ...@12 -! fixed wrong function declaration of functions FreeImage_RotateClassic(): ...@8 -> ...@12 -! fixed wrong function declaration of functions FreeImage_RotateEx(): ...@28 -> ...@48 - -June 9, 2005 - 1.2.2 -! [Carsten Klein] fixed wrong function declaration of function FreeImage_OpenMultiBitmap(): added parameter 'flags' (...@20 -> ...@24) - -June 8, 2005 - 1.2.1 -! [Carsten Klein] refactored function FreeImage_LoadFromMemoryEx(): now using pGetMemoryBlockPtrFromVariant() -+ [Carsten Klein] added private function pGetMemoryBlockPtrFromVariant() to get poiner and size of a memory block from a Variant parameter -! [Carsten Klein] changed declaration of ZLib related functions: 'target' and 'Source' are now 'ByVal Long' - -June 7, 2005 - 1.2 -+ [Carsten Klein] added some more inline comments and documentation -+ [Carsten Klein] added optional parameter 'bUnloadSource' to function FreeImage_SaveToMemoryEx() -+ added optional parameter 'bUnloadSource' to function FreeImage_SaveToMemoryEx2() -+ [Carsten Klein] added optional parameter 'InPercent' to function SavePictureEx() -! implemented the capability to resize the image on saving in function SavePictureEx() -+ [Carsten Klein] added parameters 'InPercent' and 'Format' to function LoadPictureEx() -* [Carsten Klein] fixed wrong function declaration of function FreeImage_JPEGTransform() (...@12 -> ...@16) - -June 6, 2005 - 1.1.2 -+ [Carsten Klein] added some more inline comments and documentation - -May 30, 2005 - 1.1.1 -* [Carsten Klein] fixed percent calculating bug in function FreeImage_RescaleEx() -! changed behaviour of parameter 'bIsPercentValue' -> it now has no effect on integer values -+ added function FreeImage_RescaleByPixel() to avoid confusion with overloading -+ added function FreeImage_RescaleByPercent() to avoid confusion with overloading -+ added function FreeImage_RescaleByFactor() to avoid confusion with overloading -! [Carsten Klein] changed name of parameter 'bUnloadDIB' to 'bUnloadSource' of function FreeImage_GetOlePicture() -+ [Carsten Klein] added some more inline comments and documentation -* [Carsten Klein] fixed a potential runtime error in function FreeImage_SetTransparencyTableEx(): 'Count' will no longer exceed 256 - -May 24, 2005 - 1.1 -+ [Carsten Klein] added a new VB wrapper diff --git a/#ThirdParty/FreeImage/Wrapper/VB6/test/SimpleTest.frm b/#ThirdParty/FreeImage/Wrapper/VB6/test/SimpleTest.frm deleted file mode 100644 index 1847542..0000000 --- a/#ThirdParty/FreeImage/Wrapper/VB6/test/SimpleTest.frm +++ /dev/null @@ -1,45 +0,0 @@ -VERSION 5.00 -Begin VB.Form SimpleTest - Caption = "SimpleTest" - ClientHeight = 1035 - ClientLeft = 60 - ClientTop = 345 - ClientWidth = 2325 - LinkTopic = "Form1" - ScaleHeight = 1035 - ScaleWidth = 2325 - StartUpPosition = 3 'Windows Default - Begin VB.CommandButton btnTest - Caption = "Test" - Height = 495 - Left = 240 - TabIndex = 0 - Top = 240 - Width = 1575 - End -End -Attribute VB_Name = "SimpleTest" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Option Explicit -' NOTE : -' To run this test program, you will have to copy the FreeImage.dll file -' in this directory. -' Change also the "test.tif" file name with a path to any tif file on your -' hard disk -' -Private Sub btnTest_Click() - Dim dib As Long - Dim bOK As Long - ' Load a tif image - dib = FreeImage_Load(FIF_TIFF, "test.tif", 0) - - ' Save this image as PNG - bOK = FreeImage_Save(FIF_PNG, dib, "test.png", 0) - - ' Unload the dib - FreeImage_Unload (dib) - -End Sub diff --git a/#ThirdParty/FreeImage/Wrapper/VB6/test/SimpleTest.vbp b/#ThirdParty/FreeImage/Wrapper/VB6/test/SimpleTest.vbp deleted file mode 100644 index 8ee5610..0000000 --- a/#ThirdParty/FreeImage/Wrapper/VB6/test/SimpleTest.vbp +++ /dev/null @@ -1,38 +0,0 @@ -Type=Exe -Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\..\WINNT\system32\stdole2.tlb#OLE Automation -Form=SimpleTest.frm -Module=FreeImage; ..\modFreeImage.bas -IconForm="SimpleTest" -Startup="SimpleTest" -HelpFile="" -Title="SimpleTest" -ExeName32="SimpleTest.exe" -Command32="" -Name="TestFreeImage" -HelpContextID="0" -CompatibleMode="0" -MajorVer=1 -MinorVer=0 -RevisionVer=0 -AutoIncrementVer=0 -ServerSupportFiles=0 -VersionCompanyName="HDN" -CompilationType=0 -OptimizationType=0 -FavorPentiumPro(tm)=0 -CodeViewDebugInfo=0 -NoAliasing=0 -BoundsCheck=0 -OverflowCheck=0 -FlPointCheck=0 -FDIVCheck=0 -UnroundedFP=0 -StartMode=0 -Unattended=0 -Retained=0 -ThreadPerObject=0 -MaxNumberOfThreads=1 -DebugStartupOption=0 - -[MS Transaction Server] -AutoRefresh=1 diff --git a/#ThirdParty/FreeImage/license-fi.txt b/#ThirdParty/FreeImage/license-fi.txt deleted file mode 100644 index 03b666c..0000000 --- a/#ThirdParty/FreeImage/license-fi.txt +++ /dev/null @@ -1,142 +0,0 @@ -FreeImage Public License - Version 1.0 ---------------------------------------------- - -1. Definitions. - -1.1. "Contributor" means each entity that creates or contributes to the creation of Modifications. - -1.2. "Contributor Version" means the combination of the Original Code, prior Modifications used by a Contributor, and the Modifications made by that particular Contributor. - -1.3. "Covered Code" means the Original Code or Modifications or the combination of the Original Code and Modifications, in each case including portions thereof. - -1.4. "Electronic Distribution Mechanism" means a mechanism generally accepted in the software development community for the electronic transfer of data. - -1.5. "Executable" means Covered Code in any form other than Source Code. - -1.6. "Initial Developer" means the individual or entity identified as the Initial Developer in the Source Code notice required by Exhibit A. - -1.7. "Larger Work" means a work which combines Covered Code or portions thereof with code not governed by the terms of this License. - -1.8. "License" means this document. - -1.9. "Modifications" means any addition to or deletion from the substance or structure of either the Original Code or any previous Modifications. When Covered Code is released as a series of files, a -Modification is: - -A. Any addition to or deletion from the contents of a file containing Original Code or previous Modifications. - -B. Any new file that contains any part of the Original Code or previous Modifications. - -1.10. "Original Code" means Source Code of computer software code which is described in the Source Code notice required by Exhibit A as Original Code, and which, at the time of its release under this License is not already Covered Code governed by this License. - -1.11. "Source Code" means the preferred form of the Covered Code for making modifications to it, including all modules it contains, plus any associated interface definition files, scripts used to control -compilation and installation of an Executable, or a list of source code differential comparisons against either the Original Code or another well known, available Covered Code of the Contributor's choice. The Source Code can be in a compressed or archival form, provided the appropriate decompression or de-archiving software is widely available for no charge. - -1.12. "You" means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License or a future version of this License issued under Section 6.1. For legal entities, "You" includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the -direction or management of such entity, whether by contract or otherwise, or (b) ownership of fifty percent (50%) or more of the outstanding shares or beneficial ownership of such entity. - -2. Source Code License. - -2.1. The Initial Developer Grant. -The Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims: - -(a) to use, reproduce, modify, display, perform, sublicense and distribute the Original Code (or portions thereof) with or without Modifications, or as part of a Larger Work; and - -(b) under patents now or hereafter owned or controlled by Initial Developer, to make, have made, use and sell ("Utilize") the Original Code (or portions thereof), but solely to the extent that -any such patent is reasonably necessary to enable You to Utilize the Original Code (or portions thereof) and not to any greater extent that may be necessary to Utilize further Modifications or -combinations. - -2.2. Contributor Grant. -Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims: - -(a) to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof) either on an unmodified basis, with other Modifications, as Covered Code or as part of a Larger Work; and - -(b) under patents now or hereafter owned or controlled by Contributor, to Utilize the Contributor Version (or portions thereof), but solely to the extent that any such patent is reasonably necessary to enable You to Utilize the Contributor Version (or portions thereof), and not to any greater extent that -may be necessary to Utilize further Modifications or combinations. - -3. Distribution Obligations. - -3.1. Application of License. -The Modifications which You create or to which You contribute are governed by the terms of this License, including without limitation Section 2.2. The Source Code version of Covered Code may be distributed only under the terms of this License or a future version of this License released under Section 6.1, and You must include a copy of this License with every copy of the Source Code You distribute. You may not offer or impose any terms on any Source Code version that alters or -restricts the applicable version of this License or the recipients' rights hereunder. However, You may include an additional document offering the additional rights described in Section 3.5. - -3.2. Availability of Source Code. -Any Modification which You create or to which You contribute must be made available in Source Code form under the terms of this License either on the same media as an Executable version or via an accepted Electronic Distribution Mechanism to anyone to whom you made an Executable version available; and if made available via Electronic Distribution Mechanism, must remain available for at least twelve (12) months after the date it initially became available, or at least six (6) months after a subsequent version of that particular Modification has been made available to such recipients. You are responsible for ensuring that the Source Code version remains available even if the Electronic Distribution Mechanism is maintained by a third party. - -3.3. Description of Modifications. -You must cause all Covered Code to which you contribute to contain a file documenting the changes You made to create that Covered Code and the date of any change. You must include a prominent statement that the Modification is derived, directly or indirectly, from Original Code provided by the Initial Developer and including the name of the Initial Developer in (a) the Source Code, and (b) in any notice in an Executable version or related documentation in which You describe the origin or ownership of the Covered Code. - -3.4. Intellectual Property Matters - -(a) Third Party Claims. -If You have knowledge that a party claims an intellectual property right in particular functionality or code (or its utilization under this License), you must include a text file with the source code distribution titled "LEGAL" which describes the claim and the party making the claim in sufficient detail that a recipient will know whom to contact. If you obtain such knowledge after You make Your Modification available as described in Section 3.2, You shall promptly modify the LEGAL file in all copies You make -available thereafter and shall take other steps (such as notifying appropriate mailing lists or newsgroups) reasonably calculated to inform those who received the Covered Code that new knowledge has been obtained. - -(b) Contributor APIs. -If Your Modification is an application programming interface and You own or control patents which are reasonably necessary to implement that API, you must also include this information in the LEGAL file. - -3.5. Required Notices. -You must duplicate the notice in Exhibit A in each file of the Source Code, and this License in any documentation for the Source Code, where You describe recipients' rights relating to Covered Code. If You created one or more Modification(s), You may add your name as a Contributor to the notice described in Exhibit A. If it is not possible to put such notice in a particular Source Code file due to its -structure, then you must include such notice in a location (such as a relevant directory file) where a user would be likely to look for such a notice. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Code. However, You may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear than any such warranty, support, indemnity or -liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of -warranty, support, indemnity or liability terms You offer. - -3.6. Distribution of Executable Versions. -You may distribute Covered Code in Executable form only if the requirements of Section 3.1-3.5 have been met for that Covered Code, and if You include a notice stating that the Source Code version of the Covered Code is available under the terms of this License, including a description of how and where You have fulfilled the obligations of Section 3.2. The notice must be conspicuously included in any notice in an Executable version, related documentation or collateral in which You -describe recipients' rights relating to the Covered Code. You may distribute the Executable version of Covered Code under a license of Your choice, which may contain terms different from this License, -provided that You are in compliance with the terms of this License and that the license for the Executable version does not attempt to limit or alter the recipient's rights in the Source Code version from the rights set forth in this License. If You distribute the Executable version under a different license You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer or any Contributor. You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of any such terms You offer. - -3.7. Larger Works. -You may create a Larger Work by combining Covered Code with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Code. - -4. Inability to Comply Due to Statute or Regulation. - -If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Code due to statute or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be included in the LEGAL file described in Section 3.4 and must be included with all distributions of the Source Code. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it. - -5. Application of this License. - -This License applies to code to which the Initial Developer has attached the notice in Exhibit A, and to related Covered Code. - -6. Versions of the License. - -6.1. New Versions. -Floris van den Berg may publish revised and/or new versions of the License from time to time. Each version will be given a distinguishing version number. - -6.2. Effect of New Versions. -Once Covered Code has been published under a particular version of the License, You may always continue to use it under the terms of that version. You may also choose to use such Covered Code under the terms of any subsequent version of the License published by Floris van den Berg -No one other than Floris van den Berg has the right to modify the terms applicable to Covered Code created under this License. - -6.3. Derivative Works. -If you create or use a modified version of this License (which you may only do in order to apply it to code which is not already Covered Code governed by this License), you must (a) rename Your license so that the phrases "FreeImage", `FreeImage Public License", "FIPL", or any confusingly similar phrase do not appear anywhere in your license and (b) otherwise make it clear that your version of the license contains terms which differ from the FreeImage Public License. (Filling in the name of the Initial Developer, Original Code or Contributor in the notice described in Exhibit A shall not of themselves be deemed to be modifications of this License.) - -7. DISCLAIMER OF WARRANTY. - -COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. - -8. TERMINATION. - -This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. All sublicenses to the Covered Code which are properly granted shall survive any termination of this License. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive. - -9. LIMITATION OF LIABILITY. - -UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO YOU OR ANY OTHER PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE -EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THAT EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. - -10. U.S. GOVERNMENT END USERS. - -The Covered Code is a "commercial item," as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and "commercial computer software documentation," as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Code with only those rights set forth herein. - -11. MISCELLANEOUS. - -This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by Dutch law provisions (except to the extent applicable law, if any, provides otherwise), excluding its conflict-of-law provisions. With respect to disputes in which at least one party is a citizen of, or an entity chartered or registered to do business in, the The Netherlands: (a) unless otherwise agreed in writing, all disputes relating to this License (excepting any dispute relating to intellectual property rights) shall be subject to final and binding arbitration, with the losing party paying all costs of arbitration; (b) any arbitration relating to this Agreement shall be held in Almelo, The Netherlands; and (c) any litigation relating to this Agreement shall be subject to the jurisdiction of the court of Almelo, The Netherlands with the losing party responsible for costs, including without limitation, court costs and reasonable attorneys fees and expenses. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License. - -12. RESPONSIBILITY FOR CLAIMS. - -Except in cases where another Contributor has failed to comply with Section 3.4, You are responsible for damages arising, directly or indirectly, out of Your utilization of rights under this License, based -on the number of copies of Covered Code you made available, the revenues you received from utilizing such rights, and other relevant factors. You agree to work with affected parties to distribute -responsibility on an equitable basis. - -EXHIBIT A. - -"The contents of this file are subject to the FreeImage Public License Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://home.wxs.nl/~flvdberg/freeimage-license.txt - -Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. \ No newline at end of file diff --git a/#ThirdParty/FreeImage/license-gplv2.txt b/#ThirdParty/FreeImage/license-gplv2.txt deleted file mode 100644 index 6020906..0000000 --- a/#ThirdParty/FreeImage/license-gplv2.txt +++ /dev/null @@ -1,126 +0,0 @@ -GNU General Public License, version 2 (GPL-2.0) -[OSI Approved License] -The GNU General Public License (GPL-2.0) -Version 2, June 1991 - -Copyright (C) 1989, 1991 Free Software Foundation, Inc. -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. - -Preamble - -The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. - -To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. - -For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. - -We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. - -Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. - -Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. - -The precise terms and conditions for copying, distribution and modification follow. - -TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - -0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. - -1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. - -You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. - -2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. - - c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. - -3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. - -If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. - -4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. - -5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. - -6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. - -7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. - -This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - -8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. - -9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. - -10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - -NO WARRANTY - -11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - -12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -END OF TERMS AND CONDITIONS - -How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - - One line to give the program's name and a brief idea of what it does. - Copyright (C) - - This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. - - signature of Ty Coon, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. diff --git a/#ThirdParty/FreeImage/license-gplv3.txt b/#ThirdParty/FreeImage/license-gplv3.txt deleted file mode 100644 index 5ec7b1a..0000000 --- a/#ThirdParty/FreeImage/license-gplv3.txt +++ /dev/null @@ -1,228 +0,0 @@ -GNU General Public License, version 3 (GPL-3.0) -[OSI Approved License] -GNU GENERAL PUBLIC LICENSE - -Version 3, 29 June 2007 - -Copyright (C) 2007 Free Software Foundation, Inc. - -Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. -Preamble - -The GNU General Public License is a free, copyleft license for software and other kinds of works. - -The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. - -To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. - -For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. - -Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. - -Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. - -Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. - -The precise terms and conditions for copying, distribution and modification follow. -TERMS AND CONDITIONS -0. Definitions. - -“This License” refers to version 3 of the GNU General Public License. - -“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. - -“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations. - -To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work. - -A “covered work” means either the unmodified Program or a work based on the Program. - -To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. - -To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. - -An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. -1. Source Code. - -The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work. - -A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. - -The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. - -The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. - -The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same work. -2. Basic Permissions. - -All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. - -You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. -3. Protecting Users' Legal Rights From Anti-Circumvention Law. - -No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. - -When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. -4. Conveying Verbatim Copies. - -You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. - -You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. -5. Conveying Modified Source Versions. - -You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified it, and giving a relevant date. - b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”. - c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. - d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. - -A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. -6. Conveying Non-Source Forms. - -You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: - - a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. - b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. - c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. - d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. - e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. - -A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. - -A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. - -“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. - -If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). - -The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. - -Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. -7. Additional Terms. - -“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. - -When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. - -Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or - b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or - c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or - d) Limiting the use for publicity purposes of names of licensors or authors of the material; or - e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or - f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. - -All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. -8. Termination. - -You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). - -However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. - -Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. - -Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. -9. Acceptance Not Required for Having Copies. - -You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. -10. Automatic Licensing of Downstream Recipients. - -Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. - -An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. - -You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. -11. Patents. - -A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”. - -A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. - -In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. - -If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. - -A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. -12. No Surrender of Others' Freedom. - -If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. -13. Use with the GNU Affero General Public License. - -Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. -14. Revised Versions of this License. - -The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. - -Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. -15. Disclaimer of Warranty. - -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. -16. Limitation of Liability. - -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -17. Interpretation of Sections 15 and 16. - -If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. - -END OF TERMS AND CONDITIONS -How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - - Copyright (C) - - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”. - -You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . - -The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . diff --git a/#ThirdParty/fmodapi375win/README.TXT b/#ThirdParty/fmodapi375win/README.TXT deleted file mode 100644 index 2262f1d..0000000 --- a/#ThirdParty/fmodapi375win/README.TXT +++ /dev/null @@ -1,100 +0,0 @@ ----------------------------------------------------------------------------- - FMOD 3.75 - Copyright (c) Firelight Technologies Pty, Ltd, - 1994 - 2004 ----------------------------------------------------------------------------- - - http://www.fmod.org - - ----------------------------------------------------------------------------- -WIN32 specific issues. ----------------------------------------------------------------------------- - -Remember to use the correct import library! - -MSVC Users - use FMODVC.LIB -METROWERKS/CODEWARRIOR Users - use FMODVC.LIB -WATCOM Users - use FMODWC.LIB -BORLAND Users - use FMODBC.LIB -LCC-WIN32 Users - use FMODLCC.LIB -DEV-C++, MINGW AND CYGWIN Users - use LIBFMOD.A - -Linux users - link with libfmod-3.75.so (i.e. gcc file.c -lfmod-3.75) -Delphi Users - use FMOD.PAS -Visual Basic Users - use FMOD.BAS - ----------------------------------------------------------------------------- -ASIO Config ----------------------------------------------------------------------------- -FMOD ignores FSOUND_SetBufferSize in ASIO mode. It relies on settings -provided by the ASIO control panel supplied with the driver. In the tools -directory of the FMOD api, you will find an asioconfig.exe tool which allows -you to configure the ASIO driver by doubleclicking on the appropriate driver. - ----------------------------------------------------------------------------- -FMOD End User License Agreement ----------------------------------------------------------------------------- - -FMOD's names, sources, documentation and binaries contained within the -distributed archive are copyright © Firelight Technologies, Pty, Ltd. -1994-2004. - -The contents of the FMOD distribution archive may not be redistributed, -reproduced, modified, transmitted, broadcast, published or adapted in any -way, shape or form, without the prior written consent of the owner, -Firelight Technologies, be it by tangible or non tangible media. - -The fmod.dll file may be redistributed without the authors prior permission, -and must remain unmodified. The use of dll 'static linking' tools that aim -to hide the fmod library are forbidden. - -FMOD may not be used in a commercial product, or product that directly or -indirectly receives income with the aid of the FMOD sound library, without -a commercial license from Firelight Technologies. Releasing a product -without a commercial license in this instance is a breach of the FMOD EULA -and parties who violate this license will be prosecuted under the full -extent of the law. - - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ----------------------------------------------------------------------------- -Ogg Vorbis License ----------------------------------------------------------------------------- -Portions Copyright (c) 2001, Xiphophorus - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -- Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. -- Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. -- Neither the name of the Xiphophorus nor the names of its contributors -may be used to endorse or promote products derived from this software -without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/#ThirdParty/fmodapi375win/api/delphi/fmod.dcu b/#ThirdParty/fmodapi375win/api/delphi/fmod.dcu deleted file mode 100644 index 30216cc..0000000 Binary files a/#ThirdParty/fmodapi375win/api/delphi/fmod.dcu and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/api/delphi/fmod.pas b/#ThirdParty/fmodapi375win/api/delphi/fmod.pas deleted file mode 100644 index 93dbfc8..0000000 --- a/#ThirdParty/fmodapi375win/api/delphi/fmod.pas +++ /dev/null @@ -1,783 +0,0 @@ -{ =============================================================================================== } -{ FMOD Main header file. Copyright (c), Firelight Technologies Pty, Ltd. 1999-2004. } -{ =============================================================================================== } -{ - NOTE: For the demos to run you must have either fmod.dll (in Windows) - or libfmod-3.75.so (in Linux) installed. - - In Windows, copy the fmod.dll file found in the api directory to either of - the following locations (in order of preference) - - your application directory - - Windows\System (95/98) or WinNT\System32 (NT/2000/XP) - - In Linux, make sure you are signed in as root and copy the libfmod-3.75.so - file from the api directory to your /usr/lib/ directory. - Then via a command line, navigate to the /usr/lib/ directory and create - a symbolic link between libfmod-3.75.so and libfmod.so. This is done with - the following command (assuming you are in /usr/lib/)... - ln -s libfmod-3.75.so libfmod.so. -} -{ =============================================================================================== } - -{$IFDEF FPC} - {$MODE DELPHI} - {$IFDEF WIN32} - {$DEFINE MSWINDOWS} - {$ENDIF} -{$ENDIF} - -unit fmod; - -interface - -uses -{$IFDEF MSWINDOWS} - Windows, -{$ENDIF} - fmodtypes; - -{ - Disable warning for unsafe types in Delphi 7 -} -{$IFDEF VER150} -{$WARN UNSAFE_TYPE OFF} -{$ENDIF} - -//=============================================================================================== -// FUNCTION PROTOTYPES -//=============================================================================================== - -{ ================================== } -{ Library load/unload functions. } -{ ================================== } - -{ - If no library name is passed to FMOD_Load, then the default library name - used. These are stub functions. -} - -function FMOD_Load(LibName: PChar): Boolean; -procedure FMOD_Unload; - -{ ================================== } -{ Initialization / Global functions. } -{ ================================== } - -{ - PRE - FSOUND_Init functions. These can't be called after FSOUND_Init is - called (they will fail). They set up FMOD system functionality. -} - -function FSOUND_SetOutput(OutputType: TFSoundOutputTypes): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_SetDriver(Driver: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_SetMixer(Mixer: TFSoundMixerTypes): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_SetBufferSize(LenMs: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_SetHWND(Hwnd: THandle): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_SetMinHardwareChannels(Min: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_SetMaxHardwareChannels(Max: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_SetMemorySystem(Pool: Pointer; PoolLen: Integer; - UserAlloc: TFSoundAllocCallback; - UserRealloc: TFSoundReallocCallback; - UserFree: TFSoundFreeCallback): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ - Main initialization / closedown functions. - Note : Use FSOUND_INIT_USEDEFAULTMIDISYNTH with FSOUND_Init for software override - with MIDI playback. - : Use FSOUND_INIT_GLOBALFOCUS with FSOUND_Init to make sound audible no matter - which window is in focus. (FSOUND_OUTPUT_DSOUND only) -} - -function FSOUND_Init(MixRate: Integer; MaxSoftwareChannels: Integer; Flags: Cardinal): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -procedure FSOUND_Close; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ - Runtime system level functions -} - -procedure FSOUND_Update; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; // This is called to update 3d sound / non-realtime output - -procedure FSOUND_SetSpeakerMode(SpeakerMode: Cardinal); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -procedure FSOUND_SetSFXMasterVolume(Volume: Integer); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -procedure FSOUND_SetPanSeperation(PanSep: Single); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -procedure FSOUND_File_SetCallbacks(OpenCallback: TFSoundOpenCallback; - CloseCallback: TFSoundCloseCallback; - ReadCallback: TFSoundReadCallback; - SeekCallback: TFSoundSeekCallback; - TellCallback: TFSoundTellCallback); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ - System information functions -} - -function FSOUND_GetError: TFModErrors; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetVersion: Single; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetOutput: TFSoundOutputTypes; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetOutputHandle: Pointer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetDriver: Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetMixer: TFSoundMixerTypes; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetNumDrivers: Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetDriverName(Id: Integer): PChar; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetDriverCaps(Id: Integer; var Caps: Cardinal): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetOutputRate: Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetMaxChannels: Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetMaxSamples: Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetSpeakerMode: Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetSFXMasterVolume: Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetNumHWChannels(var num2d: Integer; var num3d: Integer; var total: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetChannelsPlaying: Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetCPUUsage: Single; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -procedure FSOUND_GetMemoryStats(var CurrentAlloced: Cardinal; var MaxAlloced: Cardinal); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ =================================== } -{ Sample management / load functions. } -{ =================================== } - -{ - Sample creation and management functions - Note : Use FSOUND_LOADMEMORY flag with FSOUND_Sample_Load to load from memory. - Use FSOUND_LOADRAW flag with FSOUND_Sample_Load to treat as as raw pcm data. -} - -function FSOUND_Sample_Load(Index: Integer; const NameOrData: PChar; Mode: Cardinal; Offset: Integer; Length: Integer): PFSoundSample; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Sample_Alloc(Index: Integer; Length: Integer; Mode: Cardinal; DefFreq: Integer; DefVol: Integer; DefPan: Integer; DefPri: Integer): PFSoundSample; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -procedure FSOUND_Sample_Free(Sptr: PFSoundSample); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Sample_Upload(Sptr: PFSoundSample; SrcData: Pointer; Mode: Cardinal): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Sample_Lock(Sptr: PFSoundSample; Offset: Integer; Length: Integer; var Ptr1: Pointer; var Ptr2: Pointer; var Len1: Cardinal; var Len2: Cardinal): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Sample_Unlock(Sptr: PFSoundSample; Ptr1: Pointer; Ptr2: Pointer; Len1: Cardinal; Len2: Cardinal): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ - Sample control functions -} - -function FSOUND_Sample_SetMode(Sptr: PFSoundSample; Mode: Cardinal): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Sample_SetLoopPoints(Sptr: PFSoundSample; LoopStart, LoopEnd: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Sample_SetDefaults(Sptr: PFSoundSample; DefFreq, DefVol, DefPan, DefPri: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Sample_SetDefaultsEx(Sptr: PFSoundSample; DefFreq, DefVol, DefPan, DefPri, VarFreq, VarVol, VarPan: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Sample_SetMinMaxDistance(Sptr: PFSoundSample; Min, Max: Single): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Sample_SetMaxPlaybacks(Sptr: PFSoundSample; Max: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ - Sample information functions -} - -function FSOUND_Sample_Get(SampNo: Integer): PFSoundSample; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Sample_GetName(Sptr: PFSoundSample): PCHAR; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Sample_GetLength(Sptr: PFSoundSample): Cardinal; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Sample_GetLoopPoints(Sptr: PFSoundSample; var LoopStart: Integer; var LoopEnd: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Sample_GetDefaults(Sptr: PFSoundSample; var DefFreq: Integer; var DefVol: Integer; var DefPan: Integer; var DefPri: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Sample_GetDefaultsEx(Sptr: PFSoundSample; var DefFreq: Integer; var DefVol: Integer; var DefPan: Integer; var DefPri: Integer;var VarFreq: Integer; var VarVol: Integer; var VarPan: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Sample_GetMode(Sptr: PFSoundSample): Cardinal; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Sample_GetMinMaxDistance(Sptr: PFSoundSample; var Min: Single; var Max: Single): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ ============================ } -{ Channel control functions. } -{ ============================ } - -{ - Playing and stopping sounds. - Note : Use FSOUND_FREE as the 'channel' variable, to let FMOD pick a free channel for you. - Use FSOUND_ALL as the 'channel' variable to control ALL channels with one function call! -} - -function FSOUND_PlaySound(Channel: Integer; Sptr: PFSoundSample): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_PlaySoundEx(Channel: Integer; Sptr: PFSoundSample; Dsp: PFSoundDSPUnit; StartPaused: ByteBool): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_StopSound(Channel: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ - Functions to control playback of a channel. - Note : FSOUND_ALL can be used on most of these functions as a channel value. -} - -function FSOUND_SetFrequency(Channel: Integer; Freq: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_SetVolume(Channel: Integer; Vol: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_SetVolumeAbsolute(Channel: Integer; Vol: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_SetPan(Channel: Integer; Pan: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_SetSurround(Channel: Integer; Surround: ByteBool): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_SetMute(Channel: Integer; Mute: ByteBool): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_SetPriority(Channel: Integer; Priority: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_SetReserved(Channel: Integer; Reserved: ByteBool): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_SetPaused(Channel: Integer; Paused: ByteBool): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_SetLoopMode(Channel: Integer; LoopMode: Cardinal): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_SetCurrentPosition(Channel: Integer; Offset: Cardinal): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_3D_SetAttributes(Channel: Integer; Pos: PFSoundVector; Vel: PFSoundVector): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_3D_SetMinMaxDistance(Channel: Integer; Min: Single; Max: Single): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ - Channel information functions -} - -function FSOUND_IsPlaying(Channel: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetFrequency(Channel: Integer): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetVolume(Channel: Integer): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetAmplitude(Channel: Integer): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetPan(Channel: Integer): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetSurround(Channel: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetMute(Channel: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetPriority(Channel: Integer): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetReserved(Channel: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetPaused(Channel: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetLoopMode(Channel: Integer): Cardinal; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetCurrentPosition(Channel: Integer): Cardinal; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetCurrentSample(Channel: Integer): PFSoundSample; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetCurrentLevels(Channel: Integer; l, r: PSingle): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetNumSubChannels(Channel: Integer): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_GetSubChannel(Channel: Integer; SubChannel: Integer): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_3D_GetAttributes(Channel: Integer; Pos: PFSoundVector; Vel: PFSoundVector): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_3D_GetMinMaxDistance(Channel: Integer; var Min: Single; var Max: Single): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ =================== } -{ 3D sound functions. } -{ =================== } - -{ - See also 3d sample and channel based functions above. - Call FSOUND_Update once a frame to process 3d information. -} - -procedure FSOUND_3D_Listener_SetCurrent(current: Integer); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -procedure FSOUND_3D_Listener_SetAttributes(Pos: PFSoundVector; Vel: PFSoundVector; - fx: Single; fy: Single; fz: Single; - tx: Single; ty: Single; tz: Single); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -procedure FSOUND_3D_Listener_GetAttributes(Pos: PFSoundVector; Vel: PFSoundVector; - fx: PSingle; fy: PSingle; fz: PSingle; - tx: PSingle; ty: PSingle; tz: PSingle); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -procedure FSOUND_3D_SetDopplerFactor(Scale: Single); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -procedure FSOUND_3D_SetDistanceFactor(Scale: Single); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -procedure FSOUND_3D_SetRolloffFactor(Scale: Single); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ =================== } -{ FX functions. } -{ =================== } - -{ - Functions to control DX8 only effects processing. - - - FX enabled samples can only be played once at a time, not multiple times at once. - - Sounds have to be created with FSOUND_HW2D or FSOUND_HW3D for this to work. - - FSOUND_INIT_ENABLESYSTEMCHANNELFX can be used to apply hardware effect processing to the - global mixed output of FMOD's software channels. - - FSOUND_FX_Enable returns an FX handle that you can use to alter fx parameters. - - FSOUND_FX_Enable can be called multiple times in a row, even on the same FX type, - it will return a unique handle for each FX. - - FSOUND_FX_Enable cannot be called if the sound is playing or locked. - - FSOUND_FX_Disable must be called to reset/clear the FX from a channel. -} - -function FSOUND_FX_Enable(Channel: Integer; Fx: TFSoundFXModes): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_FX_Disable(Channel: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -function FSOUND_FX_SetChorus(FXId: Integer; WetDryMix, Depth, Feedback, Frequency: Single; Waveform: Integer; Delay: Single; Phase: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_FX_SetCompressor(FXId: Integer; Gain, Attack, Release, Threshold, Ratio, Predelay: Single): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_FX_SetDistortion(FXId: Integer; Gain, Edge, PostEQCenterFrequency, PostEQBandwidth, PreLowpassCutoff: Single): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_FX_SetEcho(FXId: Integer; WetDryMix, Feedback, LeftDelay, RightDelay: Single; PanDelay: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_FX_SetFlanger(FXId: Integer; WetDryMix, Depth, Feedback, Frequency: Single; Waveform: Integer; Delay: Single; Phase: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_FX_SetGargle(FXId, RateHz, WaveShape: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_FX_SetI3DL2Reverb(FXId, Room, RoomHF: Integer; RoomRolloffFactor, DecayTime, DecayHFRatio: Single; Reflections: Integer; ReflectionsDelay: Single; Reverb: Integer; ReverbDelay, Diffusion, Density, HFReference: Single): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_FX_SetParamEQ(FXId: Integer; Center, Bandwidth, Gain: Single): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_FX_SetWavesReverb(FXId: Integer; InGain, ReverbMix, ReverbTime, HighFreqRTRatio: Single): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ ========================= } -{ File Streaming functions. } -{ ========================= } - -{ - Note : Use FSOUND_LOADMEMORY flag with FSOUND_Stream_Open to stream from memory. - Use FSOUND_LOADRAW flag with FSOUND_Stream_Open to treat stream as raw pcm data. - Use FSOUND_MPEGACCURATE flag with FSOUND_Stream_Open to open mpegs in 'accurate mode' for settime/gettime/getlengthms. - Use FSOUND_FREE as the 'channel' variable, to let FMOD pick a free channel for you. -} - -function FSOUND_Stream_SetBufferSize(Ms: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -function FSOUND_Stream_Open(const name_or_data: PChar; Mode: Cardinal; Offset: Integer; Length: Integer): PFSoundStream; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Stream_Create(Callback: TFSoundStreamCallback; Length: Integer; Mode: Cardinal; SampleRate: Integer; UserData: Integer): PFSoundStream; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Stream_Close(Stream: PFSoundStream): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -function FSOUND_Stream_Play(Channel: Integer; Stream: PFSoundStream): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Stream_PlayEx(Channel: Integer; Stream: PFSoundStream; Dsp: PFSoundDSPUnit; StartPaused: ByteBool): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Stream_Stop(Stream: PFSoundStream): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -function FSOUND_Stream_SetPosition(Stream: PFSoundStream; Position: Cardinal): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Stream_GetPosition(Stream: PFSoundStream): Cardinal; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Stream_SetTime(Stream: PFSoundStream; Ms: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Stream_GetTime(Stream: PFSoundStream): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Stream_GetLength(Stream: PFSoundStream): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Stream_GetLengthMs(Stream: PFSoundStream): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -function FSOUND_Stream_SetMode(Stream: PFSoundStream; mode: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Stream_GetMode(Stream: PFSoundStream): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Stream_SetLoopPoints(Stream: PFSoundStream; LoopStartPCM, LoopEndPCM: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Stream_SetLoopCount(Stream: PFSoundStream; Count: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Stream_GetOpenState(Stream: PFSoundStream): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Stream_GetSample(Stream: PFSoundStream): PFSoundSample; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Stream_CreateDSP(Stream: PFSoundStream; Callback: TFSoundDSPCallback; Priority: Integer; Param: Integer): PFSoundDSPUnit; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -function FSOUND_Stream_SetEndCallback(Stream: PFSoundStream; Callback: TFSoundStreamCallback; UserData: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Stream_SetSyncCallback(Stream: PFSoundStream; Callback: TFSoundStreamCallback; UserData: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -function FSOUND_Stream_AddSyncPoint(Stream: PFSoundStream; PCMOffset: Cardinal; Name: PChar): PFSyncPoint; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Stream_DeleteSyncPoint(Point: PFSyncPoint): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Stream_GetNumSyncPoints(Stream: PFSoundStream): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Stream_GetSyncPoint(Stream: PFSoundStream; Index: Integer): PFSyncPoint; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Stream_GetSyncPointInfo(Point: PFSyncPoint; var PCMOffset: Cardinal): PCHAR; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -function FSOUND_Stream_SetSubStream(Stream: PFSoundStream; Index: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Stream_GetNumSubStreams(Stream: PFSoundStream): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Stream_SetSubStreamSentence(Stream: PFSoundStream; var SentenceList: Cardinal; NumItems: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -function FSOUND_Stream_GetNumTagFields(Stream: PFSoundStream; var Num: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Stream_GetTagField(Stream: PFSoundStream; Num: Integer; var TagType: TFSoundTagFieldType; var Name: PChar; var Value: Pointer; var Length: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Stream_FindTagField(Stream: PFSoundStream; TagType: TFSoundTagFieldType; Name: PChar; var Value: Pointer; var Length: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ - Internet streaming functions -} - -function FSOUND_Stream_Net_SetProxy(Proxy: PChar): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Stream_Net_GetLastServerStatus(): PChar; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Stream_Net_SetBufferProperties(BufferSize: Integer; PreBuffer_Percent: Integer; ReBuffer_Percent: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Stream_Net_GetBufferProperties(var Buffersize: Integer; var PreBuffer_Percent: Integer; var ReBuffer_Percent: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Stream_Net_SetMetadataCallback(Stream: PFSoundStream; Callback: TFMetaDataCallback; UserData: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Stream_Net_GetStatus(Stream: PFSoundStream; var Status: TFSoundStreamNetStatus; var BufferPercentUsed: Integer; var BitRate: Integer; var Flags: Cardinal): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ =================== } -{ CD audio functions. } -{ =================== } - -{ - Note : 0 = default cdrom. Otherwise specify the drive letter, for example. 'D'. -} - -function FSOUND_CD_Play(Drive: Byte; Track: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -procedure FSOUND_CD_SetPlayMode(Drive: Byte; Mode: Integer); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_CD_Stop(Drive: Byte): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_CD_SetPaused(Drive: Byte; Paused: ByteBool): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_CD_SetVolume(Drive: Byte; Volume: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_CD_SetTrackTime(Drive: Byte; ms: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_CD_OpenTray(Drive: Byte; Open: Byte): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -function FSOUND_CD_GetPaused(Drive: Byte): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_CD_GetTrack(Drive: Byte): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_CD_GetNumTracks(Drive: Byte): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_CD_GetVolume(Drive: Byte): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_CD_GetTrackLength(Drive: Byte; Track: Integer): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_CD_GetTrackTime(Drive: Byte): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ ============== } -{ DSP functions. } -{ ============== } - - -{ - DSP Unit control and information functions. -} - -function FSOUND_DSP_Create(Callback: TFSoundDSPCallback; Priority: Integer; Param: Integer): PFSoundDSPUnit; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -procedure FSOUND_DSP_Free(DSPUnit: PFSoundDSPUnit); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -procedure FSOUND_DSP_SetPriority(DSPUnit: PFSoundDSPUnit; Priority: Integer); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_DSP_GetPriority(DSPUnit: PFSoundDSPUnit): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -procedure FSOUND_DSP_SetActive(DSPUnit: PFSoundDSPUnit; Active: ByteBool); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_DSP_GetActive(DSPUnit: PFSoundDSPUnit): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ - Functions to get hold of FSOUND 'system DSP unit' handles. -} - -function FSOUND_DSP_GetClearUnit: PFSoundDSPUnit; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_DSP_GetSFXUnit: PFSoundDSPUnit; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_DSP_GetMusicUnit: PFSoundDSPUnit; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_DSP_GetFFTUnit: PFSoundDSPUnit; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_DSP_GetClipAndCopyUnit: PFSoundDSPUnit; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ - Miscellaneous DSP functions - Note for the spectrum analysis function to work, you have to enable the FFT DSP unit with - the following code FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(), TRUE); - It is off by default to save cpu usage. -} - -function FSOUND_DSP_MixBuffers(DestBuffer: Pointer; SrcBuffer: Pointer; Len: Integer; Freq: Integer; Vol: Integer; Pan: Integer; Mode: Cardinal): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -procedure FSOUND_DSP_ClearMixBuffer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_DSP_GetBufferLength: Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; { Length of each DSP update } -function FSOUND_DSP_GetBufferLengthTotal: Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; { Total buffer length due to FSOUND_SetBufferSize } -function FSOUND_DSP_GetSpectrum: PSingle; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; { Array of 512 floats - call FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(), TRUE)) for this to work. } - -{ ========================================================================== } -{ Reverb functions. (eax2/3 reverb) (NOT SUPPORTED IN LINUX/CE) } -{ ========================================================================== } - -{ - See structures above for definitions and information on the reverb parameters. -} - -function FSOUND_Reverb_SetProperties(var Prop: TFSoundReverbProperties): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Reverb_GetProperties(var Prop: TFSoundReverbProperties): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Reverb_SetChannelProperties(Channel: Integer; var Prop: TFSoundReverbChannelProperties): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Reverb_GetChannelProperties(Channel: Integer; var Prop: TFSoundReverbChannelProperties): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ ================================================ } -{ Recording functions (NOT SUPPORTED IN LINUX/MAC) } -{ ================================================ } - -{ - Recording initialization functions -} - -function FSOUND_Record_SetDriver(OutputType: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Record_GetNumDrivers: Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Record_GetDriverName(Id: Integer): PChar; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Record_GetDriver: Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ - Recording functionality. Only one recording session will work at a time. -} - -function FSOUND_Record_StartSample(Sptr: PFSoundSample; Loop: ByteBool): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Record_Stop: ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FSOUND_Record_GetPosition: Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ ============================================================================================= } -{ FMUSIC API (MOD,S3M,XM,IT,MIDI PLAYBACK) } -{ ============================================================================================= } - -{ - Song management / playback functions. -} - -function FMUSIC_LoadSong(const Name: PChar): PFMusicModule; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_LoadSongEx(Name_Or_Data: Pointer; Offset: Integer; Length: Integer; Mode: Cardinal; var SampleList: Integer; SampleListNum: Integer): PFMusicModule; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_GetOpenState(Module: PFMusicModule): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_FreeSong(Module: PFMusicModule): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_PlaySong(Module: PFMusicModule): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_StopSong(Module: PFMusicModule): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -procedure FMUSIC_StopAllSongs; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -function FMUSIC_SetZxxCallback(Module: PFMusicModule; Callback: TFMusicCallback): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_SetRowCallback(Module: PFMusicModule; Callback: TFMusicCallback; RowStep: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_SetOrderCallback(Module: PFMusicModule; Callback: TFMusicCallback; OrderStep: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_SetInstCallback(Module: PFMusicModule; Callback: TFMusicCallback; Instrument: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -function FMUSIC_SetSample(Module: PFMusicModule; SampNo: Integer; Sptr: PFSoundSample): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_SetUserData(Module: PFMusicModule; userdata: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_OptimizeChannels(Module: PFMusicModule; MaxChannels: Integer; MinVolume: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ - Runtime song functions. -} - -function FMUSIC_SetReverb(Reverb: ByteBool): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_SetLooping(Module: PFMusicModule; Looping: ByteBool): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_SetOrder(Module: PFMusicModule; Order: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_SetPaused(Module: PFMusicModule; Pause: ByteBool): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_SetMasterVolume(Module: PFMusicModule; Volume: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_SetMasterSpeed(Module: PFMusicModule; speed: Single): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_SetPanSeperation(Module: PFMusicModule; PanSep: Single): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ - Static song information functions. -} - -function FMUSIC_GetName(Module: PFMusicModule): PCHAR; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_GetType(Module: PFMusicModule): TFMusicTypes; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_GetNumOrders(Module: PFMusicModule): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_GetNumPatterns(Module: PFMusicModule): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_GetNumInstruments(Module: PFMusicModule): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_GetNumSamples(Module: PFMusicModule): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_GetNumChannels(Module: PFMusicModule): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_GetSample(Module: PFMusicModule; SampNo: Integer): PFSoundSample; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_GetPatternLength(Module: PFMusicModule; OrderNo: Integer): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ - Runtime song information. -} - -function FMUSIC_IsFinished(Module: PFMusicModule): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_IsPlaying(Module: PFMusicModule): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_GetMasterVolume(Module: PFMusicModule): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_GetGlobalVolume(Module: PFMusicModule): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_GetOrder(Module: PFMusicModule): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_GetPattern(Module: PFMusicModule): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_GetSpeed(Module: PFMusicModule): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_GetBPM(Module: PFMusicModule): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_GetRow(Module: PFMusicModule): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_GetPaused(Module: PFMusicModule): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_GetTime(Module: PFMusicModule): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_GetRealChannel(Module: PFMusicModule; modchannel: Integer): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; -function FMUSIC_GetUserData(Module: PFMusicModule): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -implementation - -const -{$IFDEF LINUX} - FMOD_DLL = 'libfmod.so'; -{$ELSE} -{$IFDEF MSWINDOWS} - FMOD_DLL = 'fmod.dll'; -{$ENDIF} -{$ENDIF} - -{ - Stub functions to allow applications to swap between static and dynamic with - no code changes at all. -} -function FMOD_Load(LibName: PChar): Boolean; -begin - Result := True; -end; - -procedure FMOD_Unload; -begin -end; - -function FSOUND_SetOutput; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_SetOutput@4' {$ENDIF}; -function FSOUND_SetDriver; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_SetDriver@4' {$ENDIF}; -function FSOUND_SetMixer; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_SetMixer@4' {$ENDIF}; -function FSOUND_SetBufferSize; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_SetBufferSize@4' {$ENDIF}; -function FSOUND_SetHWND; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_SetHWND@4' {$ENDIF}; -function FSOUND_SetMinHardwareChannels; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_SetMinHardwareChannels@4' {$ENDIF}; -function FSOUND_SetMaxHardwareChannels; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_SetMaxHardwareChannels@4' {$ENDIF}; -function FSOUND_SetMemorySystem; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_SetMemorySystem@20' {$ENDIF}; -function FSOUND_Init; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Init@12' {$ENDIF}; -procedure FSOUND_Close; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Close@0' {$ENDIF}; -procedure FSOUND_Update; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Update@0' {$ENDIF}; -procedure FSOUND_SetSpeakerMode; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_SetSpeakerMode@4' {$ENDIF}; -procedure FSOUND_SetSFXMasterVolume; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_SetSFXMasterVolume@4' {$ENDIF}; -procedure FSOUND_SetPanSeperation; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_SetPanSeperation@4' {$ENDIF}; -function FSOUND_GetError; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetError@0' {$ENDIF}; -function FSOUND_GetVersion; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetVersion@0' {$ENDIF}; -function FSOUND_GetOutput; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetOutput@0' {$ENDIF}; -function FSOUND_GetOutputHandle; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetOutputHandle@0' {$ENDIF}; -function FSOUND_GetDriver; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetDriver@0' {$ENDIF}; -function FSOUND_GetMixer; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetMixer@0' {$ENDIF}; -function FSOUND_GetNumDrivers; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetNumDrivers@0' {$ENDIF}; -function FSOUND_GetDriverName; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetDriverName@4' {$ENDIF}; -function FSOUND_GetDriverCaps; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetDriverCaps@8' {$ENDIF}; -function FSOUND_GetOutputRate; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetOutputRate@0' {$ENDIF}; -function FSOUND_GetMaxChannels; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetMaxChannels@0' {$ENDIF}; -function FSOUND_GetMaxSamples; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetMaxSamples@0' {$ENDIF}; -function FSOUND_GetSpeakerMode; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetSpeakerMode@0' {$ENDIF}; -function FSOUND_GetSFXMasterVolume; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetSFXMasterVolume@0' {$ENDIF}; -function FSOUND_GetNumHWChannels; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetNumHWChannels@12' {$ENDIF}; -function FSOUND_GetChannelsPlaying; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetChannelsPlaying@0' {$ENDIF}; -function FSOUND_GetCPUUsage; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetCPUUsage@0' {$ENDIF}; -procedure FSOUND_GetMemoryStats; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetMemoryStats@8' {$ENDIF}; -function FSOUND_Sample_Load; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Sample_Load@20' {$ENDIF}; -function FSOUND_Sample_Alloc; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Sample_Alloc@28' {$ENDIF}; -procedure FSOUND_Sample_Free; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Sample_Free@4' {$ENDIF}; -function FSOUND_Sample_Upload; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Sample_Upload@12' {$ENDIF}; -function FSOUND_Sample_Lock; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Sample_Lock@28' {$ENDIF}; -function FSOUND_Sample_Unlock; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Sample_Unlock@20' {$ENDIF}; -function FSOUND_Sample_SetMode; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Sample_SetMode@8' {$ENDIF}; -function FSOUND_Sample_SetLoopPoints; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Sample_SetLoopPoints@12' {$ENDIF}; -function FSOUND_Sample_SetDefaults; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Sample_SetDefaults@20' {$ENDIF}; -function FSOUND_Sample_SetDefaultsEx; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Sample_SetDefaultsEx@32' {$ENDIF}; -function FSOUND_Sample_SetMinMaxDistance; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Sample_SetMinMaxDistance@12' {$ENDIF}; -function FSOUND_Sample_SetMaxPlaybacks; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Sample_SetMaxPlaybacks@8' {$ENDIF}; -function FSOUND_Sample_Get; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Sample_Get@4' {$ENDIF}; -function FSOUND_Sample_GetName; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Sample_GetName@4' {$ENDIF}; -function FSOUND_Sample_GetLength; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Sample_GetLength@4' {$ENDIF}; -function FSOUND_Sample_GetLoopPoints; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Sample_GetLoopPoints@12' {$ENDIF}; -function FSOUND_Sample_GetDefaults; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Sample_GetDefaults@20' {$ENDIF}; -function FSOUND_Sample_GetDefaultsEx; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Sample_GetDefaultsEx@32' {$ENDIF}; -function FSOUND_Sample_GetMode; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Sample_GetMode@4' {$ENDIF}; -function FSOUND_Sample_GetMinMaxDistance; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Sample_GetMinMaxDistance@12' {$ENDIF}; -function FSOUND_PlaySound; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_PlaySound@8' {$ENDIF}; -function FSOUND_PlaySoundEx; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_PlaySoundEx@16' {$ENDIF}; -function FSOUND_StopSound; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_StopSound@4' {$ENDIF}; -function FSOUND_SetFrequency; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_SetFrequency@8' {$ENDIF}; -function FSOUND_SetVolume; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_SetVolume@8' {$ENDIF}; -function FSOUND_SetVolumeAbsolute; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_SetVolumeAbsolute@8' {$ENDIF}; -function FSOUND_SetPan; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_SetPan@8' {$ENDIF}; -function FSOUND_SetSurround; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_SetSurround@8' {$ENDIF}; -function FSOUND_SetMute; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_SetMute@8' {$ENDIF}; -function FSOUND_SetPriority; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_SetPriority@8' {$ENDIF}; -function FSOUND_SetReserved; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_SetReserved@8' {$ENDIF}; -function FSOUND_SetPaused; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_SetPaused@8' {$ENDIF}; -function FSOUND_SetLoopMode; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_SetLoopMode@8' {$ENDIF}; -function FSOUND_SetCurrentPosition; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_SetCurrentPosition@8' {$ENDIF}; -function FSOUND_3D_SetAttributes; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_3D_SetAttributes@12' {$ENDIF}; -function FSOUND_3D_SetMinMaxDistance; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_3D_SetMinMaxDistance@12' {$ENDIF}; -function FSOUND_IsPlaying; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_IsPlaying@4' {$ENDIF}; -function FSOUND_GetFrequency; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetFrequency@4' {$ENDIF}; -function FSOUND_GetVolume; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetVolume@4' {$ENDIF}; -function FSOUND_GetAmplitude; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetAmplitude@4' {$ENDIF}; -function FSOUND_GetPan; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetPan@4' {$ENDIF}; -function FSOUND_GetSurround; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetSurround@4' {$ENDIF}; -function FSOUND_GetMute; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetMute@4' {$ENDIF}; -function FSOUND_GetPriority; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetPriority@4' {$ENDIF}; -function FSOUND_GetReserved; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetReserved@4' {$ENDIF}; -function FSOUND_GetPaused; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetPaused@4' {$ENDIF}; -function FSOUND_GetLoopMode; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetLoopMode@4' {$ENDIF}; -function FSOUND_GetCurrentPosition; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetCurrentPosition@4' {$ENDIF}; -function FSOUND_GetCurrentSample; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetCurrentSample@4' {$ENDIF}; -function FSOUND_GetCurrentLevels; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetCurrentLevels@12' {$ENDIF}; -function FSOUND_GetNumSubChannels; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetNumSubChannels@4' {$ENDIF}; -function FSOUND_GetSubChannel; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_GetSubChannel@8' {$ENDIF}; -function FSOUND_3D_GetAttributes; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_3D_GetAttributes@12' {$ENDIF}; -function FSOUND_3D_GetMinMaxDistance; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_3D_GetMinMaxDistance@12' {$ENDIF}; -procedure FSOUND_3D_Listener_SetCurrent; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_3D_Listener_SetCurrent@8' {$ENDIF}; -procedure FSOUND_3D_Listener_SetAttributes; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_3D_Listener_SetAttributes@32' {$ENDIF}; -procedure FSOUND_3D_Listener_GetAttributes; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_3D_Listener_GetAttributes@32' {$ENDIF}; -procedure FSOUND_3D_SetDopplerFactor; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_3D_SetDopplerFactor@4' {$ENDIF}; -procedure FSOUND_3D_SetDistanceFactor; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_3D_SetDistanceFactor@4' {$ENDIF}; -procedure FSOUND_3D_SetRolloffFactor; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_3D_SetRolloffFactor@4' {$ENDIF}; -function FSOUND_FX_Enable; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_FX_Enable@8' {$ENDIF}; -function FSOUND_FX_Disable; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_FX_Disable@4' {$ENDIF}; -function FSOUND_FX_SetChorus; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_FX_SetChorus@32' {$ENDIF}; -function FSOUND_FX_SetCompressor; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_FX_SetCompressor@28' {$ENDIF}; -function FSOUND_FX_SetDistortion; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_FX_SetDistortion@24' {$ENDIF}; -function FSOUND_FX_SetEcho; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_FX_SetEcho@24' {$ENDIF}; -function FSOUND_FX_SetFlanger; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_FX_SetFlanger@32' {$ENDIF}; -function FSOUND_FX_SetGargle; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_FX_SetGargle@12' {$ENDIF}; -function FSOUND_FX_SetI3DL2Reverb; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_FX_SetI3DL2Reverb@52' {$ENDIF}; -function FSOUND_FX_SetParamEQ; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_FX_SetParamEQ@16' {$ENDIF}; -function FSOUND_FX_SetWavesReverb; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_FX_SetWavesReverb@20' {$ENDIF}; -function FSOUND_Stream_Open; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_Open@16' {$ENDIF}; -function FSOUND_Stream_Create; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_Create@20' {$ENDIF}; -function FSOUND_Stream_Play; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_Play@8' {$ENDIF}; -function FSOUND_Stream_PlayEx; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_PlayEx@16' {$ENDIF}; -function FSOUND_Stream_Stop; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_Stop@4' {$ENDIF}; -function FSOUND_Stream_Close; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_Close@4' {$ENDIF}; -function FSOUND_Stream_SetEndCallback; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_SetEndCallback@12' {$ENDIF}; -function FSOUND_Stream_SetSyncCallback; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_SetSyncCallback@12' {$ENDIF}; -function FSOUND_Stream_GetSample; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_GetSample@4' {$ENDIF}; -function FSOUND_Stream_CreateDSP; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_CreateDSP@16' {$ENDIF}; -function FSOUND_Stream_SetBufferSize; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_SetBufferSize@4' {$ENDIF}; -function FSOUND_Stream_SetPosition; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_SetPosition@8' {$ENDIF}; -function FSOUND_Stream_GetPosition; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_GetPosition@4' {$ENDIF}; -function FSOUND_Stream_SetTime; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_SetTime@8' {$ENDIF}; -function FSOUND_Stream_GetTime; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_GetTime@4' {$ENDIF}; -function FSOUND_Stream_GetLength; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_GetLength@4' {$ENDIF}; -function FSOUND_Stream_GetLengthMs; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_GetLengthMs@4' {$ENDIF}; -function FSOUND_Stream_SetMode; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_SetMode@8' {$ENDIF}; -function FSOUND_Stream_GetMode; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_GetMode@4' {$ENDIF}; -function FSOUND_Stream_SetLoopPoints; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_SetLoopPoints@12' {$ENDIF}; -function FSOUND_Stream_SetLoopCount; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_SetLoopCount@8' {$ENDIF}; -function FSOUND_Stream_AddSyncPoint; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_AddSyncPoint@12' {$ENDIF}; -function FSOUND_Stream_DeleteSyncPoint; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_DeleteSyncPoint@4' {$ENDIF}; -function FSOUND_Stream_GetNumSyncPoints; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_GetNumSyncPoints@4' {$ENDIF}; -function FSOUND_Stream_GetSyncPoint; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_GetSyncPoint@8' {$ENDIF}; -function FSOUND_Stream_GetSyncPointInfo; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_GetSyncPointInfo@8' {$ENDIF}; -function FSOUND_Stream_GetOpenState; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_GetOpenState@4' {$ENDIF}; -function FSOUND_Stream_SetSubStream; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_SetSubStream@8' {$ENDIF}; -function FSOUND_Stream_GetNumSubStreams; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_GetNumSubStreams@4' {$ENDIF}; -function FSOUND_Stream_SetSubStreamSentence; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_SetSubStreamSentence@12' {$ENDIF}; -function FSOUND_Stream_GetNumTagFields; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_GetNumTagFields@8' {$ENDIF}; -function FSOUND_Stream_GetTagField; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_GetTagField@24' {$ENDIF}; -function FSOUND_Stream_FindTagField; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_FindTagField@20' {$ENDIF}; -function FSOUND_Stream_Net_SetProxy; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_Net_SetProxy@4' {$ENDIF}; -function FSOUND_Stream_Net_GetLastServerStatus; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_Net_GetLastServerStatus@0' {$ENDIF}; -function FSOUND_Stream_Net_SetBufferProperties; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_Net_SetBufferProperties@12' {$ENDIF}; -function FSOUND_Stream_Net_GetBufferProperties; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_Net_GetBufferProperties@12' {$ENDIF}; -function FSOUND_Stream_Net_SetMetadataCallback; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_Net_SetMetadataCallback@12' {$ENDIF}; -function FSOUND_Stream_Net_GetStatus; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Stream_Net_GetStatus@20' {$ENDIF}; -function FSOUND_CD_Play; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_CD_Play@8' {$ENDIF}; -procedure FSOUND_CD_SetPlayMode; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_CD_SetPlayMode@8' {$ENDIF}; -function FSOUND_CD_Stop; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_CD_Stop@4' {$ENDIF}; -function FSOUND_CD_SetPaused; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_CD_SetPaused@8' {$ENDIF}; -function FSOUND_CD_SetVolume; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_CD_SetVolume@8' {$ENDIF}; -function FSOUND_CD_SetTrackTime; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_CD_SetTrackTime@8' {$ENDIF}; -function FSOUND_CD_OpenTray; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_CD_OpenTray@8' {$ENDIF}; -function FSOUND_CD_GetPaused; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_CD_GetPaused@4' {$ENDIF}; -function FSOUND_CD_GetTrack; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_CD_GetTrack@4' {$ENDIF}; -function FSOUND_CD_GetNumTracks; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_CD_GetNumTracks@4' {$ENDIF}; -function FSOUND_CD_GetVolume; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_CD_GetVolume@4' {$ENDIF}; -function FSOUND_CD_GetTrackLength; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_CD_GetTrackLength@8' {$ENDIF}; -function FSOUND_CD_GetTrackTime; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_CD_GetTrackTime@4' {$ENDIF}; -function FSOUND_DSP_Create; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_DSP_Create@12' {$ENDIF}; -procedure FSOUND_DSP_Free; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_DSP_Free@4' {$ENDIF}; -procedure FSOUND_DSP_SetPriority; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_DSP_SetPriority@8' {$ENDIF}; -function FSOUND_DSP_GetPriority; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_DSP_GetPriority@4' {$ENDIF}; -procedure FSOUND_DSP_SetActive; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_DSP_SetActive@8' {$ENDIF}; -function FSOUND_DSP_GetActive; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_DSP_GetActive@4' {$ENDIF}; -function FSOUND_DSP_GetClearUnit; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_DSP_GetClearUnit@0' {$ENDIF}; -function FSOUND_DSP_GetSFXUnit; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_DSP_GetSFXUnit@0' {$ENDIF}; -function FSOUND_DSP_GetMusicUnit; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_DSP_GetMusicUnit@0' {$ENDIF}; -function FSOUND_DSP_GetClipAndCopyUnit; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_DSP_GetClipAndCopyUnit@0' {$ENDIF}; -function FSOUND_DSP_GetFFTUnit; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_DSP_GetFFTUnit@0' {$ENDIF}; -function FSOUND_DSP_MixBuffers; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_DSP_MixBuffers@28' {$ENDIF}; -procedure FSOUND_DSP_ClearMixBuffer; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_DSP_ClearMixBuffer@0' {$ENDIF}; -function FSOUND_DSP_GetBufferLength; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_DSP_GetBufferLength@0' {$ENDIF}; -function FSOUND_DSP_GetBufferLengthTotal; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_DSP_GetBufferLengthTotal@0' {$ENDIF}; -function FSOUND_DSP_GetSpectrum; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_DSP_GetSpectrum@0' {$ENDIF}; -function FSOUND_Reverb_SetProperties; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Reverb_SetProperties@4' {$ENDIF}; -function FSOUND_Reverb_GetProperties; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Reverb_GetProperties@4' {$ENDIF}; -function FSOUND_Reverb_SetChannelProperties; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Reverb_SetChannelProperties@8' {$ENDIF}; -function FSOUND_Reverb_GetChannelProperties; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Reverb_GetChannelProperties@8' {$ENDIF}; -function FSOUND_Record_SetDriver; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Record_SetDriver@4' {$ENDIF}; -function FSOUND_Record_GetNumDrivers; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Record_GetNumDrivers@0' {$ENDIF}; -function FSOUND_Record_GetDriverName; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Record_GetDriverName@4' {$ENDIF}; -function FSOUND_Record_GetDriver; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Record_GetDriver@0' {$ENDIF}; -function FSOUND_Record_StartSample; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Record_StartSample@8' {$ENDIF}; -function FSOUND_Record_Stop; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Record_Stop@0' {$ENDIF}; -function FSOUND_Record_GetPosition; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_Record_GetPosition@0' {$ENDIF}; -procedure FSOUND_File_SetCallbacks; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FSOUND_File_SetCallbacks@20' {$ENDIF}; -function FMUSIC_LoadSong; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_LoadSong@4' {$ENDIF}; -function FMUSIC_LoadSongEx; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_LoadSongEx@24' {$ENDIF}; -function FMUSIC_GetOpenState; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_GetOpenState@4' {$ENDIF}; -function FMUSIC_FreeSong; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_FreeSong@4' {$ENDIF}; -function FMUSIC_PlaySong; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_PlaySong@4' {$ENDIF}; -function FMUSIC_StopSong; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_StopSong@4' {$ENDIF}; -procedure FMUSIC_StopAllSongs; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_StopAllSongs@0' {$ENDIF}; -function FMUSIC_SetZxxCallback; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_SetZxxCallback@8' {$ENDIF}; -function FMUSIC_SetRowCallback; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_SetRowCallback@12' {$ENDIF}; -function FMUSIC_SetOrderCallback; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_SetOrderCallback@12' {$ENDIF}; -function FMUSIC_SetInstCallback; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_SetInstCallback@12' {$ENDIF}; -function FMUSIC_SetSample; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_SetSample@12' {$ENDIF}; -function FMUSIC_SetUserData; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_SetUserData@8' {$ENDIF}; -function FMUSIC_OptimizeChannels; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_OptimizeChannels@12' {$ENDIF}; -function FMUSIC_SetReverb; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_SetReverb@4' {$ENDIF}; -function FMUSIC_SetLooping; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_SetLooping@8' {$ENDIF}; -function FMUSIC_SetOrder; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_SetOrder@8' {$ENDIF}; -function FMUSIC_SetPaused; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_SetPaused@8' {$ENDIF}; -function FMUSIC_SetMasterVolume; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_SetMasterVolume@8' {$ENDIF}; -function FMUSIC_SetMasterSpeed; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_SetMasterSpeed@8' {$ENDIF}; -function FMUSIC_SetPanSeperation; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_SetPanSeperation@8' {$ENDIF}; -function FMUSIC_GetName; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_GetName@4' {$ENDIF}; -function FMUSIC_GetType; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_GetType@4' {$ENDIF}; -function FMUSIC_GetNumOrders; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_GetNumOrders@4' {$ENDIF}; -function FMUSIC_GetNumPatterns; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_GetNumPatterns@4' {$ENDIF}; -function FMUSIC_GetNumInstruments; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_GetNumInstruments@4' {$ENDIF}; -function FMUSIC_GetNumSamples; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_GetNumSamples@4' {$ENDIF}; -function FMUSIC_GetNumChannels; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_GetNumChannels@4' {$ENDIF}; -function FMUSIC_GetSample; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_GetSample@8' {$ENDIF}; -function FMUSIC_GetPatternLength; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_GetPatternLength@8' {$ENDIF}; -function FMUSIC_IsFinished; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_IsFinished@4' {$ENDIF}; -function FMUSIC_IsPlaying; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_IsPlaying@4' {$ENDIF}; -function FMUSIC_GetMasterVolume; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_GetMasterVolume@4' {$ENDIF}; -function FMUSIC_GetGlobalVolume; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_GetGlobalVolume@4' {$ENDIF}; -function FMUSIC_GetOrder; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_GetOrder@4' {$ENDIF}; -function FMUSIC_GetPattern; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_GetPattern@4' {$ENDIF}; -function FMUSIC_GetSpeed; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_GetSpeed@4' {$ENDIF}; -function FMUSIC_GetBPM; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_GetBPM@4' {$ENDIF}; -function FMUSIC_GetRow; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_GetRow@4' {$ENDIF}; -function FMUSIC_GetPaused; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_GetPaused@4' {$ENDIF}; -function FMUSIC_GetTime; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_GetTime@4' {$ENDIF}; -function FMUSIC_GetRealChannel; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_GetRealChannel@8' {$ENDIF}; -function FMUSIC_GetUserData; external FMOD_DLL {$IFDEF MSWINDOWS} name '_FMUSIC_GetUserData@4' {$ENDIF}; - -var - Saved8087CW: Word; - -{$ifdef FPC} //FPC do not have this function in its RTL -const - Default8087CW = $1332; //according to the FPC site it's the value used in the - //startup code. -procedure Set8087CW( value :word ); Assembler; -asm - FLDCW value -end; -{$endif} - - -initialization - { Save the current FPU state and then disable FPU exceptions } - Saved8087CW := Default8087CW; - Set8087CW($133f); { Disable all fpu exceptions } - -finalization - { Reset the FPU to the previous state } - Set8087CW(Saved8087CW); - -end. diff --git a/#ThirdParty/fmodapi375win/api/delphi/fmoddyn.pas b/#ThirdParty/fmodapi375win/api/delphi/fmoddyn.pas deleted file mode 100644 index 9fbede2..0000000 --- a/#ThirdParty/fmodapi375win/api/delphi/fmoddyn.pas +++ /dev/null @@ -1,864 +0,0 @@ -{============================================================================================ } -{ FMOD Main header file. Copyright (c), FireLight Technologies Pty, Ltd. 1999-2003. } -{ =========================================================================================== } -{ - NOTE: For the demos to run you must have either fmod.dll (in Windows) - or libfmod-3.75.so (in Linux) installed. - - In Windows, copy the fmod.dll file found in the api directory to either of - the following locations (in order of preference) - - your application directory - - Windows\System (95/98) or WinNT\System32 (NT/2000/XP) - - In Linux, make sure you are signed in as root and copy the libfmod-3.75.so - file from the api directory to your /usr/lib/ directory. - Then via a command line, navigate to the /usr/lib/ directory and create - a symbolic link between libfmod-3.75.so and libfmod.so. This is done with - the following command (assuming you are in /usr/lib/)... - ln -s libfmod-3.75.so libfmod.so. -} -{ =============================================================================================== } - -unit fmoddyn; - -{ - Disable assertions by changing the following compiler directive to OFF. - Assertions are used to check the functions are correctly loaded when using - dynamic loading. -} -{$ASSERTIONS ON} - -interface - -uses -{$IFDEF MSWINDOWS} - Windows, -{$ENDIF} - fmodtypes; - -{ - Disable warning for unsafe types in Delphi 7 -} -{$IFDEF VER150} -{$WARN UNSAFE_TYPE OFF} -{$ENDIF} - -//=============================================================================================== -// FUNCTION PROTOTYPES -//=============================================================================================== - -{ ================================== } -{ Library load/unload functions. } -{ ================================== } - -{ - If no library name is passed to FMOD_Load, then the default library name - used. -} - -function FMOD_Load(LibName: PChar {$ifndef FPC}= nil{$endif}): Boolean; -procedure FMOD_Unload; - -{ ================================== } -{ Initialization / Global functions. } -{ ================================== } - -{ - Pre FSOUND_Init functions. These can't be called after FSOUND_Init is - called (they will fail). They set up FMOD system functionality. -} - -var - FSOUND_SetOutput: function (OutputType: TFSoundOutputTypes): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_SetDriver: function (Driver: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_SetMixer: function (Mixer: TFSoundMixerTypes): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_SetBufferSize: function (LenMs: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_SetHWND: function (Hwnd: THandle): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_SetMinHardwareChannels: function (Min: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_SetMaxHardwareChannels: function (Max: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_SetMemorySystem: function (Pool: Pointer; - PoolLen: Integer; - UserAlloc: TFSoundAllocCallback; - UserRealloc: TFSoundReallocCallback; - UserFree: TFSoundFreeCallback): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ - Main initialization / closedown functions - Note : Use FSOUND_INIT_USEDEFAULTMIDISYNTH with FSOUND_Init for software override with MIDI playback. - : Use FSOUND_INIT_GLOBALFOCUS with FSOUND_Init to make sound audible - no matter which window is in focus. (FSOUND_OUTPUT_DSOUND only) -} - -var - FSOUND_Init: function (MixRate: Integer; MaxSoftwareChannels: Integer; Flags: Cardinal): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Close: procedure; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ - Runtime system level functions -} - -var - FSOUND_Update: procedure; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; // This is called to update 3d sound / non-realtime output - FSOUND_SetSpeakerMode: procedure (SpeakerMode: Cardinal); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_SetSFXMasterVolume: procedure (Volume: Integer); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_SetPanSeperation: procedure (PanSep: Single); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_File_SetCallbacks: procedure (OpenCallback: TFSoundOpenCallback; - CloseCallback: TFSoundCloseCallback; - ReadCallback: TFSoundReadCallback; - SeekCallback: TFSoundSeekCallback; - TellCallback: TFSoundTellCallback); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ - System information functions -} - -var - FSOUND_GetError: function: TFModErrors; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetVersion: function: Single; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetOutput: function: TFSoundOutputTypes; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetOutputHandle: function: Pointer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetDriver: function: Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetMixer: function: TFSoundMixerTypes; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetNumDrivers: function: Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetDriverName: function (Id: Integer): PChar; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetDriverCaps: function (Id: Integer; var Caps: Cardinal): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -var - FSOUND_GetOutputRate: function: Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetMaxChannels: function: Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetMaxSamples: function: Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetSpeakerMode: function: Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetSFXMasterVolume: function: Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetNumHWChannels: function (var Num2D: Integer; var Num3D: Integer; var Total: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetChannelsPlaying: function: Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetCPUUsage: function: Single; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetMemoryStats: Procedure (var CurrentAlloced: Cardinal; var MaxAlloced: Cardinal); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ =================================== } -{ Sample management / load functions. } -{ =================================== } - -{ - Sample creation and management functions - Note : Use FSOUND_LOADMEMORY flag with FSOUND_Sample_Load to load from memory. - Use FSOUND_LOADRAW flag with FSOUND_Sample_Load to treat as as raw pcm data. -} - -var - FSOUND_Sample_Load: function (Index: Integer; const NameOrData: PChar; Mode: Cardinal; Offset: Integer; Length: Integer): PFSoundSample; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Sample_Alloc: function (Index: Integer; Length: Integer; Mode: Cardinal; DefFreq: Integer; DefVol: Integer; DefPan: Integer; DefPri: Integer): PFSoundSample; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Sample_Free: procedure (Sptr: PFSoundSample); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Sample_Upload: function (Sptr: PFSoundSample; SrcData: Pointer; Mode: Cardinal): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Sample_Lock: function (Sptr: PFSoundSample; Offset: Integer; Length: Integer; var Ptr1: Pointer; var Ptr2: Pointer; var Len1: Cardinal; var Len2: Cardinal): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Sample_Unlock: function (Sptr: PFSoundSample; Ptr1: Pointer; Ptr2: Pointer; Len1: Cardinal; Len2: Cardinal): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ - Sample control functions -} - -var - FSOUND_Sample_SetMode: function (Sptr: PFSoundSample; Mode: Cardinal): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Sample_SetLoopPoints: function (Sptr: PFSoundSample; LoopStart, LoopEnd: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Sample_SetDefaults: function (Sptr: PFSoundSample; DefFreq, DefVol, DefPan, DefPri: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Sample_SetDefaultsEx: function (Sptr: PFSoundSample; DefFreq, DefVol, DefPan, DefPri, VarFreq, VarVol, VarPan: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Sample_SetMinMaxDistance: function (Sptr: PFSoundSample; Min, Max: Single): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Sample_SetMaxPlaybacks: function (Sptr: PFSoundSample; Max: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ - Sample information functions -} - -var - FSOUND_Sample_Get: function (SampNo: Integer): PFSoundSample; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Sample_GetName: function (Sptr: PFSoundSample): PCHAR; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Sample_GetLength: function (Sptr: PFSoundSample): Cardinal; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Sample_GetLoopPoints: function (Sptr: PFSoundSample; var LoopStart: Integer; var LoopEnd: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Sample_GetDefaults: function (Sptr: PFSoundSample; var DefFreq: Integer; var DefVol: Integer; var DefPan: Integer; var DefPri: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Sample_GetDefaultsEx: function (Sptr: PFSoundSample; var DefFreq: Integer; var DefVol: Integer; var DefPan: Integer; var DefPri: Integer; var VarFreq: Integer; var VarVol: Integer; var VarPan): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Sample_GetMode: function (Sptr: PFSoundSample): Cardinal; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Sample_GetMinMaxDistance: function (Sptr: PFSoundSample; var Min: Single; var Max: Single): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ ============================ } -{ Channel control functions. } -{ ============================ } - -{ - Playing and stopping sounds. - Note : Use FSOUND_FREE as the 'channel' variable, to let FMOD pick a free channel for you. - Use FSOUND_ALL as the 'channel' variable to control ALL channels with one function call! -} - -var - FSOUND_PlaySound: function (Channel: Integer; Sptr: PFSoundSample): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_PlaySoundEx: function (Channel: Integer; Sptr: PFSoundSample; Dsp: PFSoundDSPUnit; StartPaused: ByteBool): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_StopSound: function (Channel: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ - Functions to control playback of a channel. -} - -var - FSOUND_SetFrequency: function (Channel: Integer; Freq: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_SetVolume: function (Channel: Integer; Vol: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_SetVolumeAbsolute: function (Channel: Integer; Vol: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_SetPan: function (Channel: Integer; Pan: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_SetSurround: function (Channel: Integer; Surround: ByteBool): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_SetMute: function (Channel: Integer; Mute: ByteBool): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_SetPriority: function (Channel: Integer; Priority: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_SetReserved: function (Channel: Integer; Reserved: ByteBool): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_SetPaused: function (Channel: Integer; Paused: ByteBool): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_SetLoopMode: function (Channel: Integer; LoopMode: Cardinal): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_SetCurrentPosition: function (Channel: Integer; Offset: Cardinal): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_3D_SetAttributes: function (Channel: Integer; Pos: PFSoundVector; Vel: PFSoundVector): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_3D_SetMinMaxDistance: function (Channel: Integer; Min: Single; Max: Single): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ - Channel information functions -} - -var - FSOUND_IsPlaying: function (Channel: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetFrequency: function (Channel: Integer): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetVolume: function (Channel: Integer): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetAmplitude: function (Channel: Integer): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetPan: function (Channel: Integer): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetSurround: function (Channel: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetMute: function (Channel: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetPriority: function (Channel: Integer): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetReserved: function (Channel: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetPaused: function (Channel: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetLoopMode: function (Channel: Integer): Cardinal; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetCurrentPosition: function (Channel: Integer): Cardinal; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetCurrentSample: function (Channel: Integer): PFSoundSample; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetCurrentLevels: function (Channel: Integer; L, R: PSingle): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetNumSubChannels: function (Channel: Integer): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_GetSubChannel: function (Channel: Integer; SubChannel: Integer): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_3D_GetAttributes: function (Channel: Integer; Pos: PFSoundVector; Vel: PFSoundVector): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_3D_GetMinMaxDistance: function (Channel: Integer; var Min: Single; var Max: Single): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ =================== } -{ 3D sound functions. } -{ =================== } - -{ - See also 3d sample and channel based functions above. - Call FSOUND_Update once a frame to process 3d information. -} - -var - FSOUND_3D_Listener_SetCurrent: procedure (current: Integer); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_3D_Listener_SetAttributes: procedure (Pos: PFSoundVector; Vel: PFSoundVector; - fx: Single; fy: Single; fz: Single; - tx: Single; ty: Single; tz: Single); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_3D_Listener_GetAttributes: procedure (Pos: PFSoundVector; Vel: PFSoundVector; - fx: PSingle; fy: PSingle; fz: PSingle; - tx: PSingle; ty: PSingle; tz: PSingle); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_3D_SetDopplerFactor: procedure (Scale: Single); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_3D_SetDistanceFactor: procedure (Scale: Single); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_3D_SetRolloffFactor: procedure (Scale: Single); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ =================== } -{ FX functions. } -{ =================== } - -{ - Functions to control DX8 only effects processing. - - - FX enabled samples can only be played once at a time, not multiple times at once. - - Sounds have to be created with FSOUND_HW2D or FSOUND_HW3D for this to work. - - FSOUND_INIT_ENABLESYSTEMCHANNELFX can be used to apply hardware effect processing to the - global mixed output of FMOD's software channels. - - FSOUND_FX_Enable returns an FX handle that you can use to alter fx parameters. - - FSOUND_FX_Enable can be called multiple times in a row, even on the same FX type, - it will return a unique handle for each FX. - - FSOUND_FX_Enable cannot be called if the sound is playing or locked. - - Stopping or starting a sound resets all FX and they must be re-enabled each time - if this happens. -} - -var - FSOUND_FX_Enable: function (Channel: Integer; Fx: TFSoundFXModes): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; { Set bits to enable following fx } - FSOUND_FX_Disable: function (Channel: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - - FSOUND_FX_SetChorus: function (FXId: Integer; WetDryMix, Depth, Feedback, Frequency: Single; Waveform: Integer; Delay: Single; Phase: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_FX_SetCompressor: function (FXId: Integer; Gain, Attack, Release, Threshold, Ratio, Predelay: Single): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_FX_SetDistortion: function (FXId: Integer; Gain, Edge, PostEQCenterFrequency, PostEQBandwidth, PreLowpassCutoff: Single): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_FX_SetEcho: function (FXId: Integer; WetDryMix, Feedback, LeftDelay, RightDelay: Single; PanDelay: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_FX_SetFlanger: function (FXId: Integer; WetDryMix, Depth, Feedback, Frequency: Single; Waveform: Integer; Delay: Single; Phase: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_FX_SetGargle: function (FXId, RateHz, WaveShape: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_FX_SetI3DL2Reverb: function (FXId, Room, RoomHF: Integer; RoomRolloffFactor, DecayTime, DecayHFRatio: Single; Reflections: Integer; ReflectionsDelay: Single; Reverb: Integer; ReverbDelay, Diffusion, Density, HFReference: Single): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_FX_SetParamEQ: function (FXId: Integer; Center, Bandwidth, Gain: Single): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_FX_SetWavesReverb: function (FXId: Integer; InGain, ReverbMix, ReverbTime, HighFreqRTRatio: Single): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ ========================= } -{ File Streaming functions. } -{ ========================= } - -{ - Note : Use FSOUND_LOADMEMORY flag with FSOUND_Stream_Open to stream from memory. - Use FSOUND_LOADRAW flag with FSOUND_Stream_Open to treat stream as raw pcm data. - Use FSOUND_MPEGACCURATE flag with FSOUND_Stream_Open to open mpegs in 'accurate mode' for settime/gettime/getlengthms. - Use FSOUND_FREE as the 'channel' variable, to let FMOD pick a free channel for you. -} - -var - // call this before opening streams, not after - FSOUND_Stream_SetBufferSize: function (Ms: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - - FSOUND_Stream_Open: function(const name_or_data: PChar; Mode: Cardinal; Offset: Integer; Length: Integer): PFSoundStream; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Stream_Create: function (Callback: TFSoundStreamCallback; Length: Integer; Mode: Cardinal; SampleRate: Integer; UserData: Integer): PFSoundStream; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Stream_Close: function(Stream: PFSoundStream): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - - FSOUND_Stream_Play: function(Channel: Integer; Stream: PFSoundStream): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Stream_PlayEx: function (Channel: Integer; Stream: PFSoundStream; Dsp: PFSoundDSPUnit; StartPaused: ByteBool): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Stream_Stop: function(Stream: PFSoundStream): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - - FSOUND_Stream_SetPosition: function (Stream: PFSoundStream; Position: Cardinal): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Stream_GetPosition: function (Stream: PFSoundStream): Cardinal; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Stream_SetTime: function (Stream: PFSoundStream; Ms: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Stream_GetTime: function (Stream: PFSoundStream): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Stream_GetLength: function (Stream: PFSoundStream): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Stream_GetLengthMs: function (Stream: PFSoundStream): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - - FSOUND_Stream_SetMode: function (Stream: PFSoundStream; mode: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Stream_GetMode: function (Stream: PFSoundStream): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Stream_SetLoopPoints: function (Stream: PFSoundStream; LoopStartPCM, LoopEndPCM: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Stream_SetLoopCount: function (Stream: PFSoundStream; Count: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Stream_GetOpenState: function (Stream: PFSoundStream): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Stream_GetSample: function (Stream: PFSoundStream): PFSoundSample; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; { Every stream contains a sample to play back on } - FSOUND_Stream_CreateDSP: function (Stream: PFSoundStream; Callback: TFSoundDSPCallback; Priority: Integer; Param: Integer): PFSoundDSPUnit; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - - FSOUND_Stream_SetEndCallback: function (Stream: PFSoundStream; Callback: TFSoundStreamCallback; UserData: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Stream_SetSyncCallback: function (Stream: PFSoundStream; Callback: TFSoundStreamCallback; UserData: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - - FSOUND_Stream_AddSyncPoint: function (Stream: PFSoundStream; PCMOffset: Cardinal; Name: PChar): PFSyncPoint; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Stream_DeleteSyncPoint: function (Point: PFSyncPoint): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Stream_GetNumSyncPoints: function (Stream: PFSoundStream): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Stream_GetSyncPoint: function (Stream: PFSoundStream; Index: Integer): PFSyncPoint; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Stream_GetSyncPointInfo: function (Point: PFSyncPoint; var PCMOffset: Cardinal): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - - FSOUND_Stream_SetSubStream: function (Stream: PFSoundStream; Index: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Stream_GetNumSubStreams: function (Stream: PFSoundStream): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Stream_SetSubStreamSentence: function (Stream: PFSoundStream; var sentencelist: Cardinal; numitems: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - - FSOUND_Stream_GetNumTagFields: function (Stream: PFSoundStream; var Num: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Stream_GetTagField: function (Stream: PFSoundStream; Num: Integer; var _Type: TFSoundTagFieldType; var Name: PCHAR; var Value: Pointer; var Length: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Stream_FindTagField: function (Stream: PFSoundStream; _Type: TFSoundTagFieldType; Name: PChar; var Value: Pointer; var Length: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - - FSOUND_Stream_Net_SetProxy: function (Proxy: PChar): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Stream_Net_GetLastServerStatus: function: PChar; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Stream_Net_SetBufferProperties: function (BufferSize: Integer; PreBuffer_Percent: Integer; ReBuffer_Percent: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Stream_Net_GetBufferProperties: function (var Buffersize: Integer; var PreBuffer_Percent: Integer; var ReBuffer_Percent: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Stream_Net_SetMetadataCallback: function (Stream: PFSoundStream; Callback: TFMetaDataCallback; UserData: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Stream_Net_GetStatus: function (Stream: PFSoundStream; var Status: TFSoundStreamNetStatus; var BufferPercentUsed: Integer; var BitRate: Integer; var Flags: Cardinal): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ =================== } -{ CD audio functions. } -{ =================== } - -{ - Note : 0 = default cdrom. Otherwise specify the drive letter, for example. 'D'. -} - -var - FSOUND_CD_Play: function (Drive: Byte; Track: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_CD_SetPlayMode: procedure (Drive: Byte; Mode: Integer); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_CD_Stop: function (Drive: Byte): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_CD_SetPaused: function (Drive: Byte; Paused: ByteBool): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_CD_SetVolume: function (Drive: Byte; Volume: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_CD_SetTrackTime: function (Drive: Byte; ms: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_CD_OpenTray: function (Drive: Byte; Open: Byte): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -var - FSOUND_CD_GetPaused: function (Drive: Byte): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_CD_GetTrack: function (Drive: Byte): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_CD_GetNumTracks: function (Drive: Byte): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_CD_GetVolume: function (Drive: Byte): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_CD_GetTrackLength: function (Drive: Byte; Track: Integer): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_CD_GetTrackTime: function (Drive: Byte): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ ============== } -{ DSP functions. } -{ ============== } - -{ - DSP Unit control and information functions. -} - -var - FSOUND_DSP_Create: function (Callback: TFSoundDSPCallback; Priority: Integer; Param: Integer): PFSoundDSPUnit; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_DSP_Free: procedure (DSPUnit: PFSoundDSPUnit); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_DSP_SetPriority: procedure (DSPUnit: PFSoundDSPUnit; Priority: Integer); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_DSP_GetPriority: function (DSPUnit: PFSoundDSPUnit): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_DSP_SetActive: procedure (DSPUnit: PFSoundDSPUnit; Active: ByteBool); {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_DSP_GetActive: function (DSPUnit: PFSoundDSPUnit): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ - Functions to get hold of FSOUND 'system DSP unit' handles. -} - -var - FSOUND_DSP_GetClearUnit: function: PFSoundDSPUnit; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_DSP_GetSFXUnit: function: PFSoundDSPUnit; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_DSP_GetMusicUnit: function: PFSoundDSPUnit; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_DSP_GetClipAndCopyUnit: function: PFSoundDSPUnit; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_DSP_GetFFTUnit: function: PFSoundDSPUnit; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ - Miscellaneous DSP functions - Note for the spectrum analysis function to work, you have to enable the FFT DSP unit with - the following code FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(), TRUE); - It is off by default to save cpu usage. -} - -var - FSOUND_DSP_MixBuffers: function (DestBuffer: Pointer; SrcBuffer: Pointer; Len: Integer; Freq: Integer; Vol: Integer; Pan: Integer; Mode: Cardinal): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_DSP_ClearMixBuffer: procedure; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_DSP_GetBufferLength: function: Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; { Length of each DSP update } - FSOUND_DSP_GetBufferLengthTotal: function: Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; { Total buffer length due to FSOUND_SetBufferSize } - FSOUND_DSP_GetSpectrum: function: PSingle; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; { Array of 512 floats - call FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(), TRUE)) for this to work. } - -{ ========================================================================== } -{ Reverb functions. (eax2/eax3 reverb) (NOT SUPPORTED IN LINUX/CE) } -{ ========================================================================== } - -{ - See structures above for definitions and information on the reverb parameters. -} - -var - FSOUND_Reverb_SetProperties: function (const Prop: TFSoundReverbProperties): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Reverb_GetProperties: function (var Prop: TFSoundReverbProperties): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Reverb_SetChannelProperties: function (Channel: Integer; var Prop: TFSoundReverbChannelProperties): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Reverb_GetChannelProperties: function (Channel: Integer; var Prop: TFSoundReverbChannelProperties): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ ================================================ } -{ Recording functions (NOT SUPPORTED IN LINUX/MAC) } -{ ================================================ } - -{ - Recording initialization functions -} - -var - FSOUND_Record_SetDriver: function (OutputType: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Record_GetNumDrivers: function: Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Record_GetDriverName: function (Id: Integer): PChar; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Record_GetDriver: function: Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ - Recording functionality. Only one recording session will work at a time. -} - -var - FSOUND_Record_StartSample: function (Sptr: PFSoundSample; Loop: ByteBool): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Record_Stop: function: ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FSOUND_Record_GetPosition: function: Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ ============================================================================================= } -{ FMUSIC API (MOD,S3M,XM,IT,MIDI PLAYBACK) } -{ ============================================================================================= } - -{ - Song management / playback functions. -} - -var - FMUSIC_LoadSong: function (const Name: PChar): PFMusicModule; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_LoadSongEx: function (Name_Or_Data: Pointer; Offset: Integer; Length: Integer; Mode: Cardinal; var SampleList: Integer; SampleListNum: Integer): PFMusicModule; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_GetOpenState: function (Module: PFMusicModule): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_FreeSong: function (Module: PFMusicModule): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_PlaySong: function (Module: PFMusicModule): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_StopSong: function (Module: PFMusicModule): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_StopAllSongs: procedure; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -var - FMUSIC_SetZxxCallback: function (Module: PFMusicModule; Callback: TFMusicCallback): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_SetRowCallback: function (Module: PFMusicModule; Callback: TFMusicCallback; RowStep: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_SetOrderCallback: function (Module: PFMusicModule; Callback: TFMusicCallback; OrderStep: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_SetInstCallback: function (Module: PFMusicModule; Callback: TFMusicCallback; Instrument: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -var - FMUSIC_SetSample: function (Module: PFMusicModule; SampNo: Integer; Sptr: PFSoundSample): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_SetUserData: function (Module: PFMusicModule; userdata: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_OptimizeChannels: function (Module: PFMusicModule; MaxChannels: Integer; MinVolume: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ - Runtime song functions. -} - -var - FMUSIC_SetReverb: function (Reverb: ByteBool): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_SetLooping: function (Module: PFMusicModule; Looping: ByteBool): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_SetOrder: function (Module: PFMusicModule; Order: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_SetPaused: function (Module: PFMusicModule; Pause: ByteBool): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_SetMasterVolume: function (Module: PFMusicModule; Volume: Integer): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_SetMasterSpeed: function (Module: PFMusicModule; Speed: Single): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_SetPanSeperation: function (Module: PFMusicModule; PanSep: Single): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ - Static song information functions. -} - -var - FMUSIC_GetName: function (Module: PFMusicModule): PCHAR; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_GetType: function (Module: PFMusicModule): TFMusicTypes; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_GetNumOrders: function (Module: PFMusicModule): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_GetNumPatterns: function (Module: PFMusicModule): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_GetNumInstruments: function (Module: PFMusicModule): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_GetNumSamples: function (Module: PFMusicModule): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_GetNumChannels: function (Module: PFMusicModule): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_GetSample: function (Module: PFMusicModule; SampNo: Integer): PFSoundSample; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_GetPatternLength: function (Module: PFMusicModule; OrderNo: Integer): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -{ - Runtime song information. -} - -var - FMUSIC_IsFinished: function (Module: PFMusicModule): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_IsPlaying: function (Module: PFMusicModule): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_GetMasterVolume: function (Module: PFMusicModule): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_GetGlobalVolume: function (Module: PFMusicModule): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_GetOrder: function (Module: PFMusicModule): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_GetPattern: function (Module: PFMusicModule): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_GetSpeed: function (Module: PFMusicModule): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_GetBPM: function (Module: PFMusicModule): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_GetRow: function (Module: PFMusicModule): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_GetPaused: function (Module: PFMusicModule): ByteBool; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_GetTime: function (Module: PFMusicModule): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_GetRealChannel: function (Module: PFMusicModule; ModChannel: Integer): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - FMUSIC_GetUserData: function (Module: PFMusicModule): Integer; {$IFDEF LINUX} cdecl {$ELSE} stdcall {$ENDIF}; - -implementation - -{$IFDEF LINUX} -uses - Libc; -{$ENDIF} - -const -{$IFDEF LINUX} - FMOD_DLL = 'libfmod.so'; -{$ELSE} -{$IFDEF MSWINDOWS} - FMOD_DLL = 'fmod.dll'; -{$ENDIF} -{$ENDIF} - -type -{$IFDEF LINUX} - TFMODModuleHandle = Pointer; -{$ELSE} - TFMODModuleHandle = HINST; -{$ENDIF} - -const -{$IFDEF LINUX} - INVALID_MODULEHANDLE_VALUE = TFMODModuleHandle(nil); -{$ELSE} - INVALID_MODULEHANDLE_VALUE = TFMODModuleHandle(0); -{$ENDIF} - -var - FMODHandle: TFMODModuleHandle; - -function GetAddress(Handle: TFMODModuleHandle; FuncName: PChar): Pointer; -begin -{$IFDEF MSWINDOWS} - Result := GetProcAddress(Handle, FuncName); -{$ELSE} - Result := dlsym(Handle, FuncName); -{$ENDIF} - Assert(Result <> nil, 'Failed to find ' + FuncName + ' in ' + FMOD_DLL); -end; - -function FMOD_Load(LibName: PChar): Boolean; -begin - Result := False; - - { Make sure the previous library is unloaded } - FMOD_Unload; - - { If no library name given, use the default library names } - if LibName = nil then - LibName := FMOD_DLL; - - { Load the library } -{$IFDEF MSWINDOWS} - FMODHandle := LoadLibrary(LibName); -{$ELSE} - FMODHandle := dlopen(LibName, RTLD_NOW); -{$ENDIF} - if FMODHandle = INVALID_MODULEHANDLE_VALUE then - Exit; - - { Get all the function addresses from the library } - FSOUND_SetOutput := GetAddress(FMODHandle, '_FSOUND_SetOutput@4'); - FSOUND_SetDriver := GetAddress(FMODHandle, '_FSOUND_SetDriver@4'); - FSOUND_SetMixer := GetAddress(FMODHandle, '_FSOUND_SetMixer@4'); - FSOUND_SetBufferSize := GetAddress(FMODHandle, '_FSOUND_SetBufferSize@4'); - FSOUND_SetHWND := GetAddress(FMODHandle, '_FSOUND_SetHWND@4'); - FSOUND_SetMinHardwareChannels := GetAddress(FMODHandle, '_FSOUND_SetMinHardwareChannels@4'); - FSOUND_SetMaxHardwareChannels := GetAddress(FMODHandle, '_FSOUND_SetMaxHardwareChannels@4'); - FSOUND_SetMemorySystem := GetAddress(FMODHandle, '_FSOUND_SetMemorySystem@20'); - FSOUND_Init := GetAddress(FMODHandle, '_FSOUND_Init@12'); - FSOUND_Close := GetAddress(FMODHandle, '_FSOUND_Close@0'); - FSOUND_Update := GetAddress(FMODHandle, '_FSOUND_Update@0'); - FSOUND_SetSpeakerMode := GetAddress(FMODHandle, '_FSOUND_SetSpeakerMode@4'); - FSOUND_SetSFXMasterVolume := GetAddress(FMODHandle, '_FSOUND_SetSFXMasterVolume@4'); - FSOUND_SetPanSeperation := GetAddress(FMODHandle, '_FSOUND_SetPanSeperation@4'); - FSOUND_GetError := GetAddress(FMODHandle, '_FSOUND_GetError@0'); - FSOUND_GetVersion := GetAddress(FMODHandle, '_FSOUND_GetVersion@0'); - FSOUND_GetOutput := GetAddress(FMODHandle, '_FSOUND_GetOutput@0'); - FSOUND_GetOutputHandle := GetAddress(FMODHandle, '_FSOUND_GetOutputHandle@0'); - FSOUND_GetDriver := GetAddress(FMODHandle, '_FSOUND_GetDriver@0'); - FSOUND_GetMixer := GetAddress(FMODHandle, '_FSOUND_GetMixer@0'); - FSOUND_GetNumDrivers := GetAddress(FMODHandle, '_FSOUND_GetNumDrivers@0'); - FSOUND_GetDriverName := GetAddress(FMODHandle, '_FSOUND_GetDriverName@4'); - FSOUND_GetDriverCaps := GetAddress(FMODHandle, '_FSOUND_GetDriverCaps@8'); - FSOUND_GetOutputRate := GetAddress(FMODHandle, '_FSOUND_GetOutputRate@0'); - FSOUND_GetMaxChannels := GetAddress(FMODHandle, '_FSOUND_GetMaxChannels@0'); - FSOUND_GetMaxSamples := GetAddress(FMODHandle, '_FSOUND_GetMaxSamples@0'); - FSOUND_GetSpeakerMode := GetAddress(FMODHandle, '_FSOUND_GetSpeakerMode@0'); - FSOUND_GetSFXMasterVolume := GetAddress(FMODHandle, '_FSOUND_GetSFXMasterVolume@0'); - FSOUND_GetNumHWChannels := GetAddress(FMODHandle, '_FSOUND_GetNumHWChannels@12'); - FSOUND_GetChannelsPlaying := GetAddress(FMODHandle, '_FSOUND_GetChannelsPlaying@0'); - FSOUND_GetCPUUsage := GetAddress(FMODHandle, '_FSOUND_GetCPUUsage@0'); - FSOUND_GetMemoryStats := GetAddress(FMODHandle, '_FSOUND_GetMemoryStats@8'); - FSOUND_Sample_Load := GetAddress(FMODHandle, '_FSOUND_Sample_Load@20'); - FSOUND_Sample_Alloc := GetAddress(FMODHandle, '_FSOUND_Sample_Alloc@28'); - FSOUND_Sample_Free := GetAddress(FMODHandle, '_FSOUND_Sample_Free@4'); - FSOUND_Sample_Upload := GetAddress(FMODHandle, '_FSOUND_Sample_Upload@12'); - FSOUND_Sample_Lock := GetAddress(FMODHandle, '_FSOUND_Sample_Lock@28'); - FSOUND_Sample_Unlock := GetAddress(FMODHandle, '_FSOUND_Sample_Unlock@20'); - FSOUND_Sample_SetMode := GetAddress(FMODHandle, '_FSOUND_Sample_SetMode@8'); - FSOUND_Sample_SetLoopPoints := GetAddress(FMODHandle, '_FSOUND_Sample_SetLoopPoints@12'); - FSOUND_Sample_SetDefaults := GetAddress(FMODHandle, '_FSOUND_Sample_SetDefaults@20'); - FSOUND_Sample_SetDefaultsEx := GetAddress(FMODHandle, '_FSOUND_Sample_SetDefaultsEx@32'); - FSOUND_Sample_SetMinMaxDistance := GetAddress(FMODHandle, '_FSOUND_Sample_SetMinMaxDistance@12'); - FSOUND_Sample_SetMaxPlaybacks := GetAddress(FMODHandle, '_FSOUND_Sample_SetMaxPlaybacks@8'); - FSOUND_Sample_Get := GetAddress(FMODHandle, '_FSOUND_Sample_Get@4'); - FSOUND_Sample_GetName := GetAddress(FMODHandle, '_FSOUND_Sample_GetName@4'); - FSOUND_Sample_GetLength := GetAddress(FMODHandle, '_FSOUND_Sample_GetLength@4'); - FSOUND_Sample_GetLoopPoints := GetAddress(FMODHandle, '_FSOUND_Sample_GetLoopPoints@12'); - FSOUND_Sample_GetDefaults := GetAddress(FMODHandle, '_FSOUND_Sample_GetDefaults@20'); - FSOUND_Sample_GetDefaultsEx := GetAddress(FMODHandle, '_FSOUND_Sample_GetDefaultsEx@32'); - FSOUND_Sample_GetMode := GetAddress(FMODHandle, '_FSOUND_Sample_GetMode@4'); - FSOUND_Sample_GetMinMaxDistance := GetAddress(FMODHandle, '_FSOUND_Sample_GetMinMaxDistance@12'); - FSOUND_PlaySound := GetAddress(FMODHandle, '_FSOUND_PlaySound@8'); - FSOUND_PlaySoundEx := GetAddress(FMODHandle, '_FSOUND_PlaySoundEx@16'); - FSOUND_StopSound := GetAddress(FMODHandle, '_FSOUND_StopSound@4'); - FSOUND_SetFrequency := GetAddress(FMODHandle, '_FSOUND_SetFrequency@8'); - FSOUND_SetVolume := GetAddress(FMODHandle, '_FSOUND_SetVolume@8'); - FSOUND_SetVolumeAbsolute := GetAddress(FMODHandle, '_FSOUND_SetVolumeAbsolute@8'); - FSOUND_SetPan := GetAddress(FMODHandle, '_FSOUND_SetPan@8'); - FSOUND_SetSurround := GetAddress(FMODHandle, '_FSOUND_SetSurround@8'); - FSOUND_SetMute := GetAddress(FMODHandle, '_FSOUND_SetMute@8'); - FSOUND_SetPriority := GetAddress(FMODHandle, '_FSOUND_SetPriority@8'); - FSOUND_SetReserved := GetAddress(FMODHandle, '_FSOUND_SetReserved@8'); - FSOUND_SetPaused := GetAddress(FMODHandle, '_FSOUND_SetPaused@8'); - FSOUND_SetLoopMode := GetAddress(FMODHandle, '_FSOUND_SetLoopMode@8'); - FSOUND_SetCurrentPosition := GetAddress(FMODHandle, '_FSOUND_SetCurrentPosition@8'); - FSOUND_3D_SetAttributes := GetAddress(FMODHandle, '_FSOUND_3D_SetAttributes@12'); - FSOUND_3D_SetMinMaxDistance := GetAddress(FMODHandle, '_FSOUND_3D_SetMinMaxDistance@12'); - FSOUND_IsPlaying := GetAddress(FMODHandle, '_FSOUND_IsPlaying@4'); - FSOUND_GetFrequency := GetAddress(FMODHandle, '_FSOUND_GetFrequency@4'); - FSOUND_GetVolume := GetAddress(FMODHandle, '_FSOUND_GetVolume@4'); - FSOUND_GetAmplitude := GetAddress(FMODHandle, '_FSOUND_GetAmplitude@4'); - FSOUND_GetPan := GetAddress(FMODHandle, '_FSOUND_GetPan@4'); - FSOUND_GetSurround := GetAddress(FMODHandle, '_FSOUND_GetSurround@4'); - FSOUND_GetMute := GetAddress(FMODHandle, '_FSOUND_GetMute@4'); - FSOUND_GetPriority := GetAddress(FMODHandle, '_FSOUND_GetPriority@4'); - FSOUND_GetReserved := GetAddress(FMODHandle, '_FSOUND_GetReserved@4'); - FSOUND_GetPaused := GetAddress(FMODHandle, '_FSOUND_GetPaused@4'); - FSOUND_GetLoopMode := GetAddress(FMODHandle, '_FSOUND_GetLoopMode@4'); - FSOUND_GetCurrentPosition := GetAddress(FMODHandle, '_FSOUND_GetCurrentPosition@4'); - FSOUND_GetCurrentSample := GetAddress(FMODHandle, '_FSOUND_GetCurrentSample@4'); - FSOUND_GetCurrentLevels := GetAddress(FMODHandle, '_FSOUND_GetCurrentLevels@12'); - FSOUND_GetNumSubChannels := GetAddress(FMODHandle, '_FSOUND_GetNumSubChannels@4'); - FSOUND_GetSubChannel := GetAddress(FMODHandle, '_FSOUND_GetSubChannel@8'); - FSOUND_3D_GetAttributes := GetAddress(FMODHandle, '_FSOUND_3D_GetAttributes@12'); - FSOUND_3D_GetMinMaxDistance := GetAddress(FMODHandle, '_FSOUND_3D_GetMinMaxDistance@12'); - FSOUND_3D_Listener_SetCurrent := GetAddress(FMODHandle, '_FSOUND_3D_Listener_SetCurrent@8'); - FSOUND_3D_Listener_SetAttributes := GetAddress(FMODHandle, '_FSOUND_3D_Listener_SetAttributes@32'); - FSOUND_3D_Listener_GetAttributes := GetAddress(FMODHandle, '_FSOUND_3D_Listener_GetAttributes@32'); - FSOUND_3D_SetDopplerFactor := GetAddress(FMODHandle, '_FSOUND_3D_SetDopplerFactor@4'); - FSOUND_3D_SetDistanceFactor := GetAddress(FMODHandle, '_FSOUND_3D_SetDistanceFactor@4'); - FSOUND_3D_SetRolloffFactor := GetAddress(FMODHandle, '_FSOUND_3D_SetRolloffFactor@4'); - FSOUND_FX_Enable := GetAddress(FMODHandle, '_FSOUND_FX_Enable@8'); - FSOUND_FX_SetChorus := GetAddress(FMODHandle, '_FSOUND_FX_SetChorus@32'); - FSOUND_FX_SetCompressor := GetAddress(FMODHandle, '_FSOUND_FX_SetCompressor@28'); - FSOUND_FX_SetDistortion := GetAddress(FMODHandle, '_FSOUND_FX_SetDistortion@24'); - FSOUND_FX_SetEcho := GetAddress(FMODHandle, '_FSOUND_FX_SetEcho@24'); - FSOUND_FX_SetFlanger := GetAddress(FMODHandle, '_FSOUND_FX_SetFlanger@32'); - FSOUND_FX_SetGargle := GetAddress(FMODHandle, '_FSOUND_FX_SetGargle@12'); - FSOUND_FX_SetI3DL2Reverb := GetAddress(FMODHandle, '_FSOUND_FX_SetI3DL2Reverb@52'); - FSOUND_FX_SetParamEQ := GetAddress(FMODHandle, '_FSOUND_FX_SetParamEQ@16'); - FSOUND_FX_SetWavesReverb := GetAddress(FMODHandle, '_FSOUND_FX_SetWavesReverb@20'); - FSOUND_Stream_Open := GetAddress(FMODHandle, '_FSOUND_Stream_Open@16'); - FSOUND_Stream_Create := GetAddress(FMODHandle, '_FSOUND_Stream_Create@20'); - FSOUND_Stream_Close := GetAddress(FMODHandle, '_FSOUND_Stream_Close@4'); - FSOUND_Stream_Play := GetAddress(FMODHandle, '_FSOUND_Stream_Play@8'); - FSOUND_Stream_PlayEx := GetAddress(FMODHandle, '_FSOUND_Stream_PlayEx@16'); - FSOUND_Stream_Stop := GetAddress(FMODHandle, '_FSOUND_Stream_Stop@4'); - FSOUND_Stream_SetEndCallback := GetAddress(FMODHandle, '_FSOUND_Stream_SetEndCallback@12'); - FSOUND_Stream_SetSyncCallback := GetAddress(FMODHandle, '_FSOUND_Stream_SetSyncCallback@12'); - FSOUND_Stream_GetSample := GetAddress(FMODHandle, '_FSOUND_Stream_GetSample@4'); - FSOUND_Stream_CreateDSP := GetAddress(FMODHandle, '_FSOUND_Stream_CreateDSP@16'); - FSOUND_Stream_SetBufferSize := GetAddress(FMODHandle, '_FSOUND_Stream_SetBufferSize@4'); - FSOUND_Stream_SetPosition := GetAddress(FMODHandle, '_FSOUND_Stream_SetPosition@8'); - FSOUND_Stream_GetPosition := GetAddress(FMODHandle, '_FSOUND_Stream_GetPosition@4'); - FSOUND_Stream_SetTime := GetAddress(FMODHandle, '_FSOUND_Stream_SetTime@8'); - FSOUND_Stream_GetTime := GetAddress(FMODHandle, '_FSOUND_Stream_GetTime@4'); - FSOUND_Stream_GetLength := GetAddress(FMODHandle, '_FSOUND_Stream_GetLength@4'); - FSOUND_Stream_GetLengthMs := GetAddress(FMODHandle, '_FSOUND_Stream_GetLengthMs@4'); - FSOUND_Stream_SetMode := GetAddress(FMODHandle, '_FSOUND_Stream_SetMode@8'); - FSOUND_Stream_GetMode := GetAddress(FMODHandle, '_FSOUND_Stream_GetMode@4'); - FSOUND_Stream_SetLoopPoints := GetAddress(FMODHandle, '_FSOUND_Stream_SetLoopPoints@12'); - FSOUND_Stream_SetLoopCount := GetAddress(FMODHandle, '_FSOUND_Stream_SetLoopCount@8'); - FSOUND_Stream_GetOpenState := GetAddress(FMODHandle, '_FSOUND_Stream_GetOpenState@4'); - FSOUND_Stream_AddSyncPoint := GetAddress(FMODHandle, '_FSOUND_Stream_AddSyncPoint@12'); - FSOUND_Stream_DeleteSyncPoint := GetAddress(FMODHandle, '_FSOUND_Stream_DeleteSyncPoint@4'); - FSOUND_Stream_GetNumSyncPoints := GetAddress(FMODHandle, '_FSOUND_Stream_GetNumSyncPoints@4'); - FSOUND_Stream_GetSyncPoint := GetAddress(FMODHandle, '_FSOUND_Stream_GetSyncPoint@8'); - FSOUND_Stream_GetSyncPointInfo := GetAddress(FMODHandle, '_FSOUND_Stream_GetSyncPointInfo@8'); - FSOUND_Stream_SetSubStream := GetAddress(FMODHandle, '_FSOUND_Stream_SetSubStream@8'); - FSOUND_Stream_GetNumSubStreams := GetAddress(FMODHandle, '_FSOUND_Stream_GetNumSubStreams@4'); - FSOUND_Stream_SetSubStreamSentence := GetAddress(FMODHandle, '_FSOUND_Stream_SetSubStreamSentence@12'); - FSOUND_Stream_GetNumTagFields := GetAddress(FMODHandle, '_FSOUND_Stream_GetNumTagFields@8'); - FSOUND_Stream_GetTagField := GetAddress(FMODHandle, '_FSOUND_Stream_GetTagField@24'); - FSOUND_Stream_FindTagField := GetAddress(FMODHandle, '_FSOUND_Stream_FindTagField@20'); - FSOUND_Stream_Net_SetProxy := GetAddress(FMODHandle, '_FSOUND_Stream_Net_SetProxy@4'); - FSOUND_Stream_Net_GetLastServerStatus := GetAddress(FMODHandle, '_FSOUND_Stream_Net_GetLastServerStatus@0'); - FSOUND_Stream_Net_SetBufferProperties := GetAddress(FMODHandle, '_FSOUND_Stream_Net_SetBufferProperties@12'); - FSOUND_Stream_Net_GetBufferProperties := GetAddress(FMODHandle, '_FSOUND_Stream_Net_GetBufferProperties@12'); - FSOUND_Stream_Net_SetMetadataCallback := GetAddress(FMODHandle, '_FSOUND_Stream_Net_SetMetadataCallback@12'); - FSOUND_Stream_Net_GetStatus := GetAddress(FMODHandle, '_FSOUND_Stream_Net_GetStatus@20'); - FSOUND_CD_Play := GetAddress(FMODHandle, '_FSOUND_CD_Play@8'); - FSOUND_CD_SetPlayMode := GetAddress(FMODHandle, '_FSOUND_CD_SetPlayMode@8'); - FSOUND_CD_Stop := GetAddress(FMODHandle, '_FSOUND_CD_Stop@4'); - FSOUND_CD_SetPaused := GetAddress(FMODHandle, '_FSOUND_CD_SetPaused@8'); - FSOUND_CD_SetVolume := GetAddress(FMODHandle, '_FSOUND_CD_SetVolume@8'); - FSOUND_CD_SetTrackTime := GetAddress(FMODHandle, '_FSOUND_CD_SetTrackTime@8'); - FSOUND_CD_OpenTray := GetAddress(FMODHandle, '_FSOUND_CD_OpenTray@8'); - FSOUND_CD_GetPaused := GetAddress(FMODHandle, '_FSOUND_CD_GetPaused@4'); - FSOUND_CD_GetTrack := GetAddress(FMODHandle, '_FSOUND_CD_GetTrack@4'); - FSOUND_CD_GetNumTracks := GetAddress(FMODHandle, '_FSOUND_CD_GetNumTracks@4'); - FSOUND_CD_GetVolume := GetAddress(FMODHandle, '_FSOUND_CD_GetVolume@4'); - FSOUND_CD_GetTrackLength := GetAddress(FMODHandle, '_FSOUND_CD_GetTrackLength@8'); - FSOUND_CD_GetTrackTime := GetAddress(FMODHandle, '_FSOUND_CD_GetTrackTime@4'); - FSOUND_DSP_Create := GetAddress(FMODHandle, '_FSOUND_DSP_Create@12'); - FSOUND_DSP_Free := GetAddress(FMODHandle, '_FSOUND_DSP_Free@4'); - FSOUND_DSP_SetPriority := GetAddress(FMODHandle, '_FSOUND_DSP_SetPriority@8'); - FSOUND_DSP_GetPriority := GetAddress(FMODHandle, '_FSOUND_DSP_GetPriority@4'); - FSOUND_DSP_SetActive := GetAddress(FMODHandle, '_FSOUND_DSP_SetActive@8'); - FSOUND_DSP_GetActive := GetAddress(FMODHandle, '_FSOUND_DSP_GetActive@4'); - FSOUND_DSP_GetClearUnit := GetAddress(FMODHandle, '_FSOUND_DSP_GetClearUnit@0'); - FSOUND_DSP_GetSFXUnit := GetAddress(FMODHandle, '_FSOUND_DSP_GetSFXUnit@0'); - FSOUND_DSP_GetMusicUnit := GetAddress(FMODHandle, '_FSOUND_DSP_GetMusicUnit@0'); - FSOUND_DSP_GetClipAndCopyUnit := GetAddress(FMODHandle, '_FSOUND_DSP_GetClipAndCopyUnit@0'); - FSOUND_DSP_GetFFTUnit := GetAddress(FMODHandle, '_FSOUND_DSP_GetFFTUnit@0'); - FSOUND_DSP_MixBuffers := GetAddress(FMODHandle, '_FSOUND_DSP_MixBuffers@28'); - FSOUND_DSP_ClearMixBuffer := GetAddress(FMODHandle, '_FSOUND_DSP_ClearMixBuffer@0'); - FSOUND_DSP_GetBufferLength := GetAddress(FMODHandle, '_FSOUND_DSP_GetBufferLength@0'); - FSOUND_DSP_GetBufferLengthTotal := GetAddress(FMODHandle, '_FSOUND_DSP_GetBufferLengthTotal@0'); - FSOUND_DSP_GetSpectrum := GetAddress(FMODHandle, '_FSOUND_DSP_GetSpectrum@0'); - FSOUND_Reverb_SetProperties := GetAddress(FMODHandle, '_FSOUND_Reverb_SetProperties@4'); - FSOUND_Reverb_GetProperties := GetAddress(FMODHandle, '_FSOUND_Reverb_GetProperties@4'); - FSOUND_Reverb_SetChannelProperties := GetAddress(FMODHandle, '_FSOUND_Reverb_SetChannelProperties@8'); - FSOUND_Reverb_GetChannelProperties := GetAddress(FMODHandle, '_FSOUND_Reverb_GetChannelProperties@8'); - FSOUND_Record_SetDriver := GetAddress(FMODHandle, '_FSOUND_Record_SetDriver@4'); - FSOUND_Record_GetNumDrivers := GetAddress(FMODHandle, '_FSOUND_Record_GetNumDrivers@0'); - FSOUND_Record_GetDriverName := GetAddress(FMODHandle, '_FSOUND_Record_GetDriverName@4'); - FSOUND_Record_GetDriver := GetAddress(FMODHandle, '_FSOUND_Record_GetDriver@0'); - FSOUND_Record_StartSample := GetAddress(FMODHandle, '_FSOUND_Record_StartSample@8'); - FSOUND_Record_Stop := GetAddress(FMODHandle, '_FSOUND_Record_Stop@0'); - FSOUND_Record_GetPosition := GetAddress(FMODHandle, '_FSOUND_Record_GetPosition@0'); - FSOUND_File_SetCallbacks := GetAddress(FMODHandle, '_FSOUND_File_SetCallbacks@20'); - FMUSIC_LoadSong := GetAddress(FMODHandle, '_FMUSIC_LoadSong@4'); - FMUSIC_LoadSongEx := GetAddress(FMODHandle, '_FMUSIC_LoadSongEx@24'); - FMUSIC_GetOpenState := GetAddress(FMODHandle, '_FMUSIC_GetOpenState@4'); - FMUSIC_FreeSong := GetAddress(FMODHandle, '_FMUSIC_FreeSong@4'); - FMUSIC_PlaySong := GetAddress(FMODHandle, '_FMUSIC_PlaySong@4'); - FMUSIC_StopSong := GetAddress(FMODHandle, '_FMUSIC_StopSong@4'); - FMUSIC_StopAllSongs := GetAddress(FMODHandle, '_FMUSIC_StopAllSongs@0'); - FMUSIC_SetZxxCallback := GetAddress(FMODHandle, '_FMUSIC_SetZxxCallback@8'); - FMUSIC_SetRowCallback := GetAddress(FMODHandle, '_FMUSIC_SetRowCallback@12'); - FMUSIC_SetOrderCallback := GetAddress(FMODHandle, '_FMUSIC_SetOrderCallback@12'); - FMUSIC_SetInstCallback := GetAddress(FMODHandle, '_FMUSIC_SetInstCallback@12'); - FMUSIC_SetSample := GetAddress(FMODHandle, '_FMUSIC_SetSample@12'); - FMUSIC_SetUserData := GetAddress(FMODHandle, '_FMUSIC_SetUserData@8'); - FMUSIC_OptimizeChannels := GetAddress(FMODHandle, '_FMUSIC_OptimizeChannels@12'); - FMUSIC_SetReverb := GetAddress(FMODHandle, '_FMUSIC_SetReverb@4'); - FMUSIC_SetLooping := GetAddress(FMODHandle, '_FMUSIC_SetLooping@8'); - FMUSIC_SetOrder := GetAddress(FMODHandle, '_FMUSIC_SetOrder@8'); - FMUSIC_SetPaused := GetAddress(FMODHandle, '_FMUSIC_SetPaused@8'); - FMUSIC_SetMasterVolume := GetAddress(FMODHandle, '_FMUSIC_SetMasterVolume@8'); - FMUSIC_SetMasterSpeed := GetAddress(FMODHandle, '_FMUSIC_SetMasterSpeed@8'); - FMUSIC_SetPanSeperation := GetAddress(FMODHandle, '_FMUSIC_SetPanSeperation@8'); - FMUSIC_GetName := GetAddress(FMODHandle, '_FMUSIC_GetName@4'); - FMUSIC_GetType := GetAddress(FMODHandle, '_FMUSIC_GetType@4'); - FMUSIC_GetNumOrders := GetAddress(FMODHandle, '_FMUSIC_GetNumOrders@4'); - FMUSIC_GetNumPatterns := GetAddress(FMODHandle, '_FMUSIC_GetNumPatterns@4'); - FMUSIC_GetNumInstruments := GetAddress(FMODHandle, '_FMUSIC_GetNumInstruments@4'); - FMUSIC_GetNumSamples := GetAddress(FMODHandle, '_FMUSIC_GetNumSamples@4'); - FMUSIC_GetNumChannels := GetAddress(FMODHandle, '_FMUSIC_GetNumChannels@4'); - FMUSIC_GetSample := GetAddress(FMODHandle, '_FMUSIC_GetSample@8'); - FMUSIC_GetPatternLength := GetAddress(FMODHandle, '_FMUSIC_GetPatternLength@8'); - FMUSIC_IsFinished := GetAddress(FMODHandle, '_FMUSIC_IsFinished@4'); - FMUSIC_IsPlaying := GetAddress(FMODHandle, '_FMUSIC_IsPlaying@4'); - FMUSIC_GetMasterVolume := GetAddress(FMODHandle, '_FMUSIC_GetMasterVolume@4'); - FMUSIC_GetGlobalVolume := GetAddress(FMODHandle, '_FMUSIC_GetGlobalVolume@4'); - FMUSIC_GetOrder := GetAddress(FMODHandle, '_FMUSIC_GetOrder@4'); - FMUSIC_GetPattern := GetAddress(FMODHandle, '_FMUSIC_GetPattern@4'); - FMUSIC_GetSpeed := GetAddress(FMODHandle, '_FMUSIC_GetSpeed@4'); - FMUSIC_GetBPM := GetAddress(FMODHandle, '_FMUSIC_GetBPM@4'); - FMUSIC_GetRow := GetAddress(FMODHandle, '_FMUSIC_GetRow@4'); - FMUSIC_GetPaused := GetAddress(FMODHandle, '_FMUSIC_GetPaused@4'); - FMUSIC_GetTime := GetAddress(FMODHandle, '_FMUSIC_GetTime@4'); - FMUSIC_GetRealChannel := GetAddress(FMODHandle, '_FMUSIC_GetRealChannel@8'); - FMUSIC_GetUserData := GetAddress(FMODHandle, '_FMUSIC_GetUserData@4'); - - Result := True; -end; - -procedure FMOD_Unload; -begin - { Only free the library if it was already loaded } - if FMODHandle <> INVALID_MODULEHANDLE_VALUE then -{$IFDEF MSWINDOWS} - FreeLibrary(FMODHandle); -{$ELSE} - dlclose(FMODHandle); -{$ENDIF} - FMODHandle := INVALID_MODULEHANDLE_VALUE; -end; - -var - Saved8087CW: Word; - -{$ifdef FPC} //FPC do not have this function in its RTL -const - Default8087CW = $1332; //according to the FPC site it's the value used in the - //startup code. -procedure Set8087CW( value :word ); Assembler; -asm - FLDCW value -end; -{$endif} - -initialization - FMODHandle := INVALID_MODULEHANDLE_VALUE; - - { Save the current FPU state and then disable FPU exceptions } - Saved8087CW := Default8087CW; - Set8087CW($133f); { Disable all fpu exceptions } - -finalization - { Make sure the library is unloaded } - FMOD_Unload; - - { Reset the FPU to the previous state } - Set8087CW(Saved8087CW); -end. \ No newline at end of file diff --git a/#ThirdParty/fmodapi375win/api/delphi/fmoderrors.dcu b/#ThirdParty/fmodapi375win/api/delphi/fmoderrors.dcu deleted file mode 100644 index 3ac25d6..0000000 Binary files a/#ThirdParty/fmodapi375win/api/delphi/fmoderrors.dcu and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/api/delphi/fmoderrors.pas b/#ThirdParty/fmodapi375win/api/delphi/fmoderrors.pas deleted file mode 100644 index 91f7352..0000000 --- a/#ThirdParty/fmodapi375win/api/delphi/fmoderrors.pas +++ /dev/null @@ -1,67 +0,0 @@ -{ =============================================================================================== } -{ FMOD Main header file. Copyright (c), Firelight Technologies Pty, Ltd. 1999-2004. } -{ =============================================================================================== } -{ - NOTE: For the demos to run you must have either fmod.dll (in Windows) - or libfmod-3.75.so (in Linux) installed. - - In Windows, copy the fmod.dll file found in the api directory to either of - the following locations (in order of preference) - - your application directory - - Windows\System (95/98) or WinNT\System32 (NT/2000/XP) - - In Linux, make sure you are signed in as root and copy the libfmod-3.75.so - file from the api directory to your /usr/lib/ directory. - Then via a command line, navigate to the /usr/lib/ directory and create - a symbolic link between libfmod-3.75.so and libfmod.so. This is done with - the following command (assuming you are in /usr/lib/)... - ln -s libfmod-3.75.so libfmod.so. -} -{ =============================================================================================== } - -unit fmoderrors; - -interface - -uses - fmodtypes; - -{ - Disable warning for unsafe types in Delphi 7 -} -{$IFDEF VER150} -{$WARN UNSAFE_TYPE OFF} -{$ENDIF} - -function FMOD_ErrorString(ErrorCode: TFModErrors): PChar; - -implementation - -function FMOD_ErrorString(ErrorCode: TFModErrors): PChar; -begin - case ErrorCode of - FMOD_ERR_NONE: Result := 'No errors'; - FMOD_ERR_BUSY: Result := 'Cannot call this command after FSOUND_Init. Call FSOUND_Close first'; - FMOD_ERR_UNINITIALIZED: Result := 'This command failed because FSOUND_Init was not called'; - FMOD_ERR_PLAY: Result := 'Playing the sound failed'; - FMOD_ERR_INIT: Result := 'Error initializing output device'; - FMOD_ERR_ALLOCATED: Result := 'The output device is already in use and cannot be reused'; - FMOD_ERR_OUTPUT_FORMAT: Result := 'Soundcard does not support the features needed for this soundsystem (16bit stereo output)'; - FMOD_ERR_COOPERATIVELEVEL: Result := 'Error setting cooperative level for hardware'; - FMOD_ERR_CREATEBUFFER: Result := 'Error creating hardware sound buffer'; - FMOD_ERR_FILE_NOTFOUND: Result := 'File not found'; - FMOD_ERR_FILE_FORMAT: Result := 'Unknown file format'; - FMOD_ERR_FILE_BAD: Result := 'Error loading file'; - FMOD_ERR_MEMORY: Result := 'Not enough memory or resources'; - FMOD_ERR_VERSION: Result := 'The version number of this file format is not supported'; - FMOD_ERR_INVALID_PARAM: Result := 'An invalid parameter was passed to this function'; - FMOD_ERR_NO_EAX: Result := 'Tried to use an EAX command on a non EAX enabled channel or output'; - FMOD_ERR_CHANNEL_ALLOC: Result := 'Failed to allocate a new channel'; - FMOD_ERR_RECORD: Result := 'Recording is not supported on this machine'; - FMOD_ERR_MEDIAPLAYER: Result := 'Required Mediaplayer codec is not installed'; - else - Result := 'Unknown error'; - end; -end; - -end. diff --git a/#ThirdParty/fmodapi375win/api/delphi/fmodpresets.pas b/#ThirdParty/fmodapi375win/api/delphi/fmodpresets.pas deleted file mode 100644 index 0120458..0000000 --- a/#ThirdParty/fmodapi375win/api/delphi/fmodpresets.pas +++ /dev/null @@ -1,95 +0,0 @@ -{ =============================================================================================== } -{ FMOD presets header file. Copyright (c), FireLight Technologies Pty, Ltd. 1999-2004. } -{ =============================================================================================== } -{ - NOTE: For the demos to run you must have either fmod.dll (in Windows) - or libfmod-3.75.so (in Linux) installed. - - In Windows, copy the fmod.dll file found in the api directory to either of - the following locations (in order of preference) - - your application directory - - Windows\System (95/98) or WinNT\System32 (NT/2000/XP) - - In Linux, make sure you are signed in as root and copy the libfmod-3.75.so - file from the api directory to your /usr/lib/ directory. - Then via a command line, navigate to the /usr/lib/ directory and create - a symbolic link between libfmod-3.5.so and libfmod.so. This is done with - the following command (assuming you are in /usr/lib/)... - ln -s libfmod-3.75.so libfmod.so. -} - -unit fmodpresets; - -interface - -uses - fmodtypes; - -{$IFDEF VER140} -{$DEFINE COMPILER6_UP} -{$ELSE} - {$IFDEF VER150} - {$DEFINE COMPILER6_UP} - {$ENDIF} -{$ENDIF} - -(* -[DEFINE_START] -[ - [NAME] - FSOUND_REVERB_PRESETS - - [DESCRIPTION] - A set of predefined environment PARAMETERS, created by Creative Labs - These are used to initialize an FSOUND_REVERB_PROPERTIES structure statically. - ie - FSOUND_REVERB_PROPERTIES prop = FSOUND_PRESET_GENERIC; - - [SEE_ALSO] - FSOUND_Reverb_SetProperties -] -*) - -{$IFDEF COMPILER6_UP}{$J+}{$ENDIF} -const - FSOUND_PRESET_OFF: TFSoundReverbProperties = (Environment: 0; EnvSize: 7.5; EnvDiffusion: 1.00; Room: -10000; RoomHF: -10000; RoomLF: 0; DecayTime: 1.00; DecayHFRatio: 1.00; DecayLFRatio: 1.0; Reflections: -2602; ReflectionsDelay: 0.007; ReflectionsPan: (0.0, 0.0, 0.0); Reverb: 200; ReverbDelay: 0.011; ReverbPan: (0.0, 0.0, 0.0); EchoTime: 0.250; EchoDepth: 0.00; ModulationTime: 0.25; ModulationDepth: 0.000; AirAbsorptionHF: -5.0; HFReference: 5000.0; LFReference: 250.0; RoomRolloffFactor: 0.0; Diffusion: 0.0; Density: 0.0; Flags: $33f); - FSOUND_PRESET_GENERIC: TFSoundReverbProperties = (Environment: 0; EnvSize: 7.5; EnvDiffusion: 1.00; Room: -1000; RoomHF: -100; RoomLF: 0; DecayTime: 1.49; DecayHFRatio: 0.83; DecayLFRatio: 1.0; Reflections: -2602; ReflectionsDelay: 0.007; ReflectionsPan: (0.0, 0.0, 0.0); Reverb: 200; ReverbDelay: 0.011; ReverbPan: (0.0, 0.0, 0.0); EchoTime: 0.250; EchoDepth: 0.00; ModulationTime: 0.25; ModulationDepth: 0.000; AirAbsorptionHF: -5.0; HFReference: 5000.0; LFReference: 250.0; RoomRolloffFactor: 0.0; Diffusion: 100.0; Density: 100.0; Flags: $3f); - FSOUND_PRESET_PADDEDCELL: TFSoundReverbProperties = (Environment: 1; EnvSize: 1.4; EnvDiffusion: 1.00; Room: -1000; RoomHF: -6000; RoomLF: 0; DecayTime: 0.17; DecayHFRatio: 0.10; DecayLFRatio: 1.0; Reflections: -1204; ReflectionsDelay: 0.001; ReflectionsPan: (0.0, 0.0, 0.0); Reverb: 207; ReverbDelay: 0.002; ReverbPan: (0.0, 0.0, 0.0); EchoTime: 0.250; EchoDepth: 0.00; ModulationTime: 0.25; ModulationDepth: 0.000; AirAbsorptionHF: -5.0; HFReference: 5000.0; LFReference: 250.0; RoomRolloffFactor: 0.0; Diffusion: 100.0; Density: 100.0; Flags: $3f); - FSOUND_PRESET_ROOM: TFSoundReverbProperties = (Environment: 2; EnvSize: 1.9; EnvDiffusion: 1.00; Room: -1000; RoomHF: -454; RoomLF: 0; DecayTime: 0.40; DecayHFRatio: 0.83; DecayLFRatio: 1.0; Reflections: -1646; ReflectionsDelay: 0.002; ReflectionsPan: (0.0, 0.0, 0.0); Reverb: 53; ReverbDelay: 0.003; ReverbPan: (0.0, 0.0, 0.0); EchoTime: 0.250; EchoDepth: 0.00; ModulationTime: 0.25; ModulationDepth: 0.000; AirAbsorptionHF: -5.0; HFReference: 5000.0; LFReference: 250.0; RoomRolloffFactor: 0.0; Diffusion: 100.0; Density: 100.0; Flags: $3f); - FSOUND_PRESET_BATHROOM: TFSoundReverbProperties = (Environment: 3; EnvSize: 1.4; EnvDiffusion: 1.00; Room: -1000; RoomHF: -1200; RoomLF: 0; DecayTime: 1.49; DecayHFRatio: 0.54; DecayLFRatio: 1.0; Reflections: -370; ReflectionsDelay: 0.007; ReflectionsPan: (0.0, 0.0, 0.0); Reverb: 1030; ReverbDelay: 0.011; ReverbPan: (0.0, 0.0, 0.0); EchoTime: 0.250; EchoDepth: 0.00; ModulationTime: 0.25; ModulationDepth: 0.000; AirAbsorptionHF: -5.0; HFReference: 5000.0; LFReference: 250.0; RoomRolloffFactor: 0.0; Diffusion: 100.0; Density: 60.0; Flags: $3f); - FSOUND_PRESET_LIVINGROOM: TFSoundReverbProperties = (Environment: 4; EnvSize: 2.5; EnvDiffusion: 1.00; Room: -1000; RoomHF: -6000; RoomLF: 0; DecayTime: 0.50; DecayHFRatio: 0.10; DecayLFRatio: 1.0; Reflections: -1376; ReflectionsDelay: 0.003; ReflectionsPan: (0.0, 0.0, 0.0); Reverb:-1104; ReverbDelay: 0.004; ReverbPan: (0.0, 0.0, 0.0); EchoTime: 0.250; EchoDepth: 0.00; ModulationTime: 0.25; ModulationDepth: 0.000; AirAbsorptionHF: -5.0; HFReference: 5000.0; LFReference: 250.0; RoomRolloffFactor: 0.0; Diffusion: 100.0; Density: 100.0; Flags: $3f); - FSOUND_PRESET_STONEROOM: TFSoundReverbProperties = (Environment: 5; EnvSize: 11.6; EnvDiffusion: 1.00; Room: -1000; RoomHF: -300; RoomLF: 0; DecayTime: 2.31; DecayHFRatio: 0.64; DecayLFRatio: 1.0; Reflections: -711; ReflectionsDelay: 0.012; ReflectionsPan: (0.0, 0.0, 0.0); Reverb: 83; ReverbDelay: 0.017; ReverbPan: (0.0, 0.0, 0.0); EchoTime: 0.250; EchoDepth: 0.00; ModulationTime: 0.25; ModulationDepth: 0.000; AirAbsorptionHF: -5.0; HFReference: 5000.0; LFReference: 250.0; RoomRolloffFactor: 0.0; Diffusion: 100.0; Density: 100.0; Flags: $3f); - FSOUND_PRESET_AUDITORIUM: TFSoundReverbProperties = (Environment: 6; EnvSize: 21.6; EnvDiffusion: 1.00; Room: -1000; RoomHF: -476; RoomLF: 0; DecayTime: 4.32; DecayHFRatio: 0.59; DecayLFRatio: 1.0; Reflections: -789; ReflectionsDelay: 0.020; ReflectionsPan: (0.0, 0.0, 0.0); Reverb:-289; ReverbDelay: 0.030; ReverbPan: (0.0, 0.0, 0.0); EchoTime: 0.250; EchoDepth: 0.00; ModulationTime: 0.25; ModulationDepth: 0.000; AirAbsorptionHF: -5.0; HFReference: 5000.0; LFReference: 250.0; RoomRolloffFactor: 0.0; Diffusion: 100.0; Density: 100.0; Flags: $3f); - FSOUND_PRESET_CONCERTHALL: TFSoundReverbProperties = (Environment: 7; EnvSize: 19.6; EnvDiffusion: 1.00; Room: -1000; RoomHF: -500; RoomLF: 0; DecayTime: 3.92; DecayHFRatio: 0.70; DecayLFRatio: 1.0; Reflections: -1230; ReflectionsDelay: 0.020; ReflectionsPan: (0.0, 0.0, 0.0); Reverb:-2; ReverbDelay: 0.029; ReverbPan: (0.0, 0.0, 0.0); EchoTime: 0.250; EchoDepth: 0.00; ModulationTime: 0.25; ModulationDepth: 0.000; AirAbsorptionHF: -5.0; HFReference: 5000.0; LFReference: 250.0; RoomRolloffFactor: 0.0; Diffusion: 100.0; Density: 100.0; Flags: $3f); - FSOUND_PRESET_CAVE: TFSoundReverbProperties = (Environment: 8; EnvSize: 14.6; EnvDiffusion: 1.00; Room: -1000; RoomHF: 0; RoomLF: 0; DecayTime: 2.91; DecayHFRatio: 1.30; DecayLFRatio: 1.0; Reflections: -602; ReflectionsDelay: 0.015; ReflectionsPan: (0.0, 0.0, 0.0); Reverb:-302; ReverbDelay: 0.022; ReverbPan: (0.0, 0.0, 0.0); EchoTime: 0.250; EchoDepth: 0.00; ModulationTime: 0.25; ModulationDepth: 0.000; AirAbsorptionHF: -5.0; HFReference: 5000.0; LFReference: 250.0; RoomRolloffFactor: 0.0; Diffusion: 100.0; Density: 100.0; Flags: $1f); - FSOUND_PRESET_ARENA: TFSoundReverbProperties = (Environment: 9; EnvSize: 36.2; EnvDiffusion: 1.00; Room: -1000; RoomHF: -698; RoomLF: 0; DecayTime: 7.24; DecayHFRatio: 0.33; DecayLFRatio: 1.0; Reflections: -1166; ReflectionsDelay: 0.020; ReflectionsPan: (0.0, 0.0, 0.0); Reverb: 16; ReverbDelay: 0.030; ReverbPan: (0.0, 0.0, 0.0); EchoTime: 0.250; EchoDepth: 0.00; ModulationTime: 0.25; ModulationDepth: 0.000; AirAbsorptionHF: -5.0; HFReference: 5000.0; LFReference: 250.0; RoomRolloffFactor: 0.0; Diffusion: 100.0; Density: 100.0; Flags: $3f); - FSOUND_PRESET_HANGAR: TFSoundReverbProperties = (Environment: 10; EnvSize: 50.3; EnvDiffusion: 1.00; Room: -1000; RoomHF: -1000; RoomLF: 0; DecayTime: 10.05; DecayHFRatio: 0.23; DecayLFRatio: 1.0; Reflections: -602; ReflectionsDelay: 0.020; ReflectionsPan: (0.0, 0.0, 0.0); Reverb: 198; ReverbDelay: 0.030; ReverbPan: (0.0, 0.0, 0.0); EchoTime: 0.250; EchoDepth: 0.00; ModulationTime: 0.25; ModulationDepth: 0.000; AirAbsorptionHF: -5.0; HFReference: 5000.0; LFReference: 250.0; RoomRolloffFactor: 0.0; Diffusion: 100.0; Density: 100.0; Flags: $3f); - FSOUND_PRESET_CARPETTEDHALLWAY: TFSoundReverbProperties = (Environment: 11; EnvSize: 1.9; EnvDiffusion: 1.00; Room: -1000; RoomHF: -4000; RoomLF: 0; DecayTime: 0.30; DecayHFRatio: 0.10; DecayLFRatio: 1.0; Reflections: -1831; ReflectionsDelay: 0.002; ReflectionsPan: (0.0, 0.0, 0.0); Reverb:-1630; ReverbDelay: 0.030; ReverbPan: (0.0, 0.0, 0.0); EchoTime: 0.250; EchoDepth: 0.00; ModulationTime: 0.25; ModulationDepth: 0.000; AirAbsorptionHF: -5.0; HFReference: 5000.0; LFReference: 250.0; RoomRolloffFactor: 0.0; Diffusion: 100.0; Density: 100.0; Flags: $3f); - FSOUND_PRESET_HALLWAY: TFSoundReverbProperties = (Environment: 12; EnvSize: 1.8; EnvDiffusion: 1.00; Room: -1000; RoomHF: -300; RoomLF: 0; DecayTime: 1.49; DecayHFRatio: 0.59; DecayLFRatio: 1.0; Reflections: -1219; ReflectionsDelay: 0.007; ReflectionsPan: (0.0, 0.0, 0.0); Reverb: 441; ReverbDelay: 0.011; ReverbPan: (0.0, 0.0, 0.0); EchoTime: 0.250; EchoDepth: 0.00; ModulationTime: 0.25; ModulationDepth: 0.000; AirAbsorptionHF: -5.0; HFReference: 5000.0; LFReference: 250.0; RoomRolloffFactor: 0.0; Diffusion: 100.0; Density: 100.0; Flags: $3f); - FSOUND_PRESET_STONECORRIDOR: TFSoundReverbProperties = (Environment: 13; EnvSize: 13.5; EnvDiffusion: 1.00; Room: -1000; RoomHF: -237; RoomLF: 0; DecayTime: 2.70; DecayHFRatio: 0.79; DecayLFRatio: 1.0; Reflections: -1214; ReflectionsDelay: 0.013; ReflectionsPan: (0.0, 0.0, 0.0); Reverb: 395; ReverbDelay: 0.020; ReverbPan: (0.0, 0.0, 0.0); EchoTime: 0.250; EchoDepth: 0.00; ModulationTime: 0.25; ModulationDepth: 0.000; AirAbsorptionHF: -5.0; HFReference: 5000.0; LFReference: 250.0; RoomRolloffFactor: 0.0; Diffusion: 100.0; Density: 100.0; Flags: $3f); - FSOUND_PRESET_ALLEY: TFSoundReverbProperties = (Environment: 14; EnvSize: 7.5; EnvDiffusion: 0.30; Room: -1000; RoomHF: -270; RoomLF: 0; DecayTime: 1.49; DecayHFRatio: 0.86; DecayLFRatio: 1.0; Reflections: -1204; ReflectionsDelay: 0.007; ReflectionsPan: (0.0, 0.0, 0.0); Reverb:-4; ReverbDelay: 0.011; ReverbPan: (0.0, 0.0, 0.0); EchoTime: 0.125; EchoDepth: 0.95; ModulationTime: 0.25; ModulationDepth: 0.000; AirAbsorptionHF: -5.0; HFReference: 5000.0; LFReference: 250.0; RoomRolloffFactor: 0.0; Diffusion: 100.0; Density: 100.0; Flags: $3f); - FSOUND_PRESET_FOREST: TFSoundReverbProperties = (Environment: 15; EnvSize: 38.0; EnvDiffusion: 0.30; Room: -1000; RoomHF: -3300; RoomLF: 0; DecayTime: 1.49; DecayHFRatio: 0.54; DecayLFRatio: 1.0; Reflections: -2560; ReflectionsDelay: 0.162; ReflectionsPan: (0.0, 0.0, 0.0); Reverb:-229; ReverbDelay: 0.088; ReverbPan: (0.0, 0.0, 0.0); EchoTime: 0.125; EchoDepth: 1.00; ModulationTime: 0.25; ModulationDepth: 0.000; AirAbsorptionHF: -5.0; HFReference: 5000.0; LFReference: 250.0; RoomRolloffFactor: 0.0; Diffusion: 79.0; Density: 100.0; Flags: $3f); - FSOUND_PRESET_CITY: TFSoundReverbProperties = (Environment: 16; EnvSize: 7.5; EnvDiffusion: 0.50; Room: -1000; RoomHF: -800; RoomLF: 0; DecayTime: 1.49; DecayHFRatio: 0.67; DecayLFRatio: 1.0; Reflections: -2273; ReflectionsDelay: 0.007; ReflectionsPan: (0.0, 0.0, 0.0); Reverb:-1691; ReverbDelay: 0.011; ReverbPan: (0.0, 0.0, 0.0); EchoTime: 0.250; EchoDepth: 0.00; ModulationTime: 0.25; ModulationDepth: 0.000; AirAbsorptionHF: -5.0; HFReference: 5000.0; LFReference: 250.0; RoomRolloffFactor: 0.0; Diffusion: 50.0; Density: 100.0; Flags: $3f); - FSOUND_PRESET_MOUNTAINS: TFSoundReverbProperties = (Environment: 17; EnvSize: 100.0; EnvDiffusion: 0.27; Room: -1000; RoomHF: -2500; RoomLF: 0; DecayTime: 1.49; DecayHFRatio: 0.21; DecayLFRatio: 1.0; Reflections: -2780; ReflectionsDelay: 0.300; ReflectionsPan: (0.0, 0.0, 0.0); Reverb:-1434; ReverbDelay: 0.100; ReverbPan: (0.0, 0.0, 0.0); EchoTime: 0.250; EchoDepth: 1.00; ModulationTime: 0.25; ModulationDepth: 0.000; AirAbsorptionHF: -5.0; HFReference: 5000.0; LFReference: 250.0; RoomRolloffFactor: 0.0; Diffusion: 27.0; Density: 100.0; Flags: $1f); - FSOUND_PRESET_QUARRY: TFSoundReverbProperties = (Environment: 18; EnvSize: 17.5; EnvDiffusion: 1.00; Room: -1000; RoomHF: -1000; RoomLF: 0; DecayTime: 1.49; DecayHFRatio: 0.83; DecayLFRatio: 1.0; Reflections: -10000;ReflectionsDelay: 0.061; ReflectionsPan: (0.0, 0.0, 0.0); Reverb: 500; ReverbDelay: 0.025; ReverbPan: (0.0, 0.0, 0.0); EchoTime: 0.125; EchoDepth: 0.70; ModulationTime: 0.25; ModulationDepth: 0.000; AirAbsorptionHF: -5.0; HFReference: 5000.0; LFReference: 250.0; RoomRolloffFactor: 0.0; Diffusion: 100.0; Density: 100.0; Flags: $3f); - FSOUND_PRESET_PLAIN: TFSoundReverbProperties = (Environment: 19; EnvSize: 42.5; EnvDiffusion: 0.21; Room: -1000; RoomHF: -2000; RoomLF: 0; DecayTime: 1.49; DecayHFRatio: 0.50; DecayLFRatio: 1.0; Reflections: -2466; ReflectionsDelay: 0.179; ReflectionsPan: (0.0, 0.0, 0.0); Reverb:-1926; ReverbDelay: 0.100; ReverbPan: (0.0, 0.0, 0.0); EchoTime: 0.250; EchoDepth: 1.00; ModulationTime: 0.25; ModulationDepth: 0.000; AirAbsorptionHF: -5.0; HFReference: 5000.0; LFReference: 250.0; RoomRolloffFactor: 0.0; Diffusion: 21.0; Density: 100.0; Flags: $3f); - FSOUND_PRESET_PARKINGLOT: TFSoundReverbProperties = (Environment: 20; EnvSize: 8.3; EnvDiffusion: 1.00; Room: -1000; RoomHF: 0; RoomLF: 0; DecayTime: 1.65; DecayHFRatio: 1.50; DecayLFRatio: 1.0; Reflections: -1363; ReflectionsDelay: 0.008; ReflectionsPan: (0.0, 0.0, 0.0); Reverb:-1153; ReverbDelay: 0.012; ReverbPan: (0.0, 0.0, 0.0); EchoTime: 0.250; EchoDepth: 0.00; ModulationTime: 0.25; ModulationDepth: 0.000; AirAbsorptionHF: -5.0; HFReference: 5000.0; LFReference: 250.0; RoomRolloffFactor: 0.0; Diffusion: 100.0; Density: 100.0; Flags: $1f); - FSOUND_PRESET_SEWERPIPE: TFSoundReverbProperties = (Environment: 21; EnvSize: 1.7; EnvDiffusion: 0.80; Room: -1000; RoomHF: -1000; RoomLF: 0; DecayTime: 2.81; DecayHFRatio: 0.14; DecayLFRatio: 1.0; Reflections: 429; ReflectionsDelay: 0.014; ReflectionsPan: (0.0, 0.0, 0.0); Reverb: 1023; ReverbDelay: 0.021; ReverbPan: (0.0, 0.0, 0.0); EchoTime: 0.250; EchoDepth: 0.00; ModulationTime: 0.25; ModulationDepth: 0.000; AirAbsorptionHF: -5.0; HFReference: 5000.0; LFReference: 250.0; RoomRolloffFactor: 0.0; Diffusion: 80.0; Density: 60.0; Flags: $3f); - FSOUND_PRESET_UNDERWATER: TFSoundReverbProperties = (Environment: 22; EnvSize: 1.8; EnvDiffusion: 1.00; Room: -1000; RoomHF: -4000; RoomLF: 0; DecayTime: 1.49; DecayHFRatio: 0.10; DecayLFRatio: 1.0; Reflections: -449; ReflectionsDelay: 0.007; ReflectionsPan: (0.0, 0.0, 0.0); Reverb: 1700; ReverbDelay: 0.011; ReverbPan: (0.0, 0.0, 0.0); EchoTime: 0.250; EchoDepth: 0.00; ModulationTime: 1.18; ModulationDepth: 0.348; AirAbsorptionHF: -5.0; HFReference: 5000.0; LFReference: 250.0; RoomRolloffFactor: 0.0; Diffusion: 100.0; Density: 100.0; Flags: $3f); - -(* Non I3DL2 presets *) - - FSOUND_PRESET_DRUGGED: TFSoundReverbProperties = (Environment: 23; EnvSize: 1.9; EnvDiffusion: 0.50; Room: -1000; RoomHF: 0; RoomLF: 0; DecayTime: 8.39; DecayHFRatio: 1.39; DecayLFRatio: 1.0; Reflections: -115; ReflectionsDelay: 0.002; ReflectionsPan: (0.0, 0.0, 0.0); Reverb: 985; ReverbDelay: 0.030; ReverbPan: (0.0, 0.0, 0.0); EchoTime: 0.250; EchoDepth: 0.00; ModulationTime: 0.25; ModulationDepth: 1.000; AirAbsorptionHF: -5.0; HFReference: 5000.0; LFReference: 250.0; RoomRolloffFactor: 0.0; Diffusion: 100.0; Density: 100.0; Flags: $1f); - FSOUND_PRESET_DIZZY: TFSoundReverbProperties = (Environment: 24; EnvSize: 1.8; EnvDiffusion: 0.60; Room: -1000; RoomHF: -400; RoomLF: 0; DecayTime: 17.23; DecayHFRatio: 0.56; DecayLFRatio: 1.0; Reflections: -1713; ReflectionsDelay: 0.020; ReflectionsPan: (0.0, 0.0, 0.0); Reverb:-613; ReverbDelay: 0.030; ReverbPan: (0.0, 0.0, 0.0); EchoTime: 0.250; EchoDepth: 1.00; ModulationTime: 0.81; ModulationDepth: 0.310; AirAbsorptionHF: -5.0; HFReference: 5000.0; LFReference: 250.0; RoomRolloffFactor: 0.0; Diffusion: 100.0; Density: 100.0; Flags: $1f); - FSOUND_PRESET_PSYCHOTIC: TFSoundReverbProperties = (Environment: 25; EnvSize: 1.0; EnvDiffusion: 0.50; Room: -1000; RoomHF: -151; RoomLF: 0; DecayTime: 7.56; DecayHFRatio: 0.91; DecayLFRatio: 1.0; Reflections: -626; ReflectionsDelay: 0.020; ReflectionsPan: (0.0, 0.0, 0.0); Reverb: 774; ReverbDelay: 0.030; ReverbPan: (0.0, 0.0, 0.0); EchoTime: 0.250; EchoDepth: 0.00; ModulationTime: 4.00; ModulationDepth: 1.000; AirAbsorptionHF: -5.0; HFReference: 5000.0; LFReference: 250.0; RoomRolloffFactor: 0.0; Diffusion: 100.0; Density: 100.0; Flags: $1f); - -(* PlayStation 2 Only presets *) -(* Delphi/Kylix cannot create PlayStation 2 executables, so there is no need to - convert the PlayStation 2 presets. *) -{$IFDEF COMPILER6_UP}{$J-}{$ENDIF} - -(* [DEFINE_END] *) - -implementation - -end. diff --git a/#ThirdParty/fmodapi375win/api/delphi/fmodtypes.dcu b/#ThirdParty/fmodapi375win/api/delphi/fmodtypes.dcu deleted file mode 100644 index 3af0e6a..0000000 Binary files a/#ThirdParty/fmodapi375win/api/delphi/fmodtypes.dcu and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/api/delphi/fmodtypes.pas b/#ThirdParty/fmodapi375win/api/delphi/fmodtypes.pas deleted file mode 100644 index 9a9c015..0000000 --- a/#ThirdParty/fmodapi375win/api/delphi/fmodtypes.pas +++ /dev/null @@ -1,821 +0,0 @@ -{================================================================================================ } -{ FMOD Types header file. Copyright (c), Firelight Technologies Pty, Ltd. 1999-2004. } -{ =============================================================================================== } -{ - NOTE: For the demos to run you must have either fmod.dll (in Windows) - or libfmod-3.75.so (in Linux) installed. - - In Windows, copy the fmod.dll file found in the api directory to either of - the following locations (in order of preference) - - your application directory - - Windows\System (95/98) or WinNT\System32 (NT/2000/XP) - - In Linux, make sure you are signed in as root and copy the libfmod-3.75.so - file from the api directory to your /usr/lib/ directory. - Then via a command line, navigate to the /usr/lib/ directory and create - a symbolic link between libfmod-3.75.so and libfmod.so. This is done with - the following command (assuming you are in /usr/lib/)... - ln -s libfmod-3.75.so libfmod.so. -} -{ =============================================================================================== } - -unit fmodtypes; - -{$IFDEF FPC} - {$MODE DELPHI} - {$IFDEF WIN32} - {$DEFINE MSWINDOWS} - {$ENDIF} - {$PACKRECORDS C} -{$ENDIF} - -{$IFDEF VER110} - {$DEFINE DELPHI_5_OR_LOWER} -{$ELSE} - {$IFDEF VER120} - {$DEFINE DELPHI_5_OR_LOWER} - {$ELSE} - {$IFDEF VER130} - {$DEFINE DELPHI_5_OR_LOWER} - {$ENDIF} - {$ENDIF} -{$ENDIF} - -interface - -{$IFDEF MSWINDOWS} -uses - Windows; -{$ENDIF} - -{ =============================================================================================== } -{ DEFINITIONS } -{ =============================================================================================== } - -{ - Force four-byte enums -} -{$Z4} - -{ - Disable warning for unsafe types in Delphi 7 -} -{$IFDEF VER150} -{$WARN UNSAFE_TYPE OFF} -{$ENDIF} - -{$IFDEF DELPHI_5_OR_LOWER} -type - PSingle = ^Single; - THandle = Cardinal; -{$ENDIF} - -const - FMOD_VERSION: Single = 3.75; - -{ - FMOD defined types -} - -type - PFSoundSample = Pointer; - PFSoundStream = Pointer; - PFSoundDSPUnit = Pointer; - PFMusicModule = Pointer; - PFSyncPoint = Pointer; - - PFSoundVector = ^TFSoundVector; - TFSoundVector = record - x: Single; - y: Single; - z: Single; - end; - - { - Callback types - } - - TFSoundStreamCallback = function (Stream: PFSoundStream; Buff: Pointer; Length, Param: Integer): ByteBool; stdcall; - TFSoundDSPCallback = function (OriginalBuffer: Pointer; NewBuffer: Pointer; Length, Param: Integer): Pointer; stdcall; - TFMusicCallback = procedure (Module: PFMusicModule; Param: Byte); stdcall; - - TFSoundOpenCallback = function (Name: PChar): Cardinal; stdcall; - TFSoundCloseCallback = procedure (Handle: Cardinal); stdcall; - TFSoundReadCallback = function (Buffer: Pointer; Size: Cardinal; Handle: Cardinal): Cardinal; stdcall; - TFSoundSeekCallback = procedure (Handle: Cardinal; Pos: Cardinal; Mode: Byte); stdcall; - TFSoundTellCallback = function (Handle: Cardinal): Cardinal; stdcall; - - TFSoundAllocCallback = function(Size: Cardinal): Pointer; stdcall; - TFSoundReallocCallback = function(Ptr: Pointer; Size: Cardinal): Pointer; stdcall; - TFSoundFreeCallback = procedure(Ptr: Pointer); stdcall; - - TFMetaDataCallback = function(Name: PChar; Value: PChar; userdata: Integer): ByteBool; stdcall; - -{ -[ENUM] -[ - [DESCRIPTION] - On failure of commands in FMOD, use FSOUND_GetError to attain what happened. - - [SEE_ALSO] - FSOUND_GetError -] -} - -type - TFModErrors = ( - FMOD_ERR_NONE, // No errors - FMOD_ERR_BUSY, // Cannot call this command after FSOUND_Init. Call FSOUND_Close first. - FMOD_ERR_UNINITIALIZED, // This command failed because FSOUND_Init was not called - FMOD_ERR_INIT, // Error initializing output device. - FMOD_ERR_ALLOCATED, // Error initializing output device, but more specifically, the output device is already in use and cannot be reused. - FMOD_ERR_PLAY, // Playing the sound failed. - FMOD_ERR_OUTPUT_FORMAT, // Soundcard does not support the features needed for this soundsystem (16bit stereo output) - FMOD_ERR_COOPERATIVELEVEL, // Error setting cooperative level for hardware. - FMOD_ERR_CREATEBUFFER, // Error creating hardware sound buffer. - FMOD_ERR_FILE_NOTFOUND, // File not found - FMOD_ERR_FILE_FORMAT, // Unknown file format - FMOD_ERR_FILE_BAD, // Error loading file - FMOD_ERR_MEMORY, // Not enough memory or resources - FMOD_ERR_VERSION, // The version number of this file format is not supported - FMOD_ERR_INVALID_PARAM, // An invalid parameter was passed to this function - FMOD_ERR_NO_EAX, // Tried to use an EAX command on a non EAX enabled channel or output. - FMOD_ERR_CHANNEL_ALLOC, // Failed to allocate a new channel - FMOD_ERR_RECORD, // Recording is not supported on this machine - FMOD_ERR_MEDIAPLAYER, // Windows Media Player not installed so cannot play wma or use internet streaming. */ - FMOD_ERR_CDDEVICE // An error occured trying to open the specified CD device - ); - -{ -[ENUM] -[ - [DESCRIPTION] - These output types are used with FSOUND_SetOutput, to choose which output driver to use. - - FSOUND_OUTPUT_DSOUND will not support hardware 3d acceleration if the sound card driver - does not support DirectX 6 Voice Manager Extensions. - - FSOUND_OUTPUT_WINMM is recommended for NT and CE. - - [SEE_ALSO] - FSOUND_SetOutput - FSOUND_GetOutput -] -} - -type - TFSoundOutputTypes = ( - FSOUND_OUTPUT_NOSOUND, // NoSound driver, all calls to this succeed but do nothing. - FSOUND_OUTPUT_WINMM, // Windows Multimedia driver. - FSOUND_OUTPUT_DSOUND, // DirectSound driver. You need this to get EAX2 or EAX3 support, or FX api support. - FSOUND_OUTPUT_A3D, // A3D driver. - - FSOUND_OUTPUT_OSS, // Linux/Unix OSS (Open Sound System) driver, i.e. the kernel sound drivers. - FSOUND_OUTPUT_ESD, // Linux/Unix ESD (Enlightment Sound Daemon) driver. - FSOUND_OUTPUT_ALSA, // Linux Alsa driver. - - FSOUND_OUTPUT_ASIO, // Low latency ASIO driver. - FSOUND_OUTPUT_XBOX, // Xbox driver. - FSOUND_OUTPUT_PS2, // PlayStation 2 driver. - FSOUND_OUTPUT_MAC, // Mac SoundMager driver. - FSOUND_OUTPUT_GC, // Gamecube driver. - FSOUND_OUTPUT_PSP, // PlayStation Portable driver. - - FSOUND_OUTPUT_NOSOUND_NONREALTIME // This is the same as nosound, but the sound generation is driven by FSOUND_Update - ); - - -{ -[ENUM] -[ - [DESCRIPTION] - These mixer types are used with FSOUND_SetMixer, to choose which mixer to use, or to act - upon for other reasons using FSOUND_GetMixer. - It is not necessary to set the mixer. FMOD will autodetect the best mixer for you. - - [SEE_ALSO] - FSOUND_SetMixer - FSOUND_GetMixer -] -} -type - TFSoundMixerTypes = ( - FSOUND_MIXER_AUTODETECT, // CE/PS2/GC Only - Non interpolating/low quality mixer. - FSOUND_MIXER_BLENDMODE, // Removed / obsolete - FSOUND_MIXER_MMXP5, // Removed / obsolete - FSOUND_MIXER_MMXP6, // Removed / obsolete - - FSOUND_MIXER_QUALITY_AUTODETECT,// All platforms - Autodetect the fastest quality mixer based on your cpu. - FSOUND_MIXER_QUALITY_FPU, // Win32/Linux only - Interpolating/volume ramping FPU mixer. - FSOUND_MIXER_QUALITY_MMXP5, // Win32/Linux only - Interpolating/volume ramping P5 MMX mixer. - FSOUND_MIXER_QUALITY_MMXP6, // Win32/Linux only - Interpolating/volume ramping ppro+ MMX mixer. - - FSOUND_MIXER_MONO, // CE/PS2/GC only - MONO non interpolating/low quality mixer. For speed - FSOUND_MIXER_QUALITY_MONO, // CE/PS2/GC only - MONO Interpolating mixer. For speed - - FSOUND_MIXER_MAX - ); - - -{ -[ENUM] -[ - [DESCRIPTION] - These definitions describe the type of song being played. - - [SEE_ALSO] - FMUSIC_GetType -] -} -type - TFMusicTypes = ( - FMUSIC_TYPE_NONE, - FMUSIC_TYPE_MOD, // Protracker / FastTracker - FMUSIC_TYPE_S3M, // ScreamTracker 3 - FMUSIC_TYPE_XM, // FastTracker 2 - FMUSIC_TYPE_IT, // Impulse Tracker - FMUSIC_TYPE_MIDI, // MIDI file - FMUSIC_TYPE_FSB // FMOD Sample Bank file - ); - - -{ -[DEFINE_START] -[ - [NAME] - FSOUND_DSP_PRIORITIES - - [DESCRIPTION] - These default priorities are used by FMOD internal system DSP units. They describe the - position of the DSP chain, and the order of how audio processing is executed. - You can actually through the use of FSOUND_DSP_GetxxxUnit (where xxx is the name of the DSP - unit), disable or even change the priority of a DSP unit. - - [SEE_ALSO] - FSOUND_DSP_Create - FSOUND_DSP_SetPriority - FSOUND_DSP_GetSpectrum -] -} -const - FSOUND_DSP_DEFAULTPRIORITY_CLEARUNIT = 0; // DSP CLEAR unit - done first - FSOUND_DSP_DEFAULTPRIORITY_SFXUNIT = 100; // DSP SFX unit - done second - FSOUND_DSP_DEFAULTPRIORITY_MUSICUNIT = 200; // DSP MUSIC unit - done third - FSOUND_DSP_DEFAULTPRIORITY_USER = 300; // User priority, use this as reference for your own DSP units - FSOUND_DSP_DEFAULTPRIORITY_FFTUNIT = 900; // This reads data for FSOUND_DSP_GetSpectrum, so it comes after user units - FSOUND_DSP_DEFAULTPRIORITY_CLIPANDCOPYUNIT = 1000; // DSP CLIP AND COPY unit - last -// [DEFINE_END] - - -{ -[DEFINE_START] -[ - [NAME] - FSOUND_CAPS - - [DESCRIPTION] - Driver description bitfields. Use FSOUND_Driver_GetCaps to determine if a driver enumerated - has the settings you are after. The enumerated driver depends on the output mode, see - FSOUND_OUTPUTTYPES - - [SEE_ALSO] - FSOUND_GetDriverCaps - FSOUND_OUTPUTTYPES -] -} -const - FSOUND_CAPS_HARDWARE = $1; // This driver supports hardware accelerated 3d sound. - FSOUND_CAPS_EAX2 = $2; // This driver supports EAX 2 reverb - FSOUND_CAPS_EAX3 = $10; // This driver supports EAX 3 reverb -// [DEFINE_END] - - -{ -[DEFINE_START] -[ - [NAME] - FSOUND_MODES - - [DESCRIPTION] - Sample description bitfields, OR them together for loading and describing samples. - NOTE. If the file format being loaded already has a defined format, such as WAV or MP3, then - trying to override the pre-defined format with a new set of format flags will not work. For - example, an 8 bit WAV file will not load as 16bit if you specify FSOUND_16BITS. It will just - ignore the flag and go ahead loading it as 8bits. For these type of formats the only flags - you can specify that will really alter the behaviour of how it is loaded, are the following. - - Looping behaviour - FSOUND_LOOP_OFF, FSOUND_LOOP_NORMAL, FSOUND_LOOP_BIDI - Load destination - FSOUND_HW3D, FSOUND_HW2D, FSOUND_2D - Loading behaviour - FSOUND_NONBLOCKING, FSOUND_LOADMEMORY, FSOUND_LOADRAW, FSOUND_MPEGACCURATE, FSOUND_MPEGHALFRATE, FSOUND_FORCEMONO - Playback behaviour - FSOUND_STREAMABLE, FSOUND_ENABLEFX - PlayStation 2 only - FSOUND_USECORE0, FSOUND_USECORE1, FSOUND_LOADMEMORYIOP - - See flag descriptions for what these do. -] -} -const - FSOUND_LOOP_OFF = $00000001; // For non looping samples. - FSOUND_LOOP_NORMAL = $00000002; // For forward looping samples. - FSOUND_LOOP_BIDI = $00000004; // For bidirectional looping samples. (no effect if in hardware). - FSOUND_8BITS = $00000008; // For 8 bit samples. - FSOUND_16BITS = $00000010; // For 16 bit samples. - FSOUND_MONO = $00000020; // For mono samples. - FSOUND_STEREO = $00000040; // For stereo samples. - FSOUND_UNSIGNED = $00000080; // For user created source data containing unsigned samples. - FSOUND_SIGNED = $00000100; // For user created source data containing signed data. - FSOUND_DELTA = $00000200; // For user created source data stored as delta values. - FSOUND_IT214 = $00000400; // For user created source data stored using IT214 compression. - FSOUND_IT215 = $00000800; // For user created source data stored using IT215 compression. - FSOUND_HW3D = $00001000; // Attempts to make samples use 3d hardware acceleration. (if the card supports it) - FSOUND_2D = $00002000; // Ignores any 3d processing. Overrides FSOUND_HW3D. Located in software. - FSOUND_STREAMABLE = $00004000; // For a streamimg sound where you feed the data to it. */ - FSOUND_LOADMEMORY = $00008000; // "name" will be interpreted as a pointer to data for streaming and samples. - FSOUND_LOADRAW = $00010000; // Will ignore file format and treat as raw pcm. - FSOUND_MPEGACCURATE = $00020000; // For FSOUND_Stream_OpenFile - for accurate FSOUND_Stream_GetLengthMs/FSOUND_Stream_SetTime. WARNING, see FSOUND_Stream_OpenFile for inital opening time performance issues. - FSOUND_FORCEMONO = $00040000; // For forcing stereo streams and samples to be mono - needed if using FSOUND_HW3D and stereo data - incurs a small speed hit for streams - FSOUND_HW2D = $00080000; // 2D hardware sounds. allows hardware specific effects - FSOUND_ENABLEFX = $00100000; // Allows DX8 FX to be played back on a sound. Requires DirectX 8 - Note these sounds cannot be played more than once, be 8 bit, be less than a certain size, or have a changing frequency - FSOUND_MPEGHALFRATE = $00200000; // For FMODCE only - decodes mpeg streams using a lower quality decode, but faster execution - FSOUND_XADPCM = $00400000; // For XBOX only - Contents are compressed as XADPCM */ - FSOUND_VAG = $00800000; // For PS2 only - Contents are compressed as Sony VAG format */ - FSOUND_NONBLOCKING = $01000000; // For FSOUND_Stream_OpenFile - Causes stream to open in the background and not block the foreground app - stream plays only when ready. - FSOUND_GCADPCM = $02000000; // For Gamecube only - Contents are compressed as Gamecube DSP-ADPCM format - FSOUND_MULTICHANNEL = $04000000; // For PS2 only - Contents are interleaved into a multi-channel (more than stereo) format - FSOUND_USECORE0 = $08000000; // For PS2 only - Sample/Stream is forced to use hardware voices 00-23 - FSOUND_USECORE1 = $10000000; // For PS2 only - Sample/Stream is forced to use hardware voices 24-47 - FSOUND_LOADMEMORYIOP = $20000000; // For PS2 only - "name" will be interpreted as a pointer to data for streaming and samples. The address provided will be an IOP address - -const - FSOUND_NORMAL = (FSOUND_16BITS or FSOUND_SIGNED or FSOUND_MONO); -// [DEFINE_END] - - -{ -[DEFINE_START] -[ - [NAME] - FSOUND_CDPLAYMODES - - [DESCRIPTION] - Playback method for a CD Audio track, using FSOUND_CD_SetPlayMode - - [SEE_ALSO] - FSOUND_CD_SetPlayMode - FSOUND_CD_Play -] -} -const - FSOUND_CD_PLAYCONTINUOUS = 0; // Starts from the current track and plays to end of CD. - FSOUND_CD_PLAYONCE = 1; // Plays the specified track then stops. - FSOUND_CD_PLAYLOOPED = 2; // Plays the specified track looped, forever until stopped manually. - FSOUND_CD_PLAYRANDOM = 3; // Plays tracks in random order -// [DEFINE_END] - - -{ -[DEFINE_START] -[ - [NAME] - FSOUND_CHANNELSAMPLEMODE - - [DESCRIPTION] - Miscellaneous values for FMOD functions. - - [SEE_ALSO] - FSOUND_PlaySound - FSOUND_PlaySoundEx - FSOUND_Sample_Alloc - FSOUND_Sample_Load - FSOUND_SetPan -] -} -const - FSOUND_FREE = -1; // value to play on any free channel, or to allocate a sample in a free sample slot. - FSOUND_UNMANAGED = -2; // value to allocate a sample that is NOT managed by FSOUND or placed in a sample slot. - FSOUND_ALL = -3; // for a channel index , this flag will affect ALL channels available! Not supported by every function. - FSOUND_STEREOPAN = -1; // value for FSOUND_SetPan so that stereo sounds are not played at half volume. See FSOUND_SetPan for more on this. - FSOUND_SYSTEMCHANNEL = -1000; // special 'channel' ID for all channel based functions that want to alter the global FSOUND software mixing output - FSOUND_SYSTEMSAMPLE = -1000; // special 'sample' ID for all sample based functions that want to alter the global FSOUND software mixing output sample -// [DEFINE_END] - - -{ -[STRUCT_START] -[ - [NAME] - FSOUND_REVERB_PROPERTIES - - [DESCRIPTION] - Structure defining a reverb environment. - - [REMARKS] - For more indepth descriptions of the reverb properties under win32, please see the EAX2/EAX3 - documentation at http://developer.creative.com/ under the 'downloads' section. - If they do not have the EAX3 documentation, then most information can be attained from - the EAX2 documentation, as EAX3 only adds some more parameters and functionality on top of - EAX2. - Note the default reverb properties are the same as the FSOUND_PRESET_GENERIC preset. - Note that integer values that typically range from -10,000 to 1000 are represented in - decibels, and are of a logarithmic scale, not linear, wheras float values are typically linear. - PORTABILITY: Each member has the platform it supports in braces ie (win32/xbox). - Some reverb parameters are only supported in win32 and some only on xbox. If all parameters are set then - the reverb should product a similar effect on either platform. - Only WIN32 supports the reverb api. - - The numerical values listed below are the maximum, minimum and default values for each variable respectively. - - [SEE_ALSO] - FSOUND_Reverb_SetProperties - FSOUND_Reverb_GetProperties - FSOUND_REVERB_PRESETS - FSOUND_REVERB_FLAGS -] -} -type - TFSoundReverbProperties = record // MIN MAX DEFAULT DESCRIPTION - Environment: Cardinal; // 0 25 0 sets all listener properties (win32 only) - EnvSize: Single; // 1.0 100.0 7.5 environment size in meters (win32 only) - EnvDiffusion: Single; // 0.0 1.0 1.0 environment diffusion (win32/xbox) - Room: Integer; // -10000 0 -1000 room effect level (at mid frequencies) (win32/xbox) - RoomHF: Integer; // -10000 0 -100 relative room effect level at high frequencies (win32/xbox) - RoomLF: Integer; // -10000 0 0 relative room effect level at low frequencies (win32 only) - DecayTime: Single; // 0.1 20.0 1.49 reverberation decay time at mid frequencies (win32/xbox) - DecayHFRatio: Single; // 0.1 2.0 0.83 high-frequency to mid-frequency decay time ratio (win32/xbox) - DecayLFRatio: Single; // 0.1 2.0 1.0 low-frequency to mid-frequency decay time ratio (win32 only) - Reflections: Integer; // -10000 1000 -2602 early reflections level relative to room effect (win32/xbox) - ReflectionsDelay: Single; // 0.0 0.3 0.007 initial reflection delay time (win32/xbox) - ReflectionsPan: array [0..2] of Single; // 0,0,0 early reflections panning vector (win32 only) - Reverb: Integer; // -10000 2000 200 late reverberation level relative to room effect (win32/xbox) - ReverbDelay: Single; // 0.0 0.1 0.011 late reverberation delay time relative to initial reflection (win32/xbox) - ReverbPan: array [0..2] of Single; // 0,0,0 late reverberation panning vector (win32 only) - EchoTime: Single; // .075 0.25 0.25 echo time (win32 only) - EchoDepth: Single; // 0.0 1.0 0.0 echo depth (win32 only) - ModulationTime: Single; // 0.04 4.0 0.25 modulation time (win32 only) - ModulationDepth: Single; // 0.0 1.0 0.0 modulation depth (win32 only) - AirAbsorptionHF: Single; // -100 0.0 -5.0 change in level per meter at high frequencies (win32 only) - HFReference: Single; // 1000.0 20000 5000.0 reference high frequency (hz) (win32/xbox) - LFReference: Single; // 20.0 1000.0 250.0 reference low frequency (hz) (win32 only) - RoomRolloffFactor: Single; // 0.0 10.0 0.0 like FSOUND_3D_SetRolloffFactor but for room effect (win32/xbox) - Diffusion: Single; // 0.0 100.0 100.0 Value that controls the echo density in the late reverberation decay. (xbox only) - Density: Single; // 0.0 100.0 100.0 Value that controls the modal density in the late reverberation decay (xbox only) - Flags: Cardinal; // FSOUND_REVERB_PROPERTYFLAGS - modifies the behavior of above properties (win32 only) - end; -// [STRUCT_END] - - -{ -[DEFINE_START] -[ - [NAME] - FSOUND_REVERB_FLAGS - - [DESCRIPTION] - Values for the Flags member of the FSOUND_REVERB_PROPERTIES structure. - - [SEE_ALSO] - FSOUND_REVERB_PROPERTIES -] -} -const - FSOUND_REVERBFLAGS_DECAYTIMESCALE = $00000001; // EnvironmentSize affects reverberation decay time - FSOUND_REVERBFLAGS_REFLECTIONSSCALE = $00000002; // EnvironmentSize affects reflection level - FSOUND_REVERBFLAGS_REFLECTIONSDELAYSCALE = $00000004; // EnvironmentSize affects initial reflection delay time - FSOUND_REVERBFLAGS_REVERBSCALE = $00000008; // EnvironmentSize affects reflections level - FSOUND_REVERBFLAGS_REVERBDELAYSCALE = $00000010; // EnvironmentSize affects late reverberation delay time - FSOUND_REVERBFLAGS_DECAYHFLIMIT = $00000020; // AirAbsorptionHF affects DecayHFRatio - FSOUND_REVERBFLAGS_ECHOTIMESCALE = $00000040; // EnvironmentSize affects echo time - FSOUND_REVERBFLAGS_MODULATIONTIMESCALE = $00000080; // EnvironmentSize affects modulation time - FSOUND_REVERB_FLAGS_CORE0 = $00000100; // PS2 Only - Reverb is applied to CORE0 (hw voices 0-23) - FSOUND_REVERB_FLAGS_CORE1 = $00000200; // PS2 Only - Reverb is applied to CORE1 (hw voices 24-47) - FSOUND_REVERBFLAGS_DEFAULT = FSOUND_REVERBFLAGS_DECAYTIMESCALE or FSOUND_REVERBFLAGS_REFLECTIONSSCALE or - FSOUND_REVERBFLAGS_REFLECTIONSDELAYSCALE or FSOUND_REVERBFLAGS_REVERBSCALE or - FSOUND_REVERBFLAGS_REVERBDELAYSCALE or FSOUND_REVERBFLAGS_DECAYHFLIMIT or - FSOUND_REVERB_FLAGS_CORE0 or FSOUND_REVERB_FLAGS_CORE1; -// [DEFINE_END] - - -{ -[DEFINE_START] -[ - [NAME] - FSOUND_REVERB_PRESETS - - [DESCRIPTION] - A set of predefined environment PARAMETERS, created by Creative Labs - These are used to initialize an FSOUND_REVERB_PROPERTIES structure statically. - ie - FSOUND_REVERB_PROPERTIES prop = FSOUND_PRESET_GENERIC; - - [SEE_ALSO] - FSOUND_Reverb_SetProperties -] -} -{ -const -// Env Size Diffus Room RoomHF RmLF DecTm DecHF DecLF Refl RefDel RefPan Revb RevDel ReverbPan EchoTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff Diffus Densty FLAGS - FSOUND_PRESET_OFF = 0, 7.5f, 1.00f, -10000, -10000, 0, 1.00f, 1.00f, 1.0f, -2602, 0.007f, 0.0f,0.0f,0.0f, 200, 0.011f, 0.0f,0.0f,0.0f, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 0.0f, 0.0f, 0x3f ; - FSOUND_PRESET_GENERIC = 0, 7.5f, 1.00f, -1000, -100, 0, 1.49f, 0.83f, 1.0f, -2602, 0.007f, 0.0f,0.0f,0.0f, 200, 0.011f, 0.0f,0.0f,0.0f, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f ; - FSOUND_PRESET_PADDEDCELL = 1, 1.4f, 1.00f, -1000, -6000, 0, 0.17f, 0.10f, 1.0f, -1204, 0.001f, 0.0f,0.0f,0.0f, 207, 0.002f, 0.0f,0.0f,0.0f, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f ; - FSOUND_PRESET_ROOM = 2, 1.9f, 1.00f, -1000, -454, 0, 0.40f, 0.83f, 1.0f, -1646, 0.002f, 0.0f,0.0f,0.0f, 53, 0.003f, 0.0f,0.0f,0.0f, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f ; - FSOUND_PRESET_BATHROOM = 3, 1.4f, 1.00f, -1000, -1200, 0, 1.49f, 0.54f, 1.0f, -370, 0.007f, 0.0f,0.0f,0.0f, 1030, 0.011f, 0.0f,0.0f,0.0f, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 60.0f, 0x3f ; - FSOUND_PRESET_LIVINGROOM = 4, 2.5f, 1.00f, -1000, -6000, 0, 0.50f, 0.10f, 1.0f, -1376, 0.003f, 0.0f,0.0f,0.0f, -1104, 0.004f, 0.0f,0.0f,0.0f, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f ; - FSOUND_PRESET_STONEROOM = 5, 11.6f, 1.00f, -1000, -300, 0, 2.31f, 0.64f, 1.0f, -711, 0.012f, 0.0f,0.0f,0.0f, 83, 0.017f, 0.0f,0.0f,0.0f, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f ; - FSOUND_PRESET_AUDITORIUM = 6, 21.6f, 1.00f, -1000, -476, 0, 4.32f, 0.59f, 1.0f, -789, 0.020f, 0.0f,0.0f,0.0f, -289, 0.030f, 0.0f,0.0f,0.0f, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f ; - FSOUND_PRESET_CONCERTHALL = 7, 19.6f, 1.00f, -1000, -500, 0, 3.92f, 0.70f, 1.0f, -1230, 0.020f, 0.0f,0.0f,0.0f, -2, 0.029f, 0.0f,0.0f,0.0f, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f ; - FSOUND_PRESET_CAVE = 8, 14.6f, 1.00f, -1000, 0, 0, 2.91f, 1.30f, 1.0f, -602, 0.015f, 0.0f,0.0f,0.0f, -302, 0.022f, 0.0f,0.0f,0.0f, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x1f ; - FSOUND_PRESET_ARENA = 9, 36.2f, 1.00f, -1000, -698, 0, 7.24f, 0.33f, 1.0f, -1166, 0.020f, 0.0f,0.0f,0.0f, 16, 0.030f, 0.0f,0.0f,0.0f, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f ; - FSOUND_PRESET_HANGAR = 10, 50.3f, 1.00f, -1000, -1000, 0, 10.05f, 0.23f, 1.0f, -602, 0.020f, 0.0f,0.0f,0.0f, 198, 0.030f, 0.0f,0.0f,0.0f, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f ; - FSOUND_PRESET_CARPETTEDHALLWAY = 11, 1.9f, 1.00f, -1000, -4000, 0, 0.30f, 0.10f, 1.0f, -1831, 0.002f, 0.0f,0.0f,0.0f, -1630, 0.030f, 0.0f,0.0f,0.0f, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f ; - FSOUND_PRESET_HALLWAY = 12, 1.8f, 1.00f, -1000, -300, 0, 1.49f, 0.59f, 1.0f, -1219, 0.007f, 0.0f,0.0f,0.0f, 441, 0.011f, 0.0f,0.0f,0.0f, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f ; - FSOUND_PRESET_STONECORRIDOR = 13, 13.5f, 1.00f, -1000, -237, 0, 2.70f, 0.79f, 1.0f, -1214, 0.013f, 0.0f,0.0f,0.0f, 395, 0.020f, 0.0f,0.0f,0.0f, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f ; - FSOUND_PRESET_ALLEY = 14, 7.5f, 0.30f, -1000, -270, 0, 1.49f, 0.86f, 1.0f, -1204, 0.007f, 0.0f,0.0f,0.0f, -4, 0.011f, 0.0f,0.0f,0.0f, 0.125f, 0.95f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f ; - FSOUND_PRESET_FOREST = 15, 38.0f, 0.30f, -1000, -3300, 0, 1.49f, 0.54f, 1.0f, -2560, 0.162f, 0.0f,0.0f,0.0f, -229, 0.088f, 0.0f,0.0f,0.0f, 0.125f, 1.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 79.0f, 100.0f, 0x3f ; - FSOUND_PRESET_CITY = 16, 7.5f, 0.50f, -1000, -800, 0, 1.49f, 0.67f, 1.0f, -2273, 0.007f, 0.0f,0.0f,0.0f, -1691, 0.011f, 0.0f,0.0f,0.0f, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 50.0f, 100.0f, 0x3f ; - FSOUND_PRESET_MOUNTAINS = 17, 100.0f, 0.27f, -1000, -2500, 0, 1.49f, 0.21f, 1.0f, -2780, 0.300f, 0.0f,0.0f,0.0f, -1434, 0.100f, 0.0f,0.0f,0.0f, 0.250f, 1.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 27.0f, 100.0f, 0x1f ; - FSOUND_PRESET_QUARRY = 18, 17.5f, 1.00f, -1000, -1000, 0, 1.49f, 0.83f, 1.0f, -10000, 0.061f, 0.0f,0.0f,0.0f, 500, 0.025f, 0.0f,0.0f,0.0f, 0.125f, 0.70f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f ; - FSOUND_PRESET_PLAIN = 19, 42.5f, 0.21f, -1000, -2000, 0, 1.49f, 0.50f, 1.0f, -2466, 0.179f, 0.0f,0.0f,0.0f, -1926, 0.100f, 0.0f,0.0f,0.0f, 0.250f, 1.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 21.0f, 100.0f, 0x3f ; - FSOUND_PRESET_PARKINGLOT = 20, 8.3f, 1.00f, -1000, 0, 0, 1.65f, 1.50f, 1.0f, -1363, 0.008f, 0.0f,0.0f,0.0f, -1153, 0.012f, 0.0f,0.0f,0.0f, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x1f ; - FSOUND_PRESET_SEWERPIPE = 21, 1.7f, 0.80f, -1000, -1000, 0, 2.81f, 0.14f, 1.0f, 429, 0.014f, 0.0f,0.0f,0.0f, 1023, 0.021f, 0.0f,0.0f,0.0f, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 80.0f, 60.0f, 0x3f ; - FSOUND_PRESET_UNDERWATER = 22, 1.8f, 1.00f, -1000, -4000, 0, 1.49f, 0.10f, 1.0f, -449, 0.007f, 0.0f,0.0f,0.0f, 1700, 0.011f, 0.0f,0.0f,0.0f, 0.250f, 0.00f, 1.18f, 0.348f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f ; - -// Non I3DL2 presets - - FSOUND_PRESET_DRUGGED = 23, 1.9f, 0.50f, -1000, 0, 0, 8.39f, 1.39f, 1.0f, -115, 0.002f, 0.0f,0.0f,0.0f, 985, 0.030f, 0.0f,0.0f,0.0f, 0.250f, 0.00f, 0.25f, 1.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x1f ; - FSOUND_PRESET_DIZZY = 24, 1.8f, 0.60f, -1000, -400, 0, 17.23f, 0.56f, 1.0f, -1713, 0.020f, 0.0f,0.0f,0.0f, -613, 0.030f, 0.0f,0.0f,0.0f, 0.250f, 1.00f, 0.81f, 0.310f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x1f ; - FSOUND_PRESET_PSYCHOTIC = 25, 1.0f, 0.50f, -1000, -151, 0, 7.56f, 0.91f, 1.0f, -626, 0.020f, 0.0f,0.0f,0.0f, 774, 0.030f, 0.0f,0.0f,0.0f, 0.250f, 0.00f, 4.00f, 1.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x1f ; -} -// [DEFINE_END] - - -{ -[STRUCTURE] -[ - [DESCRIPTION] - Structure defining the properties for a reverb source, related to a FSOUND channel. - For more indepth descriptions of the reverb properties under win32, please see the EAX3 - documentation at http://developer.creative.com/ under the 'downloads' section. - If they do not have the EAX3 documentation, then most information can be attained from - the EAX2 documentation, as EAX3 only adds some more parameters and functionality on top of - EAX2. - - Note the default reverb properties are the same as the FSOUND_PRESET_GENERIC preset. - Note that integer values that typically range from -10,000 to 1000 are represented in - decibels, and are of a logarithmic scale, not linear, wheras float values are typically linear. - PORTABILITY: Each member has the platform it supports in braces ie (win32/xbox). - Some reverb parameters are only supported in win32 and some only on xbox. If all parameters are set then - the reverb should product a similar effect on either platform. - Linux and FMODCE do not support the reverb api. - - The numerical values listed below are the maximum, minimum and default values for each variable respectively. - - [SEE_ALSO] - FSOUND_Reverb_SetChannelProperties - FSOUND_Reverb_GetChannelProperties - FSOUND_REVERB_CHANNELFLAGS -] -} -type - TFSoundReverbChannelProperties = record // MIN MAX DEFAULT - Direct: Integer; // -10000 1000 0 direct path level (at low and mid frequencies) (win32/xbox) - DirectHF: Integer; // -10000 0 0 relative direct path level at high frequencies (win32/xbox) - Room: Integer; // -10000 1000 0 room effect level (at low and mid frequencies) (win32/xbox) - RoomHF: Integer; // -10000 0 0 relative room effect level at high frequencies (win32/xbox) - Obstruction: Integer; // -10000 0 0 main obstruction control (attenuation at high frequencies) (win32/xbox) - ObstructionLFRatio: Single; // 0.0 1.0 0.0 obstruction low-frequency level re. main control (win32/xbox) - Occlusion: Integer; // -10000 0 0 main occlusion control (attenuation at high frequencies) (win32/xbox) - OcclusionLFRatio: Single; // 0.0 1.0 0.25 occlusion low-frequency level re. main control (win32/xbox) - OcclusionRoomRatio: Single; // 0.0 10.0 1.5 relative occlusion control for room effect (win32) - OcclusionDirectRatio: Single; // 0.0 10.0 1.0 relative occlusion control for direct path (win32) - Exclusion: Integer; // -10000 0 0 main exlusion control (attenuation at high frequencies) (win32) - ExclusionLFRatio: Single; // 0.0 1.0 1.0 exclusion low-frequency level re. main control (win32) - OutsideVolumeHF: Integer; // -10000 0 0 outside sound cone level at high frequencies (win32) - DopplerFactor: Single; // 0.0 10.0 0.0 like DS3D flDopplerFactor but per source (win32) - RolloffFactor: Single; // 0.0 10.0 0.0 like DS3D flRolloffFactor but per source (win32) - RoomRolloffFactor: Single; // 0.0 10.0 0.0 like DS3D flRolloffFactor but for room effect (win32/xbox) - AirAbsorptionFactor: Single; // 0.0 10.0 1.0 multiplies AirAbsorptionHF member of FSOUND_REVERB_PROPERTIES (win32) - Flags: Integer; // FSOUND_REVERB_CHANNELFLAGS - modifies the behavior of properties (win32) - end; -// [STRUCT_END] - -{ -[DEFINE_START] -[ - [NAME] - FSOUND_REVERB_CHANNELFLAGS - - [DESCRIPTION] - Values for the Flags member of the FSOUND_REVERB_CHANNELPROPERTIES structure. - - [SEE_ALSO] - FSOUND_REVERB_CHANNELPROPERTIES -] -} -const - FSOUND_REVERB_CHANNELFLAGS_DIRECTHFAUTO = $01; // Automatic setting of 'Direct' due to distance from listener - FSOUND_REVERB_CHANNELFLAGS_ROOMAUTO = $02; // Automatic setting of 'Room' due to distance from listener - FSOUND_REVERB_CHANNELFLAGS_ROOMHFAUTO = $04; // Automatic setting of 'RoomHF' due to distance from listener - FSOUND_REVERB_CHANNELFLAGS_DEFAULT = FSOUND_REVERB_CHANNELFLAGS_DIRECTHFAUTO or - FSOUND_REVERB_CHANNELFLAGS_ROOMAUTO or - FSOUND_REVERB_CHANNELFLAGS_ROOMHFAUTO; -// [DEFINE_END] - - -{ -[ENUM] -[ - [DESCRIPTION] - These values are used with FSOUND_FX_Enable to enable DirectX 8 FX for a channel. - - [SEE_ALSO] - FSOUND_FX_Enable - FSOUND_FX_Disable - FSOUND_FX_SetChorus - FSOUND_FX_SetCompressor - FSOUND_FX_SetDistortion - FSOUND_FX_SetEcho - FSOUND_FX_SetFlanger - FSOUND_FX_SetGargle - FSOUND_FX_SetI3DL2Reverb - FSOUND_FX_SetParamEQ - FSOUND_FX_SetWavesReverb -] -} - -type - TFSoundFXModes = ( - FSOUND_FX_CHORUS, - FSOUND_FX_COMPRESSOR, - FSOUND_FX_DISTORTION, - FSOUND_FX_ECHO, - FSOUND_FX_FLANGER, - FSOUND_FX_GARGLE, - FSOUND_FX_I3DL2REVERB, - FSOUND_FX_PARAMEQ, - FSOUND_FX_WAVES_REVERB, - FSOUND_FX_MAX - ); -// [DEFINE_END] - - -{ -[ENUM] -[ - [DESCRIPTION] - These are speaker types defined for use with the FSOUND_SetSpeakerMode command. - Note - Only reliably works with FSOUND_OUTPUT_DSOUND or FSOUND_OUTPUT_XBOX output modes. Other output modes will only - interpret FSOUND_SPEAKERMODE_MONO and set everything else to be stereo. - - [SEE_ALSO] - FSOUND_SetSpeakerMode - - [REMARKS] - Note - Only reliably works with FSOUND_OUTPUT_DSOUND or FSOUND_OUTPUT_XBOX output modes. Other output modes will only - interpret FSOUND_SPEAKERMODE_MONO and set everything else to be stereo. - - Using either DolbyDigital or DTS will use whatever 5.1 digital mode is available if destination hardware is unsure. -] -} -type - TFSoundSpeakerModes = - ( - FSOUND_SPEAKERMODE_DOLBYDIGITAL, // The audio is played through a speaker arrangement of surround speakers with a subwoofer. - FSOUND_SPEAKERMODE_HEADPHONES, // The speakers are headphones. - FSOUND_SPEAKERMODE_MONO, // The speakers are monaural. - FSOUND_SPEAKERMODE_QUAD, // The speakers are quadraphonic. - FSOUND_SPEAKERMODE_STEREO, // The speakers are stereo (default value). - FSOUND_SPEAKERMODE_SURROUND, // The speakers are surround sound. - FSOUND_SPEAKERMODE_DTS // The audio is played through a speaker arrangement of surround speakers with a subwoofer. - ); - FSOUND_SPEAKERMODES = TFSoundSpeakerModes; - - -{ -[DEFINE_START] -[ - [NAME] - FSOUND_INIT_FLAGS - - [DESCRIPTION] - Initialization flags. Use them with FSOUND_Init in the flags parameter to change various behaviour. - - FSOUND_INIT_ENABLESYSTEMCHANNELFX Is an init mode which enables the FSOUND mixer buffer to be affected by DirectX 8 effects. - Note that due to limitations of DirectSound, FSOUND_Init may fail if this is enabled because the buffersize is too small. - This can be fixed with FSOUND_SetBufferSize. Increase the BufferSize until it works. - When it is enabled you can use the FSOUND_FX api, and use FSOUND_SYSTEMCHANNEL as the channel id when setting parameters. - - [SEE_ALSO] - FSOUND_Init -] -} -const - FSOUND_INIT_USEDEFAULTMIDISYNTH = $01; // Causes MIDI playback to force software decoding. - FSOUND_INIT_GLOBALFOCUS = $02; // For DirectSound output - sound is not muted when window is out of focus. - FSOUND_INIT_ENABLESYSTEMCHANNELFX = $04; // For DirectSound output - Allows FSOUND_FX api to be used on global software mixer output! - FSOUND_INIT_ACCURATEVULEVELS = $08; // This latency adjusts FSOUND_GetCurrentLevels, but incurs a small cpu and memory hit. - FSOUND_INIT_PS2_DISABLECORE0REVERB = $10; // PS2 only - Disable reverb on CORE 0 to regain SRAM. - FSOUND_INIT_PS2_DISABLECORE1REVERB = $20; // PS2 only - Disable reverb on CORE 1 to regain SRAM. - FSOUND_INIT_PS2_SWAPDMACORES = $40; // PS2 only - By default FMOD uses DMA CH0 for mixing, CH1 for uploads, this flag swaps them around. - FSOUND_INIT_DONTLATENCYADJUST = $80; // Callbacks are not latency adjusted, and are called at mix time. Also information functions are immediate. - FSOUND_INIT_GC_INITLIBS = $100; // Gamecube only - Initializes GC audio libraries. - FSOUND_INIT_STREAM_FROM_MAIN_THREAD = $200; // Turns off fmod streamer thread, and makes streaming update from FSOUND_Update called by the user. - FSOUND_INIT_PS2_USEVOLUMERAMPING = $400; // PS2 only - Turns on volume ramping system to remove hardware clicks. - FSOUND_INIT_DSOUND_DEFERRED = $800; // Win32 only - For DirectSound output. 3D commands are batched together and executed at FSOUND_Update. - FSOUND_INIT_DSOUND_HRTF_LIGHT = $1000; // Win32 only - For DirectSound output. FSOUND_HW3D buffers use a slightly higher quality algorithm when 3d hardware acceleration is not present. - FSOUND_INIT_DSOUND_HRTF_FULL = $2000; // Win32 only - For DirectSound output. FSOUND_HW3D buffers use full quality 3d playback when 3d hardware acceleration is not present. - FSOUND_INIT_XBOX_REMOVEHEADROOM = $4000; // XBox only - By default directsound attenuates all sound by 6db to avoid clipping/distortion. CAUTION. If you use this flag you are responsible for the final mix to make sure clipping / distortion doesn't happen. - FSOUND_INIT_PSP_SILENCEONUNDERRUN = $8000; // PSP only - If streams skip / stutter when device is powered on, either increase stream buffersize, or use this flag instead to play silence while the UMD is recovering. - -// [DEFINE_END] - -(* -[ENUM] -[ - [DESCRIPTION] - Status values for internet streams. Use FSOUND_Stream_Net_GetStatus to get the current status of an internet stream. - - [SEE_ALSO] - FSOUND_Stream_Net_GetStatus -] -*) -type - TFSoundStreamNetStatus = - ( - FSOUND_STREAM_NET_NOTCONNECTED, (* Stream hasn't connected yet *) - FSOUND_STREAM_NET_CONNECTING, (* Stream is connecting to remote host *) - FSOUND_STREAM_NET_BUFFERING, (* Stream is buffering data *) - FSOUND_STREAM_NET_READY, (* Stream is ready to play *) - FSOUND_STREAM_NET_ERROR (* Stream has suffered a fatal error *) - ); - - -(* -[ENUM] -[ - [DESCRIPTION] - Describes the type of a particular tag field. - - [SEE_ALSO] - FSOUND_Stream_GetNumTagFields - FSOUND_Stream_GetTagField - FSOUND_Stream_FindTagField -] -*) -type - TFSoundTagFieldType = - ( - FSOUND_TAGFIELD_VORBISCOMMENT, (* A vorbis comment *) - FSOUND_TAGFIELD_ID3V1, (* Part of an ID3v1 tag *) - FSOUND_TAGFIELD_ID3V2, (* An ID3v2 frame *) - FSOUND_TAGFIELD_SHOUTCAST, (* A SHOUTcast header line *) - FSOUND_TAGFIELD_ICECAST, (* An Icecast header line *) - FSOUND_TAGFIELD_ASF (* An Advanced Streaming Format header line *) - ); - - -(* -[DEFINE_START] -[ - [NAME] - FSOUND_STATUS_FLAGS - - [DESCRIPTION] - These values describe the protocol and format of an internet stream. Use FSOUND_Stream_Net_GetStatus to retrieve this information for an open internet stream. - - [SEE_ALSO] - FSOUND_Stream_Net_GetStatus -] -*) -const - FSOUND_PROTOCOL_SHOUTCAST = $00000001; - FSOUND_PROTOCOL_ICECAST = $00000002; - FSOUND_PROTOCOL_HTTP = $00000004; - FSOUND_FORMAT_MPEG = $00010000; - FSOUND_FORMAT_OGGVORBIS = $00020000; -(* [DEFINE_END] *) - -{ -[STRUCTURE] -[ - [DESCRIPTION] - Structure defining a CD table of contents. This structure is returned as a tag from FSOUND_Stream_FindTagField when the tag name "CD_TOC" is specified. - Note: All tracks on the CD - including data tracks- will be represented in this structure so it's use for anything other than generating disc id information is not recommended. - See the cdda example program for info on retrieving and using this structure. - - [SEE_ALSO] - FSOUND_Stream_Open - FSOUND_Stream_FindTagField -] -} -type - TFSoundTOCTag = record - Name: array [0..3] of Char; // The string "TOC" (4th character is 0), just in case this structure is accidentally treated as a string. - NumTracks: Integer; // The number of tracks on the CD. - Min: array [0..99] of Integer; // The start offset of each track in minutes. - Sec: array [0..99] of Integer; // The start offset of each track in seconds. - Frame: array [0..99] of Integer; // The start offset of each track in frames. - end; -// [STRUCT_END] - -implementation - -end. diff --git a/#ThirdParty/fmodapi375win/api/vb/fmod.bas b/#ThirdParty/fmodapi375win/api/vb/fmod.bas deleted file mode 100644 index 58d16eb..0000000 --- a/#ThirdParty/fmodapi375win/api/vb/fmod.bas +++ /dev/null @@ -1,914 +0,0 @@ -Attribute VB_Name = "FMod" -Option Explicit - -' -'FMOD VB6 Module -' - -Public Const FMOD_VERSION = 3.75 - -'************ -'* Enums -'************ - - -' FMOD_ERRORS -' On failure of commands in FMOD, use FSOUND_GetError to attain what happened. -' -Public Enum FMOD_ERRORS - FMOD_ERR_NONE ' No errors - FMOD_ERR_BUSY ' Cannot call this command after FSOUND_Init. Call FSOUND_Close first. - FMOD_ERR_UNINITIALIZED ' This command failed because FSOUND_Init was not called - FMOD_ERR_INIT ' Error initializing output device. - FMOD_ERR_ALLOCATED ' Error initializing output device, but more specifically, the output device is already in use and cannot be reused. - FMOD_ERR_PLAY ' Playing the sound failed. - FMOD_ERR_OUTPUT_FORMAT ' Soundcard does not support the features needed for this soundsystem (16bit stereo output) - FMOD_ERR_COOPERATIVELEVEL ' Error setting cooperative level for hardware. - FMOD_ERR_CREATEBUFFER ' Error creating hardware sound buffer. - FMOD_ERR_FILE_NOTFOUND ' File not found - FMOD_ERR_FILE_FORMAT ' Unknown file format - FMOD_ERR_FILE_BAD ' Error loading file - FMOD_ERR_MEMORY ' Not enough memory - FMOD_ERR_VERSION ' The version number of this file format is not supported - FMOD_ERR_INVALID_PARAM ' An invalid parameter was passed to this function - FMOD_ERR_NO_EAX ' Tried to use an EAX command on a non EAX enabled channel or output. - FMOD_ERR_CHANNEL_ALLOC ' Failed to allocate a new channel - FMOD_ERR_RECORD ' Recording is not supported on this machine - FMOD_ERR_MEDIAPLAYER ' Windows Media Player not installed so cannot play wma or use internet streaming. - FMOD_ERR_CDDEVICE ' An error occured trying to open the specified CD device -End Enum - - -' FSOUND_OUTPUTTYPES -' These output types are used with FSOUND_SetOutput, to choose which output driver to use. -' FSOUND_OUTPUT_DSOUND will not support hardware 3d acceleration if the sound card driver -' does not support DirectX 6 Voice Manager Extensions. -' FSOUND_OUTPUT_WINMM is recommended for NT and CE. -' -Public Enum FSOUND_OUTPUTTYPES - FSOUND_OUTPUT_NOSOUND ' NoSound driver, all calls to this succeed but do nothing. - FSOUND_OUTPUT_WINMM ' Windows Multimedia driver. - FSOUND_OUTPUT_DSOUND ' DirectSound driver. You need this to get EAX2 or EAX3 support, or FX api support. - FSOUND_OUTPUT_A3D ' A3D driver. - - FSOUND_OUTPUT_OSS ' Linux/Unix OSS (Open Sound System) driver, i.e. the kernel sound drivers. - FSOUND_OUTPUT_ESD ' Linux/Unix ESD (Enlightment Sound Daemon) driver. - FSOUND_OUTPUT_ALSA ' Linux Alsa driver. - - FSOUND_OUTPUT_ASIO ' Low latency ASIO driver - FSOUND_OUTPUT_XBOX ' Xbox driver - FSOUND_OUTPUT_PS2 ' PlayStation 2 driver - FSOUND_OUTPUT_MAC ' Mac SoundMager driver - FSOUND_OUTPUT_GC ' Gamecube driver - FSOUND_OUTPUT_PSP ' PlayStation Portable driver - - FSOUND_OUTPUT_NOSOUND_NONREALTIME ' This is the same as nosound, but the sound generation is driven by FSOUND_Update -End Enum - - -' FSOUND_MIXERTYPES -' These mixer types are used with FSOUND_SetMixer, to choose which mixer to use, or to act -' upon for other reasons using FSOUND_GetMixer. -' It is not nescessary to set the mixer. FMOD will autodetect the best mixer for you. -' -Public Enum FSOUND_MIXERTYPES - FSOUND_MIXER_AUTODETECT ' CE/PS2 Only - Non interpolating/low quality mixer - FSOUND_MIXER_BLENDMODE ' removed / obsolete. - FSOUND_MIXER_MMXP5 ' removed / obsolete. - FSOUND_MIXER_MMXP6 ' removed / obsolete. - - FSOUND_MIXER_QUALITY_AUTODETECT ' All platforms - Autodetect the fastest quality mixer based on your cpu. - FSOUND_MIXER_QUALITY_FPU ' Win32/Linux only - Interpolating/volume ramping FPU mixer. - FSOUND_MIXER_QUALITY_MMXP5 ' Win32/Linux only - Interpolating/volume ramping FPU mixer. - FSOUND_MIXER_QUALITY_MMXP6 ' Win32/Linux only - Interpolating/volume ramping ppro+ MMX mixer. - - FSOUND_MIXER_MONO ' CE/PS2 only - MONO non interpolating/low quality mixer. For speed - FSOUND_MIXER_QUALITY_MONO ' CE/PS2 only - MONO Interpolating mixer. For speed -End Enum - - -' FMUSIC_TYPES -' These definitions describe the type of song being played. -' See FMUSIC_GetType -' -Public Enum FMUSIC_TYPES - FMUSIC_TYPE_NONE - FMUSIC_TYPE_MOD 'Protracker / Fasttracker - FMUSIC_TYPE_S3M 'ScreamTracker 3 - FMUSIC_TYPE_XM 'FastTracker 2 - FMUSIC_TYPE_IT 'Impulse Tracker. - FMUSIC_TYPE_MIDI 'MIDI file - FMUSIC_TYPE_FSB 'FMOD Sample Bank file -End Enum - - -' FSOUND_DSP_PRIORITIES -' These default priorities are used by FMOD internal system DSP units. They describe the -' position of the DSP chain, and the order of how audio processing is executed. -' You can actually through the use of FSOUND_DSP_GetxxxUnit (where xxx is the name of the DSP -' unit), disable or even change the priority of a DSP unit. -' -Public Enum FSOUND_DSP_PRIORITIES - FSOUND_DSP_DEFAULTPRIORITY_CLEARUNIT = 0 'DSP CLEAR unit - done first - FSOUND_DSP_DEFAULTPRIORITY_SFXUNIT = 100 'DSP SFX unit - done second - FSOUND_DSP_DEFAULTPRIORITY_MUSICUNIT = 200 'DSP MUSIC unit - done third - FSOUND_DSP_DEFAULTPRIORITY_USER = 300 'User priority, use this as reference for your own dsp units - FSOUND_DSP_DEFAULTPRIORITY_FFTUNIT = 900 'This reads data for FSOUND_DSP_GetSpectrum, so it comes after user units - FSOUND_DSP_DEFAULTPRIORITY_CLIPANDCOPYUNIT = 1000 'DSP CLIP AND COPY unit - last -End Enum - - -' FSOUND_CAPS -' Driver description bitfields. Use FSOUND_Driver_GetCaps to determine if a driver enumerated -' has the settings you are after. The enumerated driver depends on the output mode, see -' FSOUND_OUTPUTTYPES -' -Public Enum FSOUND_CAPS - FSOUND_CAPS_HARDWARE = &H1 ' This driver supports hardware accelerated 3d sound. - FSOUND_CAPS_EAX2 = &H2 ' This driver supports EAX 2 reverb - FSOUND_CAPS_EAX3 = &H10 ' This driver supports EAX 3 reverb -End Enum - - -' FSOUND_MODES -' Sample description bitfields, OR them together for loading and describing samples. -' NOTE. If the file format being loaded already has a defined format, such as WAV or MP3, then -' trying to override the pre-defined format with a new set of format flags will not work. For -' example, an 8 bit WAV file will not load as 16bit if you specify FSOUND_16BITS. It will just -' ignore the flag and go ahead loading it as 8bits. For these type of formats the only flags -' you can specify that will really alter the behaviour of how it is loaded, are the following. -' -' Looping behaviour - FSOUND_LOOP_OFF, FSOUND_LOOP_NORMAL, FSOUND_LOOP_BIDI -' Load destination - FSOUND_HW3D, FSOUND_HW2D, FSOUND_2D -' Loading behaviour - FSOUND_NONBLOCKING, FSOUND_LOADMEMORY, FSOUND_LOADRAW, FSOUND_MPEGACCURATE, FSOUND_MPEGHALFRATE, FSOUND_FORCEMONO -' Playback behaviour - FSOUND_STREAMABLE, FSOUND_ENABLEFX -' PlayStation 2 only - FSOUND_USECORE0, FSOUND_USECORE1, FSOUND_LOADMEMORYIOP -' -' See flag descriptions for what these do. -' -Public Enum FSOUND_MODES - FSOUND_LOOP_OFF = &H1 ' For non looping samples. - FSOUND_LOOP_NORMAL = &H2 ' For forward looping samples. - FSOUND_LOOP_BIDI = &H4 ' For bidirectional looping samples. (no effect if in hardware). - FSOUND_8BITS = &H8 ' For 8 bit samples. - FSOUND_16BITS = &H10 ' For 16 bit samples. - FSOUND_MONO = &H20 ' For mono samples. - FSOUND_STEREO = &H40 ' For stereo samples. - FSOUND_UNSIGNED = &H80 ' For source data containing unsigned samples. - FSOUND_SIGNED = &H100 ' For source data containing signed data. - FSOUND_DELTA = &H200 ' For source data stored as delta values. - FSOUND_IT214 = &H400 ' For source data stored using IT214 compression. - FSOUND_IT215 = &H800 ' For source data stored using IT215 compression. - FSOUND_HW3D = &H1000 ' Attempts to make samples use 3d hardware acceleration. (if the card supports it) - FSOUND_2D = &H2000 ' Ignores any 3d processing. overrides FSOUND_HW3D. Located in software. - FSOUND_STREAMABLE = &H4000 ' For realtime streamable samples. If you dont supply this sound may come out corrupted. - FSOUND_LOADMEMORY = &H8000 ' For FSOUND_Sample_Load - name will be interpreted as a pointer to data - FSOUND_LOADRAW = &H10000 ' For FSOUND_Sample_Load/FSOUND_Stream_Open - will ignore file format and treat as raw pcm. - FSOUND_MPEGACCURATE = &H20000 ' For FSOUND_Stream_Open - scans MP2/MP3 (VBR also) for accurate FSOUND_Stream_GetLengthMs/FSOUND_Stream_SetTime. - FSOUND_FORCEMONO = &H40000 ' For forcing stereo streams and samples to be mono - needed with FSOUND_HW3D - incurs speed hit - FSOUND_HW2D = &H80000 ' 2d hardware sounds. allows hardware specific effects - FSOUND_ENABLEFX = &H100000 ' Allows DX8 FX to be played back on a sound. Requires DirectX 8 - Note these sounds cant be played more than once, or have a changing frequency - FSOUND_MPEGHALFRATE = &H200000 ' For FMODCE only - decodes mpeg streams using a lower quality decode, but faster execution - FSOUND_XADPCM = &H400000 ' For XBOX only - Describes a user sample that its contents are compressed as XADPCM - FSOUND_VAG = &H800000 ' For PS2 only - Describes a user sample that its contents are compressed as Sony VAG format. - FSOUND_NONBLOCKING = &H1000000 ' For FSOUND_Stream_Open - Causes stream to open in the background and not block the foreground app - stream plays only when ready. - FSOUND_GCADPCM = &H2000000 ' For Gamecube only - Contents are compressed as Gamecube DSP-ADPCM format - FSOUND_MULTICHANNEL = &H4000000 ' For PS2 only - Contents are interleaved into a multi-channel (more than stereo) format - FSOUND_USECORE0 = &H8000000 ' For PS2 only - Sample/Stream is forced to use hardware voices 00-23 - FSOUND_USECORE1 = &H10000000 ' For PS2 only - Sample/Stream is forced to use hardware voices 24-47 - FSOUND_LOADMEMORYIOP = &H20000000 ' For PS2 only - "name" will be interpreted as a pointer to data for streaming and samples. The address provided will be an IOP address - FSOUND_IGNORETAGS = &H40000000 ' Skips id3v2 etc tag checks when opening a stream, to reduce seek/read overhead when opening files (helps with CD performance) - FSOUND_STREAM_NET = &H80000000 ' Specifies an internet stream - - FSOUND_NORMAL = FSOUND_16BITS Or FSOUND_SIGNED Or FSOUND_MONO -End Enum - - -' FSOUND_CDPLAYMODES -' Playback method for a CD Audio track, with FSOUND_CD_SetPlayMode -' -Public Enum FSOUND_CDPLAYMODES - FSOUND_CD_PLAYCONTINUOUS 'Starts from the current track and plays to end of CD. - FSOUND_CD_PLAYONCE 'Plays the specified track then stops. - FSOUND_CD_PLAYLOOPED 'Plays the specified track looped, forever until stopped manually. - FSOUND_CD_PLAYRANDOM 'Plays tracks in random order -End Enum - - -' FSOUND_CHANNELSAMPLEMODE -' Miscellaneous values for FMOD functions. -' FSOUND_PlaySound, FSOUND_PlaySoundEx, FSOUND_Sample_Alloc, FSOUND_Sample_Load, FSOUND_SetPan -' -Public Enum FSOUND_CHANNELSAMPLEMODE - FSOUND_FREE = -1 ' definition for dynamically allocated channel or sample - FSOUND_UNMANAGED = -2 ' definition for allocating a sample that is NOT managed by fsound - FSOUND_ALL = -3 ' for a channel index or sample index, this flag affects ALL channels or samples available! Not supported by all functions. - FSOUND_STEREOPAN = -1 ' definition for full middle stereo volume on both channels - FSOUND_SYSTEMCHANNEL = -1000 ' special channel ID for channel based functions that want to alter the global FSOUND software mixing output channel - FSOUND_SYSTEMSAMPLE = -1000 ' special sample ID for all sample based functions that want to alter the global FSOUND software mixing output sample -End Enum - - -' FSOUND_REVERB_PROPERTIES -' FSOUND_Reverb_SetProperties, FSOUND_Reverb_GetProperties, FSOUND_REVERB_PROPERTYFLAGS -' -Public Type FSOUND_REVERB_PROPERTIES - ' MIN MAX DEFAULT DESCRIPTION - Environment As Long ' 0 25 0 sets all listener properties - EnvSize As Single ' 1.0 100.0 7.5 environment size in meters - EnvDiffusion As Single ' 0.0 1.0 1.0 environment diffusion - Room As Long ' -10000 0 -1000 room effect level (at mid frequencies) - RoomHF As Long ' -10000 0 -100 relative room effect level at high frequencies - RoomLF As Long ' -10000 0 0 relative room effect level at low frequencies - DecayTime As Single ' 0.1 20.0 1.49 reverberation decay time at mid frequencies - DecayHFRatio As Single ' 0.1 2.0 0.83 high-frequency to mid-frequency decay time ratio - DecayLFRatio As Single ' 0.1 2.0 1.0 low-frequency to mid-frequency decay time ratio - Reflections As Long ' -10000 1000 -2602 early reflections level relative to room effect - ReflectionsDelay As Single ' 0.0 0.3 0.007 initial reflection delay time - ReflectionsPan(3) As Single ' 0,0,0 early reflections panning vector - Reverb As Long ' -1000 2000 200 late reverberation level relative to room effect - ReverbDelay As Single ' 0.0 0.1 0.011 late reverberation delay time relative to initial reflection - ReverbPan(3) As Single ' 0,0,0 late reverberation panning vector - EchoTime As Single ' .075 0.25 0.25 echo time - EchoDepth As Single ' 0.0 1.0 0.0 echo depth - ModulationTime As Single ' 0.04 4.0 0.25 modulation time - ModulationDepth As Single ' 0.0 1.0 0.0 modulation depth - AirAbsorptionHF As Single ' -100 0.0 -5.0 change in level per meter at high frequencies - HFReference As Single ' 1000.0 20000 5000.0 reference high frequency (hz) - LFReference As Single ' 20.0 1000.0 250.0 reference low frequency (hz) - RoomRolloffFactor As Single ' 0.0 10.0 0.0 like FSOUND_3D_SetRolloffFactor but for room effect - Diffusion As Single ' 0.0 100.0 100.0 Value that controls the echo density in the late reverberation decay. (xbox only) - Density As Single ' 0.0 100.0 100.0 Value that controls the modal density in the late reverberation decay (xbox only) - flags As Long ' modifies the behavior of above properties -End Type - - -' FSOUND_REVERB_FLAGS -' Values for the Flags member of the FSOUND_REVERB_PROPERTIES structure. -' -Public Enum FSOUND_REVERB_PROPERTYFLAGS - FSOUND_REVERBFLAGS_DECAYTIMESCALE = &H1 ' EnvironmentSize affects reverberation decay time - FSOUND_REVERBFLAGS_REFLECTIONSSCALE = &H2 ' EnvironmentSize affects reflection level - FSOUND_REVERBFLAGS_REFLECTIONSDELAYSCALE = &H4 ' EnvironmentSize affects initial reflection delay time - FSOUND_REVERBFLAGS_REVERBSCALE = &H8 ' EnvironmentSize affects reflections level - FSOUND_REVERBFLAGS_REVERBDELAYSCALE = &H10 ' EnvironmentSize affects late reverberation delay time - FSOUND_REVERBFLAGS_DECAYHFLIMIT = &H20 ' AirAbsorptionHF affects DecayHFRatio - FSOUND_REVERBFLAGS_ECHOTIMESCALE = &H40 ' EnvironmentSize affects echo time - FSOUND_REVERBFLAGS_MODULATIONTIMESCALE = &H80 ' EnvironmentSize affects modulation time - FSOUND_REVERB_FLAGS_CORE0 = &H100 ' PS2 Only - Reverb is applied to CORE0 (hw voices 0-23) - FSOUND_REVERB_FLAGS_CORE1 = &H200 ' PS2 Only - Reverb is applied to CORE1 (hw voices 24-47) - FSOUND_REVERBFLAGS_DEFAULT = FSOUND_REVERBFLAGS_DECAYTIMESCALE Or FSOUND_REVERBFLAGS_REFLECTIONSSCALE Or FSOUND_REVERBFLAGS_REFLECTIONSDELAYSCALE Or FSOUND_REVERBFLAGS_REVERBSCALE Or FSOUND_REVERBFLAGS_REVERBDELAYSCALE Or FSOUND_REVERBFLAGS_DECAYHFLIMIT Or FSOUND_REVERB_FLAGS_CORE0 Or FSOUND_REVERB_FLAGS_CORE1 -End Enum - - -' FSOUND_REVERB_CHANNELPROPERTIES -' Structure defining the properties for a reverb source, related to a FSOUND channel. -' FSOUND_Reverb_SetEnvironment, FSOUND_Reverb_SetEnvironmentAdvanced -' -Public Type FSOUND_REVERB_CHANNELPROPERTIES - Direct As Long ' direct path level (at low and mid frequencies) - DirectHF As Long ' relative direct path level at high frequencies - Room As Long ' room effect level (at low and mid frequencies) - RoomHF As Long ' relative room effect level at high frequencies - Obstruction As Long ' main obstruction control (attenuation at high frequencies) - ObstructionLFRatio As Single ' obstruction low-frequency level re. main control - Occlusion As Long ' main occlusion control (attenuation at high frequencies) - OcclustionLFRatio As Single ' occlusion low-frequency level re. main control - OcclusionRoomRatio As Single ' relative occlusion control for room effect - OcclusionDirectRatio As Single ' relative occlusion control for direct path - Exclusion As Long ' main exlusion control (attenuation at high frequencies) - ExclusionLFRatio As Single ' exclusion low-frequency level re. main control - OutsideVolumeHF As Long ' outside sound cone level at high frequencies - DopplerFactor As Single ' like DS3D flDopplerFactor but per source - RolloffFactor As Single ' like DS3D flRolloffFactor but per source - RoomRolloffFactor As Single ' like DS3D flRolloffFactor but for room effect - AirAbsorptionFactor As Single ' multiplies AirAbsorptionHF member of FSOUND_REVERB_PROPERTIES - flags As Long ' modifies the behavior of properties -End Type - - -' FSOUND_REVERB_CHANNELFLAGS -' Values for the Flags member of the FSOUND_REVERB_CHANNELPROPERTIES structure. -' -Public Enum FSOUND_REVERB_CHANNELFLAGS - FSOUND_REVERB_CHANNELFLAGS_DIRECTHFAUTO = &H1 ' Automatic setting of Direct due to distance from listener - FSOUND_REVERB_CHANNELFLAGS_ROOMAUTO = &H2 ' Automatic setting of Room due to distance from listener - FSOUND_REVERB_CHANNELFLAGS_ROOMHFAUTO = &H4 ' Automatic setting of RoomHF due to distance from listener - FSOUND_REVERB_CHANNELFLAGS_DEFAULT = FSOUND_REVERB_CHANNELFLAGS_DIRECTHFAUTO Or FSOUND_REVERB_CHANNELFLAGS_ROOMAUTO Or FSOUND_REVERB_CHANNELFLAGS_ROOMHFAUTO -End Enum - - -' FSOUND_FX_MODES -' These values are used with FSOUND_FX_Enable to enable DirectX 8 FX for a channel. -' -Public Enum FSOUND_FX_MODES - FSOUND_FX_CHORUS - FSOUND_FX_COMPRESSOR - FSOUND_FX_DISTORTION - FSOUND_FX_ECHO - FSOUND_FX_FLANGER - FSOUND_FX_GARGLE - FSOUND_FX_I3DL2REVERB - FSOUND_FX_PARAMEQ - FSOUND_FX_WAVES_REVERB -End Enum - - -'FSOUND_SPEAKERMODES -'These are speaker types defined for use with the FSOUND_SetSpeakerMode command. -'Note - Only reliably works with FSOUND_OUTPUT_DSOUND or FSOUND_OUTPUT_XBOX output modes. Other output modes will only -'interpret FSOUND_SPEAKERMODE_MONO and set everything else to be stereo. -'Using either DolbyDigital or DTS will use whatever 5.1 digital mode is available if destination hardware is unsure. -' -Public Enum FSOUND_SPEAKERMODES - FSOUND_SPEAKERMODE_DOLBYDIGITAL ' The audio is played through a speaker arrangement of surround speakers with a subwoofer. - FSOUND_SPEAKERMODE_HEADPHONE ' The speakers are headphones. - FSOUND_SPEAKERMODE_MONO ' The speakers are monaural. - FSOUND_SPEAKERMODE_QUAD ' The speakers are quadraphonic. - FSOUND_SPEAKERMODE_STEREO ' The speakers are stereo (default value). - FSOUND_SPEAKERMODE_SURROUND ' The speakers are surround sound. - FSOUND_SPEAKERMODE_DTS ' The audio is played through a speaker arrangement of surround speakers with a subwoofer. - FSOUND_SPEAKERMODE_PROLOGIC2 ' Dolby Prologic 2. Playstation 2 and Gamecube only -End Enum - - -' FSOUND_INIT_FLAGS -' Initialization flags. Use them with FSOUND_Init in the flags parameter to change various behaviour. -' FSOUND_INIT_ENABLESYSTEMCHANNELFX Is an init mode which enables the FSOUND mixer buffer to be affected by DirectX 8 effects. -' Note that due to limitations of DirectSound, FSOUND_Init may fail if this is enabled because the buffersize is too small. -' This can be fixed with FSOUND_SetBufferSize. Increase the BufferSize until it works. -' When it is enabled you can use the FSOUND_FX api, and use FSOUND_SYSTEMCHANNEL as the channel id when setting parameters. -' -Public Enum FSOUND_INITMODES - FSOUND_INIT_USEDEFAULTMIDISYNTH = &H1 'Causes MIDI playback to force software decoding. - FSOUND_INIT_GLOBALFOCUS = &H2 'For DirectSound output - sound is not muted when window is out of focus. - FSOUND_INIT_ENABLESYSTEMCHANNELFX = &H4 'For DirectSound output - Allows FSOUND_FX api to be used on global software mixer output! - FSOUND_INIT_ACCURATEVULEVELS = &H8 'This latency adjusts FSOUND_GetCurrentLevels, but incurs a small cpu and memory hit - FSOUND_INIT_PS2_DISABLECORE0REVERB = &H10 'PS2 only - Disable reverb on CORE 0 to regain SRAM - FSOUND_INIT_PS2_DISABLECORE1REVERB = &H20 'PS2 only - Disable reverb on CORE 1 to regain SRAM - FSOUND_INIT_PS2_SWAPDMACORES = &H40 'PS2 only - By default FMOD uses DMA CH0 for mixing, CH1 for uploads, this flag swaps them around - FSOUND_INIT_DONTLATENCYADJUST = &H80 'Callbacks are not latency adjusted, and are called at mix time. Also information functions are immediate - FSOUND_INIT_GC_INITLIBS = &H100 'Gamecube only - Initializes GC audio libraries - FSOUND_INIT_STREAM_FROM_MAIN_THREAD = &H200 'Turns off fmod streamer thread, and makes streaming update from FSOUND_Update called by the user - FSOUND_INIT_PS2_USEVOLUMERAMPING = &H400 'PS2 only - Turns on volume ramping system to remove hardware clicks. - FSOUND_INIT_DSOUND_DEFERRED = &H800 'Win32 only - For DirectSound output. 3D commands are batched together and executed at FSOUND_Update. - FSOUND_INIT_DSOUND_HRTF_LIGHT = &H1000 'Win32 only - For DirectSound output. FSOUND_HW3D buffers use a slightly higher quality algorithm when 3d hardware acceleration is not present. - FSOUND_INIT_DSOUND_HRTF_FULL = &H2000 'Win32 only - For DirectSound output. FSOUND_HW3D buffers use full quality 3d playback when 3d hardware acceleration is not present. - FSOUND_INIT_XBOX_REMOVEHEADROOM = &H4000 'XBox only - By default directsound attenuates all sound by 6db to avoid clipping/distortion. CAUTION. If you use this flag you are responsible for the final mix to make sure clipping / distortion doesn't happen. - FSOUND_INIT_PSP_SILENCEONUNDERRUN = &H8000 'PSP only - If streams skip / stutter when device is powered on, either increase stream buffersize, or use this flag instead to play silence while the UMD is recovering. -End Enum - - -' FSOUND_STREAM_NET_STATUS -' Status values for internet streams. Use FSOUND_Stream_Net_GetStatus to get the current status of an internet stream. -' -Public Enum FSOUND_STREAM_NET_STATUS - FSOUND_STREAM_NET_NOTCONNECTED ' Stream hasn't connected yet - FSOUND_STREAM_NET_CONNECTING ' Stream is connecting to remote host - FSOUND_STREAM_NET_BUFFERING ' Stream is buffering data - FSOUND_STREAM_NET_READY ' Stream is ready to play - FSOUND_STREAM_NET_ERROR ' Stream has suffered a fatal error -End Enum - - -' FSOUND_TAGFIELD_TYPE -' Describes the type of a particular tag field. -' See FSOUND_Stream_GetNumTagFields, FSOUND_Stream_GetTagField, FSOUND_Stream_FindTagField -' -Public Enum FSOUND_TAGFIELD_TYPE - FSOUND_TAGFIELD_VORBISCOMMENT = 0 ' A vorbis comment - FSOUND_TAGFIELD_ID3V1 ' Part of an ID3v1 tag - FSOUND_TAGFIELD_ID3V2 ' An ID3v2 frame - FSOUND_TAGFIELD_SHOUTCAST ' A SHOUTcast header line - FSOUND_TAGFIELD_ICECAST ' An Icecast header line - FSOUND_TAGFIELD_ASF ' An Advanced Streaming Format header line -End Enum - - -' FSOUND_STATUS_FLAGS -' These values describe the protocol and format of an internet stream. Use FSOUND_Stream_Net_GetStatus to retrieve this information for an open internet stream. -' -Public Enum FSOUND_STATUS_FLAGS - FSOUND_PROTOCOL_SHOUTCAST = &H1 - FSOUND_PROTOCOL_ICECAST = &H2 - FSOUND_PROTOCOL_HTTP = &H4 - FSOUND_FORMAT_MPEG = &H10000 - FSOUND_FORMAT_OGGVORBIS = &H20000 -End Enum - -' FSOUND_TOC_TAG -' FSOUND_Stream_Open, FSOUND_Stream_FindTagField -' -Public Type FSOUND_TOC_TAG - TagName(3) As Byte ' The string "TOC" (4th character is 0), just in case this structure is accidentally treated as a string. - NumTracks As Long ' The number of tracks on the CD. - Min(99) As Long ' The start offset of each track in minutes. - Sec(99) As Long ' The start offset of each track in seconds. - Frame(99) As Long ' The start offset of each track in frames. -End Type - - -'/* ================================== */ -'/* Initialization / Global functions. */ -'/* ================================== */ - - -' PRE - FSOUND_Init functions. These cant be called after FSOUND_Init is -' called (they will fail). They set up FMOD system functionality. - - -Public Declare Function FSOUND_SetOutput Lib "fmod.dll" Alias "_FSOUND_SetOutput@4" (ByVal outputtype As FSOUND_OUTPUTTYPES) As Byte -Public Declare Function FSOUND_SetDriver Lib "fmod.dll" Alias "_FSOUND_SetDriver@4" (ByVal driver As Long) As Byte -Public Declare Function FSOUND_SetMixer Lib "fmod.dll" Alias "_FSOUND_SetMixer@4" (ByVal mixer As FSOUND_MIXERTYPES) As Byte -Public Declare Function FSOUND_SetBufferSize Lib "fmod.dll" Alias "_FSOUND_SetBufferSize@4" (ByVal lenms As Long) As Byte -Public Declare Function FSOUND_SetHWND Lib "fmod.dll" Alias "_FSOUND_SetHWND@4" (ByVal hwnd As Long) As Byte -Public Declare Function FSOUND_SetMinHardwareChannels Lib "fmod.dll" Alias "_FSOUND_SetMinHardwareChannels@4" (ByVal min As Integer) As Byte -Public Declare Function FSOUND_SetMaxHardwareChannels Lib "fmod.dll" Alias "_FSOUND_SetMaxHardwareChannels@4" (ByVal min As Integer) As Byte -Public Declare Function FSOUND_SetMemorySystem Lib "fmod.dll" Alias "_FSOUND_SetMemorySystem@20" (ByVal pool As Long, ByVal poollen As Long, ByVal useralloc As Long, ByVal userrealloc As Long, ByVal userfree As Long) As Byte - -' -' Main initialization / closedown functions. -' Note : Use FSOUND_INIT_USEDEFAULTMIDISYNTH with FSOUND_Init for software override -' with MIDI playback. -' : Use FSOUND_INIT_GLOBALFOCUS with FSOUND_Init to make sound audible no matter -' which window is in focus. (FSOUND_OUTPUT_DSOUND only) -' - -Public Declare Function FSOUND_Init Lib "fmod.dll" Alias "_FSOUND_Init@12" (ByVal mixrate As Long, ByVal maxchannels As Long, ByVal flags As FSOUND_INITMODES) As Byte -Public Declare Function FSOUND_Close Lib "fmod.dll" Alias "_FSOUND_Close@0" () As Long - -' -' Runtime system level functions -' - -Public Declare Function FSOUND_Update Lib "fmod.dll" Alias "_FSOUND_Update@0" () As Long - -Public Declare Function FSOUND_SetSpeakerMode Lib "fmod.dll" Alias "_FSOUND_SetSpeakerMode@4" (ByVal speakermode As FSOUND_SPEAKERMODES) As Long -Public Declare Function FSOUND_SetSFXMasterVolume Lib "fmod.dll" Alias "_FSOUND_SetSFXMasterVolume@4" (ByVal volume As Long) As Long -Public Declare Function FSOUND_SetPanSeperation Lib "fmod.dll" Alias "_FSOUND_SetPanSeperation@4" (ByVal pansep As Single) As Long -Public Declare Function FSOUND_File_SetCallbacks Lib "fmod.dll" Alias "_FSOUND_File_SetCallbacks@20" (ByVal OpenCallback As Long, ByVal CloseCallback As Long, ByVal ReadCallback As Long, ByVal SeekCallback As Long, ByVal TellCallback As Long) As Long - -' -' System information functions. -' - -Public Declare Function FSOUND_GetError Lib "fmod.dll" Alias "_FSOUND_GetError@0" () As FMOD_ERRORS -Public Declare Function FSOUND_GetVersion Lib "fmod.dll" Alias "_FSOUND_GetVersion@0" () As Single -Public Declare Function FSOUND_GetOutput Lib "fmod.dll" Alias "_FSOUND_GetOutput@0" () As FSOUND_OUTPUTTYPES -Public Declare Function FSOUND_GetOutputHandle Lib "fmod.dll" Alias "_FSOUND_GetOutputHandle@0" () As Long -Public Declare Function FSOUND_GetDriver Lib "fmod.dll" Alias "_FSOUND_GetDriver@0" () As Long -Public Declare Function FSOUND_GetMixer Lib "fmod.dll" Alias "_FSOUND_GetMixer@0" () As FSOUND_MIXERTYPES -Public Declare Function FSOUND_GetNumDrivers Lib "fmod.dll" Alias "_FSOUND_GetNumDrivers@0" () As Long -Public Declare Function FSOUND_GetDriverName Lib "fmod.dll" Alias "_FSOUND_GetDriverName@4" (ByVal id As Long) As Long -Public Declare Function FSOUND_GetDriverCaps Lib "fmod.dll" Alias "_FSOUND_GetDriverCaps@8" (ByVal id As Long, ByRef caps As Long) As Byte -Public Declare Function FSOUND_GetOutputRate Lib "fmod.dll" Alias "_FSOUND_GetOutputRate@0" () As Long -Public Declare Function FSOUND_GetMaxChannels Lib "fmod.dll" Alias "_FSOUND_GetMaxChannels@0" () As Long -Public Declare Function FSOUND_GetMaxSamples Lib "fmod.dll" Alias "_FSOUND_GetMaxSamples@0" () As Long -Public Declare Function FSOUND_GetSpeakerMode Lib "fmod.dll" Alias "_FSOUND_GetSpeakerMode@0" () As Long -Public Declare Function FSOUND_GetSFXMasterVolume Lib "fmod.dll" Alias "_FSOUND_GetSFXMasterVolume@0" () As Long -Public Declare Function FSOUND_GetNumHWChannels Lib "fmod.dll" Alias "_FSOUND_GetNumHWChannels@12" (ByRef num2d As Long, ByRef num3d As Long, ByRef total As Long) -Public Declare Function FSOUND_GetChannelsPlaying Lib "fmod.dll" Alias "_FSOUND_GetChannelsPlaying@0" () As Long -Public Declare Function FSOUND_GetCPUUsage Lib "fmod.dll" Alias "_FSOUND_GetCPUUsage@0" () As Single -Public Declare Sub FSOUND_GetMemoryStats Lib "fmod.dll" Alias "_FSOUND_GetMemoryStats@8" (ByRef currentalloced As Long, ByRef maxalloced As Long) - -'/* =================================== */ -'/* Sample management / load functions. */ -'/* =================================== */ - - -' Sample creation and management functions -' Note : Use FSOUND_LOADMEMORY flag with FSOUND_Sample_Load to load from memory. -' Use FSOUND_LOADRAW flag with FSOUND_Sample_Load to treat as as raw pcm data. - - -Public Declare Function FSOUND_Sample_Load Lib "fmod.dll" Alias "_FSOUND_Sample_Load@20" (ByVal index As Long, ByVal name As String, ByVal mode As FSOUND_MODES, ByVal offset As Long, ByVal length As Long) As Long -Public Declare Function FSOUND_Sample_Alloc Lib "fmod.dll" Alias "_FSOUND_Sample_Alloc@28" (ByVal index As Long, ByVal length As Long, ByVal mode As Long, ByVal deffreq As Long, ByVal defvol As Long, ByVal defpan As Long, ByVal defpri As Long) As Long -Public Declare Function FSOUND_Sample_Free Lib "fmod.dll" Alias "_FSOUND_Sample_Free@4" (ByVal sptr As Long) As Long -Public Declare Function FSOUND_Sample_Upload Lib "fmod.dll" Alias "_FSOUND_Sample_Upload@12" (ByVal sptr As Long, ByRef srcdata As Long, ByVal mode As Long) As Byte -Public Declare Function FSOUND_Sample_Lock Lib "fmod.dll" Alias "_FSOUND_Sample_Lock@28" (ByVal sptr As Long, ByVal offset As Long, ByVal length As Long, ByRef ptr1 As Long, ByRef ptr2 As Long, ByRef len1 As Long, ByRef len2 As Long) As Byte -Public Declare Function FSOUND_Sample_Unlock Lib "fmod.dll" Alias "_FSOUND_Sample_Unlock@20" (ByVal sptr As Long, ByVal sptr1 As Long, ByVal sptr2 As Long, ByVal len1 As Long, ByVal len2 As Long) As Byte - - -' Sample control functions - - -Public Declare Function FSOUND_Sample_SetMode Lib "fmod.dll" Alias "_FSOUND_Sample_SetMode@8" (ByVal sptr As Long, ByVal mode As FSOUND_MODES) As Byte -Public Declare Function FSOUND_Sample_SetLoopPoints Lib "fmod.dll" Alias "_FSOUND_Sample_SetLoopPoints@12" (ByVal sptr As Long, ByVal loopstart As Long, ByVal loopend As Long) As Byte -Public Declare Function FSOUND_Sample_SetDefaults Lib "fmod.dll" Alias "_FSOUND_Sample_SetDefaults@20" (ByVal sptr As Long, ByVal deffreq As Long, ByVal defvol As Long, ByVal defpan As Long, ByVal defpri As Long) As Byte -Public Declare Function FSOUND_Sample_SetDefaultsEx Lib "fmod.dll" Alias "_FSOUND_Sample_SetDefaultsEx@32" (ByVal sptr As Long, ByVal deffreq As Long, ByVal defvol As Long, ByVal defpan As Long, ByVal defpri As Long, ByVal varfreq As Long, ByVal varvol As Long, ByVal varpan As Long) As Byte -Public Declare Function FSOUND_Sample_SetMinMaxDistance Lib "fmod.dll" Alias "_FSOUND_Sample_SetMinMaxDistance@12" (ByVal sptr As Long, ByVal min As Single, ByVal max As Single) As Byte -Public Declare Function FSOUND_Sample_SetMaxPlaybacks Lib "fmod.dll" Alias "_FSOUND_Sample_SetMaxPlaybacks@8" (ByVal sptr As Long, ByVal max As Long) As Byte - - -' Sample information functions - - -Public Declare Function FSOUND_Sample_Get Lib "fmod.dll" Alias "_FSOUND_Sample_Get@4" (ByVal sampno As Long) As Long -Public Declare Function FSOUND_Sample_GetName Lib "fmod.dll" Alias "_FSOUND_Sample_GetName@4" (ByVal sptr As Long) As Long -Public Declare Function FSOUND_Sample_GetLength Lib "fmod.dll" Alias "_FSOUND_Sample_GetLength@4" (ByVal sptr As Long) As Long -Public Declare Function FSOUND_Sample_GetLoopPoints Lib "fmod.dll" Alias "_FSOUND_Sample_GetLoopPoints@12" (ByVal sptr As Long, ByRef loopstart As Long, ByRef loopend As Long) As Byte -Public Declare Function FSOUND_Sample_GetDefaults Lib "fmod.dll" Alias "_FSOUND_Sample_GetDefaults@20" (ByVal sptr As Long, ByRef deffreq As Long, ByRef defvol As Long, ByRef defpan As Long, ByRef defpri As Long) As Byte -Public Declare Function FSOUND_Sample_GetDefaultsEx Lib "fmod.dll" Alias "_FSOUND_Sample_GetDefaultsEx@32" (ByVal sptr As Long, ByRef deffreq As Long, ByRef defvol As Long, ByRef defpan As Long, ByRef defpri As Long, ByRef varfreq As Long, ByRef varvol As Long, ByRef varpan As Long) As Byte -Public Declare Function FSOUND_Sample_GetMode Lib "fmod.dll" Alias "_FSOUND_Sample_GetMode@4" (ByVal sptr As Long) As Long -Public Declare Function FSOUND_Sample_GetMinMaxDistance Lib "fmod.dll" Alias "_FSOUND_Sample_GetMinMaxDistance@12" (ByVal sptr As Long, ByRef min As Single, ByRef max As Single) As Byte - -'/* ============================ */ -'/* Channel control functions. */ -'/* ============================ */ - - -' Playing and stopping sounds. -' Note : Use FSOUND_FREE as the channel variable, to let FMOD pick a free channel for you. -' Use FSOUND_ALL as the channel variable to control ALL channels with one function call! - - -Public Declare Function FSOUND_PlaySound Lib "fmod.dll" Alias "_FSOUND_PlaySound@8" (ByVal channel As Long, ByVal sptr As Long) As Long -Public Declare Function FSOUND_PlaySoundEx Lib "fmod.dll" Alias "_FSOUND_PlaySoundEx@16" (ByVal channel As Long, ByVal sptr As Long, ByVal dsp As Long, ByVal startpaused As Byte) As Long -Public Declare Function FSOUND_StopSound Lib "fmod.dll" Alias "_FSOUND_StopSound@4" (ByVal channel As Long) As Byte - - -' Functions to control playback of a channel. -' Note : FSOUND_ALL can be used on most of these functions as a channel value. - - -Public Declare Function FSOUND_SetFrequency Lib "fmod.dll" Alias "_FSOUND_SetFrequency@8" (ByVal channel As Long, ByVal freq As Long) As Byte -Public Declare Function FSOUND_SetVolume Lib "fmod.dll" Alias "_FSOUND_SetVolume@8" (ByVal channel As Long, ByVal Vol As Long) As Byte -Public Declare Function FSOUND_SetVolumeAbsolute Lib "fmod.dll" Alias "_FSOUND_SetVolumeAbsolute@8" (ByVal channel As Long, ByVal Vol As Long) As Byte -Public Declare Function FSOUND_SetPan Lib "fmod.dll" Alias "_FSOUND_SetPan@8" (ByVal channel As Long, ByVal pan As Long) As Byte -Public Declare Function FSOUND_SetSurround Lib "fmod.dll" Alias "_FSOUND_SetSurround@8" (ByVal channel As Long, ByVal surround As Long) As Byte -Public Declare Function FSOUND_SetMute Lib "fmod.dll" Alias "_FSOUND_SetMute@8" (ByVal channel As Long, ByVal mute As Byte) As Byte -Public Declare Function FSOUND_SetPriority Lib "fmod.dll" Alias "_FSOUND_SetPriority@8" (ByVal channel As Long, ByVal Priority As Long) As Byte -Public Declare Function FSOUND_SetReserved Lib "fmod.dll" Alias "_FSOUND_SetReserved@8" (ByVal channel As Long, ByVal reserved As Long) As Byte -Public Declare Function FSOUND_SetPaused Lib "fmod.dll" Alias "_FSOUND_SetPaused@8" (ByVal channel As Long, ByVal Paused As Byte) As Byte -Public Declare Function FSOUND_SetLoopMode Lib "fmod.dll" Alias "_FSOUND_SetLoopMode@8" (ByVal channel As Long, ByVal loopmode As Long) As Byte -Public Declare Function FSOUND_SetCurrentPosition Lib "fmod.dll" Alias "_FSOUND_SetCurrentPosition@8" (ByVal channel As Long, ByVal offset As Long) As Byte -Public Declare Function FSOUND_3D_SetAttributes Lib "fmod.dll" Alias "_FSOUND_3D_SetAttributes@12" (ByVal channel As Long, ByRef Pos As Single, ByRef vel As Single) As Byte -Public Declare Function FSOUND_3D_SetMinMaxDistance Lib "fmod.dll" Alias "_FSOUND_3D_SetMinMaxDistance@12" (ByVal channel As Long, ByVal min As Single, ByVal max As Single) As Byte - -' -' Channel information functions. -' - -Public Declare Function FSOUND_IsPlaying Lib "fmod.dll" Alias "_FSOUND_IsPlaying@4" (ByVal channel As Long) As Byte -Public Declare Function FSOUND_GetFrequency Lib "fmod.dll" Alias "_FSOUND_GetFrequency@4" (ByVal channel As Long) As Long -Public Declare Function FSOUND_GetVolume Lib "fmod.dll" Alias "_FSOUND_GetVolume@4" (ByVal channel As Long) As Long -Public Declare Function FSOUND_GetAmplitude Lib "fmod.dll" Alias "_FSOUND_GetAmplitude@4" (ByVal channel As Long) As Long -Public Declare Function FSOUND_GetPan Lib "fmod.dll" Alias "_FSOUND_GetPan@4" (ByVal channel As Long) As Long -Public Declare Function FSOUND_GetSurround Lib "fmod.dll" Alias "_FSOUND_GetSurround@4" (ByVal channel As Long) As Byte -Public Declare Function FSOUND_GetMute Lib "fmod.dll" Alias "_FSOUND_GetMute@4" (ByVal channel As Long) As Byte -Public Declare Function FSOUND_GetPriority Lib "fmod.dll" Alias "_FSOUND_GetPriority@4" (ByVal channel As Long) As Long -Public Declare Function FSOUND_GetReserved Lib "fmod.dll" Alias "_FSOUND_GetReserved@4" (ByVal channel As Long) As Byte -Public Declare Function FSOUND_GetPaused Lib "fmod.dll" Alias "_FSOUND_GetPaused@4" (ByVal channel As Long) As Byte -Public Declare Function FSOUND_GetLoopMode Lib "fmod.dll" Alias "_FSOUND_GetLoopMode@4" (ByVal channel As Long) As Long -Public Declare Function FSOUND_GetCurrentPosition Lib "fmod.dll" Alias "_FSOUND_GetCurrentPosition@4" (ByVal channel As Long) As Long -Public Declare Function FSOUND_GetCurrentSample Lib "fmod.dll" Alias "_FSOUND_GetCurrentSample@4" (ByVal channel As Long) As Long -Public Declare Function FSOUND_GetCurrentLevels Lib "fmod.dll" Alias "_FSOUND_GetCurrentLevels@12" (ByVal channel As Long, ByRef l As Single, ByRef r As Single) As Byte -Public Declare Function FSOUND_GetNumSubChannels Lib "fmod.dll" Alias "_FSOUND_GetNumSubChannels@4" (ByVal channel As Long) As Long -Public Declare Function FSOUND_GetSubChannel Lib "fmod.dll" Alias "_FSOUND_GetSubChannel@8" (ByVal channel As Long, ByVal subchannel As Long) As Long -Public Declare Function FSOUND_3D_GetAttributes Lib "fmod.dll" Alias "_FSOUND_3D_GetAttributes@12" (ByVal channel As Long, ByRef Pos As Single, ByRef vel As Single) As Byte -Public Declare Function FSOUND_3D_GetMinMaxDistance Lib "fmod.dll" Alias "_FSOUND_3D_GetMinMaxDistance@12" (ByVal channel As Long, ByRef min As Single, ByRef max As Single) As Byte - -'/* ========================== */ -'/* Global 3D sound functions. */ -'/* ========================== */ - -' -' See also 3d sample and channel based functions above. -' Call FSOUND_Update once a frame to process 3d information. -' - -Public Declare Function FSOUND_3D_Listener_SetCurrent Lib "fmod.dll" Alias "_FSOUND_3D_Listener_SetCurrent@8" (ByVal current As Long) As Long -Public Declare Function FSOUND_3D_Listener_SetAttributes Lib "fmod.dll" Alias "_FSOUND_3D_Listener_SetAttributes@32" (ByVal Pos As Single, ByVal vel As Single, ByVal fx As Single, ByVal fy As Single, ByVal fz As Single, ByVal tx As Single, ByVal ty As Single, ByVal tz As Single) As Long -Public Declare Function FSOUND_3D_Listener_GetAttributes Lib "fmod.dll" Alias "_FSOUND_3D_Listener_GetAttributes@32" (ByRef Pos As Single, ByRef vel As Single, ByRef fx As Single, ByRef fy As Single, ByRef fz As Single, ByRef tx As Single, ByRef ty As Single, ByRef tz As Single) As Long -Public Declare Function FSOUND_3D_SetDopplerFactor Lib "fmod.dll" Alias "_FSOUND_3D_SetDopplerFactor@4" (ByVal fscale As Single) As Long -Public Declare Function FSOUND_3D_SetDistanceFactor Lib "fmod.dll" Alias "_FSOUND_3D_SetDistanceFactor@4" (ByVal fscale As Single) As Long -Public Declare Function FSOUND_3D_SetRolloffFactor Lib "fmod.dll" Alias "_FSOUND_3D_SetRolloffFactor@4" (ByVal fscale As Single) As Long - -'/* =================== */ -'/* FX functions. */ -'/* =================== */ - - -' Functions to control DX8 only effects processing. -' -' - FX enabled samples can only be played once at a time, not multiple times at once. -' - Sounds have to be created with FSOUND_HW2D or FSOUND_HW3D for this to work. -' - FSOUND_INIT_ENABLESYSTEMCHANNELFX can be used to apply hardware effect processing to the -' global mixed output of FMOD's software channels. -' - FSOUND_FX_Enable returns an FX handle that you can use to alter fx parameters. -' - FSOUND_FX_Enable can be called multiple times in a row, even on the same FX type, -' it will return a unique handle for each FX. -' - FSOUND_FX_Enable cannot be called if the sound is playing or locked. -' - FSOUND_FX_Disable must be called to reset/clear the FX from a channel. - - -Public Declare Function FSOUND_FX_Enable Lib "fmod.dll" Alias "_FSOUND_FX_Enable@8" (ByVal channel As Long, ByVal fx As FSOUND_FX_MODES) As Long -Public Declare Function FSOUND_FX_Disable Lib "fmod.dll" Alias "_FSOUND_FX_Disable@4" (ByVal channel As Long) As Byte - -Public Declare Function FSOUND_FX_SetChorus Lib "fmod.dll" Alias "_FSOUND_FX_SetChorus@32" (ByVal fxid As Long, ByVal WetDryMix As Single, ByVal Depth As Single, ByVal Feedback As Single, ByVal Frequency As Single, ByVal Waveform As Long, ByVal Delay As Single, ByVal Phase As Long) As Byte -Public Declare Function FSOUND_FX_SetCompressor Lib "fmod.dll" Alias "_FSOUND_FX_SetCompressor@28" (ByVal fxid As Long, ByVal Gain As Single, ByVal Attack As Single, ByVal Release As Single, ByVal Threshold As Single, ByVal Ratio As Single, ByVal Predelay As Single) As Byte -Public Declare Function FSOUND_FX_SetDistortion Lib "fmod.dll" Alias "_FSOUND_FX_SetDistortion@24" (ByVal fxid As Long, ByVal Gain As Single, ByVal Edge As Single, ByVal PostEQCenterFrequency As Single, ByVal PostEQBandwidth As Single, ByVal PreLowpassCutoff As Single) As Byte -Public Declare Function FSOUND_FX_SetEcho Lib "fmod.dll" Alias "_FSOUND_FX_SetEcho@24" (ByVal fxid As Long, ByVal WetDryMix As Single, ByVal Feedback As Single, ByVal LeftDelay As Single, ByVal RightDelay As Single, ByVal PanDelay As Long) As Byte -Public Declare Function FSOUND_FX_SetFlanger Lib "fmod.dll" Alias "_FSOUND_FX_SetFlanger@32" (ByVal fxid As Long, ByVal WetDryMix As Single, ByVal Depth As Single, ByVal Feedback As Single, ByVal Frequency As Single, ByVal Waveform As Long, ByVal Delay As Single, ByVal Phase As Long) As Byte -Public Declare Function FSOUND_FX_SetGargle Lib "fmod.dll" Alias "_FSOUND_FX_SetGargle@12" (ByVal fxid As Long, ByVal RateHz As Long, ByVal WaveShape As Long) As Byte -Public Declare Function FSOUND_FX_SetI3DL2Reverb Lib "fmod.dll" Alias "_FSOUND_FX_SetI3DL2Reverb@52" (ByVal fxid As Long, ByVal Room As Long, ByVal RoomHF As Long, ByVal RoomRolloffFactor As Single, ByVal DecayTime As Single, ByVal DecayHFRatio As Single, ByVal Reflections As Long, ByVal ReflectionsDelay As Single, ByVal Reverb As Long, ByVal ReverbDelay As Single, ByVal Diffusion As Single, ByVal Density As Single, ByVal HFReference As Single) As Byte -Public Declare Function FSOUND_FX_SetParamEQ Lib "fmod.dll" Alias "_FSOUND_FX_SetParamEQ@16" (ByVal fxid As Long, ByVal Center As Single, ByVal Bandwidth As Single, ByVal Gain As Single) As Byte -Public Declare Function FSOUND_FX_SetWavesReverb Lib "fmod.dll" Alias "_FSOUND_FX_SetWavesReverb@20" (ByVal fxid As Long, ByVal InGain As Single, ByVal ReverbMix As Single, ByVal ReverbTime As Single, ByVal HighFreqRTRatio As Single) As Byte - -' ========================= */ -' File Streaming functions. */ -' ========================= */ - -' -' Note : Use FSOUND_LOADMEMORY flag with FSOUND_Stream_Open to stream from memory. -' Use FSOUND_LOADRAW flag with FSOUND_Stream_Open to treat stream as raw pcm data. -' Use FSOUND_MPEGACCURATE flag with FSOUND_Stream_Open to open mpegs in 'accurate mode' for settime/gettime/getlengthms. -' Use FSOUND_FREE as the 'channel' variable, to let FMOD pick a free channel for you. -' - -Public Declare Function FSOUND_Stream_SetBufferSize Lib "fmod.dll" Alias "_FSOUND_Stream_SetBufferSize@4" (ByVal ms As Long) As Byte - -Public Declare Function FSOUND_Stream_Open Lib "fmod.dll" Alias "_FSOUND_Stream_Open@16" (ByVal filename As String, ByVal mode As FSOUND_MODES, ByVal offset As Long, ByVal length As Long) As Long -Public Declare Function FSOUND_Stream_Open2 Lib "fmod.dll" Alias "_FSOUND_Stream_Open@16" (ByRef data As Byte, ByVal mode As FSOUND_MODES, ByVal offset As Long, ByVal length As Long) As Long -Public Declare Function FSOUND_Stream_Create Lib "fmod.dll" Alias "_FSOUND_Stream_Create@20" (ByVal callback As Long, ByVal length As Long, ByVal mode As Long, ByVal samplerate As Long, ByVal userdata As Long) As Long -Public Declare Function FSOUND_Stream_Close Lib "fmod.dll" Alias "_FSOUND_Stream_Close@4" (ByVal stream As Long) As Byte - -Public Declare Function FSOUND_Stream_Play Lib "fmod.dll" Alias "_FSOUND_Stream_Play@8" (ByVal channel As Long, ByVal stream As Long) As Long -Public Declare Function FSOUND_Stream_PlayEx Lib "fmod.dll" Alias "_FSOUND_Stream_PlayEx@16" (ByVal channel As Long, ByVal stream As Long, ByVal dsp As Long, ByVal startpaused As Byte) As Long -Public Declare Function FSOUND_Stream_Stop Lib "fmod.dll" Alias "_FSOUND_Stream_Stop@4" (ByVal stream As Long) As Byte - -Public Declare Function FSOUND_Stream_SetPosition Lib "fmod.dll" Alias "_FSOUND_Stream_SetPosition@8" (ByVal stream As Long, ByVal positition As Long) As Byte -Public Declare Function FSOUND_Stream_GetPosition Lib "fmod.dll" Alias "_FSOUND_Stream_GetPosition@4" (ByVal stream As Long) As Long -Public Declare Function FSOUND_Stream_SetTime Lib "fmod.dll" Alias "_FSOUND_Stream_SetTime@8" (ByVal stream As Long, ByVal ms As Long) As Byte -Public Declare Function FSOUND_Stream_GetTime Lib "fmod.dll" Alias "_FSOUND_Stream_GetTime@4" (ByVal stream As Long) As Long -Public Declare Function FSOUND_Stream_GetLength Lib "fmod.dll" Alias "_FSOUND_Stream_GetLength@4" (ByVal stream As Long) As Long -Public Declare Function FSOUND_Stream_GetLengthMs Lib "fmod.dll" Alias "_FSOUND_Stream_GetLengthMs@4" (ByVal stream As Long) As Long - -Public Declare Function FSOUND_Stream_SetMode Lib "fmod.dll" Alias "_FSOUND_Stream_SetMode@8" (ByVal stream As Long, ByVal mode As Long) As Byte -Public Declare Function FSOUND_Stream_GetMode Lib "fmod.dll" Alias "_FSOUND_Stream_GetMode@4" (ByVal stream As Long) As Long -Public Declare Function FSOUND_Stream_SetLoopPoints Lib "fmod.dll" Alias "_FSOUND_Stream_SetLoopPoints@12" (ByVal stream As Long, ByVal loopstartpcm As Long, ByVal loopendpcm As Long) As Byte -Public Declare Function FSOUND_Stream_SetLoopCount Lib "fmod.dll" Alias "_FSOUND_Stream_SetLoopCount@8" (ByVal stream As Long, ByVal count As Long) As Byte -Public Declare Function FSOUND_Stream_GetOpenState Lib "fmod.dll" Alias "_FSOUND_Stream_GetOpenState@4" (ByVal stream As Long) As Long -Public Declare Function FSOUND_Stream_GetSample Lib "fmod.dll" Alias "_FSOUND_Stream_GetSample@4" (ByVal stream As Long) As Long -Public Declare Function FSOUND_Stream_CreateDSP Lib "fmod.dll" Alias "_FSOUND_Stream_CreateDSP@16" (ByVal stream As Long, ByVal callback As Long, ByVal Priority As Long, ByVal userdata As Long) As Long - -Public Declare Function FSOUND_Stream_SetEndCallback Lib "fmod.dll" Alias "_FSOUND_Stream_SetEndCallback@12" (ByVal stream As Long, ByVal callback As Long, ByVal userdata As Long) As Byte -Public Declare Function FSOUND_Stream_SetSyncCallback Lib "fmod.dll" Alias "_FSOUND_Stream_SetSyncCallback@12" (ByVal stream As Long, ByVal callback As Long, ByVal userdata As Long) As Byte - -Public Declare Function FSOUND_Stream_AddSyncPoint Lib "fmod.dll" Alias "_FSOUND_Stream_AddSyncPoint@12" (ByVal stream As Long, ByVal pcmoffset As Long, ByVal name As String) As Long -Public Declare Function FSOUND_Stream_DeleteSyncPoint Lib "fmod.dll" Alias "_FSOUND_Stream_DeleteSyncPoint@4" (ByVal point As Long) As Byte -Public Declare Function FSOUND_Stream_GetNumSyncPoints Lib "fmod.dll" Alias "_FSOUND_Stream_GetNumSyncPoints@4" (ByVal stream As Long) As Long -Public Declare Function FSOUND_Stream_GetSyncPoint Lib "fmod.dll" Alias "_FSOUND_Stream_GetSyncPoint@8" (ByVal stream As Long, ByVal index As Long) As Long -Public Declare Function FSOUND_Stream_GetSyncPointInfo Lib "fmod.dll" Alias "_FSOUND_Stream_GetSyncPointInfo@8" (ByVal point As Long, ByRef pcmoffset As Long) As Long - -Public Declare Function FSOUND_Stream_SetSubStream Lib "fmod.dll" Alias "_FSOUND_Stream_SetSubStream@8" (ByVal stream As Long, ByVal index As Long) As Byte -Public Declare Function FSOUND_Stream_GetNumSubStreams Lib "fmod.dll" Alias "_FSOUND_Stream_GetNumSubStreams@4" (ByVal stream As Long) As Long -Public Declare Function FSOUND_Stream_SetSubStreamSentence Lib "fmod.dll" Alias "_FSOUND_Stream_SetSubStreamSentence@12" (ByVal stream As Long, ByRef sentencelist As Long, ByVal numitems As Long) As Byte - -Public Declare Function FSOUND_Stream_GetNumTagFields Lib "fmod.dll" Alias "_FSOUND_Stream_GetNumTagFields@8" (ByVal stream As Long, ByRef num As Long) As Byte -Public Declare Function FSOUND_Stream_GetTagField Lib "fmod.dll" Alias "_FSOUND_Stream_GetTagField@24" (ByVal stream As Long, ByVal num As Long, ByRef tagtype As Long, ByRef name As Long, ByRef value As Long, ByRef length As Long) As Byte -Public Declare Function FSOUND_Stream_FindTagField Lib "fmod.dll" Alias "_FSOUND_Stream_FindTagField@20" (ByVal stream As Long, ByVal tagtype As Long, ByVal name As String, ByRef value As Long, ByRef length As Long) As Byte - -' -' Internet streaming functions -' - -Public Declare Function FSOUND_Stream_Net_SetProxy Lib "fmod.dll" Alias "_FSOUND_Stream_Net_SetProxy@4" (ByVal proxy As String) As Byte -Public Declare Function FSOUND_Stream_Net_GetLastServerStatus Lib "fmod.dll" Alias "_FSOUND_Stream_Net_GetLastServerStatus@0" () As Long -Public Declare Function FSOUND_Stream_Net_SetBufferProperties Lib "fmod.dll" Alias "_FSOUND_Stream_Net_SetBufferProperties@12" (ByVal buffersize As Long, ByVal prebuffer_percent As Long, ByVal rebuffer_percent As Long) As Byte -Public Declare Function FSOUND_Stream_Net_GetBufferProperties Lib "fmod.dll" Alias "_FSOUND_Stream_Net_GetBufferProperties@12" (ByRef buffersize As Long, ByRef prebuffer_percent As Long, ByRef rebuffer_percent As Long) As Byte -Public Declare Function FSOUND_Stream_Net_SetMetadataCallback Lib "fmod.dll" Alias "_FSOUND_Stream_Net_SetMetadataCallback@12" (ByVal stream As Long, ByVal callback As Long, ByVal userdata As Long) As Byte -Public Declare Function FSOUND_Stream_Net_GetStatus Lib "fmod.dll" Alias "_FSOUND_Stream_Net_GetStatus@20" (ByVal stream As Long, ByRef status As Long, ByRef bufferpercentused As Long, ByRef bitrate As Long, ByRef flags As Long) As Byte - -'/* =================== */ -'/* CD audio functions. */ -'/* =================== */ - - -' Note : 0 = default cdrom. Otherwise specify the drive letter, for example. 'D'. - - -Public Declare Function FSOUND_CD_Play Lib "fmod.dll" Alias "_FSOUND_CD_Play@8" (ByVal drive As Byte, ByVal Track As Long) As Byte -Public Declare Function FSOUND_CD_SetPlayMode Lib "fmod.dll" Alias "_FSOUND_CD_SetPlayMode@8" (ByVal drive As Byte, ByVal mode As FSOUND_CDPLAYMODES) As Long -Public Declare Function FSOUND_CD_Stop Lib "fmod.dll" Alias "_FSOUND_CD_Stop@4" (ByVal drive As Byte) As Byte -Public Declare Function FSOUND_CD_SetPaused Lib "fmod.dll" Alias "_FSOUND_CD_SetPaused@8" (ByVal drive As Byte, ByVal Paused As Byte) As Byte -Public Declare Function FSOUND_CD_SetVolume Lib "fmod.dll" Alias "_FSOUND_CD_SetVolume@8" (ByVal drive As Byte, ByVal volume As Long) As Byte -Public Declare Function FSOUND_CD_SetTrackTime Lib "fmod.dll" Alias "_FSOUND_CD_SetTrackTime@8" (ByVal drive As Byte, ByVal ms As Long) As Byte -Public Declare Function FSOUND_CD_OpenTray Lib "fmod.dll" Alias "_FSOUND_CD_OpenTray@8" (ByVal drive As Byte, ByVal openState As Byte) As Byte - -Public Declare Function FSOUND_CD_GetPaused Lib "fmod.dll" Alias "_FSOUND_CD_GetPaused@4" (ByVal drive As Byte) As Byte -Public Declare Function FSOUND_CD_GetTrack Lib "fmod.dll" Alias "_FSOUND_CD_GetTrack@4" (ByVal drive As Byte) As Long -Public Declare Function FSOUND_CD_GetNumTracks Lib "fmod.dll" Alias "_FSOUND_CD_GetNumTracks@4" (ByVal drive As Byte) As Long -Public Declare Function FSOUND_CD_GetVolume Lib "fmod.dll" Alias "_FSOUND_CD_GetVolume@4" (ByVal drive As Byte) As Long -Public Declare Function FSOUND_CD_GetTrackLength Lib "fmod.dll" Alias "_FSOUND_CD_GetTrackLength@8" (ByVal drive As Byte, ByVal Track As Long) As Long -Public Declare Function FSOUND_CD_GetTrackTime Lib "fmod.dll" Alias "_FSOUND_CD_GetTrackTime@4" (ByVal drive As Byte) As Long - -'/* ============== */ -'/* DSP functions. */ -'/* ============== */ - - -' DSP Unit control and information functions. -' These functions allow you access to the mixed stream that FMOD uses to play back sound on. - - -Public Declare Function FSOUND_DSP_Create Lib "fmod.dll" Alias "_FSOUND_DSP_Create@12" (ByVal callback As Long, ByVal Priority As Long, ByVal param As Long) As Long -Public Declare Function FSOUND_DSP_Free Lib "fmod.dll" Alias "_FSOUND_DSP_Free@4" (ByVal unit As Long) As Long -Public Declare Function FSOUND_DSP_SetPriority Lib "fmod.dll" Alias "_FSOUND_DSP_SetPriority@8" (ByVal unit As Long, ByVal Priority As Long) As Long -Public Declare Function FSOUND_DSP_GetPriority Lib "fmod.dll" Alias "_FSOUND_DSP_GetPriority@4" (ByVal unit As Long) As Long -Public Declare Function FSOUND_DSP_SetActive Lib "fmod.dll" Alias "_FSOUND_DSP_SetActive@8" (ByVal unit As Long, ByVal active As Integer) As Long -Public Declare Function FSOUND_DSP_GetActive Lib "fmod.dll" Alias "_FSOUND_DSP_GetActive@4" (ByVal unit As Long) As Byte - - -' Functions to get hold of FSOUND 'system DSP unit' handles - - -Public Declare Function FSOUND_DSP_GetClearUnit Lib "fmod.dll" Alias "_FSOUND_DSP_GetClearUnit@0" () As Long -Public Declare Function FSOUND_DSP_GetSFXUnit Lib "fmod.dll" Alias "_FSOUND_DSP_GetSFXUnit@0" () As Long -Public Declare Function FSOUND_DSP_GetMusicUnit Lib "fmod.dll" Alias "_FSOUND_DSP_GetMusicUnit@0" () As Long -Public Declare Function FSOUND_DSP_GetFFTUnit Lib "fmod.dll" Alias "_FSOUND_DSP_GetFFTUnit@0" () As Long -Public Declare Function FSOUND_DSP_GetClipAndCopyUnit Lib "fmod.dll" Alias "_FSOUND_DSP_GetClipAndCopyUnit@0" () As Long - - -' Miscellaneous DSP functions -' Note for the spectrum analysis function to work, you have to enable the FFT DSP unit with -' the following code FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(), TRUE); -' It is off by default to save cpu usage. - - -Public Declare Function FSOUND_DSP_MixBuffers Lib "fmod.dll" Alias "_FSOUND_DSP_MixBuffers@28" (ByVal destbuffer As Long, ByVal srcbuffer As Long, ByVal length As Long, ByVal freq As Long, ByVal Vol As Long, ByVal pan As Long, ByVal mode As Long) As Byte -Public Declare Function FSOUND_DSP_ClearMixBuffer Lib "fmod.dll" Alias "_FSOUND_DSP_ClearMixBuffer@0" () As Long -Public Declare Function FSOUND_DSP_GetBufferLength Lib "fmod.dll" Alias "_FSOUND_DSP_GetBufferLength@0" () As Long -Public Declare Function FSOUND_DSP_GetBufferLengthTotal Lib "fmod.dll" Alias "_FSOUND_DSP_GetBufferLengthTotal@0" () As Long -Public Declare Function FSOUND_DSP_GetSpectrum Lib "fmod.dll" Alias "_FSOUND_DSP_GetSpectrum@0" () As Long - -'/* =================================================================================== */ -'/* Reverb functions. (eax2/eax3 reverb) (ONLY SUPPORTED ON WIN32 W/ FSOUND_HW3D FLAG) */ -'/* =================================================================================== */ - - -' See top of file for definitions and information on the reverb parameters. - -'The FSOUND_REVERB_PRESETS have not been included in VB yet so they cannot yet be used here... -Public Declare Function FSOUND_Reverb_SetProperties Lib "fmod.dll" Alias "_FSOUND_Reverb_SetProperties@4" (ByRef prop As FSOUND_REVERB_PROPERTIES) As Byte -Public Declare Function FSOUND_Reverb_GetProperties Lib "fmod.dll" Alias "_FSOUND_Reverb_GetProperties@4" (ByRef prop As FSOUND_REVERB_PROPERTIES) As Byte -Public Declare Function FSOUND_Reverb_SetChannelProperties Lib "fmod.dll" Alias "_FSOUND_Reverb_SetChannelProperties@8" (ByVal channel As Long, ByRef prop As FSOUND_REVERB_CHANNELPROPERTIES) As Byte -Public Declare Function FSOUND_Reverb_GetChannelProperties Lib "fmod.dll" Alias "_FSOUND_Reverb_GetChannelProperties@8" (ByVal channel As Long, ByRef prop As FSOUND_REVERB_CHANNELPROPERTIES) As Byte - -'/* ===================================================== */ -'/* Recording functions (ONLY SUPPORTED IN WIN32, WINCE) */ -'/* ===================================================== */ - - -' Recording initialization functions - - -Public Declare Function FSOUND_Record_SetDriver Lib "fmod.dll" Alias "_FSOUND_Record_SetDriver@4" (ByVal outputtype As Long) As Byte -Public Declare Function FSOUND_Record_GetNumDrivers Lib "fmod.dll" Alias "_FSOUND_Record_GetNumDrivers@0" () As Long -Public Declare Function FSOUND_Record_GetDriverName Lib "fmod.dll" Alias "_FSOUND_Record_GetDriverName@4" (ByVal id As Long) As Long -Public Declare Function FSOUND_Record_GetDriver Lib "fmod.dll" Alias "_FSOUND_Record_GetDriver@0" () As Long - - -' Recording functionality. Only one recording session will work at a time. - - -Public Declare Function FSOUND_Record_StartSample Lib "fmod.dll" Alias "_FSOUND_Record_StartSample@8" (ByVal sample As Long, ByVal loopit As Boolean) As Byte -Public Declare Function FSOUND_Record_Stop Lib "fmod.dll" Alias "_FSOUND_Record_Stop@0" () As Byte -Public Declare Function FSOUND_Record_GetPosition Lib "fmod.dll" Alias "_FSOUND_Record_GetPosition@0" () As Long - -'/* ========================================================================================== */ -'/* FMUSIC API (MOD,S3M,XM,IT,MIDI PLAYBACK) */ -'/* ========================================================================================== */ - - -' Song management / playback functions. - - -Public Declare Function FMUSIC_LoadSong Lib "fmod.dll" Alias "_FMUSIC_LoadSong@4" (ByVal name As String) As Long -Public Declare Function FMUSIC_LoadSongEx Lib "fmod.dll" Alias "_FMUSIC_LoadSongEx@24" (ByVal name As String, ByVal offset As Long, ByVal length As Long, ByVal mode As FSOUND_MODES, ByRef sentencelist As Long, ByVal numitems As Long) As Long -Public Declare Function FMUSIC_LoadSongEx2 Lib "fmod.dll" Alias "_FMUSIC_LoadSongEx@24" (ByRef data As Byte, ByVal offset As Long, ByVal length As Long, ByVal mode As FSOUND_MODES, ByRef sentencelist As Long, ByVal numitems As Long) As Long -Public Declare Function FMUSIC_GetOpenState Lib "fmod.dll" Alias "_FMUSIC_GetOpenState@4" (ByVal module As Long) As Long -Public Declare Function FMUSIC_FreeSong Lib "fmod.dll" Alias "_FMUSIC_FreeSong@4" (ByVal module As Long) As Byte -Public Declare Function FMUSIC_PlaySong Lib "fmod.dll" Alias "_FMUSIC_PlaySong@4" (ByVal module As Long) As Byte -Public Declare Function FMUSIC_StopSong Lib "fmod.dll" Alias "_FMUSIC_StopSong@4" (ByVal module As Long) As Byte -Public Declare Function FMUSIC_StopAllSongs Lib "fmod.dll" Alias "_FMUSIC_StopAllSongs@0" () As Long - -Public Declare Function FMUSIC_SetZxxCallback Lib "fmod.dll" Alias "_FMUSIC_SetZxxCallback@8" (ByVal module As Long, ByVal callback As Long) As Byte -Public Declare Function FMUSIC_SetRowCallback Lib "fmod.dll" Alias "_FMUSIC_SetRowCallback@12" (ByVal module As Long, ByVal callback As Long, ByVal rowstep As Long) As Byte -Public Declare Function FMUSIC_SetOrderCallback Lib "fmod.dll" Alias "_FMUSIC_SetOrderCallback@12" (ByVal module As Long, ByVal callback As Long, ByVal rowstep As Long) As Byte -Public Declare Function FMUSIC_SetInstCallback Lib "fmod.dll" Alias "_FMUSIC_SetInstCallback@12" (ByVal module As Long, ByVal callback As Long, ByVal instrument As Long) As Byte - -Public Declare Function FMUSIC_SetSample Lib "fmod.dll" Alias "_FMUSIC_SetSample@12" (ByVal module As Long, ByVal sampno As Long, ByVal sptr As Long) As Byte -Public Declare Function FMUSIC_SetUserData Lib "fmod.dll" Alias "_FMUSIC_SetUserData@8" (ByVal module As Long, ByVal userdata As Long) As Byte -Public Declare Function FMUSIC_OptimizeChannels Lib "fmod.dll" Alias "_FMUSIC_OptimizeChannels@12" (ByVal module As Long, ByVal maxchannels As Long, ByVal minvolume As Long) As Byte - - -' Runtime song functions - - -Public Declare Function FMUSIC_SetReverb Lib "fmod.dll" Alias "_FMUSIC_SetReverb@4" (ByVal Reverb As Byte) As Byte -Public Declare Function FMUSIC_SetLooping Lib "fmod.dll" Alias "_FMUSIC_SetLooping@8" (ByVal module As Long, ByVal looping As Byte) As Byte -Public Declare Function FMUSIC_SetOrder Lib "fmod.dll" Alias "_FMUSIC_SetOrder@8" (ByVal module As Long, ByVal order As Long) As Byte -Public Declare Function FMUSIC_SetPaused Lib "fmod.dll" Alias "_FMUSIC_SetPaused@8" (ByVal module As Long, ByVal Pause As Byte) As Byte -Public Declare Function FMUSIC_SetMasterVolume Lib "fmod.dll" Alias "_FMUSIC_SetMasterVolume@8" (ByVal module As Long, ByVal volume As Long) As Byte -Public Declare Function FMUSIC_SetMasterSpeed Lib "fmod.dll" Alias "_FMUSIC_SetMasterSpeed@8" (ByVal module As Long, ByVal speed As Single) As Byte -Public Declare Function FMUSIC_SetPanSeperation Lib "fmod.dll" Alias "_FMUSIC_SetPanSeperation@8" (ByVal module As Long, ByVal pansep As Single) As Byte - - -' Static song information functions - - -Public Declare Function FMUSIC_GetName Lib "fmod.dll" Alias "_FMUSIC_GetName@4" (ByVal module As Long) As Long -Public Declare Function FMUSIC_GetType Lib "fmod.dll" Alias "_FMUSIC_GetType@4" (ByVal module As Long) As FMUSIC_TYPES -Public Declare Function FMUSIC_GetNumOrders Lib "fmod.dll" Alias "_FMUSIC_GetNumOrders@4" (ByVal module As Long) As Long -Public Declare Function FMUSIC_GetNumPatterns Lib "fmod.dll" Alias "_FMUSIC_GetNumPatterns@4" (ByVal module As Long) As Long -Public Declare Function FMUSIC_GetNumInstruments Lib "fmod.dll" Alias "_FMUSIC_GetNumInstruments@4" (ByVal module As Long) As Long -Public Declare Function FMUSIC_GetNumSamples Lib "fmod.dll" Alias "_FMUSIC_GetNumSamples@4" (ByVal module As Long) As Long -Public Declare Function FMUSIC_GetNumChannels Lib "fmod.dll" Alias "_FMUSIC_GetNumChannels@4" (ByVal module As Long) As Long -Public Declare Function FMUSIC_GetSample Lib "fmod.dll" Alias "_FMUSIC_GetSample@8" (ByVal module As Long, ByVal sampno As Long) As Long -Public Declare Function FMUSIC_GetPatternLength Lib "fmod.dll" Alias "_FMUSIC_GetPatternLength@8" (ByVal module As Long, ByVal orderno As Long) As Long - - -' Runtime song information - - -Public Declare Function FMUSIC_IsFinished Lib "fmod.dll" Alias "_FMUSIC_IsFinished@4" (ByVal module As Long) As Byte -Public Declare Function FMUSIC_IsPlaying Lib "fmod.dll" Alias "_FMUSIC_IsPlaying@4" (ByVal module As Long) As Byte -Public Declare Function FMUSIC_GetMasterVolume Lib "fmod.dll" Alias "_FMUSIC_GetMasterVolume@4" (ByVal module As Long) As Long -Public Declare Function FMUSIC_GetGlobalVolume Lib "fmod.dll" Alias "_FMUSIC_GetGlobalVolume@4" (ByVal module As Long) As Long -Public Declare Function FMUSIC_GetOrder Lib "fmod.dll" Alias "_FMUSIC_GetOrder@4" (ByVal module As Long) As Long -Public Declare Function FMUSIC_GetPattern Lib "fmod.dll" Alias "_FMUSIC_GetPattern@4" (ByVal module As Long) As Long -Public Declare Function FMUSIC_GetSpeed Lib "fmod.dll" Alias "_FMUSIC_GetSpeed@4" (ByVal module As Long) As Long -Public Declare Function FMUSIC_GetBPM Lib "fmod.dll" Alias "_FMUSIC_GetBPM@4" (ByVal module As Long) As Long -Public Declare Function FMUSIC_GetRow Lib "fmod.dll" Alias "_FMUSIC_GetRow@4" (ByVal module As Long) As Long -Public Declare Function FMUSIC_GetPaused Lib "fmod.dll" Alias "_FMUSIC_GetPaused@4" (ByVal module As Long) As Byte -Public Declare Function FMUSIC_GetTime Lib "fmod.dll" Alias "_FMUSIC_GetTime@4" (ByVal module As Long) As Long -Public Declare Function FMUSIC_GetRealChannel Lib "fmod.dll" Alias "_FMUSIC_GetRealChannel@8" (ByVal module As Long, ByVal modchannel As Long) As Long -Public Declare Function FMUSIC_GetUserData Lib "fmod.dll" Alias "_FMUSIC_GetUserData@4" (ByVal module As Long) As Long - -'************ -'* Windows Declarations (Added by Adion) -'************ -'Required for GetStringFromPointer -Private Declare Function ConvCStringToVBString Lib "kernel32" Alias "lstrcpyA" (ByVal lpsz As String, ByVal pt As Long) As Long ' Notice the As Long return value replacing the As String given by the API Viewer. -'Required for the FFT/Spectral functions -Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal length As Long) - -'************ -'* FUNCTIONS (Added by Adion) -'************ -'Usage: myerrorstring = FSOUND_GetErrorString(FSOUND_GetError) -Public Function FSOUND_GetErrorString(ByVal errorcode As Long) As String - Select Case errorcode - Case FMOD_ERR_NONE: FSOUND_GetErrorString = "No errors" - Case FMOD_ERR_BUSY: FSOUND_GetErrorString = "Cannot call this command after FSOUND_Init. Call FSOUND_Close first." - Case FMOD_ERR_UNINITIALIZED: FSOUND_GetErrorString = "This command failed because FSOUND_Init was not called" - Case FMOD_ERR_PLAY: FSOUND_GetErrorString = "Playing the sound failed." - Case FMOD_ERR_INIT: FSOUND_GetErrorString = "Error initializing output device." - Case FMOD_ERR_ALLOCATED: FSOUND_GetErrorString = "The output device is already in use and cannot be reused." - Case FMOD_ERR_OUTPUT_FORMAT: FSOUND_GetErrorString = "Soundcard does not support the features needed for this soundsystem (16bit stereo output)" - Case FMOD_ERR_COOPERATIVELEVEL: FSOUND_GetErrorString = "Error setting cooperative level for hardware." - Case FMOD_ERR_CREATEBUFFER: FSOUND_GetErrorString = "Error creating hardware sound buffer." - Case FMOD_ERR_FILE_NOTFOUND: FSOUND_GetErrorString = "File not found" - Case FMOD_ERR_FILE_FORMAT: FSOUND_GetErrorString = "Unknown file format" - Case FMOD_ERR_FILE_BAD: FSOUND_GetErrorString = "Error loading file" - Case FMOD_ERR_MEMORY: FSOUND_GetErrorString = "Not enough memory " - Case FMOD_ERR_VERSION: FSOUND_GetErrorString = "The version number of this file format is not supported" - Case FMOD_ERR_INVALID_PARAM: FSOUND_GetErrorString = "An invalid parameter was passed to this function" - Case FMOD_ERR_NO_EAX: FSOUND_GetErrorString = "Tried to use an EAX command on a non EAX enabled channel or output." - Case FMOD_ERR_CHANNEL_ALLOC: FSOUND_GetErrorString = "Failed to allocate a new channel" - Case FMOD_ERR_RECORD: FSOUND_GetErrorString = "Recording is not supported on this machine" - Case FMOD_ERR_MEDIAPLAYER: FSOUND_GetErrorString = "Required Mediaplayer codec is not installed" - Case FMOD_ERR_CDDEVICE: FSOUND_GetErrorString = "An error occured trying to open the specified CD device" - Case Else: FSOUND_GetErrorString = "Unknown error" - End Select -End Function - -'Thanks to KarLKoX for the following function -'Example: MyDriverName = GetStringFromPointer(FSOUND_GetDriverName(count)) -Public Function GetStringFromPointer(ByVal lpString As Long) As String -Dim NullCharPos As Long -Dim szBuffer As String - - szBuffer = String(255, 0) - ConvCStringToVBString szBuffer, lpString - ' Look for the null char ending the C string - NullCharPos = InStr(szBuffer, vbNullChar) - GetStringFromPointer = Left(szBuffer, NullCharPos - 1) -End Function - -'These functions are added by Adion -Public Function GetSingleFromPointer(ByVal lpSingle As Long) As Single -'A Single is 4 bytes, so we copy 4 bytes -CopyMemory GetSingleFromPointer, ByVal lpSingle, 4 -End Function -'Warning: You should set the fft dsp to active before retreiving the spectrum -'Also make sure the array you pass is dimensioned and ready to use -'FSOUND_DSP_SetActive FSOUND_DSP_GetFFTUnit, 1 -Public Function GetSpectrum(ByRef Spectrum() As Single) -Dim nrOfVals As Long, lpSpectrum As Long -Dim a As Long -If UBound(Spectrum) > 511 Then nrOfVals = 512 Else nrOfVals = UBound(Spectrum) + 1 -lpSpectrum = FSOUND_DSP_GetSpectrum -CopyMemory Spectrum(0), ByVal lpSpectrum, nrOfVals * 4 -End Function diff --git a/#ThirdParty/fmodapi375win/documentation/FMOD.chm b/#ThirdParty/fmodapi375win/documentation/FMOD.chm deleted file mode 100644 index 989cc5e..0000000 Binary files a/#ThirdParty/fmodapi375win/documentation/FMOD.chm and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/documentation/Revision.txt b/#ThirdParty/fmodapi375win/documentation/Revision.txt deleted file mode 100644 index 142f5ad..0000000 --- a/#ThirdParty/fmodapi375win/documentation/Revision.txt +++ /dev/null @@ -1,1436 +0,0 @@ - -====================================================================================== -REVISION HISTORY : FireMOD : Copyright (c) Firelight Technologies, Pty, Ltd, 1994-2005 - http://www.fmod.org -====================================================================================== - + Added feature or noticable improvement - - Bug fix or something removed - * Changed or Information -====================================================================================== - -15/12/05 3.75 ------------- - -+ PSP - Added PSP support! Contact sales@fmod.org for evaluation versions! -+ XBOX - Added FSOUND_INIT_XBOX_REMOVEHEADROOM for 2D sounds to disable the xbox - directsound 6db attenuation on all voices (to avoid clipping). - -- ALL - Fixed rare timing crash, mainly on HyperThreaded or Multi-Processor - machines, when calling FSOUND_Stream_SetPosition or FSOUND_Stream_Play. -- ALL - Sounds not starting paused properly issue fixed. -- ALL - Stability increase calling stream related commands from a sync callback. -- ALL - IMA ADPCM compressed multichannel FSB files with channel count = 2 - played as static fixed. -- ALL - Removed any references to ctype.h so linux has an easier time linking - on old glibc versions. -- ALL - .IT format - Pitch envelope under 'amiga frequencies' issue fixed. -- ALL - .IT format - Pan envelope not panning left issue fixed. -- ALL - .IT format - some songs with extremely high pitch notes were being - clamped by fmod's internal setfrequency function, so that has been - fixed. -- ALL - Fixed stream not opening with FSOUND_NONBLOCKING if - FSOUND_OUTPUT_NOSOUND_NONREALTIME was the output mode. -- ALL - Fixed rare stream crash if FSOUND_NONBLOCKING was used and ran out - of memory. -- ALL - Fixed ogg vorbis seeking causing odd audible playback for a few ms. -- ALL - Removed stall on FSOUND_Stream_SetSubStream or - FSOUND_Stream_SetSubStreamSentence if other streams were playing - simultaneously. -- ALL - Fixed FSOUND_SetMute not taking FSOUND_SetVolumeAbsolute into account - when unmuting. -- ALL - Fixed recording returning an error if fmod was closed then reinitialized -- ALL - Fixed rare failures in FSOUND_Sample_Load if a stream was openened - beforehand. -- LINUX - More OSS and ALSA compatibility fixes, should handle most cards without - a problem now. -- LINUX - Fixed lock on cd device after FSOUND_Close was called so tray wouldnt - eject. -- LINUX - ALSA output now cooperates with other applications better. -- WIN32/ - WIN64/ - WINCE - Fixed thread leak if recording was started and stopped. -- WINCE - Fixed last few milliseconds of mp3 files not playing. -- WINCE - Fixed new streams not being able to be started if memory card or - removable media was removed during playback. -- WINCE - Fixed memory leak. -- PS2 - Mute wasn't muting hardware voices properly. -- PS2 - Free up streams in FSOUND_Close to avoid hang. -- PS2 - Fixed memory leak when using FSOUND_NONBLOCKING and sample list feature - in FMUSIC_LoadSongEx. -- PS2 - Removed rare chance of buzzing noise if FSOUND_SetSpeakerMode was set - and FSOUND_Init had 0 software channels specified. -- PS2 - Fixed FSOUND_STEREOPAN coming out in right speaker with mono sounds. -- PS2 - Unblocked FSOUND_Stream_SetEndCallback from possibly causing a stall. -- MAC - Fixed critical section issues on OS9. -- XBOX - Fixed loop point clicking on PCM based hardware sounds. -- FSBANK - Fixed command line version not returning correct error code to dos. - Also stopped messagebox popping up when -h was specified. - -* WIN32 - CDDA streams now return -3 from FSOUND_Stream_GetOpenState when cd is - ejected. -* PS2 - FSOUND_IsDiskBusy now accepts a parameter to determine if a stream is - in the middle of a close (because stream close can cause blocking in - other functions if they are called while a stream is closing) - -11/11/04 3.741 (Mac only) -------------------------- - -- MAC - Fixed problems with playing Ogg Vorbis files. -- MAC - Fixed threading issues which was causing problems in mac classic. -- MAC - Added "Classic" target to all examples. - -18/10/04 3.74 -------------- - -+ GC - Added FSOUND_GC_PrepareForReset (see fmodgc.h) to prepare for software reset. - This kills streams so FSOUND_Close can be called safely even with the tray - door open. -+ GC - Added FSOUND_GetFreeHWRam to find out how much ARAM is free. -+ GC - Memory footprint lowered. -+ XBOX - FSOUND_Stream_OpenFromHandle added to allow dashboard tracks to be played - after using XOpenSoundtrackSong. - -- ALL - FSOUND_Stream_Play is now faster. -- ALL - Fixed FSOUND_SIGNED / FSOUND_UNSIGNED being ignored when FSOUND_LOADRAW in - FSOUND_Sample_Load/Ex. -- ALL - Stream fix when a stream opened with FSOUND_NONBLOCKING runs out of memory. -- ALL - Memory leak fixed in certain error situations trying to open a stream. -- ALL - Remove rare stream crash. -- ALL - Corruption when using compressed streams and stream loop points in rare cases - fixed. -- ALL - FSOUND_SetVolumeAbsolute not working on software mixed 3D voices or PS2/GC - hardware 3D voices. -- ALL - Fixed S3M arpeggio. -- ALL - Fixed an issue where on some platforms (xbox/gc/dsound) hardware voices would - enter an inconsistent state if channel that had played and ended was paused. -- WIN32 - ASIO Crash fix. -- LINUX - Fixed hang on OSS output if another device was using the same device. -- LINUX - Fixed crash when using ALSA by upgrading to the latest ALSA library. - (It was an ALSA crash not fmod!) -- MAC - Fixed crash on OS9 support. -- XBOX - FSOUND_IsPlaying / FSOUND_GetNumChannelsPlaying fixed when FSOUND_SetPaused - was used. -- XBOX - Sounds going quiet if FSOUND_Reverb_SetChannelProperties was called on 2d - channels fix. Now reverb channel properties are ignored if it is a 2d voice, - as the properties related to a 3d environment anyway. -- PS2 - Fixed crash on streams with loop points in VAG format. -- PS2 - Fixed stream priorities being 0 instead of 256 due to a sifcmd optimization - which lead to the undesirable effect of streams being stealable by the - channel priority system. -- GC - 3D sound rolloff algorithm updated to be consistant with other platforms. -- GC - Fixed unpaused sounds playing through all of ARAM in some cases. -- GC - Fixed audible glitch upon startup in certain cases. -- FSBANK - Fixed program stealing window focus when in hidden mode. - -* ALL - FMUSIC_SetSample now allows hardware samples specified for music files. This - means you can do things like use hardware VAG samples on PS2 in mod files. -* ALL - Renamed stream2 to userstream. -* PS2 - Exposed FSOUND_SetDiskBusy on IOP interface for IOP programmers. -* GC - Reduced memory fragmentation. - -01/06/04 3.73 -------------- - -+ ALL - FSOUND_CD_TrayOpen added. Now close or open is specified manually. -+ WIN32 - Added CD TOC retrieval as an FMOD tag. CDDB diskid generation added - to CDDA example. -+ WIN32 - Extended ASF/WMA tag support added. - -- ALL - FSOUND_Stream_GetTime and stream syncpoint fixes. -- WIN32 - CDDA pausing between tracks fix. -- FSBANK - Command line calls and list file parsing fix. -- GC - Memory alignment crash fix -- PS2 - FSOUND_Init/Close restart fix if FSOUND_INIT_PS2_USEVOLUMERAMPING was specified. -- ALL - FSOUND_CD_Eject removed in favour of FSOUND_CD_TrayOpen. - -* FSBANK - If FSOUND_HW3D is specified on a stereo sample an error is displayed. - - -23/04/04 3.72 -------------- - -+ WIN64 - AMD64 version of fmod available! fmod64.dll. - Runs in Windows XP 64 / Windows Server 2003. -+ ALL - FSOUND_Sample_SetDefaultsEx / FSOUND_Sample_GetDefaultsEx added. - Now includes random variation settings for frequency, volume and pan! -+ ALL - FSOUND_3D_SetMinMaxDistance / FSOUND_3D_GetMinMaxDistance added for per channel - min/max distance control. -+ ALL - 'fsb' example added. Shows loading of an FSB file as a non blocking sample bank, - then plays back the contents using the new random variation -+ WIN32 - Faster DirectSound support, due to many driver calls eliminated. This was - probably the cause of worse performance in FSOUND_HW3D mode than using the - FMOD software mixer. The software mixing mode probably still wins, but it - is better than it used to be. -+ WIN32 - WMA, ASF and WMV now run through FMOD DSP engine / streamer! You can now load - WMA files as samples, do DSP effects and spectrum analysis on these files. -+ WIN32 - ASIO output channels made enumerable and selectable through FSOUND_SetDriver. -+ PS2 - Optimizations on EE<->IOP communication with more EE side caching -+ PS2 - Added FSOUND_IOP_Alloc/Free. -+ PS2 - Added FSOUND_SPU2_Alloc/Free. -+ PS2 - Added FSOUND_SetADSR and FSOUND_SetADSRKeyoff -+ PS2 - Added FSOUND_SetSifCommandInfo, and a similar IOP mechanism for users wanting - to make FMOD cooperate with their own EE<->IOP sif command handlers. -+ PS2 - Stream2 example now shows VAG/ADPCM Hardware playback as well as PCM playback - and has an improved interface. -+ PS2 - 'streamwithdata' example added. This shows using FSOUND_SetDiskBusy, and also - loads game data at the same time without affecting the framerate. -+ PS2 - ShellMpeg example added! This example makes the Sony Shell mpeg movie player - example use FMOD via PCM or ADPCM using a custom FMOD stream. -+ PS2 - Added FMUSIC_SetRowCallback, FMUSIC_SetOrderCallback, FMUSIC_SetZxxCallback and - FMUSIC_SetInstCallback support. -+ PS2 - Added fmodps2iop.h to expose FMOD file and memory routines to IOP programmers. -+ XBOX - Reverb on 2d voices is now possible by calling FSOUND_Reverb_SetChannelProperties. -+ XBOX - FSOUND_Output_XBox_GetEffectImageDesc added in fmodxbox.h -+ CE - FSOUND_File_HasFatalErrorOccurred and FSOUND_HasPowerOnOccurred added in fmodce.h. - -+ FSBANK - Now available as a programmers library! Make your own FSB files without - fsbank.exe! See fsbank.lib, fsbank.h and fsbank.chm. -+ FSBANK - FSBank now allows list files to specify sample defaults and randomization parameters per sound. - -- ALL - FSOUND_Sample_SetMaxPlaybacks fixed when using hardware samples. -- ALL - Voice stealing fix with FSOUND_FREE. -- ALL - FSOUND_IsPlaying / endcallbacks on streams not reacting in time when - FSOUND_INIT_STREAM_FROM_MAIN_THREAD bugfix. -- ALL - mod/s3m/xm fix with pattern loop. -- ALL - mod/s3m/xm/it. Non looping songs now play the very last row instead of cutting it off. -- ALL - .it files now respect the FMUSIC_SetLooping command! -- ALL - FMUSIC_SetOrder now cleans up/resets old channels so skipping to a new part of the song - doesn't cause weird playback issues. -- ALL - FMUSIC_GetRealChannel fix for non playing music channels. -- ALL - Loop points on natively compressed sounds (xadpcm,gcadpcm,vag) working again. -- ALL - ADPCM compressed FSB support fixed. -- WIN32 - Analogue and Digital CDROM support fixes. -- WIN32 - FSOUND_HW3D support now drops back to directsound software buffers instead of fmod - software mixed buffers to remove the issue of latency and possible skipping on - some soundcards due to bad drivers. It avoids the need to have to play with the - mixer buffersize (FSOUND_SetBufferSize). 32 'hardware' voices are now reported - if the card actually has no voices. -- GC - Bugfixes. Stereo sound fixes, crash fixes, pause/unpause fixes and more. -- PS2 - IRX files symbol stripped, now around 130k smaller for each file. -- PS2 - FSOUND_GetPaused fixed with streams that are started paused. -- PS2 - FSOUND_SetDiskBusy now does not block other FMOD commands if executed from another - thread asynchronously. (ie if the game has a threaded filesystem). -- PS2 - Memory saving. 200k on the EE. -- LINUX - Ensoniq 1371 latency fix. -- LINUX - FSOUND_Init stalls/timeouts removed from various dodgy soundcards. -- LINUX - OSS Recording bugs fixed. -- CE - Streams now stop gracefully instead of hanging the thread if a poweron occurs and the file handle - to the stream on a CF card or external medium is lost. -- FSBANK - Many bugfixes. - -* ALL - FSOUND_GetNumHardwareChannels renamed to FSOUND_GetNumHWChannels to give more - information including 2d and 3d channels seperately. -* ALL - FSB files now allow mixture of mono and stereo sounds in the one bank. - FSOUND_Stream_SetSubStreamSentence will fail if it encounters a sentence with mixed - formats but functions like FSOUND_Stream_SetSubStream will work. -* ALL - FSOUND_INIT_ENABLEOUTPUTFX renamed to FSOUND_INIT_ENABLESYSTEMCHANNELFX. - -14/11/03 3.71 -------------- -+ WIN32 - CDDA support. Now you can perform cd ripping, spectrum analysis or DSP effects - on CD audio. See FSOUND_Stream_Open and FSOUND_Stream_SetSubStream. -+ PS2 - New FSOUND_SPEAKERMODE_PROLOGIC2_INTERIOR speakermode added as an alternative - to FSOUND_SPEAKERMODE_PROLOGIC2. This method cuts number of sound playbacks to - 24 at once instead of 48, but supports interior panning. Probably not needed in - most games. - -- ALL - FSOUND_Close and stream thread safety fixes for extra stability especially when - using end callbacks. -- ALL - Buffered file system fix to avoid strangely playing streams. -- ALL - Using FSOUND_Stream_SetTime in conjunction with FSOUND_FORCEMONO fix. -- ALL - (except CE and PS2) - Chirping noise fix when not using FSOUND_MPEGACCURATE when - seeking in an mp3. -- ALL - Possible OXM format memory leaks removed. -- WIN32 - WMA tag support fix. -- WIN32 - MP3 static fixed, when playing 2 mp3s at once or loading an mp3 sample while - streaming an mp3 simultaneously, on hyperthreaded cpus. -- LINUX - FSOUND_Close hang fixed. -- PS2 - Sync callback support added -- PS2 - IOP memory leak in the kernel if FSOUND_Init and FSOUND_Close was called -- PS2 - Corruption noise removed in streams if the stream buffersize wasnt big enough and - a stream tried to restart after buffer underrun. -- PS2 - Prologic 2 support fixes in the original PL2 mode. -- CE - Small glitch noise removed when stopping and starting an mp3 stream. -- MAC - linker issues resolved with mach-o build on certain versions of OSX. -- MAC/GC - endian issue fixed with noisy samples in .IT files. - -* ALL - specifying FSOUND_8BITS in loading a sample will now force the sample depth - down to 8bits to save memory. OXM files now also downgrade decoded oggs back - to 8bit when loading if the original XM had them stored as 8bit. - -4/9/03 3.70 -------------- - -+ ALL - Shoutcast / Icecast / HTTP streaming support added! (mp3/ogg vorbis only). -+ ALL - Tag support, I3DV1, I3DV2, Ogg Tags, ASF/WMA tags now readable through api. -+ PS2 - Prologic 2 support now allows use of all 48 hardware channels, instead of 24. -+ PS2 - Delay and Feedback parameters on spu2 hardware reverb now supported through - EchoTime and EchoDepth parameters respectively. -+ WIN32 - FMOD Media Player updated with some new features. Lowpass cpu usage bug fixed. -+ ALL - NetStream example added to make it simpler to understand buffering logic etc. -+ ALL - Saving the recorded result to a wav file added. Shows how to Lock/Unlock a - sample. -+ ALL - FSOUND_Stream_*Sync* API changed around a bit / renamed. Now user points are - stored as a pointer instead of an index, and the 256 limit is removed. -+ WINCE - FSOUND_DSP_GetSpectrum now works! Integer FFT implemented for non FPU devices. - -- ALL - WAV/AIFF only. If a file had loop points embedded, then the mode (ie FSOUND_2D) - was being ignored, fixed. -- ALL - Memory leak fixed if any FSOUND_Stream_*Sync* functions were called with - FSOUND_NONBLOCKING and the stream wasnt ready yet. They now fail if not ready. -- WIN32 - WMA and FSOUND_NONBLOCKING now works. -- XBOX - 360kb or so of memory saved! Also DSSTDFX.BIN is no longer needed. -- PS2 - Ejected or corrupted CDs now recover smoothly on stream playback without making a noise. -- PS2 - FSOUND_Reverb_SetChannelProperties fix which was causing sound to dissapear. -- PS2 - Return values for most channel commands fixed, they were returning the wrong value. -- PS2 - Streams being truncated wth different stream length/buffersize combinations fixed. -- PS2 - FSOUND_GetPaused fixed. -- PS2 - Many other bugfixes. -- MAC - Recording bugfix dependent on OSX version. -- WINCE - fixed mp3 loading as sample bug, for files with corruption in them. - -* ALL - FMUSIC_LoadSongEx now takes an offset parameter for pak/wad/data file loading. -* ALL - FSOUND_Stream_OpenFile is now called FSOUND_Stream_Open and also takes an - offset parameter for pak/wad/data file loading. - -9/6/03 3.63 -------------- -+ ALL - FSBank updated. Now all platforms support compressed FSB formats. - Command line supported added. Source files can now be specified via a text - file, allowing ordering of sounds within fsb files. -+ ALL - FSB format now supports sample banks to hold any sound format that fmod can - load with FSOUND_Sample_Load, so for example you could have 1 fsb with - multiple mp3, ogg and wav files stored within it. -+ ALL - FSOUND_Stream_OpenFile with FSOUND_MPEGACCURATE is now 25% faster! -+ ALL - FSOUND_Stream_SetLoopCount added. -+ ALL - FSOUND_NONBLOCKING support added to FMUSIC_LoadSongEx! Now sample banks can - be loaded in the background. Use new FMUSIC_GetOpenState to poll status. -+ PS2 - Dolby Prologic 2 support added! Use FSOUND_SetSpeakerMode and - FSOUND_SPEAKERMODE_PROLOGIC2. Note that this mode uses 2 hardware voices - for every fmod channel, so the number of channels is effectively halved - from 48 to 24 when using this speaker mode. -+ PS2 - FSOUND_Update now 30-40% faster! -+ PS2 - File routines now split into fmodfile.irx so users can quickly compile or - hook into their own IOP file routines. -+ ALL - FSOUND_INIT_STREAM_FROM_MAIN_THREAD added. This causes FSOUND_Update to - drive the streamer thread. This is mainly because OS8/Macintosh doesnt - like streaming inside an MPTask, which is being worked on. This will work - around it. - -- WIN32 - DirectX 8/9 bug fixed which could cause a crash with FX or recording. -- ALL - FSOUND_Stream_SetTime is now sample accurate with mp3. (it previously - seeked and rounded the position to the nearest mpeg block). -- ALL - MP3 'chirp' noises when seeking (using FSOUND_Stream_SetTime or - FSOUND_Stream_SetPosition) reduced or removed completely. -- PS2 - FSOUND_IsPlaying bug fixes, Prologic 2 support! Hardware click removal! -- PS2 - Greater volume accuracy which removes 'wobbly' sound when using small - mindistances in 3D sound. -- MAC - conflict with cocoa libraries and the symbol _realloc removed. -- ALL - Strange doppler effect when sounds went outside maxdistance fixed. -- ALL - FSOUND_Stream_SynchPoint fixes. -- PS2 - FSB 16byte memleak fixed. -- ALL - AIFF loop point support fixed. -- WINCE - Loading MP3 as sample crash fix. -- WINCE - FSOUND_GetLengthMs fixed with MP3 files. -- FSBANK - Mixing 8 & 16bit sounds dissalowed. A stream is created in a particular - format (based on the first sample in an FSB), and if the first sound was - 8 bit but the rest were 16bit, the result would be noisy 16bit sounds. - -* ALL - win32/mac mainly. FSOUND_Update now yields, causes operating task switch - for smoother multitasking. You should call this function once a frame. -* MAC - fmod_cfm.shlb now only exports the relevant fmod symbols and not the MSL stuff. - -28/02/03 3.62 -------------- -+ GC - GameCube support added! -+ ALL - Added DirectX 9 support. You can now change frequency with - FSOUND_ENABLEFX enabled sounds. -+ ALL - Cross platform IMA ADPCM wav file support! Now you can use ADPCM - compression without windows codecs, and on any platform. -+ ALL - Recording support added to Mac and Linux ports! -+ ALL - FSOUND_Stream_SetMode and FSOUND_Stream_GetMode added to allow control - during playback, such as looping. -+ ALL - FSOUND_Stream_SetSubStreamSentence added! This allows for seamless - stitching/sentencing of streams. VERY useful for things like commentary - where you want parametized audio. FSB format only. -+ ALL - FSOUND_CD_SetTrackTime added. -+ PS2 - Now TRC compliant for sony submissions. -+ PS2 - Added multi-channel interleaved stream support! (FSB format only). If - stereo is 2 interleave channels (L/R), this format allows up to 16 - interleaved channels at once that play simultaneously. This eliminates - seeking and improves CD bandwidth, and also allows interactive music with - tracks that stay in perfect sync. -+ PS2 - FSOUND_Reverb_SetChannelAttributes supported, using Room parameter to make - channel wet/dry. -+ PS2 - Stereo and even 'multichannel' (see above) sample support in hardware. - (FSB format only). -+ WIN32 - New example 'multiple' shows how to load fmod dynamically, and also play - sounds out of 2 soundcards at the same time! -+ WINCE - New complete set of examples! 3d, simple, simplest etc are all included. -+ LINUX - Better compatibility for old cards. ALSA mode now allows device - enumeration. Electic Fence tested. -+ WIN32 - 24 and 32 bit PCM wav files supported! - -- ALL - FSOUND_SetSubStream fixed when in FSOUND_NONBLOCKING mode and mulitiple - calls are issued at once. -- ALL - FSOUND_Stream_SetEndCallback more accurate. -- PS2 - 'Corrupted' stream fix when usage of hardware channels were maxed out. -- PS2 - FSOUND_Stream_PlayEx was accidently blocking, fixed. -- PS2 - Multiple Listeners fix. -- PS2 - FSOUND_SetSFXMasterVolume fix for FSB banks. -- ALL - Stream timing, mod timing, and stream endcallbacks are now more accurate. -- MAC - OS8/9 support working again. - -* ALL - .FSB support is now cross platform. PS2, GameCube and XBox allow compressed - FSB data. -* WIN32 - Made fmod.h and examples more cygwin friendly. -* ALL - FMUSIC_LoadSongMemory is now changed to FMUSIC_LoadSongEx. This function - handles loading from memory and more. -* ALL - Frequency/Volume/Pan/3d position cached to reduce WIN32 driver call overhead? -* LINUX - fmoddyn.h updated and useable for linux. - -18/12/02 3.61 -------------- -+ ALL - Added FMUSIC_SetUserData and FMUSIC_GetUserData -+ ALL - Added FSOUND_3D_Listener_SetCurrent for multiple listener support! -+ ALL - Optimized Ogg Vorbis. Ogg decoding is now 2x faster! - Decoding is nearly 2x quicker than mp3! -+ WIN32 - A3D support re-added as an output mode only, for compatibility. -+ PS2 - Added FSOUND_Stream_SetSubStream/FSOUND_Stream_GetNumSubStreams, for FMOD - .FSB bank files are supported on PS2 Only. Cross platform support is coming. -+ WINCE - Added Ogg Vorbis support via fixed point Tremor API. -+ ALL - Added support for Neil Graham's .XM to .OXM converter. This tool converts - XM samples into ogg files, making them dramatically smaller. -+ WIN32 - Added dynamic loading header fmoddyn.h. This allows you to create multiple - instances of fmod = multiple soundcard output. -+ ALL - Added FSOUND_Stream_SetLoopPoints. -+ ALL - Added FSOUND_Stream_GetOpenState for determining the state of a non blocking stream open. -+ ALL - Added FSOUND_Stream_AddSynchPoint, FSOUND_Stream_DeleteSynchPoint, - FSOUND_Stream_GetNumSynchPoints for sync point manipulation. - Previously they were only available in .WAV or .AIFF files. -+ ALL - Added FSOUND_OUTPUT_NOSOUND_NONREALTIME. Calling FSOUND_Update drives the - software engine as fast as you like. - -- LINUX - Latency fixes. -- LINUX - OSS output now allows /dev/dsp* enumeration. -- PS2 - Numerous fixed and speedups. -- XBOX - Fixed WMA looping. -- WINCE - Added more power off/on support for some iPAQ models that didn't work before. -- WIN32 - Improved ASIO support! More drivers work now that didn't work before. -- WIN32 - CD playback bugfixes. -- WIN32 - MIDI 'caching' bug fixed. -- WIN32 - FSOUND_ALL support now works with WMA channels. -- WIN32 - Pan clicks removed from FSOUND_MIXER_QUALITY_FPU -- WINCE - FSOUND_Stream_GetTime / SetTime / GetLengthMs more accurate for mp3. -- ALL - Lots of memory optimizations. FMOD now uses less memory than ever. - -* FSOUND_3D_Listener_SetDopplerFactor renamed to FSOUND_3D_SetDopplerFactor. -* FSOUND_3D_Listener_SetDistanceFactor renamed to FSOUND_3D_SetDistanceFactor. -* FSOUND_3D_Listener_SetRolloffFactor renamed to FSOUND_3D_SetRolloffFactor. -* FSOUND_3D_Update renamed to FSOUND_Update - -16/08/02 3.6 (WIN32/CE/Linux/Mac/PS2/Xbox Release) -------------- - -+ PS2 - PlayStation 2 support added! -+ XBOX - XBox support added! -+ MAC - Macintosh support added! -+ LINUX - Major rewrite + support for ALSA 0.9! Vortex2 support now working 100%. -+ ALL - Added FSOUND_Sample_SetMaxPlaybacks. -+ ALL - 'Constant power pan' added to software engine for better sounding pans. -+ ALL - FSOUND_NONBLOCKING flag added for opening streams. (streams will open in background) -+ ALL - AIFF Support added with full loop point and sync marker support. -+ ALL - Ogg Vorbis support upgraded to 1.0 final codebase! -+ ALL - FMUSIC_SetLooping added. Music loops by default, so call to stop it looping. -+ ALL - FSOUND_GetCurrentLevels added which returns a seperate left and right VU level. -+ WIN32 - FSOUND_FX_Disable added, so that FSOUND_FX_Enable doesnt have to be called each time. -+ WIN32 - MP2 support optimized, significantly faster. -+ WIN32 & - WINCE - Wave-In recording support added. Now recording works in NT and PocketPC! -+ WINCE - BIDI Looping and negative frequencies now supported. -+ WINCE - Smartphone, CE 2.11 and BE-300 support added. - -- ALL - Better MP3 format detection. -- ALL - WAV sync markers now sorted if they are stored in the wav file out of order. -- ALL - 3d sound and setvolume bug fixed. -- ALL - XM apreggio was upside down on linear frequency tunes bug fixed. -- ALL - FSOUND_SetFrequency. negative followed by positive frequency now works properly. -- ALL - FSOUND_GetCurrentVU removed in favour of FSOUND_GetCurrentLevels. -- WIN32 - Midi fixes. FMUSIC_IsFinished fixed, FMUSIC_StopSong fixed, FMUSIC_LoadSongMemory fixed. -- WIN32 - A3D/Geometry support removed. Geometry may re-appear via FMOD instead of A3D support. -- WIN32 - Fixed DX8 FX (FSOUND_FX_xxx) support. -- WIN32 - Fixed CD Playback functions. -- WINCE - Better support for Casio E115G device. Use 200ms buffer for these devices. -- WINCE - Seeking through SetTime/SetPosition bugfix especially with FSOUND_MPEGACCURATE. -- LINUX - Removed CD access at FSOUND_Init. - -* ALL - maxdistance behaviour unified on all platforms. -* ALL - FSOUND_SPEAKERMODE_5POINT1 is now separated to FSOUND_SPEAKERMODE_DOLBYDIGITAL and - FSOUND_SPEAKERMODE_DTS. -* ALL - Changed FSOUND_INIT_ACCURATEGETCURRENTVU to FSOUND_INIT_ACCURATEVULEVELS. -* WIN32 - Stopping or playing a sound now does not reset the FX list. You have to manually - do this with FSOUND_FX_Disable. This reduces cpu usage if wanting to start and stop - the sound repeatedly. - -11/03/02 3.51 (CE Only release) -------------- -+ WINCE - FSOUND_GetCurrentVU support added -+ WINCE - Optimizations - All remaining emulated floats removed - now pure fixed point! - -- ALL - Memory usage reduced on MOD/S3M/XM/IT playback by up to 200-300kb per instance. -- ALL - Other small fixes. -- WINCE - FSOUND_Init failing on some PocketPC devices fixed. - -* ALL - FSOUND_FORCEMONO enabled by default when a stream or sample is attempted to be - opened with FSOUND_HW3D, so the user doesnt have to specify it manually. - -14/02/02 3.5 -------------- -+ FMOD CE Only. Mono mixers added! (FSOUND_MIXER_MONO and FSOUND_MIXER_QUALITY_MONO). - 30% faster than stereo! -+ EAX3 support added! Advanced reverb api now also supporting occlusion and obstruction. -+ FMOD CE Only. Automatic power off/on recovery! FMOD audio will resume as soon as the power - is turned back on the Pocket PC device with no programmer intervention! -+ Ogg Vorbis version update to 1.0 RC3. -+ New tutorials in the documentation! The basics, DSP tutorial, DX8 FX tutorial and spectrum - analysis. Documentation index revamped and updated. -+ FSOUND_SetMemorySystem added. Allows the user to fexibly control memory allocated by FMOD. -+ Multiple CDROM support added. Pass 0 for default, or 'D','E' etc to select the cd drive. -+ FSOUND_Stream_SetBufferSize added. Useful for streaming from CD when the default size isnt - big enough, and causes audio skips because the cd is being held up. -+ FSOUND_SetFrequency supports negative frequencies. Play sounds backwards! -+ FMOD media player allows seeking in mods and streams by clicking on progress bar -+ Linux version brought up to date. Thanks to SUSE distro guys for helping out. -+ FSOUND_GetCurrentVU latency adjusted (via FSOUND_Init flag), and now emulates a software - mixer giving perfect VU feedback. - -- Sound skips with streams removed by bigger default stream buffersize. (also on CE) -- Divide by 0 in linux version removed. -- Bug fixed where an item appeared on the windows taskbar for FMOD's cdrom handling code. -- Time accuracy bug fixed which affected gettime functions and sync callbacks. -- Fixed distortion on mp3 playback under FMOD CE. -- FSOUND_SetMute using FSOUND_ALL bugfix. -- DirectShow assert removed when an error occured loading wma. -- EAX1 support removed (superceeded by EAX2/EAX3). - -* FSOUND_FX api now allows multiple instances of the same effect per channel. -* Ability to 3d position stereo soures removed in software mode. Streams and samples now default - to FSOUND_STEREOPAN so they are louder. Use FSOUND_FORCEMONO on streams/samples to make them - 3d. -* Intel performance primitives for ARM were tested but removed due to insignificant speed increase. - -13/09/01 3.4 ------------- -+ DX8 fx support -+ Windows CE / PocketPC support added for handhelds! (such as compaq ipaq/casio/jornada etc). - CE support is considered in beta. See the forum at http://www.fmod.org for beta feedback. -+ Ogg Vorbis decoder upgraded to Version 1.0. 1.0 is a large quality improvement! -+ FSOUND_SetCurrentPosition added. -+ FSOUND_GetOutputHandle added to return dsound / waveout / a3d pointer. -+ FSOUND_SetSpeakerMode added. Get true dolby digital/DTS surround output through supported hardware! -+ FSOUND_DSP_GetFFTUnit and FSOUND_DSP_GetSpectrum added. It is now possible to get a spectrum - analysis of FMOD's mixer output in realtime. Great for graphics, beat detection and note detection. -+ FSOUND_PlaySoundEx added. Has 'paused' flag that allows the user to optinally start the sound - paused, set any attribute, and then unpause it later to start it playing. Also can takes - a DSP unit handle, which means channels can now attached or grouped to specific DSP units. -+ FSOUND_DSP_GetBufferLengthTotal for help with DSP buffersize calculations. -+ FSOUND_FORCEMONO flag added for samples/streams. Force stereo sounds to play as mono. -+ FSOUND_ENABLEFX flag added for samples/streams. Enables a sample/stream to use DX8 FX. -+ FSOUND_2DHW flag added for samples/streams. Allows 2d hardware acceleration. -+ "file://" support added for streams. -+ new sample in /samples/dsp added. This shows how to use the new DSP feature of - FSOUND_PlaySoundEx to have wet/dry effects, and also the FSOUND_FX_xxx API on hardware voices. - -- FSOUND_PlaySound3DAttrib removed due to FSOUND_PlaySoundEx. -- FSOUND_Stream_Play3DAttrib removed due to FSOUND_Stream_PlayEx. -- FSOUND_Stream_SetPaused & FSOUND_Stream_GetPaused removed. Use FSOUND_SetPaused, FSOUND_GetPaused instead. -- FSOUND_Stream_SetSynchCallback fix for long files. -- FSOUND_UNMANAGED flag fixed when calling FSOUND_Close. -- Removed small audible glitches or 'chirps' when seeking in an mp3 stream. -- Delay when opening a stream removed. -- Streams now reset's its buffers when FSOUND_Stream_SetTime or FSOUND_Stream_SetPosition is - called. This makes it more cpu intensive to seek, but results in no delays when seeking. -- Small accuracy bugfix in IT replay for looping envelopes. -- fix in delay note + volume envelope for XM. -- A3D Support fixed and working ok again. -- WMA/ASF/etc Support improved. - -* FMUSIC_SetInstCallback behaviour changed to support more than one instrument at a time. - -28/04/01 3.33 -------------- -+ Linux Version update. -+ FSOUND_ALL support added to FSOUND_Reverb_SetMix. - -- EAX2 bugfix with FSOUND_Reverb_GetEnvironmentAdvanced -- Click noise removed from WAV streams if FSOUND_Stream_SetTime was used before Play. -- S3M bugfix for samples with middlec of 0. -- Low quality mixers have been removed. The symbols are there for backwards compatibility - but choosing one will autodetect a quality mixer instead. -- Small bugfix in FPU quality mixer to do with volume ramping. - -* Licensees now get an extensive compile time configuration header to include or exclude as many - fmod features as they like! a stripped FMOD.DLL can be as small as 20k now. - -27/03/01 3.32 -------------- -+ FSOUND_SetVolume, FSOUND_SetPan & FSOUND_IsPlaying support for WMA/ASF/Internet - streams/etc added. Multiple wma's open at once bug fixed. -+ Excellent quality resonant lowpass code added to fmod.exe example. Source available. -+ FSOUND_INIT_GLOBALFOCUS added for directsound output, to allow sound to be heard - even though the window is out of focus. -+ OGG VORBIS - Official beta 4 release included. Previous ver was pre-release beta 4. - -- Recording interface re-enabled. -- MP2 fix - sound coming out one channel for stereo sounds now work properly. -- 3D sound glitch with FSOUND_PlaySound3DAttrib fixed. -- FSOUND_Stream_GetLengthMs returning incorrect results loading multiple mp3's fix. -- exception when loading many wav files fixed. -- MIDI updates - FMUSIC_GetTime works again and support for FMUSIC_IsFinished added -- Possible DX8 related problems removed. -- Better handling of machines with NO soundcard. - -* improved multitasking / buffering = lower cpu usage, more stability for sound output, - especially on weird configs and low spec machines. -* FMOD will now play the audio track out of AVI files - ie DIVX etc :) - -18/02/01 3.31 -------------- -+ WAV Loop point support added! FMOD will now interpret loop points set in soundforge etc. -+ OGG VORBIS - Beta 4 used with FMOD. Fixes problems and has speed benefits. -+ FMUSIC_SetInstCallback added. Get callbacks on mod type instrument numbers. -+ FSOUND_Stream_SetSynchCallback added. Visually drop markers in your wav editing package and - FMOD will callback in time to the points as the sound plays! Great for lipsynching/gfx - demos etc. WAV/RIFF mp3 only. -+ DX8 support added. -+ NT detection added. This will mean WINMM is automatically enabled if FSOUND_Output isnt - called for better performance. All other WIN32 OS'es will use DSOUND. -+ Static library project added for commercial licensees. - -- Extra MP3 error checking, avoids crash on bad mp3 files. (why are there so many?) -- Crash fix on certain combinations of machines with sblive cards. -- WMA / Internet stream support error code fix. -- WAV loader now handles files with 2 data chunks :) -- FSOUND_DSP_ClearMixBuffer now works properly. -- Fixed wobbling row/order/time when you pause a mod. -- small crack noise at the end of looping 8bit wav files fixed. -- FSOUND_Stream_GetTime improved especially with looping streams. -- Zxx sync bug with mod files fixed where more than 1 Zxx was placed on a row. -- XM multiretrig + volume column volume bug fix. - -- LINUX - Oss now opens the socket in nonblocking mode. That should take care of the - lockups some ppl got when another app was using the sound. -- LINUX - Esd now checks (via a select()) if it can send data, blocks if it can't. The - newest Elightment Sound Daemon choked on that one, and it's the Right Thing(tm) to do. - - -* A bug has been found in the win2k sblive drivers to do with volume levels on 3d sounds.. - We suggest you get the newest version. - -17/12/00 3.3 ------------- -+ Linux support added! Big thanks to Magnus Naeslund on this for such a big effort! -+ .MIDI/.RMI support added. (use FMUSIC_LoadSong) -+ .OGG (Ogg Vorbis) support added. (FSOUND_Stream_OpenFile/FSOUND_Sample_Load). -+ .MP2 (mpeg layer 2) support added. (FSOUND_Stream_OpenFile/FSOUND_Sample_Load). -+ .WMA Support added. (FSOUND_Stream_OpenFile). -+ .ASF audio Support added. (FSOUND_Stream_OpenFile). -+ Internet streaming support added! Pass a URL to FSOUND_Stream_OpenFile!!! -+ Volume Ramping ('click removal') added to MMX mixers. All quality mixers now ramp by default. -+ MP3 playback optimized. -+ Delphi and visual basic interface updated. -+ Documentation update. - -+ API changes and new features!!! - -+ FSOUND_Stream_GetLengthMs added. Returns length of stream in milliseconds. -+ FSOUND_Stream_SetTime added. Allows setting the position of a stream in ms. (even VBR mp3s!) -+ FSOUND_Stream_OpenFile added. This combines all the old 'FSOUND_Stream_Open*' commands into 1. -+ FSOUND_Stream_SetEndCallback added. Get a callback when the stream has finished! -+ FSOUND_Stream_GetSample added. Get the internal FSOUND_SAMPLE definition for a stream. -+ FSOUND_Stream_CreateDSP added. Add a DSP effect chain per stream if you want! -+ FSOUND_Stream_Play3DAttrib added. -+ FSOUND_CD_SetVolume and FSOUND_CD_GetVolume added. -+ FSOUND_CD_GetTrackTime added. Returns current track time. -+ FSOUND_CD_GetTrackLength added. Returns track length in milliseconds. -+ FSOUND_Sample_Load replaces all previous FSOUND_Sample_Load* functions. -+ FSOUND_Sample_GetName added. -+ FSOUND_PlaySound3DAttrib added. Replaces FSOUND_3D_PlaySound and FSOUND_PlaySoundAttrib. -+ FSOUND_SetLoopMode added for those who want per channel loop control not per sample. -+ FMUSIC_SetReverb added (for MIDI only currently) - -+ FSOUND_LOADMEMORY flag added which allows sample loading, and STREAMING from a memory pointer. -+ FSOUND_MPEGACCURATE flag added for FSOUND_Stream_SetTime and MP2/MP3. You can use this to get accurate time length, - and set the exact specified time in an MP3 even if it has a Variable BitRate!! (VBR) -+ FSOUND_ALL added to channel and sample flags. This allows 1 function call (to FSOUND_SetVolume - for example) and it will affect ALL channels! The possibilities are cool, such pitchbending all - sounds playing with FSOUND_SetFrequency(FSOUND_ALL, freqval); etc. - - -- Some mod based fixes including better support for corrupted files :} -- Click bug removed on single-shot (non looping) samples for software engine. -- Bug in mmx 8bit sample mixers fixed. -- Streaming files stutter bug upon start removed / lessened. -- MP3 frame filter added to remove corruption/glitches in bad mp3's. -- ADPCM wav file corruption introduced in 3.22 removed. -- FSOUND_Sample_SetLoopPoints bad parameter handling fixed. -- FSOUND_StopAllChannels removed in favour of FSOUND_ALL flag. fmod.dll is still backwards compatible. -- FSOUND_Sample_LoadWav removed in favour of FSOUND_Sample_Load. fmod.dll is still backwards compatible. -- FSOUND_Sample_LoadMpeg removed in favour of FSOUND_Sample_Load. fmod.dll is still backwards compatible. -- FSOUND_Sample_LoadRaw removed in favour of FSOUND_Sample_Load. fmod.dll is still backwards compatible. -- FSOUND_Sample_LoadWavMemory removed in favour of FSOUND_Sample_Load. fmod.dll is still backwards compatible. -- FSOUND_Sample_LoadMpegMemory removed in favour of FSOUND_Sample_Load. fmod.dll is still backwards compatible. -- FSOUND_Stream_Open removed in favour of FSOUND_Stream_OpenFile. fmod.dll is still backwards compatible. -- FSOUND_Stream_OpenWav removed in favour of FSOUND_Stream_OpenFile. fmod.dll is still backwards compatible. -- FSOUND_Stream_OpenMpeg removed in favour of FSOUND_Stream_OpenFile. fmod.dll is still backwards compatible. -- FSOUND_3D_PlaySound removed in favour of FSOUND_PlaySound3DAttrib. fmod.dll is still backwards compatible. -- FSOUND_PlaySoundAttrib removed in favour of FSOUND_PlaySound3DAttrib. fmod.dll is still backwards compatible. -- FSOUND_MIXER_QUALITY_FPU_VOLUMERAMP removed, all quality mixers are volume ramping now. -- FMOD_ERR_INVALID_MIXER error removed in favour of already existing FMOD_ERR_INVALID_PARAM flag. -- FSOUND_GetCurrentVU improved, and bugfixed for stereo samples. -- Other minor bugfixes. - -* Streamer callbacks created with FSOUND_Stream_Create must now return TRUE, or FALSE to terminate the stream. -* FSOUND_MixBuffers renamed to FSOUND_DSP_MixBuffers -* _cdecl calling convention specified for callbacks in case default calling convention is changed (thanks Aristarkh Zagorodnikov) -* changed LCC-WIN32 compiler definition in fmod.h to __LCC__ (not LCCWIN32) so it works better now :) - -05/11/00 3.21 -------------- -* Intermediate update before FMOD 3.3 is released. - -+ New, easier to navigate documentation layout. Recording interface added to documentation :) - -- End of non looping MP3 on rare combination of filelength crash fixed. -- More efficient streaming engine, mp3 and other format playback is even faster than before. -- Master Volume and FSOUND_SetVolumeAbsolute bug fixed. - -04/05/00 3.2 DX3 Patch ------------------------ -+ Improved playback stability with harddisk interruptions occuring in the background. -- DirectX versions *less than* DX7 compatibility problem fixed (most noticable under NT). This was thanks to bug in dsound API (thanks microsoft!) - - -01/05/00 3.2 ------------- -* FSOUND_NORMAL re-defined to (FSOUND_LOOP_OFF | FSOUND_8BITS | FSOUND_MONO), as in some - cases it was being mistaken for a bitfield and or'ed in with other flags when it infact wasnt. (it was 0!) -* FSOUND_EAX interface renamed to FSOUND_Reverb interface. (to fit a3d reverb, software reverb etc not just EAX) - -+ DX7 support added. This adds more hardware voices than previously possible before. -+ EAX 2.0 support added. This means advanced reverb functionality and manual occlusion control. -+ A3D 3.0 support added (FMOD comes with a3dapi.dll now). This adds A3D reverb and advanced reverb support. -+ RECORDING support added. See FSOUND_Record_StartSample, FSOUND_Record_StartWAV etc. -+ FSOUND_MIXER_QUALITY_FPU_VOLUMERAMP mixer added. This removes clicks on sudden volume changes for added quality. -+ MMX quality mixer speed increased AGAIN to crazy speeds! Check out the new comparison charts. -+ 'userdata' parameter added to FSOUND_Stream_Create. -+ FMOD Standalone player/example (fmod.exe). Added 48khz support, MP3,WAV & A3D 3 support! - Reverb added (NR button removed) and lowpass filter declicked. See FMOD.C for the code for all this! -+ New music callbacks! FMUSIC_SetRowCallback, FMUSIC_SetOrderCallback. LATENCY ADJUSTED, so when it calls back on a particular row, it is the row you HEAR. -+ FSOUND_Stream_GetTime smoother and LATENCY ADJUSTED, so when the time displays a value, that is the time into the stream that you HEAR. -+ FMUSIC_GetPatternLength added. (for time calculation purposes) -+ FSOUND_SetMinHardwareChannels and FSOUND_SetMaxHardwareChannels added. Great for controlling 3d Hardware resources. -+ FSOUND_REVERB_IGNOREPARAM added, so you can change specific elements of environmental reverb and ignore others. -+ Delphi interface added! -+ Added fmod_errors.h which contains FMOD_ErrorString. Use this in conjunction with FMOD_GetError to get a string description of the error. - -- PCM .WAV files accidentally did an ACM codec check even if it was PCM. Some machines didn't - have this PCM ACM codec, and so loadwav or openwav failed - ACM check now skipped for PCM files. -- FSOUND_GetCurrentVU fixed! -- 3D - Software engine bugfixed rolloff and distancefactor to make it sound more like DS3D. -- WAV/MP3 - streamer fixes and improvements. -- XM/IT - portamento with multi sample instruments fixed. -- API - FSOUND_Sample_Get somehow dissapeared from the DLL.. back again. -- API - MU-Law functions removed. -- Many other miscellaneous fixes. - -08/01/00 3.11 -------------- -+ RIFF based MP3 files and MP3's with ID3 tags at the start now supported. - -- LoadSongMemory fixed and works again -- Pentium Pro selecting wrong mixer upon autodetect now fixed. -- XM and IT bugfixes. - -24/12/99 3.1 -------------- - -* FMUSIC_OptimizeChannels put back into fmod.h. Im not sure why it dissapeared in the first place :) -* 'stream.exe sample' changed from WAV to a MP3 command line streamer because more people wanted that. -* LoadMemory functions now take a length (length of the buffer). You may have to change your code - to support this (it is not backward compatible with 3.0. I didnt want to add more functions to the - API for such a minor change. - -+ Variable bitrate MP3's now supported! -+ FSOUND_SetHWND added for those who want to specify their own HWND for dsound focus purposes. -+ FSOUND_Stream_GetTime added, for smooth, non lagged, accurate synchronization with stream - playback. - Use this for synchronizing MP3's to your graphics! -+ Added stability to sound output of software engine, for when harddisk accesses occur. - -- 8 bit raw wav streaming bug fixed where output was noisy. -- Streamer start/stop logic bug fixed/improved. (it used to hang on exit if you did several start/stops in a row) -- Small XM bugfix on delay note. -- Fixed startup crash bug. This was caused by BAD DRIVERS. Creative ES1370 sound card drivers - have a bug, and they have the cheek to set the certified bit in the caps. It also reports - 256 hardware 3d channels which is obviously a lie. Thanks to Marcus Aarts, Anders Nilsson and - Shane Stevens for helping me find this one. -- Documentation fixes. - - -12/12/99 3.0 -------------- - -* New timing system, no more update rate, no more mixahead! a lot more stable on shit cards - like awe64, and at the same time, very low latency. -* FSOUND_SetPanSeperation only affects sfx now, not music. -* If mixer is not selected, it defaults to a quality mixer now, not a low quality one like before. -* FSOUND_Geometry_AddPolygon now supplies normal as well AND opening factor. (it takes NULL also) -* FSOUND_3D_Listener_GetAttributes now consistant across all output types. (waveout missed out before) -* FSOUND_SetPaused now works on FSOUND_HW3D buffers. -* FSOUND_SetMute now works on FSOUND_HW3D buffers. -* FSOUND_MixChannel renamed to FSOUND_MixBuffers (it has nothing to do with channels really) -* FSOUND_Listener_SetAttributes does not update 3d info now, FSOUND_3D_Update does. - -+ Added FSOUND_File_SetCallbacks. Use this to make FMOD use your own file operations. -+ Compressed WAV support added -+ MP3 Support added -+ EAX Support added -+ A3D Support added (with full geometry and list support) -+ MMX quality mixer sped up 2-3 times on ppro+ machines! (p6/p2/p3) -+ FSOUND_Driver_GetCaps added.. Now query the capabilities of drivers before calling FSOUND_Init. -+ FSOUND_Stream_Create added - an easier way to stream data. -+ FMUSIC_SetPanSeperation added, for per song pan seperation control. -+ FSOUND_3D_Update added. This is now the global 3d update/flush function, NOT FSOUND_Listener_SetAttributes. -+ FSOUND_Geometry_Material functions implemented -+ Documentation added for geometry stuff, also other documentation updated (playsound, 3d stuff) -+ Software 3D Engine updated! Software sounds used to audibly update on - FSOUND_3D_Emitter_SetAttributes only, and not when the listener was updated. - Now they are updated on neither, they are audibly updated now in FSOUND_3D_Update. - This means you can now move the listener without updating the sources and all the sources will - update automatically! This behaves the same as DS3D now. -+ FSOUND_GEOMETRY_OPENING & FSOUND_GEOMETRY_OPENING_REFERENCE implemented! create doorways. -+ Geometry list functions added. A faster way of processing geometry. - FSOUND_Geometry_AddList(FSOUND_GEOMLIST *geomlist); - FSOUND_Geometry_List_Create(signed char boundingvolume); - FSOUND_Geometry_List_Free(FSOUND_GEOMLIST *geomlist); - FSOUND_Geometry_List_Begin(FSOUND_GEOMLIST *geomlist); - FSOUND_Geometry_List_End(FSOUND_GEOMLIST *geomlist); - FSOUND_Geometry_List_Add(FSOUND_GEOMLIST *geomlist); -+ Added FSOUND_SetBufferSize -+ Added FSOUND_DSP_GetBufferLength - -- FSOUND_Sample_Lock / FSOUND_Sample_Unlock documented properly (oops! :) -- Soak test bug caused wave out to crash after 3 hours of operation.. fixed. -- Fixed bug in FSOUND_Sample_Create -- Some module playback improvements from fmod 2.25. -- IT mod format bug fix. (NNA caused sample vibrato to lose integrity) -- Error code is now set to FMOD_ERR_NONE on all function calls, so you dont parse an error - that was set 10 function calls ago for example. -- NoSound output mode improved. -- Removed FSOUND_SetMixAhead -- Removed FSOUND_SetUpdateRate - -18/10/99 2.25 -------------- -* Version number now included in DLL. (right click on DLL for info) -+ IT - mods composed with IT versions older than 2.0 reenabled. I dont have many - of these songs and it seemed to work straight away and the songs i did have. - They sounded ok, but if there are any problems with old IT mods then mention - them to me and I might try to fix them. (theyre not high on my priority list) -- FMUSIC_SetZxxCallback did not have the correct documentation and just took a - void * as the callback. The actual format of the callback is - callback(FMUSIC_MODULE *mod, unsigned char param). FMUSIC_SetZxxCallback now - forces this. -- IT - Impulse tracker 2.15 compressed samples reenabled :) -- IT - FMOD was interpreting IT's stereo flag for samples, which was erroneously - set by older versions of IT, causing some samples to play twice as fast as they - should. Stereo check removed (IT never supported stereo samples) -- MOD S3M XM IT - Sample offset bug fixed. -- XM IT - minor bugs fixed. -- Closedown stability increased. - -31/08/99 2.24 -------------- -* This is the last FMOD 2.* update unless there are some small niggling bugs. I - need to finish 3.0. -* NOSOUND - FSOUND_OUTPUT_NULL now behaves as if everything is active, therefore - you will get all music callbacks and timers, vu meters, dsp functions and everything - else working correctly etc as if it was playing, but you dont hear anything. -* FMOD ported to N64. -* API - this version is now declared stable. It has been run over with memory leak - tools and numerous memory problems have been found and fixed. -* DSP - Note that the 'length' part of the callback now fluctuates more to increase - output stability, and its maximum size can equal up to the updaterate + mixahead - in milliseconds. -* TOOLS - convert.exe removed. use soundforge or some such program if you want to - convert a wav to a a raw signed datastream. - -+ API - New reference count channel index! The index PlaySound returns now has a - reference count in the top 16bits. This so you can call playsound, store the - return value, then if that channel gets stolen by the priority system, and you - blindy try and keep updating it as if it was from your original playsound, the - new sound wont be affected!! -+ API - FSOUND_Stream_OpenWav added. Now you can stream wav files with ease. This - version still only supports PCM wav, but FMOD 3.0 should change this situation. -+ API - FSOUND_SetSFXMasterVolume & FSOUND_GetSFXMasterVolume added. -+ API - FSOUND_SetVolumeAbsolute added. This volume overrides master volume. Great - if you need to lower the volume of your game effects and make one stand out. -+ MUSIC - FMUSIC_OptimizeChannels added! This function kicks arse if you are trying - to lower channel usage. You give it a 'channels mixed' value, and a 'mod volume' - value, and it wont play sounds in a song that have a lower volume than 'mod volume', - if 'channels mixed' is being exceeded as stated in FSOUND_GetChannelsPlaying. - One example is a game that reduced its maxchannels from 24 to 16 because of this - with no audible difference. (the song had a lot of 'echos' that didnt need to be - audible when things got noisy, so FMOD threw them away.) -+ MUSIC - FMUSIC_GetSample and FMUSIC_SetSample added! This allows you to get control - of samples within a mod! Great if you need to compress samples yourself and then - decompress them back into the mod during your game. This was in 2.23 but i forgot - to mention it here :) -+ STREAM - file streaming example added to the sample directory. Command line driven - and takes a .wav file. - -- 3D - Software doppler effect rewritten, now physically accurate :).. - FSOUND_3D_Listener_SetDopplerFactor() now means something different to the previous - versions. Check the documentation for more on this. -- DRIVER - fixed problem with some peoples machines that have more than 16 - 'soundcards' that i thought would be the maximum. (It is actually just a - hardware card enumerating a whole waveout device for each hardware channel.) -- INTERFACE - command line parameters fixed, and some people not seeing the interface - appear should now be happy. -- IT - channel allocation bug fixed. - -17/08/99 2.23 --------------- -+ API - FSOUND_UNMANAGED flag added for sample loading/management -+ API - Added FSOUND_DSP_ClearMixBuffer. Use this before doing a biiiiiig harddisk access so you - dont get looping noise/stuttering, (because the harddisk/windows basically bus masters and shuts - down all threads, causing the mixer to stop as well, but the soundcard keeps playing the buffer). -- API - FSOUND_Sample_LoadWav & FSOUND_Sample_LoadWavMemory now return proper error code. -- MIXER - clicks removed from bidi looping sample in quality mixer. -- IT - fixed 2.15 compressed samples now work (oops forgot to call the right decompressor) -- IT - Memory footprint drastically reduced for pattern data (now leaves pattern data compressed and - unpacks on the fly) -- XM - Digitracker saved XM's now work correctly (dont crash, and illegal stuff filtered out) -- XM - envelope bug fixed. -- 3D - divide by 0 bug fixed (when listener and emitter are at the same location) -* API - Sample based functions like FSOUND_Sample_LoadWav etc take an index now, so you can specify - an absolute sample manager index, FSOUND_FREE or FSOUND_UNMANAGED - -18/06/99 2.22 rev 1 ------------------- -- IT - really obscure crash bug fixed. - -18/06/99 2.22 ------------------- -- MOD - accidently broke mod support, fixed -- S3M - fixed bug with bpm's smaller than 20h -- Idle optimization back in - -14/06/99 2.21 ------------------- -* Fix included from 2.2rev1 (registry bug in fmod standalone player) -* VC5 compatible import library included. vc6 only slipped into the last release. -+ IT 'envelope carry' support added. -+ MIXER - big increase in sound stability when harddisk is being accessed!! -+ LCC-WIN32 import library added. -- IT - crash bugfix. (envelopes with loop end before loop start) -- IT - volume bug (not hearing some samples at all) fixed in IT 'sample' mode. -- MOD S3M XM IT - fixed pattern delay bug -- DLL - size of DLL reduced by 12k! - -08/05/99 2.2 rev 1 ------------------- -- INTERFACE - fixed stupid registry bug which cause bad drivers to be initialized - at start up. It caused possible crashing, 000 channels mixed to be displayed - and no sound. - -16/05/99 2.2 ------------- -* FMOD is now a non beta release! -* MIXER - Changing driver on the fly with FSOUND_Driver_Close and - FSOUND_Driver_Init does not stop music playback any more. Everything - continues playing as it had been. -* API - Please read the new documentation on FSOUND_SetUpdateRate and - FSOUND_SetMixAhead!!!! This should remove confusion about what they do - and the issues of cpu usage, response time/latency and sound stability! -+ MIXER - FPU 32bit interpolating high quality mixer added! -+ API - FSOUND_Sample_SetLoopMode added -+ MOD - M!K! mod format supported. -+ INTERFACE - FMOD now saves sound settings in registry. -- API - Safety checking put into FSOUND_SetOutput, FSOUND_SetDriver, - FSOUND_SetMixer, FSOUND_SetUpdateRate and FSOUND_SetMixAhead. These - functions will fail and return an error code if FMOD is active and playing - sounds. You need to close FMOD down to call these functions, then - reinitialize it. FSOUND_Driver_Close and FSOUND_Driver_Init will fail also - if FSOUND has not been initialized with FSOUND_Init. -- MIXER - Fixed rare crash bug when background disk access caused timer - fluctuations. -- MIXER - Fixed rare sound output instability caused by closing and opening - fsound's driver code very quickly in succession. -- MIXER - Fixed crash bug on bidi samples playing backwards, at volume 0, - on the standard blendmode mixer only. (FPU Mixer also) -- MIXER - Fixed horrible fuzzy quality bug with MU-Law compressed samples! -- MIXER - Fixed standard blend mode mixer, which wasnt doing vol0 optimization - on -muted- channels. -- IT - fixed crash bug with mod that reference IT instruments beyond the - number of instruments. -- API - All 'interpolation functions' removed, if you want interpolation select - the FPU interpolating mixer and every sound played will use full 32bit - interpolation. (choosing which channels you want interpolated would end - up being a pain. Most people just want everything interpolated or not) -- CD - various CD player bugs fixed (random play, pause logic etc) -- API - FSOUND_GetCurrentVU now reports correct values for MuLaw compressed - samples. - -09/05/99 2.19b --------------- -* API release, this includes changes/fixes from 2.18 Update 1 (cdrom fixes) -* Documentation updated -* FMOD is now approaching a non beta state! (no bug reports are coming in) - Beta status will most likely be removed in a few weeks (maybe version 2.20) -* API - FSOUND_SetLatency has been renamed to FSOUND_SetUpdateRate, sorry for - the name change but it is really the incorrect name for what this function does. -+ INTERFACE - Settings now saved in registry. New minimal CD Player panel! -+ CPU usage reduced during idle time. FMOD shuts itself down when nothing is happening. -+ API - FSOUND_Sample_Alloc now allows specification of default priority as well. -+ API - FSOUND_Sample_SetDefaults lets you set a sample's default freq,vol,pan & priority. -+ API - FSOUND_GetCurrentVU added, by request. (useful for vu bars/beat detection?) -+ API - FMUSIC_GetTime added, by request. Useful for exact music synchronization EVERY time. -+ API - FSOUND_GetCurrentSample added, allows you to get the currently playing sample for - a particular channel, useful for comparisons.. ie to see if a particular sample is still - playing on a particular channel. -- API - FSOUND_SetAttributes removed. It was added before due to a request but I - feel it is just API bloat and can be achieved through a macro. - -28/04/99 2.18b Update 1 (player only) ------------------------------------- -* FMOD - player only being updated here, not the API. API releases usually - come on the weekend. (they take more time to prepare) -+ CD - Added continuous, looped and random buttons for playback method. -- CD - All bugs fixed in CD player, all created by BUGS in WIN32 API - functions. (mmsystem & mci commands- some work ok on NT, fail on 95). -- Removed startup dialog box. Defaults to primary device and dsound. Hit config - to change. (maybe use registry later) - -25/04/99 2.18b --------------- -* API - FSOUND_GetNumChannels renamed to FSOUND_GetMaxChannels -+ CD - New CD commands and support. FSOUND's CD system is a NON POLLING non - intrusive system (unlike windows cd player), for smooth background performance. - Tracks can now be looped, stopped and continued. -+ INTERFACE - new filters! Preverb filter(!) and Noise reduction. -+ INTERFACE - CD Player added. - -17/04/99 2.17b --------------- -* API - FSOUNDVC.LIB now VC5.0 compatible. -- XM - Fixed crash on sample offset. -- API - FMUSIC_SetPaused fixed. -- MIXER - Fixed MULAW mixer. Remember MULAW only works when a song has 16bit - samples (it converts them to mulaw), otherwise it isn't any different. It - only works for the blend mode mixer as well. The MMX mixers are fast enough - not to need mulaw. - -11/04/99 2.16b --------------- -+ API - DSP Engine implemented and added! New functions: - FSOUND_DSP_Create,FSOUND_DSP_Free,FSOUND_DSP_SetPriority, - FSOUND_DSP_GetPriority,FSOUND_DSP_SetActive, - FSOUND_DSP_GetActive,FSOUND_DSP_GetClearUnit, - FSOUND_DSP_GetSFXUnit,FSOUND_DSP_GetMusicUnit - FSOUND_DSP_GetClipAndCopyUnit. - See FSOUND_DSP_Create for documentation on this new feature. -+ API - Added FSOUND_MixChannel - now you have direct access to - FSOUND's optimized mixers! -- MOD, S3M, XM, IT - Fixed loader bug introduced in 2.15! (to do - with load from memory system.) -- XM - Found and fixed a sample offset bug introduced a few - versions ago, with 16bit samples. -- API - Echo engine and functions removed - DSP engine is now to - be used. -- API - Fixed bug in FMUSIC_SetOrder. -- API - Fixed bug in FSOUND_GetMixer, it was returning - FSOUND_MIXER_AUTODETECT if that was used in FSOUND_SetMixer, - instead of the actual mixer it was using. -- INTERFACE - loader bug fixed. - -28/03/99 2.15b --------------- -+ API - Watcom now supported. Watcom users link in the - FSOUNDW.LIB import library. -+ API - Added FMUSIC_LoadSongMemory, now load mod/s3m/xm/it - files from memory handles / resources. -+ API - Added FSOUND_LoadWavMemory, now load wav files from - memory handles / resources. -- API - Fixed bug in FSOUND_Sample_Alloc which allocated samples - with length = 0, and hence no sound came out when played. -- SAMPLE - fixed bugs in fmod sample code. - -21/03/99 2.14b --------------- -* FSOUND / FMUSIC is now a DLL. The reason is to use a dll is - to make it easier to link on different compilers, and it really - is for aesthetic reasons only to have it as a .lib. (ie 1 exe - releases) and im not interested. -* Examples cleaned up, they dont specify unused .libs any more. -- WAVEOUT - bugfixed, works on NT now, and now actually uses - setmixahead settings. You will have to use large mixaheads - (80-100 and higher on my tests) for WaveOut, or the sound will - break up. There is nothing you can do about this. -- DSOUND - works on NT now (DX3). This is the same as waveout - (dsound3 for nt is a waveout wrapper). You will have to use - large mixahead values (80-100ms and higher on my tests), or it - may break up. -+ API - FSOUND_SetAttributes added -+ API - FSOUND_PlaySoundAttrib added - -14/03/99 2.13b --------------- -* Programmers API finally released! see - http://www.zip.com.au/~fl for more details! -+ MIXER Stereo sample mixers added. Old way of spawning 2 new - channels is gone.. Under MMX a stereo channel is actually - faster than mono! -+ S3M, XM, IT - Zxx callback now supported. Programmers can set - a callback function for whenever the Z effect is issued from a - song, for synchronizing effects etc. .MOD is not supported. -+ STREAMERS - Streamer API Added for playing very large files. - Currently only supports raw, but mulaw, adpcm and mp3 streamers - are coming. -+ MOD, S3M, XM, IT - Master volume added to API. - This is a true scalar instead of just modifying the song's - global volume like before (ie the song might have adjusted the - global volume after you set it) -+ INTERFACE - Master volume slider added. -- MIXER - Fixed extremely rare crash bug. -- MIXER - volumes were ever so slightly out, ie a channel - panned full right still had about 0.4% (not much) of the sound - playing in the left channel instead of 0% as it should have. -- MISC - many small fixes. - -04/02/99 2.12b --------------- -- Fixed linear freq problem introduced due to linear freq - optimization, I just removed it now for accuracy sake. -* a little bit more stable? - -02/02/99 2.11b --------------- -- Fixed BPM problem on all formats. Now loop songs should play ok. -- Fixed sample offset on all formats (oops sorry sample offset was - disabled on mod/s3m/xm since 2.06 accidentaly! noone seemed to - notice hahaha) - -31/01/99 2.10b --------------- -- Minor Direct Sound bugs fixed. - -30/01/99 2.09b --------------- -- IT bug fixed with instrument numbers and no note. (most - formats dont retrigger the note in this case, but IT does if - the sample has finished playing, and not before.) -- S3M Bug found in loader. (popped up only due to impulse - tracker saved s3ms). -- IT fixed porta wihout any previous note.. porta on on a - channel that has no channel playing will trigger a new note. -- DRIVER direct sound should work more reliably on NT using - directX. -- INTERFACE fixed song list box bug. Delete happily now without - problems. -- INTERFACE config box now remembers what you last set when you - hit config, and wont change any settings if you hit 'cancel' - (it used to select nosound before) -- DRIVER code now detects incompatible cpu's and exits with an - error instead of crashing? -- XM/IT replay sped up. Linear frequencies processed a lot - faster now. - -26/01/99 2.08b --------------- -+ DRIVERS added capability to switch drivers on the fly. Use - the 'Config' Button on the interface to change output - devices, soundcards, mixing rates or mixing routines. -+ MIXER added Mu-Law support! This is only for NON-MMX mixing, - and improves the speed of 16bit sample mixing dramatically, with - only a small loss in sample quality. (simulates 12bit accuracy) -- MIXER fixed ugly bug (crashes/noise) with 8bit BIDI looping - samples on standard blend mode mixer. - -24/01/99 2.07b --------------- -+ IT added volume byte portamentos -+ IT added S6x - Pattern delay by ticks -+ IT added volume byte vibrato -+ IT added sample vibrato -- IT fixed effect S73, S74, S75, S76, S77, S78. These commands - are meant to alter the behaviour of an instrument, except i was - permanently modifying the instrument instead of just altering it - for the note currently being played!! oops.. -- IT / XM - turn off envelopes that have less than 2 points. - (apparently sometimes files can have this) -- IT fixed Hxy Kxy Uxy (vibrato/finevibrato).. if Hxy is followed - by U00 then it continues to be a normal vibrato, even if it says - fine vibrato.. same for Uxy followed by H00.. it continues with - a fine vibrato even if it says normal vibrato.. The y part of - the command needs to have something in it to change vibrato - types. (dumb impulse tracker bug) -- IT fixed volume slide bug in Kxy Lxy -- IT foreground / background channel logic is more accuate now with - NNA's and effect commands. -- MOD, S3M, XM, IT - now checks internal signatures for file verification - as some people were trying to load mod's etc that were renamed to s3m! - yeah yeah thanks a lot otto ;) -- IT fixed S00 - any Sxy command gets remembered and replayed if it - is followed with S00.. (crono - not just SDx and SCx like you said) -- DSOUND fixed init/shutdown code to be cleaner. - - -20/01/99 2.06b --------------- -- XM fixed BPM issue.. seems FT2's timer is a bit faster than it - really should be.. (roughly 2bpm) mega-sample-loop songs sound - ok now. -- IT another pattern loader crash bug fixed (should be the last) -- IT fixed Gxx bug (portamento).. IT forgets it porta target - after it reaches it. (TheHornet again) -- IT fixed Oxy (sample Offset) bug - -18/01/99 2.05b --------------- -* MIXER Using large latency again just for fmod.exe with dsound, - to improve stability (im working on it) -- IT Fixed signed/unsigned sample detection in loader -- IT Disabled pitch envelopes for IT's using IIR filters so they - wont sound awful. -- XM Fixed crash bug in loader. - -17/01/99 2.04b --------------- -* Mixer buffer management totally rewritten, might be a *tiny* - bit slower (becuase of caching), but it is a lot more flexible - and stable. Built in preparation of the DSP plugin API. -* Halved size of both MMX mixer routines (to do with surround) -* API ready to use. Now at beta test stage -* Thanks to TheHornet for his doc on it 'nuances' that were too - subtle to find through normal testing. (bugs found with (***)) -* New more consistant mixer thread management. -+ Volume 0 optimizations! Average mods will now use about 30% - less cpu time (depends on the song) -+ Standard blend mode mixer sped up for 8bit samples -+ Windows Multimedia WaveOut support added. At the moment it - works well but the latency is too long for game sfx. It is - more stable than the direct sound driver (less garbling / - breakups) -+ .WAV sample support added. -+ Stereo sample support added. -+ IT added linear frequencies. -+ IT added panbrello -+ IT added support for 'compatible Gxx' in IT's options -- MIXER Fixed volume 0 optimization hang bug. -- IT fixed effected E/F/G to use the same memory. -- IT fixed SDx delay note bug (SD0 == SD1) (***) -- IT fixed SCx note cut bug (SC0 == SC1) (***) -- IT fixed Qxy retrig (now retrigs across multiple notes like - IT.. other formats ignore retrig if it is higher than the - speed of the song) -- IT fixed Gxx / Lxy (portamento). was 2x too slow. -- IT fixed Vibrato for 'old effects'.. with old effects it is - 2x deeper and does not get updated on tick 0. -- MIXER OOPS! i had '#define ROLLED' left uncommented in my P6 - MMX mixer since version 2.0 or so!! it wasnt using unrolled - loops. Now it is roughly 1.6 times faster! (from 5% to 3% cpu - usage on a p2-266 for mixing 32channels at once) - -14/11/98 2.03b --------------- -+ Added stability to mixer, removed 150ms crap from 2.02 - -07/11/98 2.02b --------------- -* ALL players use a new dynamic channel allocation system -- consider MOD, S3M & XM under beta again. (MAY have - broken something!) -* MIXER in an attempt for added stability, for this standalone - player, a different approach is used.. it has a huge - latency (150ms) and takes a bit more cpu time, but shouldnt - break up as much .. for the game library the old method - still stands. (150ms is way too long to wait for a sound - effect to trigger.. so fmod uses 50ms latency for games etc) -+ IT Added NNA's -+ IT Added DCT/DCA's. -+ MIXER Added echo post effect.. hardcoded 50ms echo for now. -+ IT Added Pan Envelope -+ IT Added all volume column effects except for porta commands & - vibrato -+ INTERFACE Added drag and drop. Drag tunes from explorer into - the player to load -+ INTERFACE also command line fileloading (ie associate the exe - in explorer with mod,s3m,xm,it then just doubleclick files - to load them) -+ IT Added most other effects -- ALL Fixed some crashing for songs that specify sample id's that - dont exist. -- XM & IT Fixed Envelope bug - loops were playing 1 tick too long :) -- S3M fixed arpeggio bug causing 0 frequencies (divide by 0) -- IT fixed pattern break and pattern jump .. both params are - hex unlike all other formats. -- IT fixed arpeggio depth -- IT enabled end of song marker.. it was crashing on this b4 -- INTERFACE Fixed memory leak.. it would slowly leak memory in - realtime until windows ran out of resources and crashed! :) -- IT fixed porta bugs.. oops i was portamento'ing 2x too fast -- IT fixed instrument bug. it was updating all nna channel's - envelopes etc, using only the most recent nna's instrument - definition, instead of the instrument that should have been - associated with each individual nna channel. -- IT fixed set pan (Xxx) bug -- IT fixed invalid pattern bug with patterns defined that are - larger than the number of patterns specified in the file. -- IT fixed vibrato (Hxy) bug -- IT fixed big NNA bug.. i was performing NNA's based on the - new instrument's nna flags instead of the one it was - cutting off! -- IT fixed the past nna s7x effects.. now the number of channels - mixed on the interface matches exactly that of impulse - trackers! - -20/10/98 2.01b --------------- -+ IT Added preliminary volume envelope support (no sustain loops) -+ IT Added channel volume slide -+ IT Added noteoff & notecut (not the effect, the note type) - -19/10/98 2.00b --------------- -* First private release Version, includes MOD, S3M and XM and IT - support. New software mixers, win32 only. Removed 669,FAR & - MTM support, old interface is gone, new win32 interface.. - jeezus has it been 3 years? im getting too old for this shit:) -* IT Support is REALLY basic.. roughly 30% done. -- XM Fixed bug with envelope loopend. - - - -/|\ - | - | - | - | - - - -30/11/95 1.06 -------------- -* Released with FMODDOC 2, including full source code -+ Totally new fast scrolling interface, some keys have changed. -+ 32channel .MOD support added. (ie dope.mod type, etc) -+ 9 octaves supported now (C-0,B-8), including 7 octaves .MOD -+ No more 64kb sample limit (4gig sample on a GUS? :) -+ MTM support added -+ 669 support added - what an awful format! -+ extended 669 support added - just as bad :) -+ 16 bit support added (err for mtm? ahh well xm will come) -+ Clipping samples at loopend points to save GUS memory -+ S3M support added -- Bugfix where all music came out in left channel on SOME cards - (none I have heard:). Thanks to Brad Thomas for the fix. -- 2 GUS bugs fixed (reported wrong dram size & dram corruption) -* now checks if the samples are too big for the card. -- Voices now play almost simultaneously instead of 1 after the - other like before -+ Added Technicality-Index (tm) meter! Truly a cool feature. -+ Knocked 52% of DRAM upload time! YES it is *2* times faster!! - (eg when.s3m even loads *3* seconds faster than cmod does) -* - FIXED at last. FMOD will now NOT crash (fingers crossed :) -- removed clicking from looping samples -- Vibrato fixed properly this time and is 100%. -* Calculated new volume table. Not so noisy. Less distortion. -+ WildCard Support added! -+ S3M Stereo Control effect SAx added -+ Solo Channel feature added and many other muting features -- Fixed S3M retrig bug -+ Vibrato/Tremolo WaveControl finished properly -+ Keyboard LED flashing added! Lights flash to channels 1-3. -- tempo bug fixed, timing system changed so BPM can drop to 24 -+ FAR support added -* Sample loader redone and >64kb bug fixed, also pattern storage - method changed. -* Panning changed, now values from 0 to 255 to suit FT2. -- Pattern Loop bug fixed, I didnt know pattern loop stored - seperate values for each channel. -- pattern jump + pattern break bug fixed now all those weird - backwards tunes work RIGHT. -+ Added S3M's Fast Volume Slide bug, err feature :) -++ NOW PMODE! Load any sized tune you like now and still have - heaps of memory left -+ NEW tracker screen. Watch pattern data like a tracker -- Keyboard LED flashing removed, caused crashes on some - peoples computers.. sigh it was rather cool. -+ NEW technical info screen. Watch a lot of meaningless info - appear on the screen. Good for developers to check against. -- .MOD bug fixed, now those extremely high and low octaves - supported PROPERLY.. (unlike some cMOD players;) -- sample offset bug fixed. -+ Dynamic interface installed, now any screen can be called up - from any other screen, instead of just from the main screen - like before. -* Error handling changed for a lot better stability. -+ File Selector included for all those losers who wanted it :) -+ Added effect Ixy - Tremor - perfect I think unlike other - players.. compared against Scream Tracker 3 -- Fixed >64kb sample loading bug - was causing crashes -- Fixed MTM loader bug after about 6 hours of tearing out hair -* File Selector now accessable while song is still playing, - press escape to return to the main interface. -- sample uploader recoded, fixed. 16 bit samples now load - a lot better (this is actually from 1.07 which isnt released - yet and probably wont be for a while ;) -- a zillion little other bugs fixed. - -13/6/95 1.05 -------------- -- GUS looping clicks removed. -- Mute bug fixed. Wouldnt unmute unused channles. - -10/6/95 1.04 -------------- -- fixed another crash bug -+ Added cool new pan cycling effect! Hit 'c' to try it. - -7/6/95 1.03 -------------- -- Fixed interface bug (was printing ^g's in sample names) -+ Added effect 8xy (Panning) -- Fixed crash bug maybe.. I think I did, people complained of - the interface crashing.. I've never seen it crash but I found - I was mixing 'new' and 'malloc'.. fixed. -+ Added effect 7xy (Tremolo) - woopee ;) -+ Added mute channels -+ Added panning keys '(' and ')' to set default panning. - -30/5/95 1.02 -------------- -* major internal storage changes! -+ More memory in dos shell! around 30kb on average sized tunes. -* A lot faster. -- Pattern break fixed. Tested on backward.mod by FireLight -- Now mixes at 44.1khz like it should instead of 30khz..oops :} -+ Added effect EEx (Pattern Delay). -+ Added effect E6x (Pattern Loop). -- Retrig fixed now 100% protracker. - -5/4/95 1.01 -------------- -- fixed crash bug / increased speed by not calculating unused - channels. (I don't think i released this version though) - -6/3/95 1.00 -------------- -* FIRST PUBLIC RELEASE (In FireStorm 2 Music Disk) -- Vibrato bug fixed, now works I think :). -* Interface Completely changed looks much nicer now -+ speed of interface increased greatly - -============================================================================== - diff --git a/#ThirdParty/fmodapi375win/media/canyon.mid b/#ThirdParty/fmodapi375win/media/canyon.mid deleted file mode 100644 index 9530d80..0000000 Binary files a/#ThirdParty/fmodapi375win/media/canyon.mid and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/media/chimes.wav b/#ThirdParty/fmodapi375win/media/chimes.wav deleted file mode 100644 index 265a37f..0000000 Binary files a/#ThirdParty/fmodapi375win/media/chimes.wav and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/media/drumloop.wav b/#ThirdParty/fmodapi375win/media/drumloop.wav deleted file mode 100644 index b35e216..0000000 Binary files a/#ThirdParty/fmodapi375win/media/drumloop.wav and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/media/footsteps.fsb b/#ThirdParty/fmodapi375win/media/footsteps.fsb deleted file mode 100644 index 948ef22..0000000 Binary files a/#ThirdParty/fmodapi375win/media/footsteps.fsb and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/media/invtro94.s3m b/#ThirdParty/fmodapi375win/media/invtro94.s3m deleted file mode 100644 index 1f2ad5d..0000000 Binary files a/#ThirdParty/fmodapi375win/media/invtro94.s3m and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/media/jaguar.wav b/#ThirdParty/fmodapi375win/media/jaguar.wav deleted file mode 100644 index 0347714..0000000 Binary files a/#ThirdParty/fmodapi375win/media/jaguar.wav and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/media/jbtennis.wav b/#ThirdParty/fmodapi375win/media/jbtennis.wav deleted file mode 100644 index 77e710c..0000000 Binary files a/#ThirdParty/fmodapi375win/media/jbtennis.wav and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/media/jules.mp3 b/#ThirdParty/fmodapi375win/media/jules.mp3 deleted file mode 100644 index 85ce933..0000000 Binary files a/#ThirdParty/fmodapi375win/media/jules.mp3 and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/samples/3d/3d.dsp b/#ThirdParty/fmodapi375win/samples/3d/3d.dsp deleted file mode 100644 index 5157bb9..0000000 --- a/#ThirdParty/fmodapi375win/samples/3d/3d.dsp +++ /dev/null @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="3d" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=3d - 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 "3d.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 "3d.mak" CFG="3d - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "3d - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "3d - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "3d - 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 "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX -# 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 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:console /machine:I386 -# ADD LINK32 ..\..\api\lib\fmodvc.lib /nologo /subsystem:console /machine:I386 /out:"3d.exe" - -!ELSEIF "$(CFG)" == "3d - 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 "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX -# 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 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:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ..\..\api\lib\fmodvc.lib /nologo /subsystem:console /debug /machine:I386 /out:"3d.exe" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "3d - Win32 Release" -# Name "3d - Win32 Debug" -# Begin Source File - -SOURCE=.\Main.cpp -# End Source File -# End Target -# End Project diff --git a/#ThirdParty/fmodapi375win/samples/3d/3d.exe b/#ThirdParty/fmodapi375win/samples/3d/3d.exe deleted file mode 100644 index 32925ce..0000000 Binary files a/#ThirdParty/fmodapi375win/samples/3d/3d.exe and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/samples/3d/Main.cpp b/#ThirdParty/fmodapi375win/samples/3d/Main.cpp deleted file mode 100644 index 3f7abae..0000000 --- a/#ThirdParty/fmodapi375win/samples/3d/Main.cpp +++ /dev/null @@ -1,450 +0,0 @@ -//=============================================================================================== -// 3D.EXE -// Copyright (c), Firelight Technologies Pty, Ltd, 1999-2004. -// -// This test shows EAX, DS3D and Software all being used together and the simple commands needed -// to set up some 3d audio. -// This application also displays the use of FSOUND_GetDriverCaps to get information on the -// 3D capabilities of the selected driver -//=============================================================================================== - -#include -#include -#include -#if defined(WIN32) || defined(__WATCOMC__) || defined(_WIN64) - #include - #include -#else - #include "../../api/inc/wincompat.h" -#endif - -#include "../../api/inc/fmod.h" -#include "../../api/inc/fmod_errors.h" // optional - -#define INTERFACE_UPDATETIME 50 // 50ms update for interface - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -void Close(FSOUND_SAMPLE *samp1, FSOUND_SAMPLE *samp2, FSOUND_SAMPLE *samp3) -{ - // you dont need to free samples if you let fsound's sample manager look after samples, as - // it will free them all for you. - FSOUND_Sample_Free(samp1); - FSOUND_Sample_Free(samp2); - FSOUND_Sample_Free(samp3); - - FSOUND_Close(); -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -int main() -{ - FSOUND_SAMPLE *samp1 = NULL, *samp2 = NULL, *samp3 = NULL; - char key, listenerflag = 1; - int driver, i = 0, channel1 = -1, channel2 = -1; - float listenerpos[3] = { 0,0,0 }; - - if (FSOUND_GetVersion() < FMOD_VERSION) - { - printf("Error : You are using the wrong DLL version! You should be using FMOD %.02f\n", FMOD_VERSION); - return 1; - } - - // ========================================================================================== - // SELECT OUTPUT METHOD - // ========================================================================================== - - printf("---------------------------------------------------------\n"); - printf("Output Type\n"); - printf("---------------------------------------------------------\n"); -#if defined(WIN32) || defined(_WIN64) || defined(__CYGWIN32__) || defined(__WATCOMC__) - printf("1 - Direct Sound\n"); - printf("2 - Windows Multimedia Waveout\n"); - printf("3 - ASIO\n"); -#elif defined(__linux__) - printf("1 - OSS - Open Sound System\n"); - printf("2 - ESD - Elightment Sound Daemon\n"); - printf("3 - ALSA 0.9 - Advanced Linux Sound Architecture\n"); -#endif - printf("4 - NoSound\n"); - printf("---------------------------------------------------------\n"); // print driver names - printf("Press a corresponding number or ESC to quit\n"); - - do - { - key = getch(); - } while (key != 27 && key < '1' && key > '4'); - - switch (key) - { - -#if defined(WIN32) || defined(_WIN64) || defined(__CYGWIN32__) || defined(__WATCOMC__) - case '1' : FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND); - break; - case '2' : FSOUND_SetOutput(FSOUND_OUTPUT_WINMM); - break; - case '3' : FSOUND_SetOutput(FSOUND_OUTPUT_ASIO); - break; -#elif defined(__linux__) - case '1' : FSOUND_SetOutput(FSOUND_OUTPUT_OSS); - break; - case '2' : FSOUND_SetOutput(FSOUND_OUTPUT_ESD); - break; - case '3' : FSOUND_SetOutput(FSOUND_OUTPUT_ALSA); - break; -#endif - case '4' : FSOUND_SetOutput(FSOUND_OUTPUT_NOSOUND); - break; - default : return 1; - } - - - // ========================================================================================== - // SELECT DRIVER - // ========================================================================================== - - // The following list are the drivers for the output method selected above. - printf("---------------------------------------------------------\n"); - switch (FSOUND_GetOutput()) - { - case FSOUND_OUTPUT_NOSOUND: printf("NoSound"); break; -#if defined(WIN32) || defined(_WIN64) || defined(__CYGWIN32__) || defined(__WATCOMC__) - case FSOUND_OUTPUT_WINMM: printf("Windows Multimedia Waveout"); break; - case FSOUND_OUTPUT_DSOUND: printf("Direct Sound"); break; - case FSOUND_OUTPUT_ASIO: printf("ASIO"); break; -#elif defined(__linux__) - case FSOUND_OUTPUT_OSS: printf("Open Sound System"); break; - case FSOUND_OUTPUT_ESD: printf("Enlightment Sound Daemon"); break; - case FSOUND_OUTPUT_ALSA: printf("Alsa"); break; -#endif - - }; - printf(" Driver list\n"); - printf("---------------------------------------------------------\n"); - - for (i=0; i < FSOUND_GetNumDrivers(); i++) - { - printf("%d - %s\n", i+1, FSOUND_GetDriverName(i)); // print driver names - { - unsigned int caps = 0; - - FSOUND_GetDriverCaps(i, &caps); - - if (caps & FSOUND_CAPS_HARDWARE) - printf(" * Driver supports hardware 3D sound!\n"); - if (caps & FSOUND_CAPS_EAX2) - printf(" * Driver supports EAX 2 reverb!\n"); - if (caps & FSOUND_CAPS_EAX3) - printf(" * Driver supports EAX 3 reverb!\n"); - } - } - printf("---------------------------------------------------------\n"); // print driver names - printf("Press a corresponding number or ESC to quit\n"); - - do - { - key = getch(); - if (key == 27) - return 0; - driver = key - '1'; - } while (driver < 0 || driver >= FSOUND_GetNumDrivers()); - - FSOUND_SetDriver(driver); // Select sound card (0 = default) - - { - unsigned int caps = 0; - - FSOUND_GetDriverCaps(FSOUND_GetDriver(), &caps); - - printf("---------------------------------------------------------\n"); - printf("Driver capabilities\n"); - printf("---------------------------------------------------------\n"); - if (!caps) - printf("- This driver will support software mode only.\n It does not properly support 3D sound hardware.\n"); - if (caps & FSOUND_CAPS_HARDWARE) - printf("- Driver supports hardware 3D sound!\n"); - if (caps & FSOUND_CAPS_EAX2) - printf("- Driver supports EAX 2 reverb!\n"); - if (caps & FSOUND_CAPS_EAX3) - printf("- Driver supports EAX 3 reverb!\n"); - printf("---------------------------------------------------------\n"); - } - - FSOUND_SetMixer(FSOUND_MIXER_AUTODETECT); - - // ========================================================================================== - // INITIALIZE - // ========================================================================================== - if (!FSOUND_Init(44100, 32, 0)) - { - printf("Init: %s\n", FMOD_ErrorString(FSOUND_GetError())); - return 1; - } - - // ========================================================================================== - // LOAD SAMPLES - // ========================================================================================== - - // ========================================================================================== - // 3D MONO - // ========================================================================================== - - samp1 = FSOUND_Sample_Load(FSOUND_FREE, "../../media/drumloop.wav", FSOUND_HW3D, 0, 0); - if (!samp1) - { - printf("samp1: %s\n", FMOD_ErrorString(FSOUND_GetError())); - Close(samp1, samp2, samp3); - return 1; - } - - // increasing mindistnace makes it louder in 3d space - FSOUND_Sample_SetMinMaxDistance(samp1, 4.0f, 10000.0f); - FSOUND_Sample_SetMode(samp1, FSOUND_LOOP_NORMAL); - - // ========================================================================================== - // 3D MONO - // ========================================================================================== - samp2 = FSOUND_Sample_Load(FSOUND_UNMANAGED, "../../media/jaguar.wav", FSOUND_HW3D, 0, 0); - if (!samp2) - { - printf("samp2: %s\n", FMOD_ErrorString(FSOUND_GetError())); - Close(samp1, samp2, samp3); - return 1; - } - // increasing mindistance makes it louder in 3d space - FSOUND_Sample_SetMinMaxDistance(samp2, 4.0f, 10000.0f); - FSOUND_Sample_SetMode(samp2, FSOUND_LOOP_NORMAL); - - // ========================================================================================== - // 2D STEREO - // ========================================================================================== - samp3 = FSOUND_Sample_Load(FSOUND_UNMANAGED, "../../media/chimes.wav", FSOUND_HW2D, 0, 0); - if (!samp3) - { - printf("samp3: %s\n", FMOD_ErrorString(FSOUND_GetError())); - Close(samp1, samp2, samp3); - return 1; - } - - // ========================================================================================== - // DISPLAY HELP - // ========================================================================================== - - printf("FSOUND Output Method : "); - switch (FSOUND_GetOutput()) - { - case FSOUND_OUTPUT_NOSOUND: printf("FSOUND_OUTPUT_NOSOUND\n"); break; - case FSOUND_OUTPUT_WINMM: printf("FSOUND_OUTPUT_WINMM\n"); break; - case FSOUND_OUTPUT_DSOUND: printf("FSOUND_OUTPUT_DSOUND\n"); break; - case FSOUND_OUTPUT_ASIO: printf("FSOUND_OUTPUT_ASIO\n"); break; - case FSOUND_OUTPUT_OSS: printf("FSOUND_OUTPUT_OSS\n"); break; - case FSOUND_OUTPUT_ESD: printf("FSOUND_OUTPUT_ESD\n"); break; - case FSOUND_OUTPUT_ALSA: printf("FSOUND_OUTPUT_ALSA\n"); break; - }; - - printf("FSOUND Mixer : "); - switch (FSOUND_GetMixer()) - { - case FSOUND_MIXER_BLENDMODE: printf("FSOUND_MIXER_BLENDMODE\n"); break; - case FSOUND_MIXER_MMXP5: printf("FSOUND_MIXER_MMXP5\n"); break; - case FSOUND_MIXER_MMXP6: printf("FSOUND_MIXER_MMXP6\n"); break; - case FSOUND_MIXER_QUALITY_FPU: printf("FSOUND_MIXER_QUALITY_FPU\n"); break; - case FSOUND_MIXER_QUALITY_MMXP5: printf("FSOUND_MIXER_QUALITY_MMXP5\n"); break; - case FSOUND_MIXER_QUALITY_MMXP6: printf("FSOUND_MIXER_QUALITY_MMXP6\n"); break; - }; - printf("FSOUND Driver : "); - printf("%s\n", FSOUND_GetDriverName(FSOUND_GetDriver())); - - int num2d, num3d; - - FSOUND_GetNumHWChannels(&num2d, &num3d, NULL); - - printf("Hardware 2D channels : %d\n", num2d); - printf("Hardware 3D channels : %d\n", num3d); - - printf("=========================================================================\n"); - printf("Press 1 Pause/Unpause 16bit 3D sound at any time\n"); - printf(" 2 Pause/Unpause 8bit 3D sound at any time\n"); - printf(" 3 Play 16bit STEREO 2D sound at any time\n"); - printf(" 4 Change to EAX Reverb mode CONCERTHALL (DirectSound/SBLive only)\n"); - printf(" 5 Change to EAX Reverb mode SEWERPIPE (DirectSound/SBLive only)\n"); - printf(" 6 Change to EAX Reverb mode PSYCHOTIC (DirectSound/SBLive only)\n"); - printf(" < Move listener left (in still mode)\n"); - printf(" > Move listener right (in still mode)\n"); - printf(" SPACE Stop/Start listener automatic movement\n"); - printf(" ESC Quit\n"); - printf("=========================================================================\n"); - - // ========================================================================================== - // PLAY 2 LOOPING SOUNDS - // ========================================================================================== - - - { - float pos[3] = { -10.0f, -0.0f, 0.0f }; - float vel[3] = { 0,0,0 }; - - channel1 = FSOUND_PlaySoundEx(FSOUND_FREE, samp1, NULL, TRUE); - FSOUND_3D_SetAttributes(channel1, pos, vel); - if (!FSOUND_SetPaused(channel1, FALSE)) - { - printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); - } - } - { - float pos[3] = { 15.0f, -0.0f, -0.0f }; - float vel[3] = { 0,0,0 }; - - channel2 = FSOUND_PlaySoundEx(FSOUND_FREE, samp2, NULL, TRUE); - FSOUND_3D_SetAttributes(channel2, pos, vel); - FSOUND_SetVolume(channel2, 128); - if (!FSOUND_SetPaused(channel2, FALSE)) - { - printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); - } - } - - // ========================================================================================== - // MAIN LOOP - // ========================================================================================== - - do - { - if (kbhit()) - { - key = getch(); - - if (key == '1') - { - FSOUND_SetPaused(channel1, !FSOUND_GetPaused(channel1)); - } - if (key == '2') - { - FSOUND_SetPaused(channel2, !FSOUND_GetPaused(channel2)); - } - if (key == '3') - { - FSOUND_PlaySound(FSOUND_FREE, samp3); - } - if (key == '4') - { - FSOUND_REVERB_PROPERTIES props = FSOUND_PRESET_CONCERTHALL; - FSOUND_Reverb_SetProperties(&props); - } - if (key == '5') - { - FSOUND_REVERB_PROPERTIES props = FSOUND_PRESET_SEWERPIPE; - FSOUND_Reverb_SetProperties(&props); - } - if (key == '6') - { - FSOUND_REVERB_PROPERTIES props = FSOUND_PRESET_PSYCHOTIC; - FSOUND_Reverb_SetProperties(&props); - } - - if (key == ' ') - { - listenerflag = !listenerflag; - } - - if (!listenerflag) - { - if (key == '<') - { - listenerpos[0] -= 1.0f; - if (listenerpos[0] < -35) - { - listenerpos[0] = -35; - } - } - if (key == '>') - { - listenerpos[0] += 1.0f; - if (listenerpos[0] > 30) - { - listenerpos[0] = 30; - } - } - } - } - - - // ========================================================================================== - // UPDATE THE LISTENER - // ========================================================================================== - { - static float t = 0; - static float lastpos[3] = { 0,0,0 }; - float vel[3]; - - if (listenerflag) - { - listenerpos[0] = ((float)sin(t*0.05f) * 33.0f); // left right pingpong - } - - // ********* NOTE ******* READ NEXT COMMENT!!!!! - // vel = how far we moved last FRAME (m/f), then time compensate it to SECONDS (m/s). - vel[0] = (listenerpos[0]-lastpos[0]) * (1000 / INTERFACE_UPDATETIME); - vel[1] = (listenerpos[1]-lastpos[1]) * (1000 / INTERFACE_UPDATETIME); - vel[2] = (listenerpos[2]-lastpos[2]) * (1000 / INTERFACE_UPDATETIME); - - // store pos for next time - lastpos[0] = listenerpos[0]; - lastpos[1] = listenerpos[1]; - lastpos[2] = listenerpos[2]; - - FSOUND_3D_Listener_SetAttributes(&listenerpos[0], &vel[0], 0, 0, 1.0f, 0, 1.0f, 0); - - t += (30 * (1.0f / (float)INTERFACE_UPDATETIME)); // t is just a time value .. it increments in 30m/s steps in this example - - // print out a small visual display - { - char s[80]; - - sprintf(s, "|.......................<1>......................<2>....................|"); - - s[(int)(listenerpos[0])+35] = 'L'; - printf("%s\r", s); - } - } - - FSOUND_Update(); - - Sleep(INTERFACE_UPDATETIME-1); // -1 for time taken for printf etc - - } while (key != 27); - - printf("\n"); - - // ========================================================================================== - // CLEANUP AND SHUTDOWN - // ========================================================================================== - - Close(samp1, samp2, samp3); - - return 0; -} diff --git a/#ThirdParty/fmodapi375win/samples/3d/watcom.bat b/#ThirdParty/fmodapi375win/samples/3d/watcom.bat deleted file mode 100644 index 18d21a6..0000000 --- a/#ThirdParty/fmodapi375win/samples/3d/watcom.bat +++ /dev/null @@ -1,2 +0,0 @@ -wpp386 main.cpp -wlink system nt name 3d.exe file main.obj library ..\..\api\lib\fmodwc.lib diff --git a/#ThirdParty/fmodapi375win/samples/cdda/Main.cpp b/#ThirdParty/fmodapi375win/samples/cdda/Main.cpp deleted file mode 100644 index d790406..0000000 --- a/#ThirdParty/fmodapi375win/samples/cdda/Main.cpp +++ /dev/null @@ -1,258 +0,0 @@ -//=============================================================================================== -// CDDA.EXE -// Copyright (c), Firelight Technologies Pty, Ltd, 1999-2004. -// -// Use FMOD stream API to do digital CD playback. Also demonstrates how to use FMOD to -// generate a CDDB query. -//=============================================================================================== - -#include -#include - -#if defined(WIN32) || defined(_WIN64) || defined(__WATCOMC__) - #include - #include -#else - #include "../../api/inc/wincompat.h" - #include -#endif - -#include "../../api/inc/fmod.h" -#include "../../api/inc/fmod_errors.h" // optional - - -int cddb_sum(int n) -{ - int ret = 0; - - while (n > 0) - { - ret += (n % 10); - n /= 10; - } - - return ret; -} - -unsigned long cddb_discid(FSOUND_TOC_TAG *toc) -{ - int i, t, n = 0; - - for (i = 0; i < toc->numtracks; i++) - { - n += cddb_sum((toc->min[i] * 60) + toc->sec[i]); - } - - t = ((toc->min[toc->numtracks] * 60) + toc->sec[toc->numtracks]) - ((toc->min[0] * 60) + toc->sec[0]); - - return ((n % 0xff) << 24 | t << 8 | toc->numtracks); -} - -void dump_cddb_query(FSOUND_TOC_TAG *toc) -{ - int i; - - printf("cddb query %08x %d", cddb_discid(toc), toc->numtracks); - - for (i = 0; i < toc->numtracks; i++) - { - printf(" %d", (toc->min[i] * (60 * 75)) + (toc->sec[i] * 75) + toc->frame[i]); - } - - printf(" %d\n", (toc->min[toc->numtracks] * 60) + toc->sec[toc->numtracks]); -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -int main(int argc, char *argv[]) -{ - unsigned char key; - FSOUND_STREAM *stream; - int channel = -1; - int track = 0; - char *cd_error; - char drive_letter[6] = "d:*?j"; - - if (argc < 2) - { - printf("Usage: cdda \n"); - printf("Example: cdda d\n"); - return 1; - } - - drive_letter[0] = argv[1][0]; - if (!((drive_letter[0] >= 'a' && drive_letter[0] <= 'z') || (drive_letter[0] >= 'A' && drive_letter[0] <= 'Z'))) - { - printf("ERROR: Invalid drive letter\n"); - return 1; - } - - if (FSOUND_GetVersion() < FMOD_VERSION) - { - printf("ERROR: You are using the wrong DLL version! You should be using FMOD %.02f\n", FMOD_VERSION); - return 1; - } - - if (!FSOUND_Init(44100, 32, 0)) - { - printf("ERROR: %s\n", FMOD_ErrorString(FSOUND_GetError())); - FSOUND_Close(); - return 1; - } - - FSOUND_Stream_SetBufferSize(2000); - - stream = FSOUND_Stream_Open(drive_letter, FSOUND_NORMAL | FSOUND_NONBLOCKING, 0, 0); - if (!stream) - { - printf("ERROR: %s\n", FMOD_ErrorString(FSOUND_GetError())); - FSOUND_Close(); - return 1; - } - - FSOUND_Stream_SetSubStream(stream, 0); - - printf("=========================================================================\n"); - printf("Press f Skip forward 2 seconds\n"); - printf(" b Skip back 2 seconds\n"); - printf(" n Next track\n"); - printf(" SPACE Pause/Unpause\n"); - printf(" ESC Quit\n"); - printf("=========================================================================\n"); - - key = 0; - do - { - static int last_openstate = -1; - - if (stream && (channel < 0)) - { - int this_openstate = FSOUND_Stream_GetOpenState(stream); - - if (this_openstate == -3) - { - if (FSOUND_Stream_FindTagField(stream, 0, "CD_ERROR", (void **)&cd_error, 0)) - { - printf("%s\n", cd_error); - } - else - { - printf("ERROR: Couldn't open CDDA stream\n"); - } - FSOUND_Stream_Close(stream); - FSOUND_Close(); - return 1; - } - - if ((last_openstate != 0) && (this_openstate == 0)) - { - static int firsttime = TRUE; - - if (firsttime) - { - char *cd_device_info; - FSOUND_TOC_TAG *toc; - - if (FSOUND_Stream_FindTagField(stream, 0, "CD_TOC", (void **)&toc, 0)) - { - dump_cddb_query(toc); - } - - if (!FSOUND_Stream_GetTagField(stream, 0, 0, 0, (void **)&cd_device_info, 0)) - { - printf("ERROR: Couldn't get CD_DEVICE_INFO tag\n"); - FSOUND_Stream_Close(stream); - FSOUND_Close(); - return 1; - } - - printf(cd_device_info); - printf("\n=========================================================================\n"); - firsttime = FALSE; - - if (FSOUND_Stream_FindTagField(stream, 0, "CD_ERROR", (void **)&cd_error, 0)) - { - printf("%s\n", cd_error); - FSOUND_Stream_Close(stream); - FSOUND_Close(); - return 1; - } - } - - channel = FSOUND_Stream_PlayEx(FSOUND_FREE, stream, 0, TRUE); - FSOUND_SetPaused(channel, FALSE); - } - - last_openstate = this_openstate; - } - - if (kbhit()) - { - key = getch(); - - if (channel != -1) - { - if (key == ' ') - { - FSOUND_SetPaused(channel, !FSOUND_GetPaused(channel)); - } - - if (key == 'f') - { - FSOUND_Stream_SetTime(stream, FSOUND_Stream_GetTime(stream) + 2000); - } - - if (key == 'b') - { - FSOUND_Stream_SetTime(stream, FSOUND_Stream_GetTime(stream) - 2000); - } - - if (key == 'n') - { - track++; - if (track >= FSOUND_Stream_GetNumSubStreams(stream)) - { - track = 0; - } - FSOUND_Stream_SetSubStream(stream, track); - last_openstate = -2; - channel = -1; - } - } - } - - if (FSOUND_Stream_GetOpenState(stream) == 0) - { - printf("Track %d/%d %02d:%02d/%02d:%02d cpu %5.02f%% \r", track + 1, - FSOUND_Stream_GetNumSubStreams(stream), - FSOUND_Stream_GetTime(stream) / 1000 / 60, - FSOUND_Stream_GetTime(stream) / 1000 % 60, - FSOUND_Stream_GetLengthMs(stream) / 1000 / 60, - FSOUND_Stream_GetLengthMs(stream) / 1000 % 60, - FSOUND_GetCPUUsage()); - } - - FSOUND_Update(); - Sleep(10); - - } while (key != 27); - - printf("\n"); - - FSOUND_Stream_Close(stream); - FSOUND_Close(); - - return 0; -} diff --git a/#ThirdParty/fmodapi375win/samples/cdda/cdda.dsp b/#ThirdParty/fmodapi375win/samples/cdda/cdda.dsp deleted file mode 100644 index b4e6f95..0000000 --- a/#ThirdParty/fmodapi375win/samples/cdda/cdda.dsp +++ /dev/null @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="cdda" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=cdda - 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 "cdda.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 "cdda.mak" CFG="cdda - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "cdda - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "cdda - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "cdda - 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 "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0xc09 /d "NDEBUG" -# ADD RSC /l 0xc09 /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:console /machine:I386 -# ADD LINK32 ../../api/lib/fmodvc.lib /nologo /subsystem:console /machine:I386 /out:"cdda.exe" - -!ELSEIF "$(CFG)" == "cdda - 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 "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0xc09 /d "_DEBUG" -# ADD RSC /l 0xc09 /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:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ../../api/lib/fmodvc.lib /nologo /subsystem:console /debug /machine:I386 /out:"cdda.exe" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "cdda - Win32 Release" -# Name "cdda - Win32 Debug" -# Begin Source File - -SOURCE=.\Main.cpp -# End Source File -# End Target -# End Project diff --git a/#ThirdParty/fmodapi375win/samples/cdda/cdda.exe b/#ThirdParty/fmodapi375win/samples/cdda/cdda.exe deleted file mode 100644 index 2b42687..0000000 Binary files a/#ThirdParty/fmodapi375win/samples/cdda/cdda.exe and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/samples/cdda/watcom.bat b/#ThirdParty/fmodapi375win/samples/cdda/watcom.bat deleted file mode 100644 index 5b64618..0000000 --- a/#ThirdParty/fmodapi375win/samples/cdda/watcom.bat +++ /dev/null @@ -1,2 +0,0 @@ -wpp386 main.cpp -wlink system nt name cdda.exe file main.obj library ..\..\api\lib\fmodwc.lib diff --git a/#ThirdParty/fmodapi375win/samples/cddarip/Main.cpp b/#ThirdParty/fmodapi375win/samples/cddarip/Main.cpp deleted file mode 100644 index 9fa337d..0000000 --- a/#ThirdParty/fmodapi375win/samples/cddarip/Main.cpp +++ /dev/null @@ -1,235 +0,0 @@ -//=============================================================================================== -// CDDARIP.EXE -// Copyright (c), Firelight Technologies Pty, Ltd, 1999-2004. -// -// Use CDDA streaming to rip a CD track to a wav file -//=============================================================================================== - -#include -#include - -#if defined(WIN32) || defined(_WIN64) || defined(__WATCOMC__) - #include - #include - #define __PACKED /*dummy*/ -#else - #include "../../api/inc/wincompat.h" - #include - #define __PACKED __attribute__((packed)) /* gcc packed */ -#endif - -#include "../../api/inc/fmod.h" -#include "../../api/inc/fmod_errors.h" // optional - - -#if defined(WIN32) || defined(_WIN64) || defined(__WATCOMC__) || defined(_WIN32) || defined(__WIN32__) -#pragma pack(1) -#endif - -/* - WAV Structures -*/ -typedef struct -{ - signed char id[4]; - int size; -} RiffChunk; - -struct -{ - RiffChunk chunk __PACKED; - unsigned short wFormatTag __PACKED; /* format type */ - unsigned short nChannels __PACKED; /* number of channels (i.e. mono, stereo...) */ - unsigned int nSamplesPerSec __PACKED; /* sample rate */ - unsigned int nAvgBytesPerSec __PACKED; /* for buffer estimation */ - unsigned short nBlockAlign __PACKED; /* block size of data */ - unsigned short wBitsPerSample __PACKED; /* number of bits per sample of mono data */ -} FmtChunk = { {{'f','m','t',' '}, sizeof(FmtChunk) - sizeof(RiffChunk) }, 1, 2, 44100, 44100 * 2 * 16 / 8, 1 * 2 * 16 / 8, 16 } __PACKED; - -struct -{ - RiffChunk chunk; -} DataChunk = { {{'d','a','t','a'}, 0 } }; - -struct -{ - RiffChunk chunk; - signed char rifftype[4]; -} WavHeader = { {{'R','I','F','F'}, 0 }, {'W','A','V','E'} }; - -#if defined(WIN32) || defined(_WIN64) || defined(__WATCOMC__) || defined(_WIN32) || defined(__WIN32__) -#pragma pack() -#endif - - -const char bar[56] = "=================================================="; -const char nobar[56] = " "; - -FILE *fp; -signed char stream_ended = FALSE; -unsigned int byteswritten = 0; - - -signed char F_CALLBACKAPI endcallback(FSOUND_STREAM *stream, void *buff, int len, void *param) -{ - stream_ended = TRUE; - return TRUE; -} - - -void * F_CALLBACKAPI DSP_RawWriteCallback(void *originalbuffer, void *newbuffer, int length, void *param) -{ - if (fp && !stream_ended) - { - fwrite(newbuffer, 1, length << 2, fp); - byteswritten += (length << 2); - } - - return newbuffer; -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -int main(int argc, char *argv[]) -{ - char s[256]; - unsigned char key; - char drive_letter[5] = "d:*j"; - int track_num, read_percent; - unsigned int start_time, elapsed_time; - FSOUND_STREAM *stream; - FSOUND_DSPUNIT *rawwrite_dsp; - - start_time = timeGetTime(); - - if (argc < 3) - { - printf("Usage: cddarip \n"); - printf("Example: cddarip d 2\n"); - return 1; - } - - drive_letter[0] = argv[1][0]; - if (!((drive_letter[0] >= 'a' && drive_letter[0] <= 'z') || (drive_letter[0] >= 'A' && drive_letter[0] <= 'Z'))) - { - printf("ERROR: Invalid drive letter\n"); - return 1; - } - - if (FSOUND_GetVersion() < FMOD_VERSION) - { - printf("Error : You are using the wrong DLL version! You should be using FMOD %.02f\n", FMOD_VERSION); - return 1; - } - - FSOUND_SetOutput(FSOUND_OUTPUT_NOSOUND_NONREALTIME); - - if (!FSOUND_Init(44100, 32, 0)) - { - printf("Error!\n"); - printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); - FSOUND_Close(); - return 1; - } - - fp = fopen("dump.wav", "wb"); - if (!fp) - { - printf("ERROR: Couldn't open dump.wav for writing\n"); - FSOUND_Close(); - return 1; - } - - /* - Before we've even written the headers for the wav out, seek to the offset the raw data will start from. - */ - fseek(fp, sizeof(WavHeader) + sizeof(FmtChunk) + sizeof(DataChunk), SEEK_SET); - - /* - Create a DSP callback which will capture the mixed data and write it to disk - */ - rawwrite_dsp = FSOUND_DSP_Create(&DSP_RawWriteCallback, FSOUND_DSP_DEFAULTPRIORITY_USER, 0); - FSOUND_DSP_SetActive(rawwrite_dsp, TRUE); - - FSOUND_Stream_SetBufferSize(2000); - - stream = FSOUND_Stream_Open(drive_letter, FSOUND_NORMAL, 0, 0); - if (!stream) - { - printf("ERROR: Couldn't create CDDA stream\n"); - FSOUND_DSP_SetActive(rawwrite_dsp, FALSE); - FSOUND_DSP_Free(rawwrite_dsp); - FSOUND_Close(); - return 1; - } - - track_num = atoi(argv[2]); - if ((track_num < 1) || ((track_num - 1) >= FSOUND_Stream_GetNumSubStreams(stream))) - { - printf("ERROR: Invalid track number\n"); - FSOUND_Stream_Close(stream); - FSOUND_DSP_SetActive(rawwrite_dsp, FALSE); - FSOUND_DSP_Free(rawwrite_dsp); - FSOUND_Close(); - return 1; - } - - FSOUND_Stream_SetEndCallback(stream, endcallback, 0); - FSOUND_Stream_SetSubStream(stream, track_num - 1); - FSOUND_Stream_Play(FSOUND_FREE, stream); - - printf("Ripping %s track %d (%02d:%02d)\n", drive_letter, track_num, FSOUND_Stream_GetLengthMs(stream) / 1000 / 60, FSOUND_Stream_GetLengthMs(stream) / 1000 % 60); - - key = 0; - do - { - if (kbhit()) - { - key = getch(); - } - - read_percent = (int)(((float)FSOUND_Stream_GetTime(stream) / (float)FSOUND_Stream_GetLengthMs(stream)) * 100.0f); - s[0] = 0; - strncat(s, bar, (read_percent >> 1) + (read_percent & 1)); - strncat(s, nobar, (100 - read_percent) >> 1); - printf("|%s| %d%% \r", s, read_percent); - - FSOUND_Update(); - - } while ((key != 27) && !stream_ended); - - FSOUND_Stream_Close(stream); - FSOUND_DSP_SetActive(rawwrite_dsp, FALSE); - FSOUND_DSP_Free(rawwrite_dsp); - - /* - Now finalize the wav file by seeking to the start and putting in the headers. - */ - WavHeader.chunk.size = sizeof(FmtChunk) + sizeof(RiffChunk) + byteswritten; - DataChunk.chunk.size = byteswritten; - - fseek(fp, 0, SEEK_SET); - fwrite(&WavHeader, sizeof(WavHeader), 1, fp); - fwrite(&FmtChunk, sizeof(FmtChunk), 1, fp); - fwrite(&DataChunk, sizeof(DataChunk), 1, fp); - fclose(fp); - - FSOUND_Close(); - - elapsed_time = timeGetTime() - start_time; - printf("\nElapsed time: %02d:%02d\n", elapsed_time / 1000 / 60, elapsed_time / 1000 % 60); - - return 0; -} diff --git a/#ThirdParty/fmodapi375win/samples/cddarip/cddarip.dsp b/#ThirdParty/fmodapi375win/samples/cddarip/cddarip.dsp deleted file mode 100644 index 6d9325d..0000000 --- a/#ThirdParty/fmodapi375win/samples/cddarip/cddarip.dsp +++ /dev/null @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="cddarip" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=cddarip - 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 "cddarip.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 "cddarip.mak" CFG="cddarip - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "cddarip - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "cddarip - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "cddarip - 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 "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0xc09 /d "NDEBUG" -# ADD RSC /l 0xc09 /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:console /machine:I386 -# ADD LINK32 ../../api/lib/fmodvc.lib winmm.lib /nologo /subsystem:console /machine:I386 /out:"cddarip.exe" - -!ELSEIF "$(CFG)" == "cddarip - 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 "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0xc09 /d "_DEBUG" -# ADD RSC /l 0xc09 /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:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ../../api/lib/fmodvc.lib winmm.lib /nologo /subsystem:console /debug /machine:I386 /out:"cddarip.exe" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "cddarip - Win32 Release" -# Name "cddarip - Win32 Debug" -# Begin Source File - -SOURCE=.\Main.cpp -# End Source File -# End Target -# End Project diff --git a/#ThirdParty/fmodapi375win/samples/cddarip/cddarip.exe b/#ThirdParty/fmodapi375win/samples/cddarip/cddarip.exe deleted file mode 100644 index 54c9065..0000000 Binary files a/#ThirdParty/fmodapi375win/samples/cddarip/cddarip.exe and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/samples/cddarip/watcom.bat b/#ThirdParty/fmodapi375win/samples/cddarip/watcom.bat deleted file mode 100644 index 2993608..0000000 --- a/#ThirdParty/fmodapi375win/samples/cddarip/watcom.bat +++ /dev/null @@ -1,2 +0,0 @@ -wpp386 main.cpp -wlink system nt name cddarip.exe file main.obj library ..\..\api\lib\fmodwc.lib diff --git a/#ThirdParty/fmodapi375win/samples/dsp/Main.cpp b/#ThirdParty/fmodapi375win/samples/dsp/Main.cpp deleted file mode 100644 index 6aa59a4..0000000 --- a/#ThirdParty/fmodapi375win/samples/dsp/Main.cpp +++ /dev/null @@ -1,532 +0,0 @@ -/*=========================================================================================== - DSP.EXE - Copyright (c), Firelight Technologies Pty, Ltd, 1999-2004. - - This example demonstrates advanced DSP usage. - You can now attach sounds to dsp units. The dsp units to be attached to must have a NULL - callback. It is simply a holder for sounds to attach to, and have a specific position in - the DSP chain.. see the diagram below for a visual representation of the DSP chain. - It also demonstrates the use of hardware DirectX 8 FX. -===========================================================================================*/ - - -/* - Priority : 0 100 320-332 400 1000 - Name : [CLEAR]-->[samp1-WET]-->[REVERB]-->[samp1-DRY]-->[CLIPCOPY]-->[SOUNDCARD] - - Note the above priority values correspond to the values in FMOD.H - - FSOUND_DSP_DEFAULTPRIORITY_CLEARUNIT 0 - FSOUND_DSP_DEFAULTPRIORITY_SFXUNIT 100 - FSOUND_DSP_DEFAULTPRIORITY_MUSICUNIT 200 - FSOUND_DSP_DEFAULTPRIORITY_USER 300 - FSOUND_DSP_DEFAULTPRIORITY_FFTUNIT 900 - FSOUND_DSP_DEFAULTPRIORITY_CLIPANDCOPYUNIT 1000 - - Notice how 'SFX' unit is wet (has reverb). This is because it is the default destination - For sound effects if NULL is passed to PlaySoundEx or PlaySound is used. - Also the Reverb DSP has itself positioned AFTER the 'SFX' unit so then we will hear reverb. - Now if a sound is attached to the 'Dry' DSP unit located at priority 400, then it will not - be affected by reverb! -*/ - - -/* - INCLUDES -*/ - -#include -#if defined(WIN32) || defined(_WIN64) || defined(__WATCOMC__) - #include - #include -#elif defined(__linux__) - #include "../../api/inc/wincompat.h" -#endif -#include -#include - -#include "../../api/inc/fmod.h" -#include "../../api/inc/fmod_errors.h" /* optional */ - -/* - GLOBALS AND DEFINIITIONS -*/ - -/* - Here's our simple reverb again -*/ - -#define REVERB_NUMTAPS 7 -typedef struct -{ - FSOUND_DSPUNIT *Unit; - char *historybuff; /* storage space for tap history */ - char *workarea; /* a place to hold 1 buffer worth of data (for preverb) */ - int delayms; /* delay of p/reverb tab in milliseconds */ - int volume; /* volume of p/reverb tab */ - int pan; /* pan of p/reverb tab */ - int historyoffset; /* running offset into history buffer */ - int historylen; /* size of history buffer in SAMPLES */ -} REVERBTAP; - -/* - Reverb stuff -*/ -REVERBTAP DSP_ReverbTap[REVERB_NUMTAPS]; - -/* - Dry sfx unit -*/ -FSOUND_DSPUNIT *DrySFXUnit = NULL; - - -/* -[ - [DESCRIPTION] - Callback to mix in one reverb tap. It copies the buffer into its own history buffer also. - - [PARAMETERS] - 'originalbuffer' Pointer to the original mixbuffer, not any buffers passed down - through the dsp chain. They are in newbuffer. - 'newbuffer' Pointer to buffer passed from previous DSP unit. - 'length' Length in SAMPLES of buffer being passed. - 'userdata' User parameter. In this case it is a pointer to DSP_LowPassBuffer. - - [RETURN_VALUE] - a pointer to the buffer that was passed in, with a tap mixed into it. - - [REMARKS] -] -*/ -void * F_CALLBACKAPI DSP_ReverbCallback(void *originalbuffer, void *newbuffer, int length, void *userdata) -{ - int mixertype = FSOUND_GetMixer(); - int count; - int bytesperoutputsample; - REVERBTAP *tap = (REVERBTAP *)userdata; - union sample - { - void *vptr; - signed int *dptr; - signed short *wptr; - float *fptr; - }; - - if (mixertype == FSOUND_MIXER_MMXP5 || mixertype == FSOUND_MIXER_MMXP6 || mixertype == FSOUND_MIXER_QUALITY_MMXP5 || mixertype == FSOUND_MIXER_QUALITY_MMXP6) - { - bytesperoutputsample = 4; // 16bit stereo - } - else - { - bytesperoutputsample = 8; // 32bit stereo - } - - // reverb history buffer is a ringbuffer. If the length makes the copy wrap, then split the copy - // into end part, and start part.. - if (tap->historyoffset + length > tap->historylen) - { - int taillen = tap->historylen - tap->historyoffset; - int startlen = length - taillen; - - // mix a scaled version of history buffer into output - FSOUND_DSP_MixBuffers(newbuffer, tap->historybuff + (tap->historyoffset << 2), taillen, 44100, tap->volume, tap->pan, FSOUND_STEREO | FSOUND_16BITS); - FSOUND_DSP_MixBuffers((char *)newbuffer+(taillen * bytesperoutputsample), tap->historybuff, startlen, 44100, tap->volume, tap->pan, FSOUND_STEREO | FSOUND_16BITS); - - // now copy input into reverb/history buffer - { - signed short *dest; - union sample src; - - dest = (signed short *)(tap->historybuff + (tap->historyoffset << 2)); - src.vptr = newbuffer; - - for (count=0; count < taillen * 2; count++) - { - int val; - - if (mixertype == FSOUND_MIXER_QUALITY_FPU) - { - val = (int)src.fptr[count]; - } - else if (mixertype == FSOUND_MIXER_MMXP5 || mixertype == FSOUND_MIXER_MMXP6 || mixertype == FSOUND_MIXER_QUALITY_MMXP5 || mixertype == FSOUND_MIXER_QUALITY_MMXP6) - { - val = (int)src.wptr[count]; - } - else - { - val = (int)src.dptr[count]; - } - - val = (val > 32767 ? 32767 : val < -32768 ? -32768 : val); - dest[count] = val; - } - } - { - signed short *dest; - union sample src; - - dest = (signed short *)tap->historybuff; // always 16bit - src.vptr = (char *)newbuffer + (taillen * bytesperoutputsample); - - for (count=0; count < startlen * 2; count++) - { - int val; - - if (mixertype == FSOUND_MIXER_QUALITY_FPU) - { - val = (int)src.fptr[count]; - } - else if (mixertype == FSOUND_MIXER_MMXP5 || mixertype == FSOUND_MIXER_MMXP6 || mixertype == FSOUND_MIXER_QUALITY_MMXP5 || mixertype == FSOUND_MIXER_QUALITY_MMXP6) - { - val = (int)src.wptr[count]; - } - else - { - val = (int)src.dptr[count]; - } - - val = (val > 32767 ? 32767 : val < -32768 ? -32768 : val); - dest[count] = val; - } - } - - } - // no wrapping reverb buffer, just write dest - else - { - // mix a scaled version of history buffer into output - FSOUND_DSP_MixBuffers(newbuffer, tap->historybuff + (tap->historyoffset << 2), length, 44100, tap->volume, tap->pan, FSOUND_STEREO | FSOUND_16BITS); - - // now copy input into reverb/history buffer - { - signed short *dest; - union sample src = { newbuffer }; - - dest = (signed short *)(tap->historybuff + (tap->historyoffset << 2)); - - for (count=0; count < length * 2; count++) - { - int val; - - if (mixertype == FSOUND_MIXER_QUALITY_FPU) - { - val = (int)src.fptr[count]; - } - else if (mixertype == FSOUND_MIXER_MMXP5 || mixertype == FSOUND_MIXER_MMXP6 || mixertype == FSOUND_MIXER_QUALITY_MMXP5 || mixertype == FSOUND_MIXER_QUALITY_MMXP6) - { - val = (int)src.wptr[count]; - } - else - { - val = (int)src.dptr[count]; - } - val = (val > 32767 ? 32767 : val < -32768 ? -32768 : val); - dest[count] = val; - } - } - } - - - tap->historyoffset += length; - if (tap->historyoffset >= tap->historylen) - { - tap->historyoffset -= tap->historylen; - } - - // reverb history has been mixed into new buffer, so return it. - return newbuffer; -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -void SetupReverb() -{ - /* - REVERB SETUP - */ - /* something to fiddle with. */ - int delay[REVERB_NUMTAPS] = { 131, 149, 173, 211, 281, 401, 457}; /* prime numbers make it sound cool! */ - int volume[REVERB_NUMTAPS] = { 120, 100, 95, 90, 80, 60, 50}; - int pan[REVERB_NUMTAPS] = { 100, 128, 128, 152, 128, 100, 152}; - int count; - - for (count=0; count< REVERB_NUMTAPS; count++) - { - DSP_ReverbTap[count].delayms = delay[count]; - DSP_ReverbTap[count].volume = volume[count]; - DSP_ReverbTap[count].pan = pan[count]; - DSP_ReverbTap[count].historyoffset = 0; - DSP_ReverbTap[count].historylen = (DSP_ReverbTap[count].delayms * 44100 / 1000); - if (DSP_ReverbTap[count].historylen < FSOUND_DSP_GetBufferLength()) - { - DSP_ReverbTap[count].historylen = FSOUND_DSP_GetBufferLength(); /* just in case our calc is not the same. */ - } - - DSP_ReverbTap[count].historybuff = (char *)calloc(DSP_ReverbTap[count].historylen, 4); /* * 4 is for 16bit stereo (mmx only) */ - DSP_ReverbTap[count].workarea = NULL; - DSP_ReverbTap[count].Unit = FSOUND_DSP_Create(&DSP_ReverbCallback, FSOUND_DSP_DEFAULTPRIORITY_USER+20+(count*2), &DSP_ReverbTap[count]); - - FSOUND_DSP_SetActive(DSP_ReverbTap[count].Unit, TRUE); - } -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -void CloseReverb() -{ - int count; - - for (count=0; count -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=dsp - 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 "dsp.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 "dsp.mak" CFG="dsp - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "dsp - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "dsp - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "dsp - 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 "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0xc09 /d "NDEBUG" -# ADD RSC /l 0xc09 /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 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:console /machine:I386 -# ADD LINK32 ../../api/lib/fmodvc.lib /nologo /subsystem:console /machine:I386 /out:"dsp.exe" - -!ELSEIF "$(CFG)" == "dsp - 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 "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0xc09 /d "_DEBUG" -# ADD RSC /l 0xc09 /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 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:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ../../api/lib/fmodvc.lib /nologo /subsystem:console /debug /machine:I386 /out:"dsp.exe" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "dsp - Win32 Release" -# Name "dsp - Win32 Debug" -# Begin Source File - -SOURCE=.\Main.cpp -# End Source File -# End Target -# End Project diff --git a/#ThirdParty/fmodapi375win/samples/dsp/dsp.exe b/#ThirdParty/fmodapi375win/samples/dsp/dsp.exe deleted file mode 100644 index bb7a0f2..0000000 Binary files a/#ThirdParty/fmodapi375win/samples/dsp/dsp.exe and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/samples/dsp/watcom.bat b/#ThirdParty/fmodapi375win/samples/dsp/watcom.bat deleted file mode 100644 index 4d5b70a..0000000 --- a/#ThirdParty/fmodapi375win/samples/dsp/watcom.bat +++ /dev/null @@ -1,2 +0,0 @@ -wpp386 main.cpp -wlink system nt name dsp.exe file main.obj library ..\..\api\lib\fmodwc.lib diff --git a/#ThirdParty/fmodapi375win/samples/fmod/Main.c b/#ThirdParty/fmodapi375win/samples/fmod/Main.c deleted file mode 100644 index c35537e..0000000 --- a/#ThirdParty/fmodapi375win/samples/fmod/Main.c +++ /dev/null @@ -1,4784 +0,0 @@ -/* - FMOD.EXE - Copyright (c), Firelight Technologies Pty, Ltd, 1999-2004. - - This example really demonstrates the FMOD music system at work, and is a standalone - mod/wav/mp3 player! - It displays a lot of information and uses the DSP engine as well to provide DSP effects under - MMX only. -*/ - -#include -#include -#include -#include -#include -#include - -#include "../../api/inc/fmod.h" -#include "../../api/inc/fmod_errors.h" /* optional */ - -#include "resource.h" -#include "sdriver.h" -#include "lowpass.h" -#include "reverb.h" - - -/* - DEFINITIONS -*/ -#define NAME "FSOUND TESTBED" -#define TITLE "FMOD" -#define NUMCHANNELS 128 -#define MAXSONGS 512 -#define FSOUND_BUFFERSIZE 200 /* millisecond value for FMOD buffersize. */ -#define MRU_MAX 16 -#define STREAM_PLAYING 255 - -const float WINDOW_WIDTH = 675.0f; -const float WINDOW_HEIGHT = 324.0f; -const int TEXT_CHANNELSPLAYING_X = 636; -const int TEXT_CHANNELSPLAYING_Y = 237; -const int TEXT_CPUUSAGE_X = 622; -const int TEXT_CPUUSAGE_Y = 273; - -enum -{ - GRAPHICWINDOW_MODINFO = 0, - GRAPHICWINDOW_EQUALISER, - GRAPHICWINDOW_WAVE, - GRAPHICWINDOW_MAX -}; - -enum -{ - SONGTYPE_NONE = 0, - SONGTYPE_MOD, - SONGTYPE_STREAM, - SONGTYPE_NETSTREAM, - SONGTYPE_CD, -}; - -typedef struct -{ - FMUSIC_MODULE *mod; - FSOUND_STREAM *stream; - int channel; - char *url; - int last_status; - int last_netstatus; - char *server_status; - char *title; - char *artist; - char *protocol; - char *format; - char *streamname; - int metadata; - char *listname; - int cdtrack; - unsigned int cdtrack_length; -} SONGTYPE; - -typedef struct -{ - int count; - void **name; - void **displayname; -} Playlist; - -/* - GLOBALS -*/ - -HWND mainhwnd; -HWND streaminfo_hwnd; -HWND netstreaminfo_hwnd; -HWND modinfo_hwnd; -HWND cdinfo_hwnd; -HWND songlist_hwnd; - -#ifdef _WIN64 -UINT_PTR timerid=0; -#else -UINT timerid=0; -#endif - -SONGTYPE song[MAXSONGS + 1]; - -int DraggingCDSlider = FALSE; -int DSP_Ready = FALSE; -int outputfreq = 44100; /* default output freq */ -int playlistsong = 0; -char cddevice = 0; /* 0 is the default device, could be 'D' or 'E' etc */ -float scalex = 1.0f, scaley = 1.0f; - -/* - Lowpass stuff -*/ -FSOUND_DSPUNIT *LowPassUnit; -signed char *LowPassBuffer; -float LowPassCutoffFrequency = 5000.0f; -float LowPassResonance = 1.0f; - -/* - Echo stuff -*/ -#define MAXECHOLEN (500 * outputfreq / 1000) - -FSOUND_DSPUNIT *EchoUnit = NULL; -signed char *EchoBuffer = NULL; -int EchoOffset=0, EchoLen=0; - -/* - Graphical window stuff for Spectrum and oscilliscope. -*/ - -#define GRAPHICWINDOW_WIDTH 256 -#define GRAPHICWINDOW_HEIGHT 116 - -int GraphicWindowCurrent = GRAPHICWINDOW_MODINFO; -BITMAPINFO GraphicWindowBitmap; -RGBQUAD GraphicWindowBitmapData[GRAPHICWINDOW_WIDTH * GRAPHICWINDOW_HEIGHT]; -int graphic_window_x; -int graphic_window_y; - - -/* - Oscilliscope stuff -*/ - -FSOUND_DSPUNIT *OscUnit = NULL; -static signed short *OscBuffer = NULL; -static int OscBlock = 0; - - -/* - SETTINGS -*/ - -int setting_xpos = 0; -int setting_ypos = 0; -int setting_output = 0; -int setting_driver = 0; -int setting_mixer = 0; -int setting_outputrate = 44100; -int setting_buffersize = 64000; -int setting_prebuffer_percent = 95; -int setting_rebuffer_percent = 95; -char setting_http_proxy[2048]; -int setting_cdda = 1; -int setting_jitter = 1; -int setting_forceaspi = 0; -char setting_cdletter[4] = "C:"; - -char url_to_load[4096]; -HINSTANCE g_hinst; -char *mru[MRU_MAX]; -signed char play_button_play = TRUE; - -FSOUND_STREAM *cdda_stream = 0; -int cdda_channel = -1; -int cdda_track = 0; -int cdda_stream_state = -2; - -/* - PROTOTYPES -*/ - -void CloseDown(); -BOOL PlaySong(int index); -BOOL AddToMRU(char *url); -BOOL UpdateModInfo(int songid, BOOL forceupdate); -BOOL UpdateStreamInfo(int songid, BOOL forceupdate); -BOOL UpdateNetStreamInfo(int songid, BOOL forceupdate, BOOL forcequiet); -BOOL UpdateCDInfo(int songid, BOOL forceupdate); -void SelectInfoWindow(); -char *GetCommentValue(FSOUND_STREAM *stream, char *tag); -signed char FreePlaylist(Playlist *playlist); -void DeleteSong(int songid); -void DeleteAllCDTracks(); -signed char StopCDTrack(); - -WNDPROC oldprogressproc; -WNDPROC oldcdtimeproc; - -#ifdef _WIN64 -INT_PTR CALLBACK FMOD_LoadURLDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); -#else -BOOL CALLBACK FMOD_LoadURLDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); -#endif - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -signed char F_CALLBACKAPI MetadataCallback(char *name, char *value, void *userdata) -{ - char *tmp; - int index = (int)userdata; - - if (!strcmp("ARTIST", name)) - { - if (song[index].artist) - { - free(song[index].artist); - } - tmp = strdup(value); - song[index].artist = tmp; - song[index].metadata++; - } - else if (!strcmp("TITLE", name)) - { - if (song[index].title) - { - free(song[index].title); - } - tmp = strdup(value); - song[index].title = tmp; - song[index].metadata++; - } - - return TRUE; -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -char *stristr(char *string2, char *string1) -{ - char *s1 = strdup(string1); - char *s2 = strdup(string2); - char *ret = 0; - int i, j; - int len1 = (int)strlen(string1); - int len2 = (int)strlen(string2); - - for (i=0;s1[i];i++) s1[i] = tolower(s1[i]); - for (i=0;s2[i];i++) s2[i] = tolower(s2[i]); - - for (j=0;j < (len2 - len1);j++) - { - char *a = s1; - char *b = &s2[j]; - - for (i=0;(i < len1) && *a && *b;a++, b++, i++) - { - if (*a != *b) - { - break; - } - } - - if (i == len1) - { - ret = &string2[j]; - break; - } - } - - free(s1); - free(s2); - return ret; -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -void SetFirstCDLetter() -{ - int count; - char str[256]; - - for (count=2;count < 26;count++) - { - sprintf(str, "%c:\\", (char)('A' + count)); - if (GetDriveType(str) == DRIVE_CDROM) - { - strncpy(setting_cdletter, str, 2); - cddevice = str[0]; - break; - } - } -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -void LoadSettings() -{ - HKEY key; - DWORD result,size=4; - int i; - - result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\FMOD\\Settings", 0, KEY_QUERY_VALUE , &key); - - setting_output = FSOUND_OUTPUT_DSOUND; - setting_driver = 0; - setting_mixer = FSOUND_MIXER_QUALITY_AUTODETECT; - setting_outputrate = 44100; - - SetFirstCDLetter(); - - if (result != ERROR_SUCCESS) - { - return; - } - - RegQueryValueEx(key, "xpos", 0, NULL, (LPBYTE)&setting_xpos, &size); - RegQueryValueEx(key, "ypos", 0, NULL, (LPBYTE)&setting_ypos, &size); - - RegQueryValueEx(key, "output", 0, NULL, (LPBYTE)&setting_output, &size); - RegQueryValueEx(key, "driver", 0, NULL, (LPBYTE)&setting_driver, &size); - RegQueryValueEx(key, "mixer", 0, NULL, (LPBYTE)&setting_mixer, &size); - RegQueryValueEx(key, "outputrate", 0, NULL, (LPBYTE)&setting_outputrate, &size); - - /* - It is not possible to select nosound from dialog box, so it must be an uninitialized - registry key.. anyway, however it was 0, set it to directsound if it is. - */ - if (!setting_output) - { - setting_output = FSOUND_OUTPUT_DSOUND; - } - if (setting_outputrate < 4000) - { - setting_outputrate = 44100; - } - - for (i=0;i < MRU_MAX;i++) - { - char s[16]; - char *tmp; - - size = 0; - - if (mru[i]) - { - free(mru[i]); - mru[i] = 0; - } - - sprintf(s, "MRU%d", i); - - if (RegQueryValueEx(key, s, 0, NULL, (LPBYTE)s, &size) == ERROR_MORE_DATA) - { - tmp = (char *)malloc(size); - if (!tmp) - { - break; - } - - if (RegQueryValueEx(key, s, 0, NULL, tmp, &size) == ERROR_SUCCESS) - { - mru[i] = tmp; - } - } - } - - RegQueryValueEx(key, "buffersize", 0, NULL, (LPBYTE)&setting_buffersize, &size); - RegQueryValueEx(key, "prebuffer_percent", 0, NULL, (LPBYTE)&setting_prebuffer_percent, &size); - RegQueryValueEx(key, "rebuffer_percent", 0, NULL, (LPBYTE)&setting_rebuffer_percent, &size); - FSOUND_Stream_Net_SetBufferProperties(setting_buffersize, setting_prebuffer_percent, setting_rebuffer_percent); - - size = 2048; - setting_http_proxy[0] = 0; - RegQueryValueEx(key, "http_proxy", 0, NULL, setting_http_proxy, &size); - FSOUND_Stream_Net_SetProxy(setting_http_proxy); - - RegQueryValueEx(key, "cdda", 0, NULL, (LPBYTE)&setting_cdda, &size); - RegQueryValueEx(key, "jitter", 0, NULL, (LPBYTE)&setting_jitter, &size); - RegQueryValueEx(key, "forceaspi", 0, NULL, (LPBYTE)&setting_forceaspi, &size); - - size = 3; - setting_cdletter[0] = 0; - RegQueryValueEx(key, "cdletter", 0, NULL, setting_cdletter, &size); - - /* - If it doesn't have a valid cd drive letter in the registry then set the first cd drive letter - */ - if (GetDriveType(setting_cdletter) != DRIVE_CDROM) - { - SetFirstCDLetter(); - } - - RegCloseKey(key); -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -void SaveSettings() -{ - HKEY key; - DWORD result; - int i; - - setting_output = FSOUND_GetOutput(); - setting_driver = FSOUND_GetDriver(); - setting_mixer = FSOUND_GetMixer(); - setting_outputrate = FSOUND_GetOutputRate(); - - RegCreateKeyEx(HKEY_LOCAL_MACHINE, "Software\\FMOD\\Settings", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &key, &result); - RegSetValueEx(key, "xpos", 0, REG_DWORD, (LPBYTE)&setting_xpos, 4); - RegSetValueEx(key, "ypos", 0, REG_DWORD, (LPBYTE)&setting_ypos, 4); - - RegSetValueEx(key, "output", 0, REG_DWORD, (LPBYTE)&setting_output, 4); - RegSetValueEx(key, "driver", 0, REG_DWORD, (LPBYTE)&setting_driver, 4); - RegSetValueEx(key, "mixer", 0, REG_DWORD, (LPBYTE)&setting_mixer, 4); - RegSetValueEx(key, "outputrate", 0, REG_DWORD, (LPBYTE)&setting_outputrate, 4); - - for (i=0;i < MRU_MAX;i++) - { - char s[16]; - - sprintf(s, "MRU%d", i); - - if (mru[i]) - { - RegSetValueEx(key, s, 0, REG_SZ, mru[i], (int)strlen(mru[i]) + 1); - } - else - { - RegDeleteValue(key, s); - } - } - - FSOUND_Stream_Net_GetBufferProperties(&setting_buffersize, &setting_prebuffer_percent, &setting_rebuffer_percent); - RegSetValueEx(key, "buffersize", 0, REG_DWORD, (LPBYTE)&setting_buffersize, 4); - RegSetValueEx(key, "prebuffer_percent", 0, REG_DWORD, (LPBYTE)&setting_prebuffer_percent, 4); - RegSetValueEx(key, "rebuffer_percent", 0, REG_DWORD, (LPBYTE)&setting_rebuffer_percent, 4); - - if (setting_http_proxy[0]) - { - RegSetValueEx(key, "http_proxy", 0, REG_SZ, setting_http_proxy, (int)strlen(setting_http_proxy) + 1); - } - else - { - RegDeleteValue(key, "http_proxy"); - } - - RegSetValueEx(key, "cdda", 0, REG_DWORD, (LPBYTE)&setting_cdda, 4); - RegSetValueEx(key, "jitter", 0, REG_DWORD, (LPBYTE)&setting_jitter, 4); - RegSetValueEx(key, "forceaspi", 0, REG_DWORD, (LPBYTE)&setting_forceaspi, 4); - RegSetValueEx(key, "cdletter", 0, REG_SZ, setting_cdletter, (int)strlen(setting_cdletter) + 1); - - RegCloseKey(key); -} - - - - - -/* -[ - [DESCRIPTION] - A slow and quite unscientific 4th order low pass filter, which leaves the source mix - buffer in tact, and returns a pointer to the new 'dirty' buffer. - - [PARAMETERS] - 'originalbuffer' Pointer to the original mixbuffer, not any buffers passed down - through the dsp chain. They are in newbuffer. - 'newbuffer' Pointer to buffer passed from previous DSP unit. - 'length' Length in SAMPLES of buffer being passed. - 'param' User parameter. In this case it is a pointer to LowPassBuffer. - - [RETURN_VALUE] - A pointer to the new modified lowpass buffer, leaving the original buffer untouched. - - [REMARKS] - Leaving the original source data untouched means we still have clean source data to - work with using other chained filters. -] -*/ -void * F_CALLBACKAPI LowPassCallback(void *originalbuffer, void *newbuffer, int length, void *userdata) -{ - int count; - int mixertype = FSOUND_GetMixer(); - union sample - { - void *vptr; - signed int *dptr; - signed short *wptr; - float *fptr; - }; - union sample srcleft, srcright, destleft, destright; - - /* - Must be 16bit stereo integer buffer.. sorry blendmode (32bit) and fpu (32bit float) dont support this. - */ - srcleft.vptr = newbuffer; - destleft.vptr = userdata; - if (mixertype == FSOUND_MIXER_QUALITY_FPU) - { - srcright.fptr = (float *)newbuffer + 1; - destright.fptr = (float *)userdata + 1; - } - else if (mixertype == FSOUND_MIXER_MMXP5 || mixertype == FSOUND_MIXER_MMXP6 || mixertype == FSOUND_MIXER_QUALITY_MMXP5 || mixertype == FSOUND_MIXER_QUALITY_MMXP6) - { - srcright.wptr = (signed short *)newbuffer + 1; - destright.wptr = (signed short *)userdata + 1; - } - else - { - srcright.dptr = (signed int *)newbuffer + 1; - destright.dptr = (signed int *)userdata + 1; - } - - length <<= 1; /* *2 for stereo (number of 16 bit samples) */ - - for (count=0; count 32767) l = 32767; - if (r < -32768) r = -32768; - else if (r > 32767) r = 32767; - - if (mixertype == FSOUND_MIXER_QUALITY_FPU) - { - destleft.fptr[count] = (float)l; - destright.fptr[count] = (float)r; - } - else if (mixertype == FSOUND_MIXER_MMXP5 || mixertype == FSOUND_MIXER_MMXP6 || mixertype == FSOUND_MIXER_QUALITY_MMXP5 || mixertype == FSOUND_MIXER_QUALITY_MMXP6) - { - destleft.wptr[count] = (signed short)l; - destright.wptr[count] = (signed short)r; - } - else - { - destleft.dptr[count] = l; - destright.dptr[count] = r; - } - } - - /* - Data has been copied into new buffer, old buffer is still in tact (clean) for another filter - */ - return userdata; -} - - -/* -[ - [DESCRIPTION] - Simple echo callback. It copies the data into its own history buffer, then copies the data back in. - - [PARAMETERS] - 'originalbuffer' Pointer to the original mixbuffer, not any buffers passed down - through the dsp chain. They are in newbuffer. - 'newbuffer' Pointer to buffer passed from previous DSP unit. - 'length' Length in SAMPLES of buffer being passed. - 'param' User parameter. In this case it is a pointer to EchoBuffer. - - [RETURN_VALUE] - A pointer to the new modified buffer. The buffer passed in has been modified, and - EchoBuffer has just been filled with a copy of the original information to keep - an echo history for later. - - [REMARKS] - All the <<2 stuff is to convert samples to bytes, as all offsets and lengths are based - on samples not bytes. For mmx the output size is 4 bytes per sample. - - [SEE_ALSO] - LowPassCallback -] -*/ -void * F_CALLBACKAPI EchoCallback(void *originalbuffer, void *newbuffer, int length, void *userdata) -{ - int mixertype = FSOUND_GetMixer(); - char *echobuff = userdata; - int bytesperoutputsample; - int count; - union sample - { - void *vptr; - signed int *dptr; - signed short *wptr; - float *fptr; - }; - - - if (mixertype == FSOUND_MIXER_MMXP5 || mixertype == FSOUND_MIXER_MMXP6 || mixertype == FSOUND_MIXER_QUALITY_MMXP5 || mixertype == FSOUND_MIXER_QUALITY_MMXP6) - { - bytesperoutputsample = 4; // 16bit stereo - } - else - { - bytesperoutputsample = 8; // 32bit stereo - } - - /* - Echobuff is a ringbuffer that we copy the mixbuffer to. - If the length of the write exceeds the end of the echo buffer, - then do the mix in 2 parts, the end part, and the start part. - */ - if (EchoOffset + length > EchoLen) - { - int taillen = EchoLen - EchoOffset; - int startlen = length - taillen; - - /* - Feedback history from echo buffer into mixbuffer - */ - FSOUND_DSP_MixBuffers(newbuffer, echobuff+(EchoOffset << 2), taillen, outputfreq, 128, FSOUND_STEREOPAN, FSOUND_STEREO | FSOUND_16BITS); - FSOUND_DSP_MixBuffers((char *)newbuffer + (taillen * bytesperoutputsample), echobuff, startlen, outputfreq, 128, FSOUND_STEREOPAN, FSOUND_STEREO | FSOUND_16BITS); - - /* - Now copy result into echo buffer again for next time - */ - { - signed short *dest; - union sample src; - - dest = (signed short *)(echobuff + (EchoOffset << 2)); - src.vptr = newbuffer; - - for (count=0; count < taillen * 2; count++) - { - int val; - - if (mixertype == FSOUND_MIXER_QUALITY_FPU) - { - val = (int)src.fptr[count]; - } - else if (mixertype == FSOUND_MIXER_MMXP5 || mixertype == FSOUND_MIXER_MMXP6 || mixertype == FSOUND_MIXER_QUALITY_MMXP5 || mixertype == FSOUND_MIXER_QUALITY_MMXP6) - { - val = (int)src.wptr[count]; - } - else - { - val = (int)src.dptr[count]; - } - - val = (val > 32767 ? 32767 : val < -32768 ? -32768 : val); - dest[count] = val; - } - } - { - signed short *dest; - union sample src; - - dest = (signed short *)echobuff; // always 16bit - src.vptr = (char *)newbuffer + (taillen * bytesperoutputsample); - - for (count=0; count < startlen * 2; count++) - { - int val; - - if (mixertype == FSOUND_MIXER_QUALITY_FPU) - { - val = (int)src.fptr[count]; - } - else if (mixertype == FSOUND_MIXER_MMXP5 || mixertype == FSOUND_MIXER_MMXP6 || mixertype == FSOUND_MIXER_QUALITY_MMXP5 || mixertype == FSOUND_MIXER_QUALITY_MMXP6) - { - val = (int)src.wptr[count]; - } - else - { - val = (int)src.dptr[count]; - } - - val = (val > 32767 ? 32767 : val < -32768 ? -32768 : val); - dest[count] = val; - } - } - } - /* - No wrapping echo buffer write, just do a straight write - */ - else - { - /* - Feedback history from echo buffer into mixbuffer - */ - FSOUND_DSP_MixBuffers(newbuffer, echobuff + (EchoOffset << 2), length, outputfreq, 128, FSOUND_STEREOPAN, FSOUND_STEREO | FSOUND_16BITS); - - /* - Now copy result into echo buffer again for next time - */ - { - signed short *dest; - union sample src = { newbuffer }; - - dest = (signed short *)(echobuff + (EchoOffset << 2)); - - for (count=0; count < length * 2; count++) - { - int val; - - if (mixertype == FSOUND_MIXER_QUALITY_FPU) - { - val = (int)src.fptr[count]; - } - else if (mixertype == FSOUND_MIXER_MMXP5 || mixertype == FSOUND_MIXER_MMXP6 || mixertype == FSOUND_MIXER_QUALITY_MMXP5 || mixertype == FSOUND_MIXER_QUALITY_MMXP6) - { - val = (int)src.wptr[count]; - } - else - { - val = (int)src.dptr[count]; - } - val = (val > 32767 ? 32767 : val < -32768 ? -32768 : val); - dest[count] = val; - } - } - } - - EchoOffset+=length; - if (EchoOffset >= EchoLen) - { - EchoOffset -= EchoLen; - } - - /* - Echo history has been mixed into new buffer, so return it. - */ - return newbuffer; -} - - - - -/* -[ - [DESCRIPTION] - Buffering code for oscilliscope. - - [PARAMETERS] - 'originalbuffer' Pointer to the original mixbuffer, not any buffers passed down - through the dsp chain. They are in newbuffer. - 'newbuffer' Pointer to buffer passed from previous DSP unit. - 'length' Length in SAMPLES of buffer being passed. - 'param' User parameter. In this case it is 0. - - [RETURN_VALUE] - A pointer to the new modified buffer. - - [REMARKS] - All the <<2 stuff is to convert samples to bytes, as all offsets and lengths are based - on samples not bytes. For mmx the output size is 4 bytes per sample. - - [SEE_ALSO] -] -*/ -void * F_CALLBACKAPI OscCallback(void *originalbuffer, void *newbuffer, int length, void *userdata) -{ - int mixertype = FSOUND_GetMixer(); - int count; - int totalblocks; - signed short *dest; - - totalblocks = FSOUND_DSP_GetBufferLengthTotal() / FSOUND_DSP_GetBufferLength(); - - /* - Convert and downmix into a mono short int buffer. - */ - - dest = &OscBuffer[OscBlock * FSOUND_DSP_GetBufferLength()]; - - if (mixertype == FSOUND_MIXER_QUALITY_FPU) - { - float *src = (float *)newbuffer; - - for (count=0; count < length; count++) - { - dest[count] = (signed short)((src[count << 1] + src[(count << 1) + 1]) * 0.5f); - } - } - else if (mixertype == FSOUND_MIXER_MMXP5 || mixertype == FSOUND_MIXER_MMXP6 || mixertype == FSOUND_MIXER_QUALITY_MMXP5 || mixertype == FSOUND_MIXER_QUALITY_MMXP6) - { - signed short *src = (signed short *)newbuffer; - - for (count=0; count < length; count++) - { - dest[count] = (signed short)(((int)src[count << 1] + (int)src[(count << 1) + 1]) >> 1); - } - } - else - { - signed int *src = (signed int *)newbuffer; - - for (count=0; count < length; count++) - { - dest[count] = (signed short)((src[count << 1] + src[(count << 1) + 1]) >> 1); - } - } - - OscBlock++; - if (OscBlock >= totalblocks) - { - OscBlock = 0; - } - - return newbuffer; -} - - - -/* -[ - [DESCRIPTION] - Plots a graphic spectrum using FSOUND_DSP_GetSpectrum - - [PARAMETERS] - 'hdc' Handle to device context to paint to. - - [RETURN_VALUE] - void - - [REMARKS] - - [SEE_ALSO] - FSOUND_DSP_GetSpectrum - FSOUND_DSP_GetFFTUnit - PlotOscilliscope -] -*/ -void PlotSpectrum(HDC hdc) -{ - int count, count2; - float *spectrum; - - spectrum = FSOUND_DSP_GetSpectrum(); /* returns an array of 512 floats */ - if (!spectrum) - { - return; - } - - memset(GraphicWindowBitmapData, 0, GRAPHICWINDOW_WIDTH * GRAPHICWINDOW_HEIGHT * sizeof(RGBQUAD)); - - /* - Spectrum graphic is 256 entries wide, and the spectrum is 512 entries. - The upper band of frequencies at 44khz is pretty boring (ie 11-22khz), so we are only - going to display the first 256 frequencies, or (0-11khz) - */ - for (count=0; count < GRAPHICWINDOW_WIDTH; count++) - { - RGBQUAD *pixel; - int y; - - #define calcoffset(_x, _y) (GRAPHICWINDOW_WIDTH * _y) + _x - - y = (int)(spectrum[count] * 4.0f * (float)GRAPHICWINDOW_HEIGHT); - if (y >= GRAPHICWINDOW_HEIGHT) - { - y = GRAPHICWINDOW_HEIGHT - 1; - } - - for (count2=0; count2rgbRed = count2 << 1; - pixel->rgbGreen = 0xFF - (count2 << 1); - pixel->rgbBlue = 0x1F; - } - } - - - SetDIBitsToDevice( - hdc, // Target device HDC - graphic_window_x, - graphic_window_y, - GRAPHICWINDOW_WIDTH, // Destination width - GRAPHICWINDOW_HEIGHT, // Destination height - 0, // X source position - 0, // Adjusted Y source position - (UINT)0, // Start scan line - GraphicWindowBitmap.bmiHeader.biHeight, // Scan lines present - GraphicWindowBitmapData, // Image data - &GraphicWindowBitmap, // DIB header - DIB_RGB_COLORS); // Type of palette -} - - -/* -[ - [DESCRIPTION] - Plots an oscilliscope. - - [PARAMETERS] - 'hdc' Handle to device context to paint to. - - [RETURN_VALUE] - void - - [REMARKS] - The oscilliscope data is buffer because the block of data received in a DSP unit is the block - being mixed ahead of time, not the block that is AUDIBLE. - - [SEE_ALSO] - PlotSpectrum -] -*/ -void PlotOscilliscope(HDC hdc) -{ - memset(GraphicWindowBitmapData, 0, GRAPHICWINDOW_WIDTH * GRAPHICWINDOW_HEIGHT * sizeof(RGBQUAD)); - - if (OscBuffer) - { - int count, count2, offset; - float xoff, step; - signed short *src; - /* - The next pcmblock (Oscblock + 1) is the one that is audible. - */ - offset = (OscBlock + 1) * FSOUND_DSP_GetBufferLength(); - if (offset >= FSOUND_DSP_GetBufferLengthTotal()) - { - offset -= FSOUND_DSP_GetBufferLengthTotal(); - } - - src = &OscBuffer[offset]; - - /* - xoff is the x position that is scaled lookup of the dsp block according to the graphical - window size. - */ - xoff = 0; - step = (float)FSOUND_DSP_GetBufferLength() / (float)GRAPHICWINDOW_WIDTH; - - for (count=0; count < GRAPHICWINDOW_WIDTH; count++) - { - RGBQUAD *pixel; - int x, y, y2; - - #define calcoffset(_x, _y) (GRAPHICWINDOW_WIDTH * _y) + _x - - x = (int)xoff; - y = (int)(((float)src[x] + 32768.0f) / 65536.0f * (float)GRAPHICWINDOW_HEIGHT); - y2 = (int)(((float)src[x+(int)step] + 32768.0f) / 65536.0f * (float)GRAPHICWINDOW_HEIGHT); - - if (y > y2) - { - int tmp = y; - y = y2; - y2 = tmp; - } - - for (count2=y; count2<=y2; count2++) - { - pixel = &GraphicWindowBitmapData[calcoffset(count, count2)]; - pixel->rgbRed = 0xff; - pixel->rgbGreen = 0xff; - pixel->rgbBlue = 0xaf; - } - - xoff += step; - } - } - - - SetDIBitsToDevice( - hdc, // Target device HDC - graphic_window_x, - graphic_window_y, - GRAPHICWINDOW_WIDTH, // Destination width - GRAPHICWINDOW_HEIGHT, // Destination height - 0, // X source position - 0, // Adjusted Y source position - (UINT)0, // Start scan line - GraphicWindowBitmap.bmiHeader.biHeight, // Scan lines present - GraphicWindowBitmapData, // Image data - &GraphicWindowBitmap, // DIB header - DIB_RGB_COLORS); // Type of palette -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -Playlist *ParsePlaylist(char *name) -{ - struct _stat buf; - FILE *fp; - char *filebuf, *p; - Playlist *playlist = 0; - int buflen, count, i; - - if (!name || stricmp((const char *)".pls", (const char *)(&name[strlen(name) - 4]))) - { - return 0; - } - - if (_stat(name, &buf)) - { - return 0; - } - - buflen = buf.st_size + 1; - - filebuf = (char *)malloc(buflen); - if (!filebuf) - { - return 0; - } - - fp = fopen(name, "rb"); - if (!fp) - { - free(filebuf); - return 0; - } - - if (fread(filebuf, 1, buf.st_size, fp) != (unsigned int)buf.st_size) - { - fclose(fp); - free(filebuf); - return 0; - } - - fclose(fp); - - filebuf[buflen - 1] = 0; - - p = stristr(filebuf, "NumberOfEntries="); - if (!p) - { - goto ERR; - } - - p += 16; - count = atoi(p); - - if (!count) - { - goto ERR; - } - - playlist = (Playlist *)calloc(sizeof(Playlist), 1); - if (!playlist) - { - goto ERR; - } - - playlist->count = count; - - playlist->name = (char **)calloc(sizeof(char *) * count, 1); - if (!playlist->name) - { - goto ERR; - } - - playlist->displayname = (char **)calloc(sizeof(char *) * count, 1); - if (!playlist->displayname) - { - goto ERR; - } - - for (i=0;i < count;i++) - { - char tmp[32]; - char *filename, *displayname, *t; - - filename = displayname = 0; - - sprintf(tmp, "File%d=", i + 1); - p = strstr(filebuf, tmp); - if (p) - { - p += strlen(tmp); - t = p; - for (;*t && (*t != 0xa) && (*t != 0xd);t++); - if (*t) - { - char tmpc = *t; - *t = 0; - filename = strdup(p); - *t = tmpc; - } - } - - if (strncmp(filename, "http://", 7) && strncmp(filename, "http:\\\\", 7)) - { - char *tmpname = strdup(filename); - p = &tmpname[strlen(tmpname) - 1]; - for (;(p > tmpname) && (*p != '\\') && (*p != '/');p--); - if ((*p == '\\') || (*p == '/')) - { - p++; - } - displayname = strdup(p); - free(tmpname); - } - - playlist->name[i] = filename; - playlist->displayname[i] = displayname; - } - - free(filebuf); - return playlist; - -ERR: - FreePlaylist(playlist); - free(filebuf); - return 0; -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -signed char FreePlaylist(Playlist *playlist) -{ - int i; - - if (!playlist) - { - return FALSE; - } - - if (playlist->name) - { - for (i=0;i < playlist->count;i++) - { - if (playlist->name[i]) - { - free(playlist->name[i]); - } - } - - free(playlist->name); - } - - if (playlist->displayname) - { - for (i=0;i < playlist->count;i++) - { - if (playlist->displayname[i]) - { - free(playlist->displayname[i]); - } - } - - free(playlist->displayname); - } - - free(playlist); - - return TRUE; -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - Returns FALSE if there's no more room in the song list - - [REMARKS] - - [SEE_ALSO] -] -*/ -signed char AddFileToSongList(char *name, char *displayname) -{ - FMUSIC_MODULE *mod = NULL; - FSOUND_STREAM *stream = NULL; - int currsong = 0; - char s[256]; - - if (!strncmp(name, "http://", 7) || !strncmp(name, "http:\\\\", 7)) - { - displayname = name; - } - else - { - stream = NULL; - mod = FMUSIC_LoadSong(name); - if (!mod) - { - stream = FSOUND_Stream_Open(name, FSOUND_NORMAL | FSOUND_2D | FSOUND_MPEGACCURATE | FSOUND_NONBLOCKING, 0, 0); - } - - if (!mod && !stream) - { - MessageBox(0, FMOD_ErrorString(FSOUND_GetError()), "Loading a song", MB_ICONHAND|MB_OK|MB_SYSTEMMODAL); - return TRUE; - } - - if (mod) - { - if (FMUSIC_GetType(mod) != FMUSIC_TYPE_IT) /* IT has its own master volume setting */ - { - FMUSIC_SetMasterVolume(mod, 192); - } - if (FMUSIC_GetType(mod) == FMUSIC_TYPE_MOD || FMUSIC_GetType(mod) == FMUSIC_TYPE_S3M) - { - FMUSIC_SetPanSeperation(mod, 0.85f); /* 15% crossover */ - } - } - } - - currsong = (int)SendMessage(songlist_hwnd, LB_GETCOUNT, 0, 0); - if (currsong >= MAXSONGS) - { - MessageBox(0, "Error. Unable to fit any more songs in.. please restart app", "Loading a song", MB_ICONHAND|MB_OK|MB_SYSTEMMODAL); - return FALSE; - } - - if (mod) - { - song[currsong].mod = mod; - song[currsong].stream = NULL; - song[currsong].url = NULL; - } - else if (stream) - { - song[currsong].stream = stream; - song[currsong].mod = NULL; - song[currsong].url = NULL; - } - else - { - song[currsong].stream = NULL; - song[currsong].mod = NULL; - song[currsong].url = strdup(name); - } - - strcpy(s, displayname); - song[currsong].listname = strdup(displayname); - - SendMessage(songlist_hwnd, LB_ADDSTRING, 0, (LPARAM) (LPCTSTR)s); - UpdateWindow(songlist_hwnd); - SendMessage(songlist_hwnd, LB_SETCURSEL, currsong, 0); - - return TRUE; -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -void LoadSong() -{ - OPENFILENAME ofn; /* common dialog box structure */ - char szDirName[MAX_PATH]; /* directory string */ - char szFile[20481]; /* filename string */ - char szFileTitle[4096]; /* filename string */ - - /* - Obtain the system directory name and store it in szDirName. - */ - GetSystemDirectory(szDirName, sizeof(szDirName)); - - /* - Place the terminating null character in the szFile. - */ - szFile[0] = '\0'; - szFileTitle[0] = '\0'; - - /* - Set the members of the OPENFILENAME structure. - */ - memset(&ofn, 0, sizeof(ofn)); - ofn.lStructSize = sizeof(OPENFILENAME); - ofn.hwndOwner = mainhwnd; - ofn.lpstrTitle = "Open\0"; - ofn.lpstrFilter = "All song Types\0*.MOD;*.S3M;*.XM;*.IT;*.MID;*.RMI;*.SGT;*.WAV;*.MP2;*.MP3;*.OGG;*.WMA;*.ASF;*.AIFF;*.PLS;*.FSB;*.OXM\0Microsoft WAV (*.WAV)\0*.WAV\0MP2/MP3 (*.MP3 *.MP2)\0*.MP2;*.MP3\0Ogg Vorbis (*.OGG)\0*.OGG\0Windows Media Format (*.WMA *.ASF)\0*.WMA;*.ASF\0Audio Interchange File Format (*.AIFF)\0*.AIFF\0MIDI / DirectMusic Files (*.MID,*.RMI,*.SGT)\0*.MID;*.RMI;*.SGT\0Impulse Tracker (*.IT)\0*.IT\0FastTracker2 (*.XM)\0*.XM\0ScreamTracker 3 (*.S3M)\0*.S3M\0Protracker/FastTracker (*.MOD)\0*.MOD\0Playlist (*.PLS)\0*.PLS\0FMOD Sample Bank (*.FSB)\0*.FSB\0Ogg commpress XM (*.OXM)\0*.OXM\0All files (*.*)\0*.*\0\0"; - ofn.lpstrCustomFilter = NULL; - ofn.nFilterIndex = 1; - ofn.lpstrFile = szFile; - ofn.nMaxFile = 20480; /* Huge value allows many files to be multi-selected */ - ofn.lpstrFileTitle = szFileTitle; - ofn.nMaxFileTitle = 2048; - ofn.lpstrInitialDir = ".\0"; - ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_ALLOWMULTISELECT; - - /* - Display the Open dialog box. - */ - if (GetOpenFileName(&ofn)) - { - char *path = ofn.lpstrFile; - char *fname = ofn.lpstrFile; - char name[256]; - - /* - Single file - */ - if (ofn.nFileOffset) - { - /* - Skip to the first filename - */ - fname +=ofn.nFileOffset; - *(fname-1) = 0; /* clear the backslash before the filename so the loop below handles it */ - } - /* - Multiple files - */ - else - { - while (*fname++); /* search to the first filename */ - } - - do - { - Playlist *p; - int i; - - /* - Put path in name - */ - strcpy(name, path); - strcat(name, "\\"); - strcat(name, fname); - - /* - Open the file. - */ - p = ParsePlaylist(name); - if (p) - { - for (i=0;i < p->count;i++) - { - AddFileToSongList(p->name[i], p->displayname[i]); - } - - FreePlaylist(p); - } - else - { - AddFileToSongList(name, fname); - } - - while (*fname++); - - Sleep(1); - - } while (*fname); - } -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -void LoadURL() -{ - if (DialogBox(g_hinst, MAKEINTRESOURCE(IDD_LOADURLDLG), mainhwnd, FMOD_LoadURLDlgProc)) - { - if (strlen(url_to_load)) - { - int songid = (int)SendMessage(songlist_hwnd, LB_GETCOUNT, 0, 0); - if (songid >= MAXSONGS) - { - MessageBox(0, "Error. Unable to fit any more songs in.. please restart app", "Loading a song", MB_ICONHAND|MB_OK|MB_SYSTEMMODAL); - return; - } - - song[songid].mod = 0; - song[songid].stream = 0; - song[songid].url = strdup(url_to_load); - song[songid].listname = strdup(url_to_load); - - SendMessage(songlist_hwnd, LB_ADDSTRING, 0, (LPARAM) (LPCTSTR)song[songid].url); - UpdateWindow(songlist_hwnd); - SendMessage(songlist_hwnd, LB_SETCURSEL, songid, 0); - - UpdateNetStreamInfo(songid, TRUE, FALSE); - } - } -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -void LoadCD() -{ - int numsongs, songid, i; - char tmp[256]; - - /* - Bomb out if there's a cdda_stream already loading - */ - if (cdda_stream) - { - if (FSOUND_Stream_GetOpenState(cdda_stream) == -2) - { - return; - } - } - - DeleteAllCDTracks(); - - if (cdda_stream) - { - FSOUND_Stream_Close(cdda_stream); - cdda_stream = 0; - cdda_channel = -1; - } - - if (setting_cdda) - { - /* - Use the "!" qualifier to specify "quick open" mode so we can populate the playlist and get - the track lengths quickly - */ - sprintf(tmp, "%s*!j", setting_cdletter); - cdda_stream = FSOUND_Stream_Open(tmp, FSOUND_NORMAL, 0, 0); - if (!cdda_stream) - { - MessageBox(mainhwnd, "Couldn't open cdda stream", "Error", MB_ICONHAND|MB_OK|MB_SYSTEMMODAL); - } - - numsongs = FSOUND_Stream_GetNumSubStreams(cdda_stream); - for (i=0;i < numsongs;i++) - { - songid = (int)SendMessage(songlist_hwnd, LB_GETCOUNT, 0, 0); - if (songid >= MAXSONGS) - { - MessageBox(0, "Error. Unable to fit any more songs in.. please restart app", "Loading a song", MB_ICONHAND|MB_OK|MB_SYSTEMMODAL); - break; - } - - memset(&song[songid], 0, sizeof(song[songid])); - - sprintf(tmp, "Track %02d", i + 1); - song[songid].listname = strdup(tmp); - song[songid].channel = -1; - song[songid].cdtrack = i + 1; - - SendMessage(songlist_hwnd, LB_ADDSTRING, 0, (LPARAM) (LPCTSTR)tmp); - UpdateWindow(songlist_hwnd); - } - - SendMessage(songlist_hwnd, LB_SETCURSEL, 0, 0); - - numsongs = (int)SendMessage(songlist_hwnd, LB_GETCOUNT, 0, 0); - for (i=0;i < numsongs;i++) - { - if (song[i].cdtrack) - { - FSOUND_Stream_SetSubStream(cdda_stream, song[i].cdtrack - 1); - song[i].cdtrack_length = FSOUND_Stream_GetLengthMs(cdda_stream); - } - } - - FSOUND_Stream_Close(cdda_stream); - - /* - Now do a normal non-blocking open to setup the stream properly for playing - */ - strcpy(tmp, setting_cdletter); - strcat(tmp, "*"); - if (!setting_jitter) - { - strcat(tmp, "j"); - } - if (setting_forceaspi) - { - strcat(tmp, "a"); - } - cdda_stream = FSOUND_Stream_Open(tmp, FSOUND_NORMAL | FSOUND_NONBLOCKING, 0, 0); - if (!cdda_stream) - { - MessageBox(mainhwnd, "Couldn't open cdda stream", "Error", MB_ICONHAND|MB_OK|MB_SYSTEMMODAL); - } - - cdda_stream_state = -2; - } - else - { - numsongs = FSOUND_CD_GetNumTracks(cddevice); - if (numsongs) - { - for (i=0;i < numsongs;i++) - { - songid = (int)SendMessage(songlist_hwnd, LB_GETCOUNT, 0, 0); - if (songid >= MAXSONGS) - { - MessageBox(0, "Error. Unable to fit any more songs in.. please restart app", "Loading a song", MB_ICONHAND|MB_OK|MB_SYSTEMMODAL); - break; - } - - memset(&song[songid], 0, sizeof(song[songid])); - - sprintf(tmp, "Track %02d", i + 1); - song[songid].listname = strdup(tmp); - song[songid].channel = -1; - song[songid].cdtrack = i + 1; - song[songid].cdtrack_length = 0; - - SendMessage(songlist_hwnd, LB_ADDSTRING, 0, (LPARAM) (LPCTSTR)tmp); - UpdateWindow(songlist_hwnd); - SendMessage(songlist_hwnd, LB_SETCURSEL, songid, 0); - } - } - } -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -void DeleteAllCDTracks() -{ - int numsongs, i; - - StopCDTrack(); - - numsongs = (int)SendMessage(songlist_hwnd, LB_GETCOUNT, 0, 0); - for (i=0;i < numsongs;i++) - { - if (song[i].cdtrack) - { - DeleteSong(i); - i = -1; /* Force it to start at the start */ - numsongs--; - } - } -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -signed char StopCDTrack() -{ - int songid; - int numsongs = (int)SendMessage(songlist_hwnd, LB_GETCOUNT, 0, 0); - - if (setting_cdda) - { - for (songid=0;songid < numsongs;songid++) - { - if (song[songid].cdtrack && (song[songid].channel != -1)) - { - FSOUND_Stream_Stop(cdda_stream); - song[songid].channel = -1; - return TRUE; - } - } - } - else - { - FSOUND_CD_Stop(cddevice); - } - - return FALSE; -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -signed char PlayCDTrack(int songid, int looped) -{ - unsigned int mode; - - if (setting_cdda) - { - if (cdda_stream) - { - if ((song[songid].channel != -1) && FSOUND_IsPlaying(song[songid].channel)) - { - int off = FSOUND_Stream_GetTime(cdda_stream); - int len = FSOUND_Stream_GetLengthMs(cdda_stream); - if ((off < len) && (off > 0)) - { - /* - It's already playing - */ - return TRUE; - } - } - - if (FSOUND_Stream_GetOpenState(cdda_stream) == 0) - { - StopCDTrack(); - - FSOUND_Stream_SetSubStream(cdda_stream, song[songid].cdtrack - 1); - /* - It's non-blocking - wait for it to finish seeking - */ - while (FSOUND_Stream_GetOpenState(cdda_stream) != 0) - { - Sleep(100); - } - - mode = FSOUND_Stream_GetMode(cdda_stream); - mode &= ~(FSOUND_LOOP_OFF | FSOUND_LOOP_NORMAL | FSOUND_LOOP_BIDI); - if (looped == FSOUND_CD_PLAYONCE) - { - mode |= FSOUND_LOOP_OFF; - } - else if (looped == FSOUND_CD_PLAYLOOPED) - { - mode |= FSOUND_LOOP_NORMAL; - } - else - { - mode |= FSOUND_LOOP_OFF; - } - FSOUND_Stream_SetMode(cdda_stream, mode); - - song[songid].channel = FSOUND_Stream_Play(FSOUND_FREE, cdda_stream); - if (song[songid].channel < 0) - { - MessageBox(mainhwnd, "Error. Cannot start song", "Playing a song", MB_ICONHAND|MB_OK|MB_SYSTEMMODAL); - return FALSE; - } - } - - return TRUE; - } - } - else - { - if (FSOUND_CD_GetPaused(cddevice)) - { - return FSOUND_CD_SetPaused(cddevice, FALSE); - } - else - { - FSOUND_CD_SetPlayMode(cddevice, looped); - return FSOUND_CD_Play(cddevice, song[songid].cdtrack); - } - } - - return FALSE; -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -void DeleteSong(int songid) -{ - int count; - - if (song[songid].mod) - { - FMUSIC_FreeSong(song[songid].mod); - song[songid].mod = NULL; - } - else if (song[songid].stream) - { - FSOUND_Stream_Close(song[songid].stream); - song[songid].stream = NULL; - - if (song[songid].url) - { - free(song[songid].url); - song[songid].url = 0; - } - } - else if (song[songid].cdtrack) - { - if (setting_cdda) - { - if (song[songid].channel && cdda_stream) - { - FSOUND_Stream_Stop(cdda_stream); - } - } - else - { - if (FSOUND_CD_GetTrack(cddevice) == song[songid].cdtrack) - { - FSOUND_CD_Stop(cddevice); - } - } - } - - song[songid].channel = -1; - - if (song[songid].listname) - { - free(song[songid].listname); - song[songid].listname = 0; - } - - if (song[songid].server_status) - { - free(song[songid].server_status); - song[songid].server_status = 0; - } - - if (song[songid].title) - { - free(song[songid].title); - song[songid].title = 0; - } - - if (song[songid].artist) - { - free(song[songid].artist); - song[songid].artist = 0; - } - - song[songid].protocol = NULL; - song[songid].format = NULL; - song[songid].streamname = NULL; - song[songid].last_status = -1; - - SendMessage(songlist_hwnd, LB_DELETESTRING, songid, 0); - - /* - Shuffle down tunes - */ - for (count=songid+1; count= SendMessage(songlist_hwnd, LB_GETCOUNT, 0, 0)) - { - songid = (int)SendMessage(songlist_hwnd, LB_GETCOUNT, 0, 0) - 1; - if (songid < 0) - { - songid = 0; - } - } - - SendMessage(songlist_hwnd, LB_SETCURSEL, songid, 0); - - UpdateStreamInfo(songid, TRUE); - UpdateNetStreamInfo(songid, TRUE, FALSE); - UpdateModInfo(songid, TRUE); - UpdateCDInfo(songid, TRUE); - SelectInfoWindow(); - - playlistsong = 0; -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -BOOL PlaySong(int index) -{ - if (song[index].mod) - { - FMUSIC_SetLooping(song[index].mod, Button_GetCheck(GetDlgItem(mainhwnd, IDC_PLAYLOOPED))); - FMUSIC_PlaySong(song[index].mod); - } - else if (song[index].stream && !song[index].url) - { - FSOUND_Stream_SetMode(song[index].stream, Button_GetCheck(GetDlgItem(mainhwnd, IDC_PLAYLOOPED)) ? FSOUND_LOOP_NORMAL : FSOUND_LOOP_OFF); - song[index].channel = FSOUND_Stream_Play(FSOUND_FREE, song[index].stream); - } - else if (!song[index].stream && song[index].url) - { - song[index].stream = FSOUND_Stream_Open(song[index].url, FSOUND_NORMAL | FSOUND_NONBLOCKING, 0, 0); - if (!song[index].stream) - { - MessageBox(mainhwnd, "ERROR: Couldn't open stream", "Playing a song", MB_ICONHAND|MB_OK|MB_SYSTEMMODAL); - return FALSE; - } - } - else if (song[index].cdtrack) - { - PlayCDTrack(index, Button_GetCheck(GetDlgItem(mainhwnd, IDC_PLAYLOOPED)) ? FSOUND_CD_PLAYLOOPED : FSOUND_CD_PLAYONCE); - } - - return TRUE; -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -signed char PlayNextSong() -{ - playlistsong++; - - if (playlistsong >= SendMessage(songlist_hwnd, LB_GETCOUNT, 0, 0)) - { - playlistsong = 0; - } - - PlaySong(playlistsong); - - SendMessage(songlist_hwnd, LB_SETCURSEL, playlistsong, 0); - SelectInfoWindow(); - - return TRUE; -} - - -/* -[ - [DESCRIPTION] - Create DSP units and reverb buffers etc - - [PARAMETERS] - void - - [RETURN_VALUE] - void - - [REMARKS] - - [SEE_ALSO] - CloseDSP -] -*/ -void InitDSP() -{ - int bytesperoutputsample; - int mixertype = FSOUND_GetMixer(); - - DSP_Ready = FALSE; - - if (mixertype == FSOUND_MIXER_MMXP5 || mixertype == FSOUND_MIXER_MMXP6 || mixertype == FSOUND_MIXER_QUALITY_MMXP5 || mixertype == FSOUND_MIXER_QUALITY_MMXP6) - { - bytesperoutputsample = 4; // 16bit stereo - } - else - { - bytesperoutputsample = 8; // 32bit stereo - } - - /* - Initalize and create lowpass buffer and DSP unit - */ - LowPass_Init(); - LowPassBuffer = calloc(FSOUND_DSP_GetBufferLength()+256, bytesperoutputsample); - LowPass_Update(LowPassResonance, LowPassCutoffFrequency, outputfreq); - LowPassUnit = FSOUND_DSP_Create(&LowPassCallback, FSOUND_DSP_DEFAULTPRIORITY_USER+1, LowPassBuffer); - - /* - Create buffer and dsp unit for echo effect - */ - EchoLen = MAXECHOLEN; /* 500ms */ - EchoBuffer = calloc(EchoLen, 4); /* The echo buff is always 16bit stereo int regardless of the mixer format, so * 4 */ - EchoOffset = 0; - EchoUnit = FSOUND_DSP_Create(&EchoCallback, FSOUND_DSP_DEFAULTPRIORITY_USER+2, EchoBuffer); - - /* - Create buffer and dsp unit for oscilliscope. - */ - OscUnit = FSOUND_DSP_Create(&OscCallback, FSOUND_DSP_DEFAULTPRIORITY_USER+3, 0); - OscBuffer = calloc(FSOUND_DSP_GetBufferLengthTotal() + 16, 2); /* *2 for mono 16bit buffer */ - - /* - Initialize reverb stuff - */ - Reverb_Init(); - - /* - Create a bitmap to draw the Spectrum into - */ - - // make the header - ZeroMemory( &GraphicWindowBitmap, sizeof( BITMAPINFO ) ); - GraphicWindowBitmap.bmiHeader.biSize = sizeof( GraphicWindowBitmap.bmiHeader ); - GraphicWindowBitmap.bmiHeader.biWidth = GRAPHICWINDOW_WIDTH; - GraphicWindowBitmap.bmiHeader.biHeight = GRAPHICWINDOW_HEIGHT; - GraphicWindowBitmap.bmiHeader.biPlanes = 1; - GraphicWindowBitmap.bmiHeader.biBitCount = 32; - GraphicWindowBitmap.bmiHeader.biCompression = BI_RGB; - GraphicWindowBitmap.bmiHeader.biSizeImage = 0; - GraphicWindowBitmap.bmiHeader.biXPelsPerMeter = 0; - GraphicWindowBitmap.bmiHeader.biYPelsPerMeter = 0; - GraphicWindowBitmap.bmiHeader.biClrUsed = 0; - GraphicWindowBitmap.bmiHeader.biClrImportant = 0; - - - DSP_Ready = TRUE; -} - - -/* -[ - [DESCRIPTION] - Remove all DSP units and reverb buffers etc. - - [PARAMETERS] - void - - [RETURN_VALUE] - void - - [REMARKS] - - [SEE_ALSO] - InitDSP -] -*/ -void CloseDSP() -{ - DSP_Ready = FALSE; - - if (LowPassUnit) - { - FSOUND_DSP_Free(LowPassUnit); - } - LowPassUnit = NULL; - - if (EchoUnit) - { - FSOUND_DSP_Free(EchoUnit); - } - EchoUnit = NULL; - - if (OscUnit) - { - FSOUND_DSP_Free(OscUnit); - } - OscUnit = NULL; - - /* - Free buffers - */ - if (LowPassBuffer) - { - free(LowPassBuffer); - } - LowPassBuffer = NULL; - - if (EchoBuffer) - { - free(EchoBuffer); - } - EchoBuffer = NULL; - - if (OscBuffer) - { - free(OscBuffer); - } - OscBuffer = NULL; - - Reverb_Close(); - LowPass_Close(); -} - - -/* - ** TextWindowProc - * - * PARAMETERS: - * - * DESCRIPTION: Sends back messages to the parent window if this window got focus - * - * RETURNS: - * - */ -long FAR PASCAL ProgressWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch (message) - { - case WM_LBUTTONDOWN: - case WM_MOUSEMOVE: - { - int songid = (int)SendMessage(songlist_hwnd, LB_GETCURSEL, 0, 0); - - if (message == WM_MOUSEMOVE && wParam != MK_LBUTTON) - { - break; - } - - if (songid != LB_ERR) - { - FMUSIC_MODULE *mod = song[songid].mod; - FSOUND_STREAM *stream = song[songid].stream; - char *url = song[songid].url; - RECT r; - int width; - int xPos = LOWORD(lParam); // horizontal position of cursor - - GetWindowRect(hwnd, &r); - - width = r.right - r.left; - - if (mod) - { - int count; - - for (count=0; count < FMUSIC_GetNumChannels(mod); count++) - { - FSOUND_StopSound(FMUSIC_GetRealChannel(mod, count)); - } - FMUSIC_SetOrder(mod, (int)((float)FMUSIC_GetNumOrders(mod) / (float)width * (float)xPos)); - } - else if (stream && !url) - { - FSOUND_Stream_SetTime(stream, (int)((float)FSOUND_Stream_GetLengthMs(stream) / (float)width * (float)xPos)); - } - else if (song[songid].cdtrack) - { - if (setting_cdda) - { - if ((song[songid].channel != -1) && cdda_stream) - { - FSOUND_Stream_SetTime(cdda_stream, (int)((float)FSOUND_Stream_GetLengthMs(cdda_stream) / (float)width * (float)xPos)); - } - } - else - { - if (song[songid].cdtrack == FSOUND_CD_GetTrack(cddevice)) - { - FSOUND_CD_SetTrackTime(cddevice, (int)((float)FSOUND_CD_GetTrackLength(cddevice, FSOUND_CD_GetTrack(cddevice)) / (float)width * (float)xPos)); - } - } - } - } - break; - } - }; - - return (long)CallWindowProc(oldprogressproc, hwnd, message, wParam, lParam); -} - - -/* - ** TextWindowProc - * - * PARAMETERS: - * - * DESCRIPTION: Sends back messages to the parent window if this window got focus - * - * RETURNS: - * - */ -long FAR PASCAL CDTimeWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch (message) - { - case WM_LBUTTONDOWN: - { - DraggingCDSlider = TRUE; - break; - } - case WM_LBUTTONUP: - { - int pos = (int)SendMessage(hwnd, TBM_GETPOS, 0, 0); - - if (setting_cdda) - { - if (cdda_stream) - { - FSOUND_Stream_SetTime(cdda_stream, (int)((float)pos * (float)FSOUND_Stream_GetLengthMs(cdda_stream) / 1000.0f)); - } - } - else - { - FSOUND_CD_SetTrackTime(cddevice, (int)((float)pos * (float)FSOUND_CD_GetTrackLength(cddevice, FSOUND_CD_GetTrack(cddevice)) / 1000.0f)); - } - DraggingCDSlider = FALSE; - break; - } - }; - - return (long)CallWindowProc(oldcdtimeproc, hwnd, message, wParam, lParam); -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -#ifdef _WIN64 -INT_PTR CALLBACK FMOD_DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -#else -BOOL CALLBACK FMOD_DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -#endif -{ - switch (msg) - { - case WM_INITDIALOG: - { - int count; - RECT r; - - SetFocus(hwnd); - - /* - CALL DRIVER DIALOG BOX - */ - #if 0 - if (!SoundDriver_Init(&outputfreq)) - { - SendMessage(hwnd, WM_CLOSE, 0, 0); - return TRUE; - } - #endif - - /* - CONFIGURE STABILITY OF SOUND OUTPUT UNDER WINDOWS - */ - - FSOUND_SetBufferSize(FSOUND_BUFFERSIZE); - - /* - INITIALIZE FSOUND - */ - FSOUND_SetOutput(setting_output); - FSOUND_SetDriver(setting_driver); - FSOUND_SetMixer(setting_mixer); - FSOUND_SetHWND(hwnd); - - outputfreq = setting_outputrate; - if (!FSOUND_Init(outputfreq, NUMCHANNELS, FSOUND_INIT_GLOBALFOCUS)) - { - MessageBox(hwnd, FMOD_ErrorString(FSOUND_GetError()), "FSOUND", MB_ICONHAND|MB_OK|MB_SYSTEMMODAL); - SendMessage(hwnd, WM_CLOSE, 0, 0); - return TRUE; - } - - FSOUND_Stream_Net_SetProxy(setting_http_proxy); - FSOUND_Stream_SetBufferSize(1000); - - /* - SET UP A PAINT TIMER FOR INTERFACE - */ - timerid = SetTimer(hwnd, 0, 5, (TIMERPROC)0); - if (!timerid) - { - MessageBox( NULL, "Too many timers in use", "Error", MB_ICONHAND|MB_OK|MB_SYSTEMMODAL); - return FALSE; - } - - /* - INITIALIZE SONG LIST TO NULL - */ - for (count=0; count= len)) - { - FSOUND_Stream_Close(song[songid].stream); - song[songid].stream = FSOUND_Stream_Open(song[songid].url, FSOUND_NORMAL | FSOUND_NONBLOCKING, 0, 0); - if (!song[songid].stream) - { - MessageBox(hwnd, "ERROR: Couldn't open stream", "Playing a song", MB_ICONHAND|MB_OK|MB_SYSTEMMODAL); - } - } - break; - } - } - } - else - { - song[songid].stream = FSOUND_Stream_Open(song[songid].url, FSOUND_NORMAL | FSOUND_NONBLOCKING, 0, 0); - if (!song[songid].stream) - { - MessageBox(hwnd, "ERROR: Couldn't open stream", "Playing a song", MB_ICONHAND|MB_OK|MB_SYSTEMMODAL); - } - } - } - else if (song[songid].stream) - { - /* - It's non-blocking - wait for it to finish opening first - */ - if (FSOUND_Stream_GetOpenState(song[songid].stream) != 0) - { - HWND pwhwnd = CreateDialog(g_hinst, MAKEINTRESOURCE(IDD_DIALOGWAIT), mainhwnd, 0); - while (FSOUND_Stream_GetOpenState(song[songid].stream) == -2) - { - Sleep(100); - } - EndDialog(pwhwnd, 0); - } - - FSOUND_Stream_SetMode(song[songid].stream, Button_GetCheck(GetDlgItem(hwnd,IDC_PLAYLOOPED)) ? FSOUND_LOOP_NORMAL : FSOUND_LOOP_OFF); - song[songid].channel = FSOUND_Stream_Play(FSOUND_FREE, song[songid].stream); - if (song[songid].channel < 0) - { - MessageBox(hwnd, "Error. Cannot start song", "Playing a song", MB_ICONHAND|MB_OK|MB_SYSTEMMODAL); - } - } - else if (song[songid].cdtrack) - { - if (!PlayCDTrack(songid, Button_GetCheck(GetDlgItem(hwnd,IDC_PLAYLOOPED)) ? FSOUND_CD_PLAYLOOPED : FSOUND_CD_PLAYONCE)) - { - MessageBox(hwnd, "Error. Cannot start song", "Playing a song", MB_ICONHAND|MB_OK|MB_SYSTEMMODAL); - } - } - } - else - { - MessageBox(hwnd, "Error. Please select a song to play first", "Playing a song", MB_ICONHAND|MB_OK|MB_SYSTEMMODAL); - } - } - else - { - int songid = (int)SendMessage(songlist_hwnd, LB_GETCURSEL, 0, 0); - if (songid != LB_ERR) - { - if (song[songid].mod) - { - FMUSIC_StopSong(song[songid].mod); - } - else if (song[songid].stream) - { - if (song[songid].url) - { - FSOUND_Stream_Close(song[songid].stream); - song[songid].stream = NULL; - } - else - { - FSOUND_Stream_Stop(song[songid].stream); - } - } - else if (song[songid].cdtrack) - { - if (setting_cdda) - { - if ((song[songid].channel != -1) && cdda_stream) - { - StopCDTrack(); - } - } - else - { - if (song[songid].cdtrack == FSOUND_CD_GetTrack(cddevice)) - { - StopCDTrack(); - } - } - } - - if (song[songid].title) - { - free(song[songid].title); - song[songid].title = 0; - } - - if (song[songid].artist) - { - free(song[songid].artist); - song[songid].artist = 0; - } - - song[songid].channel = -1; - song[songid].protocol = NULL; - song[songid].format = NULL; - song[songid].streamname = NULL; - } - else - { - MessageBox(hwnd, "Error. Please select a song to play first", "Playing a mod", MB_ICONHAND|MB_OK|MB_SYSTEMMODAL); - } - } - - break; - } - - case IDC_SPECTRUM: /* GRAPHIC SPECTRUM / INFO BUTTON */ - { - int x, y; - RECT rect; - - if (GraphicWindowCurrent == GRAPHICWINDOW_MODINFO) - { - ShowWindow(modinfo_hwnd, SW_HIDE); - ShowWindow(streaminfo_hwnd, SW_HIDE); - ShowWindow(netstreaminfo_hwnd, SW_HIDE); - ShowWindow(cdinfo_hwnd, SW_HIDE); - } - else if (GraphicWindowCurrent == GRAPHICWINDOW_EQUALISER) - { - FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(), FALSE); - } - else if (GraphicWindowCurrent == GRAPHICWINDOW_WAVE) - { - FSOUND_DSP_SetActive(OscUnit, FALSE); - } - - GraphicWindowCurrent++; - if (GraphicWindowCurrent >= GRAPHICWINDOW_MAX) - { - GraphicWindowCurrent = GRAPHICWINDOW_MODINFO; - } - - if (GraphicWindowCurrent == GRAPHICWINDOW_MODINFO) - { - SelectInfoWindow(); - SendMessage(GetDlgItem(hwnd, IDC_SPECTRUM), WM_SETTEXT, 0, (LPARAM)(LPCTSTR)"Spectrum"); - } - else if (GraphicWindowCurrent == GRAPHICWINDOW_EQUALISER) - { - FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(), TRUE); - SendMessage(GetDlgItem(hwnd, IDC_STATIC_INFO), WM_SETTEXT, 0, (LPARAM)(LPCTSTR)"Spectrum"); - SendMessage(GetDlgItem(hwnd, IDC_SPECTRUM), WM_SETTEXT, 0, (LPARAM)(LPCTSTR)"Wave"); - } - else if (GraphicWindowCurrent == GRAPHICWINDOW_WAVE) - { - FSOUND_DSP_SetActive(OscUnit, TRUE); - SendMessage(GetDlgItem(hwnd, IDC_STATIC_INFO), WM_SETTEXT, 0, (LPARAM)(LPCTSTR)"Oscilliscope"); - SendMessage(GetDlgItem(hwnd, IDC_SPECTRUM), WM_SETTEXT, 0, (LPARAM)(LPCTSTR)"Info"); - } - - x = graphic_window_x; - y = graphic_window_y; - rect.left = x; - rect.top = y; - rect.right = x + GRAPHICWINDOW_WIDTH; - rect.bottom = y + GRAPHICWINDOW_HEIGHT; - InvalidateRect(hwnd, &rect, TRUE); - - break; - } - - case IDC_SONGLIST : - { - if (HIWORD(wParam) == LBN_SELCHANGE) - { - SelectInfoWindow(); - } - break; - } - - case IDC_CONFIG : - { - int i, numsongs, currsong; - - CloseDSP(); - - /* - Close all open internet streams because all network stuff gets shutdown in FSOUND_Close - */ - numsongs = (int)SendMessage(songlist_hwnd, LB_GETCOUNT, 0, 0); - currsong = (int)SendMessage(songlist_hwnd, LB_GETCURSEL, 0, 0); - for (i=0;i < numsongs;i++) - { - if (song[i].url && song[i].stream) - { - FSOUND_Stream_Close(song[i].stream); - song[i].stream = 0; - song[i].channel = -1; - song[i].last_status = -1; - - if (i == currsong) - { - UpdateNetStreamInfo(i, TRUE, FALSE); - } - } - } - - if (cdda_stream) - { - FSOUND_Stream_Close(cdda_stream); - cdda_stream = 0; - cdda_channel = -1; - } - - DeleteAllCDTracks(); - - /* - Remember .. FSOUND_Close cleans up all DSP units, so if you still have pointers to them, - it could cause problems (crashes) because they are pointing to freed data. - This is why there is a call to CloseDSP above. - */ - FSOUND_Close(); - - /* - Call up dialog box to select sound options - */ - SoundDriver_Init(&outputfreq); - - FSOUND_SetBufferSize(FSOUND_BUFFERSIZE); - - /* - Initialize FSOUND - */ - - if (!FSOUND_Init(outputfreq,NUMCHANNELS, FSOUND_INIT_GLOBALFOCUS)) - { - MessageBox(hwnd, FMOD_ErrorString(FSOUND_GetError()), "FSOUND", MB_ICONHAND|MB_OK|MB_SYSTEMMODAL); - return FALSE; - } - - FSOUND_Stream_Net_SetProxy(setting_http_proxy); - FSOUND_Stream_SetBufferSize(1000); - - InitDSP(); - - if (GraphicWindowCurrent == GRAPHICWINDOW_EQUALISER) - { - FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(), TRUE); - } - else if (GraphicWindowCurrent == GRAPHICWINDOW_WAVE) - { - FSOUND_DSP_SetActive(OscUnit, TRUE); - } - - break; - } - } - - InvalidateRect(songlist_hwnd, NULL, FALSE); - - break; - } - - case WM_DROPFILES : - { - HDROP hDrop = (HDROP)wParam; - int numfiles, count; - char name[1024]; - Playlist *p; - int i; - struct _stat buf; - - numfiles = DragQueryFile(hDrop, 0xFFFFFFFF, &name[0], 1024); - if (!numfiles) - break; - - for (count=0; countcount;i++) - { - AddFileToSongList(p->name[i], p->displayname[i]); - } - - FreePlaylist(p); - } - else - { - AddFileToSongList(name, name); - } - } - - DragFinish(hDrop); - SelectInfoWindow(); - - break; - } - case WM_COPYDATA : - { - Playlist *p; - char *name; - int i; - COPYDATASTRUCT *data; - - data = (COPYDATASTRUCT *)lParam; - if (data->cbData) - { - char tmp[2048]; - - strcpy(tmp, (char *)data->lpData); - name = tmp; - - if (*name == '"') - { - name++; - } - - if (name[strlen(name) - 1] == '"') - { - name[strlen(name) - 1] = 0; - } - - p = ParsePlaylist(name); - if (p) - { - for (i=0;i < p->count;i++) - { - AddFileToSongList(p->name[i], p->displayname[i]); - } - - FreePlaylist(p); - } - else - { - AddFileToSongList(name, name); - } - } - - SelectInfoWindow(); - break; - } - - case WM_TIMER : - { - char s[256]; - HDC hdc = GetDC(hwnd); - HFONT myfont; - FMUSIC_MODULE *mod; - FSOUND_STREAM *stream; - int songid; - int greyoutfilters; - - greyoutfilters = FALSE; - - myfont = GetStockObject(DEFAULT_GUI_FONT); - SelectObject(hdc, myfont); - - SetBkColor(hdc, GetSysColor(COLOR_3DFACE)); - SetTextColor(hdc, RGB(0, 0, 255)); - - sprintf(s, "%03d", FSOUND_GetChannelsPlaying()); - TextOut(hdc, (int)(TEXT_CHANNELSPLAYING_X * scalex), (int)(TEXT_CHANNELSPLAYING_Y * scaley), s, (int)strlen(s)); - - sprintf(s, "%5.02f%% ", FSOUND_GetCPUUsage()); - TextOut(hdc, (int)(TEXT_CPUUSAGE_X * scalex), (int)(TEXT_CPUUSAGE_Y * scaley), s, (int)strlen(s)); - - /* - DSP BUTTONS - */ - if (DSP_Ready) - { - int count; - - /* - If the unit is inactive and the checkbox is checked, then clear preverb buffer - this stops any old preverb dregs hanging around. - */ - if (!FSOUND_DSP_GetActive(PreverbTap[0].Unit) && (char)Button_GetCheck(GetDlgItem(hwnd,IDC_PREVERB))) - { - for (count=0; count < PREVERB_NUMTAPS; count++) - { - memset(PreverbTap[count].historybuff, 0, PreverbTap[count].historylen<<2); /* preverblen is in samples. */ - } - } - for (count=0; count < PREVERB_NUMTAPS; count++) - { - FSOUND_DSP_SetActive(PreverbTap[count].Unit, (char)Button_GetCheck(GetDlgItem(hwnd,IDC_PREVERB))); - } - - /* - If the unit is inactive and the checkbox is checked, then clear reverb buffer - this stops any old reverb dregs hanging around. - */ - if (!FSOUND_DSP_GetActive(ReverbTap[0].Unit) && (char)Button_GetCheck(GetDlgItem(hwnd,IDC_REVERB))) - { - for (count=0; count < REVERB_NUMTAPS; count++) - { - memset(ReverbTap[count].historybuff, 0, ReverbTap[count].historylen<<2); /* preverblen is in samples. */ - } - } - for (count=0; count < REVERB_NUMTAPS; count++) - { - FSOUND_DSP_SetActive(ReverbTap[count].Unit, (char)Button_GetCheck(GetDlgItem(hwnd,IDC_REVERB))); - } - - - /* - MIDI reverb uses the reverb button as well - */ - FMUSIC_SetReverb((char)Button_GetCheck(GetDlgItem(hwnd,IDC_REVERB))); - - - /* - If the unit is inactive and the checkbox is checked, then clear echo buffer - this stops any old echo dregs hanging around. - */ - if (!FSOUND_DSP_GetActive(EchoUnit) && (char)Button_GetCheck(GetDlgItem(hwnd,IDC_ECHO))) - { - /* - Set status - */ - ShowWindow(GetDlgItem(mainhwnd,IDC_ECHOSLIDER), SW_SHOW); - memset(EchoBuffer, 0, MAXECHOLEN); /* echolen is in samples. */ - - SendMessage(GetDlgItem(mainhwnd,IDC_ECHOSLIDER), TBM_SETPOS, TRUE, EchoLen * 1000 / outputfreq); - } - if (FSOUND_DSP_GetActive(EchoUnit) && !(char)Button_GetCheck(GetDlgItem(hwnd,IDC_ECHO))) - { - ShowWindow(GetDlgItem(mainhwnd,IDC_ECHOSLIDER), SW_HIDE); - } - - FSOUND_DSP_SetActive(EchoUnit, (char)Button_GetCheck(GetDlgItem(hwnd,IDC_ECHO))); - - - - if (!FSOUND_DSP_GetActive(LowPassUnit) && (char)Button_GetCheck(GetDlgItem(hwnd,IDC_LOWPASS))) - { - /* - Set status - */ - ShowWindow(GetDlgItem(mainhwnd,IDC_CUTOFFSLIDER), SW_SHOW); - ShowWindow(GetDlgItem(mainhwnd,IDC_RESOSLIDER), SW_SHOW); - - SendMessage(GetDlgItem(mainhwnd,IDC_CUTOFFSLIDER), TBM_SETPOS, TRUE, 520 - (int)(LowPassCutoffFrequency / 10.0f)); - SendMessage(GetDlgItem(mainhwnd,IDC_RESOSLIDER), TBM_SETPOS, TRUE, 520 - (int)(LowPassResonance * 50.0f)); - } - if (FSOUND_DSP_GetActive(LowPassUnit) && !(char)Button_GetCheck(GetDlgItem(hwnd,IDC_LOWPASS))) - { - ShowWindow(GetDlgItem(mainhwnd,IDC_CUTOFFSLIDER), SW_HIDE); - ShowWindow(GetDlgItem(mainhwnd,IDC_RESOSLIDER), SW_HIDE); - } - - FSOUND_DSP_SetActive(LowPassUnit, (char)Button_GetCheck(GetDlgItem(hwnd,IDC_LOWPASS))); - } - - /* - Check PLAYLIST checkbox - */ - if (Button_GetCheck(GetDlgItem(hwnd,IDC_PLAYLIST))) - { - mod = song[playlistsong].mod; - if (mod) - { - if (FMUSIC_IsFinished(mod)) - { - FMUSIC_StopSong(mod); - PlayNextSong(); - } - } - else - { - stream = song[playlistsong].stream; - if (stream) - { - int off = FSOUND_Stream_GetTime(stream); - int len = FSOUND_Stream_GetLengthMs(stream); - - if ((!song[playlistsong].url) || (song[playlistsong].url && (FSOUND_Stream_GetOpenState(song[playlistsong].stream) == 0))) - { - if (off >= len) - { - if (song[playlistsong].url) - { - FSOUND_Stream_Close(stream); - song[playlistsong].stream = 0; - } - else - { - FSOUND_Stream_Stop(stream); - } - - song[playlistsong].channel = -1; - - PlayNextSong(); - } - } - } - else - { - if (song[playlistsong].cdtrack) - { - if (setting_cdda) - { - if ((song[playlistsong].channel != -1) && cdda_stream && (FSOUND_Stream_GetOpenState(cdda_stream) == 0)) - { - int off = FSOUND_Stream_GetTime(cdda_stream); - int len = FSOUND_Stream_GetLengthMs(cdda_stream); - - if (off >= len) - { - StopCDTrack(); - PlayNextSong(); - } - } - } - else - { - int off = FSOUND_CD_GetTrackTime(cddevice); - int len = FSOUND_CD_GetTrackLength(cddevice, FSOUND_CD_GetTrack(cddevice)); - if (off >= len) - { - StopCDTrack(); - PlayNextSong(); - } - } - } - } - } - } - - songid = (int)SendMessage(songlist_hwnd, LB_GETCURSEL, 0, 0); - if (songid >= 0) - { - unsigned int lengthms, currtime; - signed char playing = FALSE; - - if (song[songid].mod) - { - mod = song[songid].mod; - UpdateModInfo(songid, FALSE); - SendMessage(GetDlgItem(hwnd,IDC_PROGRESS1), PBM_SETRANGE, 0, MAKELPARAM(0, FMUSIC_GetNumOrders(mod)-1)); - SendMessage(GetDlgItem(hwnd,IDC_PROGRESS1), PBM_SETPOS, FMUSIC_GetOrder(mod), 0); - - /* - Grey out fx buttons for midi - */ - if (FMUSIC_GetType(mod) == FMUSIC_TYPE_MIDI) - { - greyoutfilters = TRUE; - } - - playing = FMUSIC_IsPlaying(mod); - } - else if (song[songid].url) - { - UpdateNetStreamInfo(songid, FALSE, FALSE); - - if (song[songid].stream && (song[songid].channel != -1)) - { - playing = FSOUND_IsPlaying(song[songid].channel); - } - } - else if (song[songid].stream) - { - UpdateStreamInfo(songid, FALSE); - - currtime = FSOUND_Stream_GetTime(song[songid].stream); - lengthms = FSOUND_Stream_GetLengthMs(song[songid].stream); - - SendMessage(GetDlgItem(hwnd,IDC_PROGRESS1), PBM_SETRANGE, 0, MAKELPARAM(0, 1000) ); - SendMessage(GetDlgItem(hwnd,IDC_PROGRESS1), PBM_SETPOS, (WPARAM)((float)currtime / (float)lengthms * 1000.0f), 0); - - if (song[songid].channel != -1) - { - playing = FSOUND_IsPlaying(song[songid].channel); - if (currtime >= lengthms) - { - playing = FALSE; - } - } - } - else if (song[songid].cdtrack) - { - UpdateCDInfo(songid, TRUE); - - if (setting_cdda) - { - if ((song[songid].channel != -1) && cdda_stream) - { - currtime = FSOUND_Stream_GetTime(cdda_stream); - lengthms = FSOUND_Stream_GetLengthMs(cdda_stream); - SendMessage(GetDlgItem(hwnd,IDC_PROGRESS1), PBM_SETRANGE, 0, MAKELPARAM(0, 1000) ); - SendMessage(GetDlgItem(hwnd,IDC_PROGRESS1), PBM_SETPOS, (WPARAM)((float)currtime / (float)lengthms * 1000.0f), 0); - - playing = FSOUND_IsPlaying(song[songid].channel); - } - else - { - currtime = 0; - lengthms = 1; - SendMessage(GetDlgItem(hwnd,IDC_PROGRESS1), PBM_SETRANGE, 0, MAKELPARAM(0, 1000) ); - SendMessage(GetDlgItem(hwnd,IDC_PROGRESS1), PBM_SETPOS, (WPARAM)((float)currtime / (float)lengthms * 1000.0f), 0); - } - } - else - { - if (song[songid].cdtrack == FSOUND_CD_GetTrack(cddevice)) - { - currtime = FSOUND_CD_GetTrackTime(cddevice); - lengthms = FSOUND_CD_GetTrackLength(cddevice, FSOUND_CD_GetTrack(cddevice)); - SendMessage(GetDlgItem(hwnd,IDC_PROGRESS1), PBM_SETRANGE, 0, MAKELPARAM(0, 1000) ); - SendMessage(GetDlgItem(hwnd,IDC_PROGRESS1), PBM_SETPOS, (WPARAM)((float)currtime / (float)lengthms * 1000.0f), 0); - - if (FSOUND_CD_GetTrack(cddevice)) - { - playing = TRUE; - } - } - else - { - currtime = 0; - lengthms = 1; - SendMessage(GetDlgItem(hwnd,IDC_PROGRESS1), PBM_SETRANGE, 0, MAKELPARAM(0, 1000) ); - SendMessage(GetDlgItem(hwnd,IDC_PROGRESS1), PBM_SETPOS, (WPARAM)((float)currtime / (float)lengthms * 1000.0f), 0); - } - } - } - - if (!playing) - { - if (!play_button_play) - { - SetWindowText(GetDlgItem(hwnd, IDC_PLAY), "Play"); - play_button_play = TRUE; - } - } - else - { - if (play_button_play) - { - SetWindowText(GetDlgItem(hwnd, IDC_PLAY), "Stop"); - play_button_play = FALSE; - } - } - - /* - Set position of the master volume slider - */ - if (song[songid].mod) - { - SendMessage(GetDlgItem(hwnd,IDC_SLIDER1), TBM_SETPOS, TRUE, FMUSIC_GetMasterVolume(mod)); - } - else if (song[songid].cdtrack && !setting_cdda) - { - SendMessage(GetDlgItem(hwnd,IDC_SLIDER1), TBM_SETPOS, TRUE, FSOUND_CD_GetVolume(cddevice)); - } - else - { - SendMessage(GetDlgItem(hwnd,IDC_SLIDER1), TBM_SETPOS, TRUE, FSOUND_GetVolume(song[songid].channel)); - } - } - - /* - Update song listbox entries if the open state has changed - */ - { - int numsongs = (int)SendMessage(songlist_hwnd, LB_GETCOUNT, 0, 0); - int count; - - for (count = 0; count < numsongs; count++) - { - int status = -2; - - if (song[count].url) - { - UpdateNetStreamInfo(count, FALSE, TRUE); - } - - if (song[count].stream) - { - status = FSOUND_Stream_GetOpenState(song[count].stream); - } - else if (song[count].mod) - { - status = FMUSIC_GetOpenState(song[count].mod); - } - - if (status != song[count].last_status) - { - if (song[count].stream && !song[count].url && !status) - { - UpdateStreamInfo(count, TRUE); - } - - SendMessage(songlist_hwnd, LB_SETITEMDATA, count, 0); - InvalidateRect(songlist_hwnd, 0, FALSE); - } - song[count].last_status = status; - } - } - - if (greyoutfilters) - { - EnableWindow(GetDlgItem(hwnd,IDC_LOWPASS), FALSE); - EnableWindow(GetDlgItem(hwnd,IDC_PREVERB), FALSE); - EnableWindow(GetDlgItem(hwnd,IDC_ECHO), FALSE); - } - else - { - EnableWindow(GetDlgItem(hwnd,IDC_LOWPASS), TRUE); - EnableWindow(GetDlgItem(hwnd,IDC_PREVERB), TRUE); - EnableWindow(GetDlgItem(hwnd,IDC_ECHO), TRUE); - } - - if (GraphicWindowCurrent == GRAPHICWINDOW_EQUALISER) - { - PlotSpectrum(hdc); - } - else if (GraphicWindowCurrent == GRAPHICWINDOW_WAVE) - { - PlotOscilliscope(hdc); - } - - if (setting_cdda) - { - if (cdda_stream) - { - if (FSOUND_Stream_GetOpenState(cdda_stream) == -3) - { - FSOUND_Stream_Close(cdda_stream); - cdda_stream = 0; - cdda_channel = -1; - MessageBox(0, "ERROR: Unable to open CDDA stream", "Error", MB_ICONHAND | MB_OK | MB_SYSTEMMODAL); - } - else - { - if ((cdda_stream_state != 0) && (FSOUND_Stream_GetOpenState(cdda_stream) == 0)) - { - char *tag; - - cdda_stream_state = 0; - - if (FSOUND_Stream_FindTagField(cdda_stream, FSOUND_TAGFIELD_ASF + 1, "CD_ERROR", (void **)&tag, 0)) - { - MessageBox(mainhwnd, tag, "Error", MB_ICONHAND|MB_OK|MB_SYSTEMMODAL); - FSOUND_Stream_Close(cdda_stream); - cdda_stream = 0; - cdda_channel = -1; - } - else - { - FSOUND_Stream_SetSubStream(cdda_stream, 0); - while (FSOUND_Stream_GetOpenState(cdda_stream) != 0) - { - Sleep(100); - } - - InvalidateRect(songlist_hwnd, 0, FALSE); - } - } - if (cdda_stream) - { - if (FSOUND_Stream_GetLengthMs(cdda_stream) && !DraggingCDSlider) - { - SendMessage(GetDlgItem(hwnd,IDC_CDTIME), TBM_SETPOS, TRUE, (int)((float)FSOUND_Stream_GetTime(cdda_stream) * 1000.0f / (float)FSOUND_Stream_GetLengthMs(cdda_stream))); - } - } - } - } - } - else - { - if (FSOUND_CD_GetTrack(cddevice)) - { - if (FSOUND_CD_GetTrackLength(cddevice, FSOUND_CD_GetTrack(cddevice)) && !DraggingCDSlider) - { - SendMessage(GetDlgItem(hwnd,IDC_CDTIME), TBM_SETPOS, TRUE, (int)((float)FSOUND_CD_GetTrackTime(cddevice) * 1000.0f / (float)FSOUND_CD_GetTrackLength(cddevice, FSOUND_CD_GetTrack(cddevice)))); - } - } - } - - DeleteObject(myfont); - ReleaseDC(hwnd, hdc); - break; - } - - case WM_MEASUREITEM: - { - LPMEASUREITEMSTRUCT lpmis = (LPMEASUREITEMSTRUCT) lParam; - TEXTMETRIC m; - HDC hdc; - - hdc = GetDC(hwnd); - - GetTextMetrics(hdc, &m); - - ReleaseDC(hwnd, hdc); - - lpmis->itemHeight = m.tmAscent; - return TRUE; - } - case WM_DRAWITEM: - { - DRAWITEMSTRUCT FAR *pDIS; - DWORD crBack; - DWORD crText; - HBRUSH hbrBack; - char szBuf[MAX_PATH]; - int state; - - #define PHDC (pDIS->hDC) - #define PRC (pDIS->rcItem) - - pDIS = (DRAWITEMSTRUCT FAR *)lParam; - - if (pDIS->itemID < 0) - { - break; - - } - memset(szBuf, 0, MAX_PATH); - - /* Draw the focus rectangle for an empty list box or an - empty combo box to indicate that the control has the - focus - */ - if ((int)(pDIS->itemID) < 0) - { - switch(pDIS->CtlType) - { - case ODT_LISTBOX: - { - if ((pDIS->itemAction) & (ODA_FOCUS)) - { - DrawFocusRect (PHDC, &PRC); - } - break; - } - case ODT_COMBOBOX: - { - if ((pDIS->itemState) & (ODS_FOCUS)) - { - DrawFocusRect (PHDC, &PRC); - } - break; - } - } - return TRUE; - } - - /* Get the string */ - switch(pDIS->CtlType) - { - case ODT_LISTBOX: - { - SendMessage ( pDIS->hwndItem, LB_GETTEXT, pDIS->itemID, (LPARAM)(LPSTR)szBuf); - break; - } - case ODT_COMBOBOX: - { - SendMessage ( pDIS->hwndItem, CB_GETLBTEXT, pDIS->itemID, (LPARAM)(LPSTR)szBuf); - break; - } - } - - - if ((pDIS->itemState) & (ODS_SELECTED)) - { - /* Set background and text colors for selected item */ - crBack = GetSysColor (COLOR_HIGHLIGHT); - } - else - { - /* Set background and text colors for unselected item */ - crBack = GetSysColor (COLOR_WINDOW); - } - - if (song[pDIS->itemID].mod) - { - state = FMUSIC_GetOpenState(song[pDIS->itemID].mod); - } - if (song[pDIS->itemID].stream) - { - state = FSOUND_Stream_GetOpenState(song[pDIS->itemID].stream); - } - if (song[pDIS->itemID].cdtrack) - { - if (setting_cdda && cdda_stream) - { - state = FSOUND_Stream_GetOpenState(cdda_stream); - } - else - { - state = 0; - } - } - - switch (state) - { - case 0: crText = (pDIS->itemState & ODS_SELECTED) ? GetSysColor(COLOR_HIGHLIGHTTEXT) : GetSysColor(COLOR_WINDOWTEXT) ; break; - case -1: crText = (pDIS->itemState & ODS_SELECTED) ? GetSysColor(COLOR_HIGHLIGHTTEXT) : RGB(255, 0, 0) ; break; - case -2: crText = (pDIS->itemState & ODS_SELECTED) ? GetSysColor(COLOR_HIGHLIGHTTEXT) : RGB(192, 192, 192) ; break; - case -3: crText = (pDIS->itemState & ODS_SELECTED) ? GetSysColor(COLOR_HIGHLIGHTTEXT) : RGB(255, 0, 0) ; break; - case -4: crText = (pDIS->itemState & ODS_SELECTED) ? GetSysColor(COLOR_HIGHLIGHTTEXT) : RGB(0, 0, 255) ; break; - case -5: crText = (pDIS->itemState & ODS_SELECTED) ? GetSysColor(COLOR_HIGHLIGHTTEXT) : RGB(0, 0, 255) ; break; - } - - // Fill item rectangle with background color - hbrBack = CreateSolidBrush (crBack); - FillRect (PHDC, &PRC, hbrBack); - DeleteObject (hbrBack); - - // Set current background and text colors - SetBkColor (PHDC, crBack); - SetTextColor (PHDC, crText); - - // TextOut uses current background and text colors - TextOut ( PHDC, PRC.left, PRC.top, szBuf, lstrlen(szBuf)); - - /* If enabled item has the input focus, call DrawFocusRect to set or clear the focus rectangle */ - if ((pDIS->itemState) & (ODS_FOCUS)) - { - DrawFocusRect (PHDC, &PRC); - } - break; - } - default: - { - return FALSE; - } - } - - return FALSE; -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -#ifdef _WIN64 -INT_PTR CALLBACK FMOD_StreamDetailsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -#else -BOOL CALLBACK FMOD_StreamDetailsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -#endif -{ - switch (msg) - { - case WM_INITDIALOG : - { - RECT r; - char str[8192]; - char tmp[4096]; - int songid, numinfo, i, bitrate; - signed char twotabs = FALSE; - - songid = (int)SendMessage(songlist_hwnd, LB_GETCURSEL, 0, 0); - str[0] = 0; - - FSOUND_Stream_GetNumTagFields(song[songid].stream, &numinfo); - - for (i=0;i < numinfo;i++) - { - char *name, *value; - int type, length; - char *str_streaminfotype[6] = - { - "VORBIS", - "ID3V1", - "ID3V2", - "SHOUTcast", - "Icecast", - "ASF" - }; - - if (FSOUND_Stream_GetTagField(song[songid].stream, i, &type, &name, &value, &length)) - { - if (type == FSOUND_TAGFIELD_SHOUTCAST) - { - twotabs = TRUE; - } - - if (type == FSOUND_TAGFIELD_ID3V2 && ((name[0] == 'T' && value[0] == 0) || !strncmp(name, "COMM", 4))) - { - char tmp2[2048]; - int offset = 0; - - if (name[0] == 'T' && value[0] == 0) - { - offset = 1; - } - else if (!strncmp(name, "COMM", 4) && length > 8) - { - offset = 8; /* a quick hack to skip the COMM tag stuff at the start (language etc), check id3.org for more */ - } - - strncpy(tmp2, value + offset, length - offset); - - tmp2[length - 1] = 0; - - sprintf(tmp, "%s\t%s = %s (%d bytes)\r\n", str_streaminfotype[type], name, tmp2, length); - } - else - { - if (type != FSOUND_TAGFIELD_SHOUTCAST) - { - sprintf(tmp, "%s%s%s = %s (%d bytes)\r\n", str_streaminfotype[type], twotabs ? "\t\t" : "\t", name, value, length); - } - else - { - sprintf(tmp, "%s\t%s = %s (%d bytes)\r\n", str_streaminfotype[type], name, value, length); - } - } - - strcat(str, tmp); - } - } - - if (FSOUND_Stream_Net_GetStatus(song[songid].stream, 0, 0, &bitrate, 0)) - { - sprintf(tmp, "Current bitrate : %d\r\n", bitrate); - strcat(str, tmp); - } - - SetWindowText(GetDlgItem(hwnd, IDC_STREAMDETAILSEDIT), str); - PostMessage(GetDlgItem(hwnd, IDC_STREAMDETAILSEDIT), EM_SETSEL, 0, 0); - GetClientRect(hwnd, &r); - MoveWindow(GetDlgItem(hwnd, IDC_STREAMDETAILSEDIT), 0, 0, r.right, r.bottom, TRUE); - - return TRUE; - } - - case WM_COMMAND : - switch (LOWORD(wParam)) - { - case IDOK : - { - EndDialog(hwnd, 0); - return TRUE; - } - } - break; - - case WM_SIZE : - MoveWindow(GetDlgItem(hwnd, IDC_STREAMDETAILSEDIT), 0, 0, LOWORD(lParam), HIWORD(lParam), TRUE); - return 0; - - case WM_CLOSE: - EndDialog(hwnd, 0); - return TRUE; - - default: - return FALSE; - } - - return FALSE; -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -#ifdef _WIN64 -INT_PTR CALLBACK FMOD_InfoDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -#else -BOOL CALLBACK FMOD_InfoDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -#endif -{ - switch (msg) - { - case WM_COMMAND : - { - switch (LOWORD(wParam)) - { - case IDC_NETSTREAMINFO_DETAILS : - { - int songid = (int)SendMessage(songlist_hwnd, LB_GETCURSEL, 0, 0); - if ((songid >= 0) && song[songid].stream) - { - DialogBox(g_hinst, MAKEINTRESOURCE(IDD_STREAMDETAILSDLG), mainhwnd, FMOD_StreamDetailsDlgProc); - } - break; - } - } - break; - } - - case WM_CLOSE: - { - EndDialog(hwnd, 0); - return TRUE; - } - - default: - return FALSE; - } - - return FALSE; -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -#ifdef _WIN64 -INT_PTR CALLBACK FMOD_LoadURLDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -#else -BOOL CALLBACK FMOD_LoadURLDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -#endif -{ - switch (msg) - { - case WM_INITDIALOG : - { - int i; - HWND h = GetDlgItem(hwnd, IDC_URLCOMBO); - - ComboBox_ResetContent(h); - - for (i=0;i < MRU_MAX;i++) - { - if (!mru[i]) - { - break; - } - - ComboBox_AddString(h, mru[i]); - } - - url_to_load[0] = 0; - SetFocus(hwnd); - return TRUE; - } - - case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case IDOK : - { - ComboBox_GetText(GetDlgItem(hwnd, IDC_URLCOMBO), url_to_load, 4095); - if (strlen(url_to_load)) - { - AddToMRU(url_to_load); - } - EndDialog(hwnd, 1); - return TRUE; - } - - case IDCANCEL : - { - EndDialog(hwnd, 0); - return TRUE; - } - } - break; - } - - case WM_CLOSE : - { - EndDialog(hwnd, 0); - return TRUE; - } - - default: - return FALSE; - } - - return FALSE; -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -BOOL AddToMRU(char *url) -{ - int i, j; - - for (i=0;i < MRU_MAX;i++) - { - if (!mru[i]) - { - break; - } - else - { - if (!strcmp(mru[i], url)) - { - if (i) - { - char *tmp = mru[i]; - for (j=i;j > 0;j--) - { - mru[j] = mru[j - 1]; - } - mru[0] = tmp; - } - - return TRUE; - } - } - } - - for (i=MRU_MAX - 1;i > 0;i--) - { - mru[i] = mru[i - 1]; - } - - mru[0] = strdup(url); - - return FALSE; -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -BOOL UpdateStreamInfo(int songid, BOOL forceupdate) -{ - char s[256]; - static int last_songid = -1; - static unsigned int last_pos = -1; - static int last_time = -1; - BOOL update = forceupdate; - FSOUND_STREAM *stream; - - if (!song[songid].stream) - { - return FALSE; - } - - stream = song[songid].stream; - - if (songid != last_songid) - { - update = TRUE; - } - - if (update) - { - sprintf(s, "Name\t%s", FSOUND_Sample_GetName(FSOUND_Stream_GetSample(stream))); - SetWindowText(GetDlgItem(streaminfo_hwnd, IDC_STREAMINFO_NAME), s); - } - - if ((last_pos != FSOUND_Stream_GetPosition(stream)) || update) - { - sprintf(s, "Pos\t%d/%d", FSOUND_Stream_GetPosition(stream), FSOUND_Stream_GetLength(stream)); - SetWindowText(GetDlgItem(streaminfo_hwnd, IDC_STREAMINFO_POSITION), s); - } - - if ((last_time != FSOUND_Stream_GetTime(stream)) || update) - { - sprintf(s, "Pos\t%d/%d", FSOUND_Stream_GetPosition(stream), FSOUND_Stream_GetLength(stream)); - SetWindowText(GetDlgItem(streaminfo_hwnd, IDC_STREAMINFO_POSITION), s); - sprintf(s, "Time\t%02d:%02d/%02d:%02d", FSOUND_Stream_GetTime(stream) / 1000 / 60, - FSOUND_Stream_GetTime(stream) / 1000 % 60, - FSOUND_Stream_GetLengthMs(stream) / 1000 / 60, - FSOUND_Stream_GetLengthMs(stream) / 1000 % 60); - SetWindowText(GetDlgItem(streaminfo_hwnd, IDC_STREAMINFO_TIME), s); - } - - last_time = FSOUND_Stream_GetTime(stream); - last_pos = FSOUND_Stream_GetPosition(stream); - last_songid = songid; - - return TRUE; -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -BOOL UpdateCDInfo(int songid, BOOL forceupdate) -{ - char s[256]; - static int last_songid = -1; - static unsigned int last_time = -1; - BOOL update = forceupdate; - unsigned int pos, length; - - if (!song[songid].cdtrack) - { - return FALSE; - } - - if (setting_cdda && !cdda_stream) - { - return FALSE; - } - - if (songid != last_songid) - { - update = TRUE; - } - - if (update) - { - sprintf(s, "Name\tTrack %02d", song[songid].cdtrack); - SetWindowText(GetDlgItem(cdinfo_hwnd, IDC_CDINFO_NAME), s); - } - - if ((setting_cdda && (song[songid].channel != -1)) || (!setting_cdda && (FSOUND_CD_GetTrack(cddevice) == song[songid].cdtrack))) - { - pos = setting_cdda ? FSOUND_Stream_GetTime(cdda_stream) : FSOUND_CD_GetTrackTime(cddevice); - length = setting_cdda ? FSOUND_Stream_GetLengthMs(cdda_stream) : FSOUND_CD_GetTrackLength(cddevice, FSOUND_CD_GetTrack(cddevice)); - - if ((last_time != pos) || update) - { - sprintf(s, "Time\t%02d:%02d/%02d:%02d", pos / 1000 / 60, - pos / 1000 % 60, - length / 1000 / 60, - length / 1000 % 60); - SetWindowText(GetDlgItem(cdinfo_hwnd, IDC_CDINFO_TIME), s); - } - } - else - { - if (setting_cdda && (song[songid].channel == -1)) - { - sprintf(s, "Time\t%02d:%02d/%02d:%02d", 0 / 1000 / 60, - 0 / 1000 % 60, - song[songid].cdtrack_length / 1000 / 60, - song[songid].cdtrack_length / 1000 % 60); - SetWindowText(GetDlgItem(cdinfo_hwnd, IDC_CDINFO_TIME), s); - } - else - { - sprintf(s, "Time\t%02d:%02d/%02d:%02d", 0 / 1000 / 60, - 0 / 1000 % 60, - 0 / 1000 / 60, - 0 / 1000 % 60); - SetWindowText(GetDlgItem(cdinfo_hwnd, IDC_CDINFO_TIME), s); - } - } - - last_time = pos; - last_songid = songid; - - return TRUE; -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -BOOL UpdateNetStreamInfo(int songid, BOOL forceupdate, BOOL forceqiuet) -{ - static int last_songid = -1; - static int last_read_percent = -1; - signed char update = forceupdate; - int status, off, len, flags; - char str[4096]; - char *tmp; - - if (!song[songid].url) - { - return FALSE; - } - - if (song[songid].stream) - { - int ret = FSOUND_Stream_GetOpenState(song[songid].stream); - if ((ret == -3) || (ret == -1)) - { - status = FSOUND_STREAM_NET_ERROR; - if (song[songid].last_netstatus != status) - { - char *s; - - if (song[songid].server_status) - { - free(song[songid].server_status); - song[songid].server_status = 0; - } - - s = FSOUND_Stream_Net_GetLastServerStatus(); - if (s) - { - song[songid].server_status = strdup(s); - } - } - } - else - { - FSOUND_Stream_Net_GetStatus(song[songid].stream, &status, 0, 0, 0); - - if ((status == FSOUND_STREAM_NET_READY) && (song[songid].channel == -1)) - { - song[songid].channel = FSOUND_Stream_Play(FSOUND_FREE, song[songid].stream); - if (song[songid].channel != -1) - { - FSOUND_Stream_Net_SetMetadataCallback(song[songid].stream, MetadataCallback, (void *)songid); - update = TRUE; - } - } - - if (FSOUND_Stream_GetOpenState(song[songid].stream) == 0) - { - off = FSOUND_Stream_GetTime(song[songid].stream); - len = FSOUND_Stream_GetLengthMs(song[songid].stream); - - if (off >= len) - { - FSOUND_Stream_Close(song[songid].stream); - song[songid].stream = 0; - song[songid].channel = -1; - song[songid].last_status = -2; - } - } - } - } - else - { - status = FSOUND_STREAM_NET_NOTCONNECTED; - } - - if ((songid != last_songid) || (status != song[songid].last_netstatus)) - { - update = TRUE; - } - - if (song[songid].metadata) - { - song[songid].metadata = 0; - update = TRUE; - } - - last_songid = songid; - song[songid].last_netstatus = status; - - if (!forceqiuet) - { - if (update) - { - SetWindowText(GetDlgItem(netstreaminfo_hwnd, IDC_NETSTREAMINFO_STREAM), "Stream"); - SetWindowText(GetDlgItem(netstreaminfo_hwnd, IDC_NETSTREAMINFO_TRACK), "Track"); - SetWindowText(GetDlgItem(netstreaminfo_hwnd, IDC_NETSTREAMINFO_PROTOCOL), "Proto"); - SetWindowText(GetDlgItem(netstreaminfo_hwnd, IDC_NETSTREAMINFO_FORMAT), "Format"); - SetWindowText(GetDlgItem(netstreaminfo_hwnd, IDC_NETSTREAMINFO_STATUS), "Status"); - - if (!song[songid].url) - { - return TRUE; - } - - switch (status) - { - case FSOUND_STREAM_NET_NOTCONNECTED : - SetWindowText(GetDlgItem(netstreaminfo_hwnd, IDC_NETSTREAMINFO_STATUS), "Status\tNot playing"); - break; - - case FSOUND_STREAM_NET_CONNECTING : - SetWindowText(GetDlgItem(netstreaminfo_hwnd, IDC_NETSTREAMINFO_STATUS), "Status\tConnecting..."); - break; - - case FSOUND_STREAM_NET_BUFFERING : - SetWindowText(GetDlgItem(netstreaminfo_hwnd, IDC_NETSTREAMINFO_STATUS), "Status\tBuffering..."); - break; - - case FSOUND_STREAM_NET_ERROR : - { - if (song[songid].server_status) - { - char tmp[1024]; - sprintf(tmp, "Status\t%s", song[songid].server_status); - SetWindowText(GetDlgItem(netstreaminfo_hwnd, IDC_NETSTREAMINFO_STATUS), tmp); - } - else - { - SetWindowText(GetDlgItem(netstreaminfo_hwnd, IDC_NETSTREAMINFO_STATUS), "Status\tError"); - } - break; - } - - case FSOUND_STREAM_NET_READY : - SetWindowText(GetDlgItem(netstreaminfo_hwnd, IDC_NETSTREAMINFO_STATUS), "Status\tPlaying"); - break; - - default : - SetWindowText(GetDlgItem(netstreaminfo_hwnd, IDC_NETSTREAMINFO_STATUS), "Status\tUnknown"); - break; - } - - if (status != FSOUND_STREAM_NET_NOTCONNECTED) - { - sprintf(str, "Track\t%s%s%s", song[songid].artist ? song[songid].artist : "", song[songid].title ? " - " : "", song[songid].title ? song[songid].title : ""); - SetWindowText(GetDlgItem(netstreaminfo_hwnd, IDC_NETSTREAMINFO_TRACK), str); - - if (song[songid].protocol) - { - sprintf(str, "Proto\t%s", song[songid].protocol); - SetWindowText(GetDlgItem(netstreaminfo_hwnd, IDC_NETSTREAMINFO_PROTOCOL), str); - } - - if (song[songid].format) - { - sprintf(str, "Format\t%s", song[songid].format); - SetWindowText(GetDlgItem(netstreaminfo_hwnd, IDC_NETSTREAMINFO_FORMAT), str); - } - - if (song[songid].streamname) - { - sprintf(str, "Stream\t%s", song[songid].streamname); - SetWindowText(GetDlgItem(netstreaminfo_hwnd, IDC_NETSTREAMINFO_STREAM), str); - } - } - } - - { - int read_percent; - - FSOUND_Stream_Net_GetStatus(song[songid].stream, 0, &read_percent, 0, 0); - if (read_percent != last_read_percent) - { - SendMessage(GetDlgItem(mainhwnd, IDC_PROGRESS1), PBM_SETRANGE, 0, MAKELPARAM(0, 100) ); - SendMessage(GetDlgItem(mainhwnd, IDC_PROGRESS1), PBM_SETPOS, (WPARAM)read_percent, 0); - } - } - - if (FSOUND_Stream_Net_GetStatus(song[songid].stream, 0, 0, 0, &flags)) - { - if (!song[songid].protocol) - { - char *str_protocol[3] = - { - "SHOUTcast", - "Icecast", - "HTTP" - }; - - if (flags & FSOUND_PROTOCOL_SHOUTCAST) - { - tmp = str_protocol[0]; - } - else if (flags & FSOUND_PROTOCOL_ICECAST) - { - tmp = str_protocol[1]; - } - else if (flags & FSOUND_PROTOCOL_HTTP) - { - tmp = str_protocol[2]; - } - else - { - tmp = 0; - } - - if (tmp) - { - song[songid].protocol = tmp; - sprintf(str, "Proto\t%s", tmp); - SetWindowText(GetDlgItem(netstreaminfo_hwnd, IDC_NETSTREAMINFO_PROTOCOL), str); - } - } - - if (!song[songid].format) - { - char *str_format[2] = - { - "MPEG Layer 3", - "Ogg Vorbis" - }; - - if (flags & FSOUND_FORMAT_MPEG) - { - tmp = str_format[0]; - } - else if (flags & FSOUND_FORMAT_OGGVORBIS) - { - tmp = str_format[1]; - } - else - { - tmp = 0; - } - - if (tmp) - { - song[songid].format = tmp; - sprintf(str, "Format\t%s", tmp); - SetWindowText(GetDlgItem(netstreaminfo_hwnd, IDC_NETSTREAMINFO_FORMAT), str); - } - } - - if (!song[songid].streamname) - { - if (flags & FSOUND_PROTOCOL_SHOUTCAST) - { - FSOUND_Stream_FindTagField(song[songid].stream, FSOUND_TAGFIELD_SHOUTCAST, "icy-name", &tmp, 0); - } - else if (flags & FSOUND_PROTOCOL_ICECAST) - { - FSOUND_Stream_FindTagField(song[songid].stream, FSOUND_TAGFIELD_ICECAST, "ice-name", &tmp, 0); - } - else if (flags & FSOUND_PROTOCOL_HTTP) - { - tmp = song[songid].url; - } - else - { - tmp = 0; - } - - if (tmp) - { - song[songid].streamname = tmp; - sprintf(str, "Stream\t%s", tmp); - SetWindowText(GetDlgItem(netstreaminfo_hwnd, IDC_NETSTREAMINFO_STREAM), str); - } - } - } - } - - return TRUE; -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -BOOL UpdateModInfo(int songid, BOOL forceupdate) -{ - char s[256]; - static int last_songid = -1; - static int last_speed = -1; - static int last_bpm = -1; - static int last_order = -1; - static int last_pattern = -1; - static int last_row = -1; - char *type[] = - { - "Unknown ", - "Protracker / FastTracker ", - "ScreamTracker 3 ", - "FastTracker 2 ", - "Impulse Tracker ", - "MIDI ", - "FMOD Sample Bank " - }; - FMUSIC_MODULE *mod = song[songid].mod; - BOOL update = forceupdate; - - if (!song[songid].mod) - { - return FALSE; - } - - if (songid != last_songid) - { - update = TRUE; - } - - if (update) - { - sprintf(s, "Name\t%s", FMUSIC_GetName(mod)); - SetWindowText(GetDlgItem(modinfo_hwnd, IDC_MODINFO_NAME), s); - - sprintf(s, "Type\t%s", type[FMUSIC_GetType(mod)]); - SetWindowText(GetDlgItem(modinfo_hwnd, IDC_MODINFO_TYPE), s); - } - - if ((last_speed != FMUSIC_GetSpeed(mod)) || update) - { - sprintf(s, "Speed\t%02d", FMUSIC_GetSpeed(mod)); - SetWindowText(GetDlgItem(modinfo_hwnd, IDC_MODINFO_SPEED), s); - } - - if ((last_bpm != FMUSIC_GetBPM(mod)) || update) - { - sprintf(s, "BPM\t%03d", FMUSIC_GetBPM(mod)); - SetWindowText(GetDlgItem(modinfo_hwnd, IDC_MODINFO_BPM), s); - } - - if ((last_order != FMUSIC_GetOrder(mod)) || update) - { - sprintf(s, "Order\t%03d / %03d", FMUSIC_GetOrder(mod), FMUSIC_GetNumOrders(mod)); - SetWindowText(GetDlgItem(modinfo_hwnd, IDC_MODINFO_ORDER), s); - } - - if ((last_pattern != FMUSIC_GetPattern(mod)) || update) - { - sprintf(s, "Pattern\t%03d / %03d", FMUSIC_GetPattern(mod), FMUSIC_GetNumPatterns(mod)); - SetWindowText(GetDlgItem(modinfo_hwnd, IDC_MODINFO_PATTERN), s); - } - - if ((last_row != FMUSIC_GetRow(mod)) || (last_order != FMUSIC_GetOrder(mod)) || update) - { - sprintf(s, "Row\t%03d / %03d", FMUSIC_GetRow(mod), FMUSIC_GetPatternLength(mod, FMUSIC_GetOrder(mod))); - SetWindowText(GetDlgItem(modinfo_hwnd, IDC_MODINFO_ROW), s); - } - - last_speed = FMUSIC_GetSpeed(mod); - last_bpm = FMUSIC_GetBPM(mod); - last_order = FMUSIC_GetOrder(mod); - last_pattern = FMUSIC_GetPattern(mod); - last_row = FMUSIC_GetRow(mod); - last_songid = songid; - - return TRUE; -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -void SelectInfoWindow() -{ - int songid; - int songtype = SONGTYPE_NONE; - - ShowWindow(modinfo_hwnd, SW_HIDE); - ShowWindow(streaminfo_hwnd, SW_HIDE); - ShowWindow(netstreaminfo_hwnd, SW_HIDE); - ShowWindow(cdinfo_hwnd, SW_HIDE); - - if (GraphicWindowCurrent == GRAPHICWINDOW_MODINFO) - { - songid = (int)SendMessage(songlist_hwnd, LB_GETCURSEL, 0, 0); - if (songid != LB_ERR) - { - songtype = song[songid].mod ? SONGTYPE_MOD : song[songid].url ? SONGTYPE_NETSTREAM : song[songid].stream ? SONGTYPE_STREAM : song[songid].cdtrack ? SONGTYPE_CD : SONGTYPE_NONE; - } - - switch (songtype) - { - case SONGTYPE_MOD : - SendMessage(GetDlgItem(mainhwnd, IDC_STATIC_INFO), WM_SETTEXT, 0, (LPARAM)(LPCTSTR)"Module Info"); - ShowWindow(modinfo_hwnd, SW_SHOW); - break; - - case SONGTYPE_STREAM : - SendMessage(GetDlgItem(mainhwnd, IDC_STATIC_INFO), WM_SETTEXT, 0, (LPARAM)(LPCTSTR)"Stream Info"); - ShowWindow(streaminfo_hwnd, SW_SHOW); - break; - - case SONGTYPE_NETSTREAM : - SendMessage(GetDlgItem(mainhwnd, IDC_STATIC_INFO), WM_SETTEXT, 0, (LPARAM)(LPCTSTR)"Net Stream Info"); - ShowWindow(netstreaminfo_hwnd, SW_SHOW); - break; - - case SONGTYPE_CD : - SendMessage(GetDlgItem(mainhwnd, IDC_STATIC_INFO), WM_SETTEXT, 0, (LPARAM)(LPCTSTR)"CD Track Info"); - ShowWindow(cdinfo_hwnd, SW_SHOW); - break; - - case SONGTYPE_NONE : - SendMessage(GetDlgItem(mainhwnd, IDC_STATIC_INFO), WM_SETTEXT, 0, (LPARAM)(LPCTSTR)"No file loaded"); - break; - } - } -} - - -/* -[API] -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -char SetupInterface(HINSTANCE hinst, LPSTR lpCmdLine) -{ - char name[2048]; - RECT r; - int desktop_height,desktop_width; - int window_height,window_width; - int i; - - for (i=0;i < MRU_MAX;i++) - { - mru[i] = 0; - } - - LoadSettings(); - - GetWindowRect(GetDesktopWindow(), &r); - desktop_width = r.right - r.left; - desktop_height = r.bottom - r.top; - - /* - Fix up screwed up xy positions - */ - if (setting_xpos > desktop_width || setting_xpos < 0) - { - setting_xpos = (desktop_width / 2)-320; - } - if (setting_ypos > desktop_height || setting_ypos < 0) - { - setting_ypos = (desktop_height / 2)-140; - } - - mainhwnd = CreateDialog(hinst, MAKEINTRESOURCE(IDD_INTERFACE), GetDesktopWindow(), FMOD_DlgProc); - - ShowWindow(mainhwnd, SW_HIDE); - - sprintf(name, "FMOD %.2f", FMOD_VERSION); - SetWindowText(mainhwnd, name); - - - /* - Set the icon - */ -#ifdef _WIN64 - SetClassLong(mainhwnd, GCLP_HICON, (LONG) LoadIcon(hinst, MAKEINTRESOURCE(IDI_ICON1))); -#else - SetClassLong(mainhwnd, GCL_HICON, (LONG) LoadIcon(hinst, MAKEINTRESOURCE(IDI_ICON1))); -#endif - - GetWindowRect(mainhwnd, &r); - MoveWindow(mainhwnd, setting_xpos, setting_ypos, r.right, r.bottom, TRUE); - - window_width = r.right - r.left; - window_height = r.bottom - r.top; - scalex = (float)window_width / WINDOW_WIDTH; - scaley = (float)window_height / WINDOW_HEIGHT; - - ShowWindow(mainhwnd, SW_SHOW); - - InitCommonControls(); - - /* - Set the range of the master volume slider - */ - SendMessage(GetDlgItem(mainhwnd,IDC_SLIDER1), TBM_SETRANGE, TRUE, MAKELPARAM(0, 256)); - - /* - Set position of the master volume slider - */ - SendMessage(GetDlgItem(mainhwnd,IDC_SLIDER1), TBM_SETPOS, TRUE, 256); - - /* - set the range of the echo slider - set position of the echo slider - set status - */ - SendMessage(GetDlgItem(mainhwnd,IDC_ECHOSLIDER), TBM_SETRANGE, TRUE, MAKELPARAM(20, 500)); - SendMessage(GetDlgItem(mainhwnd,IDC_ECHOSLIDER), TBM_SETPOS, TRUE, 500); - ShowWindow(GetDlgItem(mainhwnd,IDC_ECHOSLIDER), SW_HIDE); - - /* - set the range of the cutoff freq slider - set position of the cutoff freq slider - set status - */ - SendMessage(GetDlgItem(mainhwnd,IDC_CUTOFFSLIDER), TBM_SETRANGE, TRUE, MAKELPARAM(20, 500)); - SendMessage(GetDlgItem(mainhwnd,IDC_CUTOFFSLIDER), TBM_SETPOS, TRUE, 20); - ShowWindow(GetDlgItem(mainhwnd,IDC_CUTOFFSLIDER), SW_HIDE); - - /* - set the range of the resonance slider - set position of the resonance slider - set status - */ - SendMessage(GetDlgItem(mainhwnd,IDC_RESOSLIDER), TBM_SETRANGE, TRUE, MAKELPARAM(20, 500)); - SendMessage(GetDlgItem(mainhwnd,IDC_RESOSLIDER), TBM_SETPOS, TRUE, 500); - ShowWindow(GetDlgItem(mainhwnd,IDC_RESOSLIDER), SW_HIDE); - - /* - COMMAND LINE - */ - if (strlen(lpCmdLine)) - { - Playlist *p; - int i; - char *filename = name; - - strcpy(filename, lpCmdLine); - - if (*filename == '"') - { - filename++; - } - - if (filename[strlen(filename) - 1] == '"') - { - filename[strlen(filename) - 1] = 0; - } - - /* - Open the file. - */ - p = ParsePlaylist(filename); - if (p) - { - for (i=0;i < p->count;i++) - { - AddFileToSongList(p->name[i], p->displayname[i]); - } - - FreePlaylist(p); - } - else - { - AddFileToSongList(filename, filename); - } - } - - srand(clock()); - Button_SetCheck(GetDlgItem(mainhwnd,IDC_RADIOCONTINUOUS), TRUE); - - /* - Subclass the position slider so we can get the mouse messages and process them there - */ -#ifdef _WIN64 - oldprogressproc = (WNDPROC)GetWindowLong(GetDlgItem(mainhwnd, IDC_PROGRESS1), GWLP_WNDPROC); - oldcdtimeproc = (WNDPROC)GetWindowLong(GetDlgItem(mainhwnd, IDC_CDTIME), GWLP_WNDPROC); - - SetWindowLong(GetDlgItem(mainhwnd, IDC_PROGRESS1), GWLP_WNDPROC, (LONG)&ProgressWindowProc); - SetWindowLong(GetDlgItem(mainhwnd, IDC_CDTIME), GWLP_WNDPROC, (LONG)&CDTimeWindowProc); -#else - oldprogressproc = (WNDPROC)GetWindowLong(GetDlgItem(mainhwnd, IDC_PROGRESS1), GWL_WNDPROC); - oldcdtimeproc = (WNDPROC)GetWindowLong(GetDlgItem(mainhwnd, IDC_CDTIME), GWL_WNDPROC); - - SetWindowLong(GetDlgItem(mainhwnd, IDC_PROGRESS1), GWL_WNDPROC, (LONG)&ProgressWindowProc); - SetWindowLong(GetDlgItem(mainhwnd, IDC_CDTIME), GWL_WNDPROC, (LONG)&CDTimeWindowProc); -#endif - - SetWindowText(GetDlgItem(mainhwnd, IDC_STATIC_INFO), "No file loaded"); - SetWindowText(GetDlgItem(mainhwnd, IDC_INFOWINDOW), ""); - - streaminfo_hwnd = CreateDialog(hinst, MAKEINTRESOURCE(IDD_STREAMINFODLG), GetDlgItem(mainhwnd, IDC_INFOWINDOW), FMOD_InfoDlgProc); - ShowWindow(streaminfo_hwnd, SW_HIDE); - - netstreaminfo_hwnd = CreateDialog(hinst, MAKEINTRESOURCE(IDD_NETSTREAMINFODLG), GetDlgItem(mainhwnd, IDC_INFOWINDOW), FMOD_InfoDlgProc); - ShowWindow(netstreaminfo_hwnd, SW_HIDE); - - cdinfo_hwnd = CreateDialog(hinst, MAKEINTRESOURCE(IDD_CDINFODLG), GetDlgItem(mainhwnd, IDC_INFOWINDOW), FMOD_InfoDlgProc); - ShowWindow(cdinfo_hwnd, SW_HIDE); - - modinfo_hwnd = CreateDialog(hinst, MAKEINTRESOURCE(IDD_MODINFODLG), GetDlgItem(mainhwnd, IDC_INFOWINDOW), FMOD_InfoDlgProc); - ShowWindow(modinfo_hwnd, SW_HIDE); - - url_to_load[0] = 0; - - if (strlen(lpCmdLine)) - { - int songid = (int)SendMessage(songlist_hwnd, LB_GETCURSEL, 0, 0); - UpdateStreamInfo(songid, TRUE); - UpdateNetStreamInfo(songid, TRUE, FALSE); - UpdateModInfo(songid, TRUE); - UpdateCDInfo(songid, TRUE); - SelectInfoWindow(); - } - - return TRUE; -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -void CloseDown() -{ - int count, i; - RECT r; - int desktop_height, desktop_width; - - GetWindowRect(mainhwnd, &r); - setting_xpos = r.left; - setting_ypos = r.top; - - GetWindowRect(GetDesktopWindow(), &r); - desktop_width = r.right - r.left; - desktop_height = r.bottom - r.top; - if (setting_xpos > desktop_width || setting_xpos < 0) - { - setting_xpos = (desktop_width / 2)-320; - } - if (setting_ypos > desktop_height || setting_ypos < 0) - { - setting_ypos = (desktop_height / 2)-140; - } - - SaveSettings(); - - for (i=0;i < MRU_MAX;i++) - { - if (mru[i]) - { - free(mru[i]); - mru[i] = 0; - } - } - - for (count=0; count -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Application" 0x0101 - -CFG=fmodsample - Win32 Debug64 -!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 "fmodsample.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 "fmodsample.mak" CFG="fmodsample - Win32 Debug64" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "fmodsample - Win32 Release" (based on "Win32 (x86) Application") -!MESSAGE "fmodsample - Win32 Debug" (based on "Win32 (x86) Application") -!MESSAGE "fmodsample - Win32 Debug64" (based on "Win32 (x86) Application") -!MESSAGE "fmodsample - Win32 Release64" (based on "Win32 (x86) Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "fmodsample - 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 "Release" -# PROP Intermediate_Dir "Release" -# 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 /O1 /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 comctl32.lib shell32.lib gdi32.lib user32.lib comdlg32.lib winmm.lib advapi32.lib ..\..\api\lib\fmodvc.lib /nologo /subsystem:windows /machine:I386 /out:"fmod.exe" - -!ELSEIF "$(CFG)" == "fmodsample - 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 "Debug" -# PROP Intermediate_Dir "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 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FD /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 comctl32.lib shell32.lib gdi32.lib user32.lib comdlg32.lib winmm.lib advapi32.lib ..\..\api\lib\fmodvc.lib /nologo /subsystem:windows /debug /machine:I386 /out:"fmod.exe" /pdbtype:sept - -!ELSEIF "$(CFG)" == "fmodsample - Win32 Debug64" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "fmodsample___Win32_Debug64" -# PROP BASE Intermediate_Dir "fmodsample___Win32_Debug64" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug64" -# PROP Intermediate_Dir "Debug64" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MD /W3 /GX /Zi /Od /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_WIN64" /FD /c -# 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 comctl32.lib shell32.lib gdi32.lib user32.lib comdlg32.lib winmm.lib advapi32.lib ..\..\api\lib\fmodvc.lib /nologo /subsystem:windows /debug /machine:I386 /out:"fmod.exe" /pdbtype:sept -# ADD LINK32 comctl32.lib shell32.lib gdi32.lib user32.lib comdlg32.lib winmm.lib advapi32.lib ..\..\api\lib\fmod64vc.lib /nologo /subsystem:windows /incremental:no /debug /machine:IX86 /out:"fmod64.exe" /machine:AMD64 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "fmodsample - Win32 Release64" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "fmodsample___Win32_Release64" -# PROP BASE Intermediate_Dir "fmodsample___Win32_Release64" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release64" -# PROP Intermediate_Dir "Release64" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MD /W3 /GX /O1 /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_WIN64" /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 comctl32.lib shell32.lib gdi32.lib user32.lib comdlg32.lib winmm.lib advapi32.lib ..\..\api\lib\fmodvc.lib /nologo /subsystem:windows /machine:I386 /out:"fmod.exe" -# ADD LINK32 comctl32.lib shell32.lib gdi32.lib user32.lib comdlg32.lib winmm.lib advapi32.lib ..\..\api\lib\fmod64vc.lib /nologo /subsystem:windows /machine:IX86 /out:"fmod64.exe" /machine:AMD64 -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "fmodsample - Win32 Release" -# Name "fmodsample - Win32 Debug" -# Name "fmodsample - Win32 Debug64" -# Name "fmodsample - Win32 Release64" -# Begin Source File - -SOURCE=.\fmod.ico -# End Source File -# Begin Source File - -SOURCE=.\fmod.rc -# End Source File -# Begin Source File - -SOURCE=.\lowpass.c -# End Source File -# Begin Source File - -SOURCE=.\lowpass.h -# End Source File -# Begin Source File - -SOURCE=.\Main.c -# End Source File -# Begin Source File - -SOURCE=.\resource.h -# End Source File -# Begin Source File - -SOURCE=.\reverb.c -# End Source File -# Begin Source File - -SOURCE=.\reverb.h -# End Source File -# Begin Source File - -SOURCE=.\sdriver.c -# End Source File -# Begin Source File - -SOURCE=.\sdriver.h -# End Source File -# End Target -# End Project diff --git a/#ThirdParty/fmodapi375win/samples/fmod/lowpass.c b/#ThirdParty/fmodapi375win/samples/fmod/lowpass.c deleted file mode 100644 index 6659e16..0000000 --- a/#ThirdParty/fmodapi375win/samples/fmod/lowpass.c +++ /dev/null @@ -1,371 +0,0 @@ -/* -Resonant low pass filter source code. -By baltrax@hotmail.com (Zxform) - -- little changes and optimizations by Brett Paterson for FMOD example. - -*/ - -#include -#include -#include - -#include "lowpass.h" - -/************************************************************************** - -FILTER.C - Source code for filter functions - - iir_filter IIR filter floats sample by sample (real time) - -*************************************************************************/ - -FILTER iir; - -/* - * -------------------------------------------------------------------- - * - * iir_filter - Perform IIR filtering sample by sample on floats - * - * Implements cascaded direct form II second order sections. - * Requires FILTER structure for history and coefficients. - * The length in the filter structure specifies the number of sections. - * The size of the history array is 2*iir.length. - * The size of the coefficient array is 4*iir.length + 1 because - * the first coefficient is the overall scale factor for the filter. - * Returns one output sample for each input sample. Allocates history - * array if not previously allocated. - * - * float iir_filter(float input,FILTER *iir) - * - * float input new float input sample - * FILTER *iir pointer to FILTER structure - * - * Returns float value giving the current output. - * - * Allocation errors cause an error message and a call to exit. - * -------------------------------------------------------------------- - */ -float LowPass_Filter(float input) -{ - unsigned int i; - float *hist1_ptr,*hist2_ptr,*coef_ptr; - float output,new_hist,history1,history2; - static float dc = (float)1E-25; - input += dc; - dc = -dc; - - /* allocate history array if different size than last call */ - - coef_ptr = iir.coef; /* coefficient pointer */ - - hist1_ptr = iir.history; /* first history */ - hist2_ptr = hist1_ptr + 1; /* next history */ - - /* 1st number of coefficients array is overall input scale factor, - * or filter gain */ - output = input * (*coef_ptr++); - - for (i = 0 ; i < iir.length; i++) - { - history1 = *hist1_ptr; /* history values */ - history2 = *hist2_ptr; - - output = output - history1 * coef_ptr[0]; - new_hist = output - history2 * coef_ptr[1]; /* poles */ - - output = new_hist + history1 * coef_ptr[2]; - output = output + history2 * coef_ptr[3]; /* zeros */ - - coef_ptr += 4; - *hist2_ptr++ = *hist1_ptr; - *hist1_ptr++ = new_hist; - hist1_ptr++; - hist2_ptr++; - } - - return(output); -} - - -void LowPass_Update(float resonance, float cutoff, int samplerate) -{ - unsigned nInd; - double a0, a1, a2, b0, b1, b2; - double fs; /* Sampling frequency, cutoff frequency */ - double k; /* overall gain factor */ - float *coef; - - k = 1.0; /* Set overall filter gain */ - coef = iir.coef + 1; /* Skip k, or gain */ - fs = (double)samplerate; /* Sampling frequency (Hz) */ - -/* - * Compute z-domain coefficients for each biquad section - * for new Cutoff Frequency and Resonance - */ - for (nInd = 0; nInd < iir.length; nInd++) - { - a0 = ProtoCoef[nInd].a0; - a1 = ProtoCoef[nInd].a1; - a2 = ProtoCoef[nInd].a2; - - b0 = ProtoCoef[nInd].b0; - b1 = ProtoCoef[nInd].b1 / resonance; /* Divide by resonance or Q */ - b2 = ProtoCoef[nInd].b2; - szxform(&a0, &a1, &a2, &b0, &b1, &b2, cutoff, fs, &k, coef); - coef += 4; /* Point to next filter section */ - } - - /* Update overall filter gain in coef array */ - iir.coef[0] = (float)k; -} - - -/* - * -------------------------------------------------------------------- - * - * initn() - * - * Example main function to show how to update filter coefficients. - * We create a 4th order filter (24 db/oct roloff), consisting - * of two second order sections. - * -------------------------------------------------------------------- - */ -signed char LowPass_Init() -{ - -/* - * Setup filter s-domain coefficients - */ - /* Section 1 */ - ProtoCoef[0].a0 = 1.0; - ProtoCoef[0].a1 = 0; - ProtoCoef[0].a2 = 0; - ProtoCoef[0].b0 = 1.0; - ProtoCoef[0].b1 = 0.765367; - ProtoCoef[0].b2 = 1.0; - - /* Section 2 */ - ProtoCoef[1].a0 = 1.0; - ProtoCoef[1].a1 = 0; - ProtoCoef[1].a2 = 0; - ProtoCoef[1].b0 = 1.0; - ProtoCoef[1].b1 = 1.847759; - ProtoCoef[1].b2 = 1.0; - - iir.length = FILTER_SECTIONS; /* Number of filter sections */ - -/* - * Allocate array of z-domain coefficients for each filter section - * plus filter gain variable - */ - iir.coef = (float *) calloc(4 * iir.length + 1, sizeof(float)); - if (!iir.coef) - { -// printf("Unable to allocate coef array, exiting\n"); - return 0; - } - - LowPass_Update(1.0, 5000.0, 44100); - - /* Display filter coefficients */ -// for (nInd = 0; nInd < (iir.length * 4 + 1); nInd++) -// printf("C[%d] = %15.10f\n", nInd, iir.coef[nInd]); -/* - * To process audio samples, call function iir_filter() - * for each audio sample - */ - return 1; -} - -void LowPass_Close() -{ -} - - -/* - * ---------------------------------------------------------- - * bilinear.c - * - * Perform bilinear transformation on s-domain coefficients - * of 2nd order biquad section. - * First design an analog filter and use s-domain coefficients - * as input to szxform() to convert them to z-domain. - * - * Here's the butterworth polinomials for 2nd, 4th and 6th order sections. - * When we construct a 24 db/oct filter, we take to 2nd order - * sections and compute the coefficients separately for each section. - * - * n Polinomials - * -------------------------------------------------------------------- - * 2 s^2 + 1.4142s +1 - * 4 (s^2 + 0.765367s + 1) (s^2 + 1.847759s + 1) - * 6 (s^2 + 0.5176387s + 1) (s^2 + 1.414214 + 1) (s^2 + 1.931852s + 1) - * - * Where n is a filter order. - * For n=4, or two second order sections, we have following equasions for each - * 2nd order stage: - * - * (1 / (s^2 + (1/Q) * 0.765367s + 1)) * (1 / (s^2 + (1/Q) * 1.847759s + 1)) - * - * Where Q is filter quality factor in the range of - * 1 to 1000. The overall filter Q is a product of all - * 2nd order stages. For example, the 6th order filter - * (3 stages, or biquads) with individual Q of 2 will - * have filter Q = 2 * 2 * 2 = 8. - * - * The nominator part is just 1. - * The denominator coefficients for stage 1 of filter are: - * b2 = 1; b1 = 0.765367; b0 = 1; - * numerator is - * a2 = 0; a1 = 0; a0 = 1; - * - * The denominator coefficients for stage 1 of filter are: - * b2 = 1; b1 = 1.847759; b0 = 1; - * numerator is - * a2 = 0; a1 = 0; a0 = 1; - * - * These coefficients are used directly by the szxform() - * and bilinear() functions. For all stages the numerator - * is the same and the only thing that is different between - * different stages is 1st order coefficient. The rest of - * coefficients are the same for any stage and equal to 1. - * - * Any filter could be constructed using this approach. - * - * References: - * Van Valkenburg, "Analog Filter Design" - * Oxford University Press 1982 - * ISBN 0-19-510734-9 - * - * C Language Algorithms for Digital Signal Processing - * Paul Embree, Bruce Kimble - * Prentice Hall, 1991 - * ISBN 0-13-133406-9 - * - * Digital Filter Designer's Handbook - * With C++ Algorithms - * Britton Rorabaugh - * McGraw Hill, 1997 - * ISBN 0-07-053806-9 - * ---------------------------------------------------------- - */ - -void prewarp(double *a0, double *a1, double *a2, double fc, double fs); -void bilinear( - double a0, double a1, double a2, /* numerator coefficients */ - double b0, double b1, double b2, /* denominator coefficients */ - double *k, /* overall gain factor */ - double fs, /* sampling rate */ - float *coef); /* pointer to 4 iir coefficients */ - - -/* - * ---------------------------------------------------------- - * Pre-warp the coefficients of a numerator or denominator. - * Note that a0 is assumed to be 1, so there is no wrapping - * of it. - * ---------------------------------------------------------- - */ -void prewarp( - double *a0, double *a1, double *a2, - double fc, double fs) -{ - double wp, pi; - - pi = 4.0 * atan(1.0); - wp = 2.0 * fs * tan(pi * fc / fs); - - *a2 = (*a2) / (wp * wp); - *a1 = (*a1) / wp; -} - - -/* - * ---------------------------------------------------------- - * bilinear() - * - * Transform the numerator and denominator coefficients - * of s-domain biquad section into corresponding - * z-domain coefficients. - * - * Store the 4 IIR coefficients in array pointed by coef - * in following order: - * beta1, beta2 (denominator) - * alpha1, alpha2 (numerator) - * - * Arguments: - * a0-a2 - s-domain numerator coefficients - * b0-b2 - s-domain denominator coefficients - * k - filter gain factor. initially set to 1 - * and modified by each biquad section in such - * a way, as to make it the coefficient by - * which to multiply the overall filter gain - * in order to achieve a desired overall filter gain, - * specified in initial value of k. - * fs - sampling rate (Hz) - * coef - array of z-domain coefficients to be filled in. - * - * Return: - * On return, set coef z-domain coefficients - * ---------------------------------------------------------- - */ -void bilinear( - double a0, double a1, double a2, /* numerator coefficients */ - double b0, double b1, double b2, /* denominator coefficients */ - double *k, /* overall gain factor */ - double fs, /* sampling rate */ - float *coef /* pointer to 4 iir coefficients */ -) -{ - double ad, bd; - - /* alpha (Numerator in s-domain) */ - ad = 4. * a2 * fs * fs + 2. * a1 * fs + a0; - /* beta (Denominator in s-domain) */ - bd = 4. * b2 * fs * fs + 2. * b1* fs + b0; - - /* update gain constant for this section */ - *k *= ad/bd; - - /* Denominator */ - *coef++ = (float)((2. * b0 - 8. * b2 * fs * fs) / bd); /* beta1 */ - *coef++ = (float)((4. * b2 * fs * fs - 2. * b1 * fs + b0) / bd); /* beta2 */ - - /* Nominator */ - *coef++ = (float)((2. * a0 - 8. * a2 * fs * fs) / ad); /* alpha1 */ - *coef = (float)((4. * a2 * fs * fs - 2. * a1 * fs + a0) / ad); /* alpha2 */ -} - - -/* - * ---------------------------------------------------------- - * Transform from s to z domain using bilinear transform - * with prewarp. - * - * Arguments: - * For argument description look at bilinear() - * - * coef - pointer to array of floating point coefficients, - * corresponding to output of bilinear transofrm - * (z domain). - * - * Note: frequencies are in Hz. - * ---------------------------------------------------------- - */ -void szxform( - double *a0, double *a1, double *a2, /* numerator coefficients */ - double *b0, double *b1, double *b2, /* denominator coefficients */ - double fc, /* Filter cutoff frequency */ - double fs, /* sampling rate */ - double *k, /* overall gain factor */ - float *coef) /* pointer to 4 iir coefficients */ -{ - /* Calculate a1 and a2 and overwrite the original values */ - prewarp(a0, a1, a2, fc, fs); - prewarp(b0, b1, b2, fc, fs); - bilinear(*a0, *a1, *a2, *b0, *b1, *b2, k, fs, coef); -} - - diff --git a/#ThirdParty/fmodapi375win/samples/fmod/lowpass.h b/#ThirdParty/fmodapi375win/samples/fmod/lowpass.h deleted file mode 100644 index 31a33a4..0000000 --- a/#ThirdParty/fmodapi375win/samples/fmod/lowpass.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef _LOWPASS_H -#define _LOWPASS_H - - -/* FILTER INFORMATION STRUCTURE FOR FILTER ROUTINES */ - -#define FILTER_SECTIONS 2 /* 2 filter sections for 24 db/oct filter */ - -typedef struct { - unsigned int length; /* size of filter */ - float history[2 * FILTER_SECTIONS]; /* history in filter */ - float *coef; /* pointer to coefficients of filter */ -} FILTER; - -typedef struct { - double a0, a1, a2; /* numerator coefficients */ - double b0, b1, b2; /* denominator coefficients */ -} BIQUAD; - -BIQUAD ProtoCoef[FILTER_SECTIONS]; /* Filter prototype coefficients, - 1 for each filter section */ - -void szxform( - double *a0, double *a1, double *a2, /* numerator coefficients */ - double *b0, double *b1, double *b2, /* denominator coefficients */ - double fc, /* Filter cutoff frequency */ - double fs, /* sampling rate */ - double *k, /* overall gain factor */ - float *coef); /* pointer to 4 iir coefficients */ - - - -#ifdef __cplusplus - extern "C" { -#endif - - signed char LowPass_Init(); - void LowPass_Close(); - float LowPass_Filter(float input); - void LowPass_Update(float resonance, float cutoff, int samplerate); - -#ifdef __cplusplus - } -#endif - -#endif \ No newline at end of file diff --git a/#ThirdParty/fmodapi375win/samples/fmod/resource.h b/#ThirdParty/fmodapi375win/samples/fmod/resource.h deleted file mode 100644 index 679c62f..0000000 --- a/#ThirdParty/fmodapi375win/samples/fmod/resource.h +++ /dev/null @@ -1,168 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by fmod.rc -// -#define IDS_APPNAME 1 -#define IDS_NOVIDEODRIVERFOUND 2 -#define IDD_DIALOG1 102 -#define IDR_MENU1 103 -#define IDD_INTERFACE 104 -#define IDI_ICON1 105 -#define IDD_DSENUMBOX 109 -#define IDD_CDINTERFACE 111 -#define IDR_MODULE1 113 -#define IDD_STREAMINFODLG 117 -#define IDD_LOADURLDLG 118 -#define IDD_STREAMDETAILSDLG 120 -#define IDD_MODINFODLG 121 -#define IDD_NETSTREAMINFODLG 122 -#define IDD_ABOUTDLG 123 -#define IDD_CDINFODLG 123 -#define IDB_BITMAP1 125 -#define IDD_DIALOGWAIT 127 -#define IDC_RADIO1 1000 -#define IDC_DRIVERNAME 1001 -#define IDC_RADIO2 1001 -#define IDC_FULLSCREEN 1002 -#define IDC_RADIO3 1002 -#define IDC_ZBUFFER 1003 -#define IDC_RADIO4 1003 -#define IDC_PERSCORRECT 1004 -#define IDC_VIDEOMODE 1005 -#define IDC_RADIO5 1005 -#define IDC_TRIPLEBUFFER 1006 -#define IDC_SONGLIST 1006 -#define IDC_BILINEARFILTER 1007 -#define IDC_BUTTON1 1007 -#define IDC_LOAD 1007 -#define IDC_CONFIG_CDINFO 1007 -#define IDC_ZBUFFER2 1008 -#define IDC_BUTTON2 1008 -#define IDC_DELETE 1008 -#define IDC_DEVICES 1009 -#define IDC_LOADURL 1009 -#define IDC_DSENUM_COMBO 1010 -#define IDC_PROGRESS1 1010 -#define IDC_DSENUM_COMBO2 1011 -#define IDC_BUTTON3 1011 -#define IDC_PLAY 1011 -#define IDC_BUTTON4 1012 -#define IDC_DSENUM_COMBO3 1012 -#define IDC_STOP 1012 -#define IDC_CHECK1 1013 -#define IDC_PLAYLIST 1013 -#define IDC_CONFIG_CDDA 1013 -#define IDC_CHECK2 1014 -#define IDC_ECHO 1014 -#define IDC_CONFIG_JITTER 1014 -#define IDC_CHECK3 1015 -#define IDC_LOWPASS 1015 -#define IDC_CONFIG_FORCEASPI 1015 -#define IDC_CHECK4 1016 -#define IDC_FLANGE 1016 -#define IDC_CDLOOPCHECK 1016 -#define IDC_EQUALIZER 1016 -#define IDC_SPECTRUM 1016 -#define IDC_CHECK5 1017 -#define IDC_PLAYLOOPED 1017 -#define IDC_CHECK6 1018 -#define IDC_RESONANCE 1018 -#define IDC_LOADCD 1018 -#define IDC_BUTTON5 1019 -#define IDC_DEBUG 1019 -#define IDC_CDPLAY 1019 -#define IDC_BUTTON6 1020 -#define IDC_EXIT 1020 -#define IDC_BUTTON7 1021 -#define IDC_ABOUT 1021 -#define IDC_BUTTON8 1022 -#define IDC_ORDER_DEC 1022 -#define IDC_BUTTON9 1023 -#define IDC_ORDER_INC 1023 -#define IDC_LAG 1023 -#define IDC_BUTTON10 1024 -#define IDC_CDSTOP 1024 -#define IDC_BUTTON11 1025 -#define IDC_CDPAUSE 1025 -#define IDC_CHECK7 1026 -#define IDC_BASSBOOST 1026 -#define IDC_NR 1026 -#define IDC_REVERB 1026 -#define IDC_CHECK8 1027 -#define IDC_PREVERB 1027 -#define IDC_CHECK9 1028 -#define IDC_CDBACK 1028 -#define IDC_CONFIG 1029 -#define IDC_SLIDER1 1030 -#define IDC_CDFORWARD 1032 -#define IDC_CDEJECT 1033 -#define IDC_RADIOCONTINUOUS 1039 -#define IDC_RADIORANDOM 1040 -#define IDC_RADIOLOOPED 1042 -#define IDC_CDMAXIMIZE 1043 -#define IDC_CDMINIMIZE 1044 -#define IDC_SLIDER2 1045 -#define IDC_ECHOSLIDER 1045 -#define IDC_CUTOFFSLIDER 1046 -#define IDC_CDVOLUME 1047 -#define IDC_RESOSLIDER 1048 -#define IDC_STATIC_NAME 1049 -#define IDC_STATIC_TYPE 1050 -#define IDC_STATIC_SPEED 1051 -#define IDC_STATIC_BPM 1052 -#define IDC_STATIC_ORDER 1053 -#define IDC_STATIC_PATTERN 1054 -#define IDC_STATIC_ROW 1055 -#define IDC_STATIC_INFO 1056 -#define IDC_CDTIME 1058 -#define IDC_INFOWINDOW 1062 -#define IDC_URLCOMBO 1063 -#define IDC_STREAMINFO_NAME 1065 -#define IDC_STREAMINFO_POSITION 1066 -#define IDC_STREAMINFO_TIME 1067 -#define IDC_STREAMDETAILSEDIT 1069 -#define IDC_MODINFO_NAME 1070 -#define IDC_MODINFO_TYPE 1071 -#define IDC_MODINFO_SPEED 1072 -#define IDC_MODINFO_BPM 1073 -#define IDC_MODINFO_ORDER 1074 -#define IDC_MODINFO_PATTERN 1075 -#define IDC_NETSTREAMINFO_STREAM 1075 -#define IDC_MODINFO_ROW 1076 -#define IDC_NETSTREAMINFO_TRACK 1076 -#define IDC_NETSTREAMINFO_PROTOCOL 1077 -#define IDC_NETSTREAMINFO_FORMAT 1078 -#define IDC_NETSTREAMINFO_STATUS 1079 -#define IDC_NETSTREAMINFO_DETAILS 1080 -#define IDC_ABOUT_OUTPUT 1081 -#define IDC_ABOUT_MIXER 1082 -#define IDC_ABOUT_DRIVER 1083 -#define IDC_ABOUT_CHANNELS 1084 -#define IDC_CONFIG_BUFFERSIZE 1085 -#define IDC_CONFIG_INITIALPERCENT 1086 -#define IDC_CONFIG_REBUFFERPERCENT 1087 -#define IDC_CONFIG_PROXY 1088 -#define IDC_CONFIG_CD 1089 -#define IDC_CDINFO_NAME 1092 -#define IDC_CDINFO_TIME 1094 -#define IDC_CDINFO_JITTER 1095 -#define MENU_ABOUT 40001 -#define MENU_OPEN 40002 -#define MENU_EXIT 40003 -#define MENU_PLAYSOUND 40004 -#define MENU_STOPSOUND 40005 -#define MENU_ADDCHANNELS 40006 -#define MENU_REMOVECHANNELS 40007 -#define MENU_INFO 40009 -#define MENU_STEPTHROUGH 40011 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 128 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1096 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/#ThirdParty/fmodapi375win/samples/fmod/reverb.c b/#ThirdParty/fmodapi375win/samples/fmod/reverb.c deleted file mode 100644 index 70766b6..0000000 --- a/#ThirdParty/fmodapi375win/samples/fmod/reverb.c +++ /dev/null @@ -1,419 +0,0 @@ -#include "reverb.h" - -#include -#include - -/* - Pre-verb stuff -*/ -REVERBTAP PreverbTap[PREVERB_NUMTAPS]; - -/* - Reverb stuff -*/ -REVERBTAP ReverbTap[REVERB_NUMTAPS]; - -extern int outputfreq; - -/* -[ - [DESCRIPTION] - Callback to mix in one reverb tap. It copies the buffer into its own history buffer also. - - [PARAMETERS] - 'originalbuffer' Pointer to the original mixbuffer, not any buffers passed down - through the dsp chain. They are in newbuffer. - 'newbuffer' Pointer to buffer passed from previous DSP unit. - 'length' Length in SAMPLES of buffer being passed. - 'param' User parameter. In this case it is a pointer to LowPassBuffer. - - [RETURN_VALUE] - a pointer to the buffer that was passed in, with a tap mixed into it. - - [REMARKS] -] -*/ -void * F_CALLBACKAPI ReverbCallback(void *originalbuffer, void *newbuffer, int length, void *userdata) -{ - int mixertype = FSOUND_GetMixer(); - int count; - int bytesperoutputsample; - REVERBTAP *tap = (REVERBTAP *)userdata; - union sample - { - void *vptr; - signed int *dptr; - signed short *wptr; - float *fptr; - }; - - if (mixertype == FSOUND_MIXER_MMXP5 || mixertype == FSOUND_MIXER_MMXP6 || mixertype == FSOUND_MIXER_QUALITY_MMXP5 || mixertype == FSOUND_MIXER_QUALITY_MMXP6) - { - bytesperoutputsample = 4; // 16bit stereo - } - else - { - bytesperoutputsample = 8; // 32bit stereo - } - - // reverb history buffer is a ringbuffer. If the length makes the copy wrap, then split the copy - // into end part, and start part.. - if (tap->historyoffset + length > tap->historylen) - { - int taillen = tap->historylen - tap->historyoffset; - int startlen = length - taillen; - - // mix a scaled version of history buffer into output - FSOUND_DSP_MixBuffers(newbuffer, tap->historybuff + (tap->historyoffset << 2), taillen, outputfreq, tap->volume, tap->pan, FSOUND_STEREO | FSOUND_16BITS); - FSOUND_DSP_MixBuffers((char *)newbuffer+(taillen * bytesperoutputsample), tap->historybuff, startlen, outputfreq, tap->volume, tap->pan, FSOUND_STEREO | FSOUND_16BITS); - - // now copy input into reverb/history buffer - { - signed short *dest; - union sample src; - - dest = (signed short *)(tap->historybuff + (tap->historyoffset << 2)); - src.vptr = newbuffer; - - for (count=0; count < taillen * 2; count++) - { - int val; - - if (mixertype == FSOUND_MIXER_QUALITY_FPU) - { - val = (int)src.fptr[count]; - } - else if (mixertype == FSOUND_MIXER_MMXP5 || mixertype == FSOUND_MIXER_MMXP6 || mixertype == FSOUND_MIXER_QUALITY_MMXP5 || mixertype == FSOUND_MIXER_QUALITY_MMXP6) - { - val = (int)src.wptr[count]; - } - else - { - val = (int)src.dptr[count]; - } - - val = (val > 32767 ? 32767 : val < -32768 ? -32768 : val); - dest[count] = val; - } - } - { - signed short *dest; - union sample src; - - dest = (signed short *)tap->historybuff; // always 16bit - src.vptr = (char *)newbuffer + (taillen * bytesperoutputsample); - - for (count=0; count < startlen * 2; count++) - { - int val; - - if (mixertype == FSOUND_MIXER_QUALITY_FPU) - { - val = (int)src.fptr[count]; - } - else if (mixertype == FSOUND_MIXER_MMXP5 || mixertype == FSOUND_MIXER_MMXP6 || mixertype == FSOUND_MIXER_QUALITY_MMXP5 || mixertype == FSOUND_MIXER_QUALITY_MMXP6) - { - val = (int)src.wptr[count]; - } - else - { - val = (int)src.dptr[count]; - } - - val = (val > 32767 ? 32767 : val < -32768 ? -32768 : val); - dest[count] = val; - } - } - - } - // no wrapping reverb buffer, just write dest - else - { - // mix a scaled version of history buffer into output - FSOUND_DSP_MixBuffers(newbuffer, tap->historybuff + (tap->historyoffset << 2), length, outputfreq, tap->volume, tap->pan, FSOUND_STEREO | FSOUND_16BITS); - - // now copy input into reverb/history buffer - { - signed short *dest; - union sample src = { newbuffer }; - - dest = (signed short *)(tap->historybuff + (tap->historyoffset << 2)); - - for (count=0; count < length * 2; count++) - { - int val; - - if (mixertype == FSOUND_MIXER_QUALITY_FPU) - { - val = (int)src.fptr[count]; - } - else if (mixertype == FSOUND_MIXER_MMXP5 || mixertype == FSOUND_MIXER_MMXP6 || mixertype == FSOUND_MIXER_QUALITY_MMXP5 || mixertype == FSOUND_MIXER_QUALITY_MMXP6) - { - val = (int)src.wptr[count]; - } - else - { - val = (int)src.dptr[count]; - } - val = (val > 32767 ? 32767 : val < -32768 ? -32768 : val); - dest[count] = val; - } - } - } - - - tap->historyoffset += length; - if (tap->historyoffset >= tap->historylen) - { - tap->historyoffset -= tap->historylen; - } - - // reverb history has been mixed into new buffer, so return it. - return newbuffer; -} - - -/* -[ - [DESCRIPTION] - Similair to a reverb tap except the history copy and the tap mix are done back to front. - - [PARAMETERS] - 'originalbuffer' Pointer to the original mixbuffer, not any buffers passed down - through the dsp chain. They are in newbuffer. - 'newbuffer' Pointer to buffer passed from previous DSP unit. - 'length' Length in SAMPLES of buffer being passed. - 'param' User parameter. In this case it is a pointer to a REVERBTAP structure - - [RETURN_VALUE] - A pointer to the new modified buffer. - - [REMARKS] - - [SEE_ALSO] - LowPassCallback -] -*/ -void * F_CALLBACKAPI PreverbCallback(void *originalbuffer, void *newbuffer, int length, void *userdata) -{ - int mixertype = FSOUND_GetMixer(); - int count; - REVERBTAP *tap = (REVERBTAP *)userdata; - int bytesperoutputsample; - union sample - { - void *vptr; - signed int *dptr; - signed short *wptr; - float *fptr; - }; - - if (mixertype == FSOUND_MIXER_MMXP5 || mixertype == FSOUND_MIXER_MMXP6 || mixertype == FSOUND_MIXER_QUALITY_MMXP5 || mixertype == FSOUND_MIXER_QUALITY_MMXP6) - { - bytesperoutputsample = 4; // 16bit stereo - } - else - { - bytesperoutputsample = 8; // 32bit stereo - } - - // preverbbuff is a ringbuffer. If the length makes the copy wrap, then split the copy - // into end part, and start part - if (tap->historyoffset + length > tap->historylen) - { - int taillen = tap->historylen - tap->historyoffset; - int startlen = length - taillen; // whatever is left - - // get a clean version of the preverb buffer (should be an unscaled history of the mixbuffer) - memcpy(tap->workarea, tap->historybuff + (tap->historyoffset * bytesperoutputsample), taillen * bytesperoutputsample); - memcpy(tap->workarea + (taillen * bytesperoutputsample), tap->historybuff, (length - taillen) * bytesperoutputsample); - - // now copy input into preverb/history buffer - memcpy(tap->historybuff + (tap->historyoffset * bytesperoutputsample), newbuffer, taillen * bytesperoutputsample); - memcpy(tap->historybuff, (signed char *)newbuffer + (taillen * bytesperoutputsample), (length - taillen) * bytesperoutputsample); - } - // no wrapping preverb buffer, just write dest - else - { - // get a clean version of the preverb buffer (should be an unscaled history of the mixbuffer) - memcpy(tap->workarea, tap->historybuff + (tap->historyoffset * bytesperoutputsample), length * bytesperoutputsample); - - // now copy input into preverb/history buffer - memcpy(tap->historybuff + (tap->historyoffset * bytesperoutputsample), newbuffer, length * bytesperoutputsample); - } - - /* - Now we mix a copy of the NEW input into our preverbed buffer - */ - { - union sample src = { newbuffer }; - signed short *dest = (signed short *)tap->workarea2; - - for (count=0; count < length * 2; count++) - { - int val; - - if (mixertype == FSOUND_MIXER_QUALITY_FPU) - { - val = (int)src.fptr[count]; - } - else if (mixertype == FSOUND_MIXER_MMXP5 || mixertype == FSOUND_MIXER_MMXP6 || mixertype == FSOUND_MIXER_QUALITY_MMXP5 || mixertype == FSOUND_MIXER_QUALITY_MMXP6) - { - val = (int)src.wptr[count]; - } - else - { - val = (int)src.dptr[count]; - } - val = (val > 32767 ? 32767 : val < -32768 ? -32768 : val); - dest[count] = val; - } - } - - // now mix a scaled input into this - FSOUND_DSP_MixBuffers(tap->workarea, tap->workarea2, length, outputfreq, tap->volume, tap->pan, FSOUND_STEREO | FSOUND_16BITS); - - tap->historyoffset += length; - if (tap->historyoffset >= tap->historylen) - { - tap->historyoffset -= tap->historylen; - } - - // preverb history has been mixed into new buffer, so return it. - return tap->workarea; -} - - -void Reverb_Init() -{ - int bytesperoutputsample; - int mixertype = FSOUND_GetMixer(); - - if (mixertype == FSOUND_MIXER_MMXP5 || mixertype == FSOUND_MIXER_MMXP6 || mixertype == FSOUND_MIXER_QUALITY_MMXP5 || mixertype == FSOUND_MIXER_QUALITY_MMXP6) - { - bytesperoutputsample = 4; // 16bit stereo - } - else - { - bytesperoutputsample = 8; // 32bit stereo - } - - // ==================================================================================================================== - // PREVERB SETUP - // ==================================================================================================================== - { - int delay[PREVERB_NUMTAPS] = { 57, 97, 163 }; // // prime numbers! dont go lower than 20! it will be smaller than the DSP bufferlen!! (a check is done below for this) - int volume[PREVERB_NUMTAPS] = { 128, 78, 46 }; - int pan[PREVERB_NUMTAPS] = { 128-24, 128+24, 128 }; - int count; - - for (count=0; count< PREVERB_NUMTAPS; count++) - { - PreverbTap[count].delayms = delay[count]; - PreverbTap[count].volume = volume[count]; - PreverbTap[count].pan = pan[count]; - PreverbTap[count].historyoffset = 0; - PreverbTap[count].historylen = (PreverbTap[count].delayms * outputfreq / 1000); - - if (PreverbTap[count].historylen < FSOUND_DSP_GetBufferLength()) - { - PreverbTap[count].historylen = FSOUND_DSP_GetBufferLength(); // just in case our calc is not the same. - } - - PreverbTap[count].historybuff = calloc(PreverbTap[count].historylen + 2048, bytesperoutputsample); - PreverbTap[count].workarea = calloc(FSOUND_DSP_GetBufferLength(), bytesperoutputsample); - PreverbTap[count].workarea2 = calloc(FSOUND_DSP_GetBufferLength(), 4); - PreverbTap[count].Unit = FSOUND_DSP_Create(&PreverbCallback, FSOUND_DSP_DEFAULTPRIORITY_USER+count, &PreverbTap[count]); - } - } - - // ==================================================================================================================== - // REVERB SETUP - // ==================================================================================================================== - { - // something to fiddle with.. - int delay[REVERB_NUMTAPS] = { 131, 149, 173, 211, 281, 401, 457}; // prime numbers! - int volume[REVERB_NUMTAPS] = { 120, 100, 95, 90, 80, 60, 50}; - int pan[REVERB_NUMTAPS] = { 100, 128, 128, 152, 128, 100, 152}; - int count; - - for (count=0; count< REVERB_NUMTAPS; count++) - { - ReverbTap[count].delayms = delay[count]; - ReverbTap[count].volume = volume[count]; - ReverbTap[count].pan = pan[count]; - ReverbTap[count].historyoffset = 0; - ReverbTap[count].historylen = (ReverbTap[count].delayms * outputfreq / 1000); - if (ReverbTap[count].historylen < FSOUND_DSP_GetBufferLength()) - { - ReverbTap[count].historylen = FSOUND_DSP_GetBufferLength(); // just in case our calc is not the same. - } - - ReverbTap[count].historybuff = calloc(ReverbTap[count].historylen, 4); // * 4 is for 16bit stereo buffer - ReverbTap[count].workarea = NULL; - ReverbTap[count].workarea2 = NULL; - ReverbTap[count].Unit = FSOUND_DSP_Create(&ReverbCallback, FSOUND_DSP_DEFAULTPRIORITY_USER+20+(count*2), &ReverbTap[count]); - } - } -} - - -void Reverb_Close() -{ - int count; - - for (count=0; count -#include -#include -#include -#include - -#include "../../api/inc/fmod.h" - -#include "sdriver.h" -#include "resource.h" - -#ifdef _WIN64 -INT_PTR CALLBACK SoundDriverDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); -#else -BOOL CALLBACK SoundDriverDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); -#endif - -WNDPROC oldcomboproc; -HWND DeviceComboHwnd; - -extern int setting_buffersize; -extern int setting_prebuffer_percent; -extern int setting_rebuffer_percent; -extern char setting_http_proxy[2048]; -extern char setting_cdletter[4]; -extern signed char setting_cdda; -extern signed char setting_jitter; -extern signed char setting_forceaspi; -extern char cddevice; - - -/* - Function to call to create dialog box -*/ -char SoundDriver_Init(long *freq) -{ - HWND hwnd = GetForegroundWindow(); -#ifdef _WIN64 - HINSTANCE hinst = (HINSTANCE)GetWindowLong(hwnd,GWLP_HINSTANCE); -#else - HINSTANCE hinst = (HINSTANCE)GetWindowLong(hwnd,GWL_HINSTANCE); -#endif - - return (char)DialogBoxParam(hinst,MAKEINTRESOURCE(IDD_DSENUMBOX), hwnd, SoundDriverDlgProc, (LPARAM)freq); -} - - -/* - SubClassed windowproc for the 'select output' combobox -*/ -long CALLBACK ComboWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) -{ - switch (message) - { - case WM_COMMAND: - { - int count; - - if (ComboBox_GetCurSel(hwnd) == 0) - FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND); - else if (ComboBox_GetCurSel(hwnd) == 1) - FSOUND_SetOutput(FSOUND_OUTPUT_WINMM); - else - FSOUND_SetOutput(FSOUND_OUTPUT_ASIO); - - SendMessage(DeviceComboHwnd, CB_RESETCONTENT, 0, 0); - - for (count=0; count < FSOUND_GetNumDrivers(); count++) - ComboBox_AddString(DeviceComboHwnd, FSOUND_GetDriverName(count)); - - ComboBox_SetCurSel(DeviceComboHwnd,0); - UpdateWindow(DeviceComboHwnd); - - break; - } - - }; - - return (long)oldcomboproc(hwnd, message, wParam, lParam); -} - - -/* - Window proc for dialog box -*/ -#ifdef _WIN64 -INT_PTR CALLBACK SoundDriverDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -#else -BOOL CALLBACK SoundDriverDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) -#endif -{ - static HWND hCombo, hRadio, hCheckbox; - static long *freq; - static long lastoutput=0, lastdriver=0, lastmixer=0, lastoutputrate=44100; - char str[1024]; - - switch (msg) - { - case WM_INITDIALOG: - { - char str[1024]; - int count, buffersize, prebuffer_percent, rebuffer_percent, thisitem, cur; - - /* - Remember what came in last - */ - lastoutput = FSOUND_GetOutput(); - lastdriver = FSOUND_GetDriver(); - lastmixer = FSOUND_GetMixer(); - lastoutputrate = FSOUND_GetOutputRate(); - -#ifdef _WIN64 - if (lastmixer != FSOUND_MIXER_AUTODETECT && - lastmixer != FSOUND_MIXER_QUALITY_AUTODETECT && - lastmixer != FSOUND_MIXER_MONO && - lastmixer != FSOUND_MIXER_QUALITY_MONO) - { - lastmixer = FSOUND_MIXER_QUALITY_AUTODETECT; - } -#else - if (lastmixer > FSOUND_MIXER_QUALITY_MMXP6) - { - lastmixer = FSOUND_MIXER_QUALITY_MMXP6; - } -#endif - - if (lastoutput < FSOUND_OUTPUT_WINMM || lastoutput > FSOUND_OUTPUT_ASIO) - { - lastoutput = FSOUND_OUTPUT_DSOUND; /* somehow lastoutput got corrupted */ - } - if (lastdriver < 0) - { - lastdriver = 0; /* somehow lastdriver got corrupted */ - } - - FSOUND_SetOutput(lastoutput); - - /* - SET UP OUTPUT COMBO BOX - */ - hCombo = GetDlgItem(hwnd,IDC_DSENUM_COMBO3); - ComboBox_AddString(hCombo,"Direct Sound"); - ComboBox_AddString(hCombo,"Windows Multimedia WaveOut"); - ComboBox_AddString(hCombo,"ASIO Low latency"); - - if (lastoutput == FSOUND_OUTPUT_DSOUND) - { - ComboBox_SetCurSel(hCombo,0); - } - if (lastoutput == FSOUND_OUTPUT_WINMM) - { - ComboBox_SetCurSel(hCombo,1); - } - if (lastoutput == FSOUND_OUTPUT_ASIO) - { - ComboBox_SetCurSel(hCombo,2); - } - - /* - Subclass this combo box - */ -#ifdef _WIN64 - oldcomboproc = (WNDPROC)GetWindowLong(hCombo, GWLP_WNDPROC); - SetWindowLong(hCombo, GWLP_WNDPROC, (LONG)ComboWindowProc); -#else - oldcomboproc = (WNDPROC)GetWindowLong(hCombo, GWL_WNDPROC); - SetWindowLong(hCombo, GWL_WNDPROC, (LONG)ComboWindowProc); -#endif - - /* - SET UP MIXER COMBO BOX - */ - hCombo = GetDlgItem(hwnd,IDC_DSENUM_COMBO2); - ComboBox_AddString(hCombo,"Autodetect"); -#ifndef _WIN64 - ComboBox_AddString(hCombo,"Interpolation/Volume Ramping - FPU "); - ComboBox_AddString(hCombo,"Interpolation/Volume Ramping - Pentium MMX"); - ComboBox_AddString(hCombo,"Interpolation/Volume Ramping - P6/P2/P3+ MMX"); -#endif - - if (lastmixer == FSOUND_MIXER_QUALITY_AUTODETECT) ComboBox_SetCurSel(hCombo,0); -#ifndef _WIN64 - if (lastmixer == FSOUND_MIXER_QUALITY_FPU) ComboBox_SetCurSel(hCombo,1); - if (lastmixer == FSOUND_MIXER_QUALITY_MMXP5) ComboBox_SetCurSel(hCombo,2); - if (lastmixer == FSOUND_MIXER_QUALITY_MMXP6) ComboBox_SetCurSel(hCombo,3); -#endif - - /* - SET UP DRIVER COMBO BOX - */ - hCombo = GetDlgItem(hwnd,IDC_DSENUM_COMBO); - DeviceComboHwnd = hCombo; - for (count=0; count < FSOUND_GetNumDrivers(); count++) - { - ComboBox_AddString(hCombo,FSOUND_GetDriverName(count)); - } - - if (ComboBox_GetCount(hCombo)) - { - ComboBox_SetCurSel(hCombo, lastdriver); - } - - /* - SET UP FREQUENCY RADIO BUTTON - */ - if (lastoutputrate == 48000) hRadio = GetDlgItem(hwnd,IDC_RADIO5); - else if (lastoutputrate == 44100) hRadio = GetDlgItem(hwnd,IDC_RADIO1); - else if (lastoutputrate == 22050) hRadio = GetDlgItem(hwnd,IDC_RADIO2); - else if (lastoutputrate == 11025) hRadio = GetDlgItem(hwnd,IDC_RADIO3); - else if (lastoutputrate == 8000) hRadio = GetDlgItem(hwnd,IDC_RADIO4); - else hRadio = GetDlgItem(hwnd,IDC_RADIO1); - - freq = (long *)lParam; - Button_SetCheck(hRadio, TRUE); - - /* - SET UP INTERNET STREAMING VALUES - */ - FSOUND_Stream_Net_GetBufferProperties(&buffersize, &prebuffer_percent, &rebuffer_percent); - sprintf(str, "%d", buffersize); - SetWindowText(GetDlgItem(hwnd, IDC_CONFIG_BUFFERSIZE), str); - sprintf(str, "%d", prebuffer_percent); - SetWindowText(GetDlgItem(hwnd, IDC_CONFIG_INITIALPERCENT), str); - sprintf(str, "%d", rebuffer_percent); - SetWindowText(GetDlgItem(hwnd, IDC_CONFIG_REBUFFERPERCENT), str); - SetWindowText(GetDlgItem(hwnd, IDC_CONFIG_PROXY), setting_http_proxy); - - /* - SET UP CD SETTINGS - */ - thisitem = 0; - hCombo = GetDlgItem(hwnd, IDC_CONFIG_CD); - for (count=2;count < 26;count++) - { - sprintf(str, "%c:\\", (char)('A' + count)); - if (GetDriveType(str) == DRIVE_CDROM) - { - str[2] = 0; - ComboBox_AddString(hCombo, str); - if (!strcmp(str, setting_cdletter)) - { - cur = thisitem; - } - thisitem++; - } - } - ComboBox_SetCurSel(hCombo, cur); - - hCheckbox = GetDlgItem(hwnd, IDC_CONFIG_CDDA); - Button_SetCheck(hCheckbox, setting_cdda); - - hCheckbox = GetDlgItem(hwnd, IDC_CONFIG_JITTER); - Button_SetCheck(hCheckbox, setting_jitter); - - hCheckbox = GetDlgItem(hwnd, IDC_CONFIG_FORCEASPI); - Button_SetCheck(hCheckbox, setting_forceaspi); - - return TRUE; - } - - case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case IDOK : - { - int buffersize, prebuffer_percent, rebuffer_percent; - - hCombo = GetDlgItem(hwnd,IDC_DSENUM_COMBO); - - FSOUND_SetDriver((char)ComboBox_GetCurSel(hCombo)); - - if (Button_GetCheck(GetDlgItem(hwnd,IDC_RADIO5))) *freq = 48000; - else if (Button_GetCheck(GetDlgItem(hwnd,IDC_RADIO1))) *freq = 44100; - else if (Button_GetCheck(GetDlgItem(hwnd,IDC_RADIO2))) *freq = 22050; - else if (Button_GetCheck(GetDlgItem(hwnd,IDC_RADIO3))) *freq = 11025; - else if (Button_GetCheck(GetDlgItem(hwnd,IDC_RADIO4))) *freq = 8000; - - hCombo = GetDlgItem(hwnd,IDC_DSENUM_COMBO2); - switch (ComboBox_GetCurSel(hCombo)) - { - case 0: - FSOUND_SetMixer(FSOUND_MIXER_QUALITY_AUTODETECT); - break; - case 1: - FSOUND_SetMixer(FSOUND_MIXER_QUALITY_FPU); - break; - case 2: - FSOUND_SetMixer(FSOUND_MIXER_QUALITY_MMXP5); - break; - case 3: - FSOUND_SetMixer(FSOUND_MIXER_QUALITY_MMXP6); - break; - } - - GetWindowText(GetDlgItem(hwnd, IDC_CONFIG_BUFFERSIZE), str, 1023); - buffersize = atoi(str); - GetWindowText(GetDlgItem(hwnd, IDC_CONFIG_INITIALPERCENT), str, 1023); - prebuffer_percent = atoi(str); - GetWindowText(GetDlgItem(hwnd, IDC_CONFIG_REBUFFERPERCENT), str, 1023); - rebuffer_percent = atoi(str); - - if (buffersize < 8192) - { - MessageBox(hwnd, "Buffer size too small!", "Warning", MB_OK | MB_ICONWARNING); - return TRUE; - } - - if ((prebuffer_percent <= 0) || (prebuffer_percent > 99)) - { - MessageBox(hwnd, "Initial buffer percent must be between 1 - 99", "Warning", MB_OK | MB_ICONWARNING); - return TRUE; - } - - if ((rebuffer_percent <= 0) || (rebuffer_percent > 99)) - { - MessageBox(hwnd, "Rebuffer percent must be between 1 - 99", "Warning", MB_OK | MB_ICONWARNING); - return TRUE; - } - - setting_buffersize = buffersize; - setting_prebuffer_percent = prebuffer_percent; - setting_rebuffer_percent = rebuffer_percent; - FSOUND_Stream_Net_SetBufferProperties(setting_buffersize, setting_prebuffer_percent, setting_rebuffer_percent); - - GetWindowText(GetDlgItem(hwnd, IDC_CONFIG_PROXY), setting_http_proxy, 2047); - FSOUND_Stream_Net_SetProxy(setting_http_proxy); - - hCombo = GetDlgItem(hwnd, IDC_CONFIG_CD); - ComboBox_GetLBText(hCombo, ComboBox_GetCurSel(hCombo), str); - strncpy(setting_cdletter, str, 2); - cddevice = str[0]; - - hCheckbox = GetDlgItem(hwnd, IDC_CONFIG_CDDA); - setting_cdda = Button_GetCheck(hCheckbox); - - hCheckbox = GetDlgItem(hwnd, IDC_CONFIG_JITTER); - setting_jitter = Button_GetCheck(hCheckbox); - - hCheckbox = GetDlgItem(hwnd, IDC_CONFIG_FORCEASPI); - setting_forceaspi = Button_GetCheck(hCheckbox); - - EndDialog(hwnd,TRUE); - return TRUE; - } - - case IDCANCEL: - FSOUND_SetOutput(lastoutput); - FSOUND_SetDriver(lastdriver); - FSOUND_SetMixer(lastmixer); - - EndDialog(hwnd, FALSE); - return TRUE; - - case IDC_CONFIG_CDINFO : - { - FILE *fp; - char cdstring[5]; - char *cd_device_info; - FSOUND_STREAM *stream; - STARTUPINFO startup_info; - PROCESS_INFORMATION process_info; - - if (!FSOUND_Init(44100, 4, 0)) - { - MessageBox(hwnd, "ERROR: CD/DVD device info not available", "Error", MB_ICONERROR | MB_OK); - break; - } - - hCombo = GetDlgItem(hwnd, IDC_CONFIG_CD); - ComboBox_GetLBText(hCombo, ComboBox_GetCurSel(hCombo), str); - sprintf(cdstring, "%s*?", str); - - stream = FSOUND_Stream_Open(cdstring, 0, 0, 0); - if (!stream) - { - MessageBox(hwnd, "ERROR: CD/DVD device info not available", "Error", MB_ICONERROR | MB_OK); - FSOUND_Close(); - break; - } - - if (FSOUND_Stream_FindTagField(stream, FSOUND_TAGFIELD_ASF + 1, "CD_DEVICE_INFO", (void **)&cd_device_info, 0)) - { - fp = fopen("cd_device_info.txt", "wb"); - fwrite(cd_device_info, 1, strlen(cd_device_info), fp); - fclose(fp); - - memset(&startup_info, 0, sizeof(STARTUPINFO)); - startup_info.cb = sizeof(STARTUPINFO); - - if (CreateProcess(0, - "notepad cd_device_info.txt", - 0, - 0, - TRUE, - NORMAL_PRIORITY_CLASS, - 0, - 0, - &startup_info, - &process_info)) - { - CloseHandle(process_info.hProcess); - CloseHandle(process_info.hThread); - } - else - { - MessageBox(hwnd, "ERROR: CD/DVD device info not available", "Error", MB_ICONERROR | MB_OK); - } - } - else - { - if (FSOUND_Stream_FindTagField(stream, FSOUND_TAGFIELD_ASF + 1, "CD_ERROR", (void **)&cd_device_info, 0)) - { - MessageBox(hwnd, cd_device_info, "Error", MB_ICONHAND|MB_OK|MB_SYSTEMMODAL); - } - else - { - MessageBox(hwnd, "ERROR: CD/DVD device info not available", "Error", MB_ICONERROR | MB_OK); - } - } - - FSOUND_Stream_Close(stream); - FSOUND_Close(); - break; - } - - case IDC_ABOUT : - { - char tmp[128]; - sprintf(tmp, "FMOD %.2f Media Player Copyright (c), Firelight Technologies Pty, Ltd, 1999-2004", FMOD_VERSION); - MessageBox(hwnd, tmp, "About", MB_OK); - break; - } - } - break; - } - default: - { - return FALSE; - } - } - - return FALSE; -} - diff --git a/#ThirdParty/fmodapi375win/samples/fmod/sdriver.h b/#ThirdParty/fmodapi375win/samples/fmod/sdriver.h deleted file mode 100644 index 970c19e..0000000 --- a/#ThirdParty/fmodapi375win/samples/fmod/sdriver.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef _SDRIVER_H_ -#define _SDRIVER_H_ - -char SoundDriver_Init(long *freq); - -#endif - - diff --git a/#ThirdParty/fmodapi375win/samples/fsb/Main.cpp b/#ThirdParty/fmodapi375win/samples/fsb/Main.cpp deleted file mode 100644 index f6700d6..0000000 --- a/#ThirdParty/fmodapi375win/samples/fsb/Main.cpp +++ /dev/null @@ -1,189 +0,0 @@ -//=============================================================================================== -// FSB.EXE -// Copyright (c), Firelight Technologies Pty, Ltd, 1999-2004. -// -// This example demonstrates use of the FMOD Sample Bank format and also usage of the -// FSOUND_Sample_SetDefaultsEx function. -//=============================================================================================== - -#include -#include - -#if defined(WIN32) || defined(_WIN64) || defined(__WATCOMC__) - #include - #include -#else - #include "../../api/inc/wincompat.h" -#endif - -#include "../../api/inc/fmod.h" -#include "../../api/inc/fmod_errors.h" // optional - - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -int main(int argc, char *argv[]) -{ - FSOUND_SAMPLE *sample; - FMUSIC_MODULE *mod; - char key; - int sampleindex = 0, variation = 1, lastopenstate = -1; - - if (FSOUND_GetVersion() < FMOD_VERSION) - { - printf("Error : You are using the wrong DLL version! You should be using FMOD %.02f\n", FMOD_VERSION); - return 1; - } - -#if defined(WIN32) || defined(_WIN64) || defined(__CYGWIN32__) || defined(__WATCOMC__) - FSOUND_SetOutput(FSOUND_OUTPUT_WINMM); -#elif defined(__linux__) - FSOUND_SetOutput(FSOUND_OUTPUT_OSS); -#endif - - // ========================================================================================== - // SELECT DRIVER - // ========================================================================================== - { - long i,driver=0; - char key; - - // The following list are the drivers for the output method selected above. - printf("---------------------------------------------------------\n"); - switch (FSOUND_GetOutput()) - { - case FSOUND_OUTPUT_NOSOUND: printf("NoSound"); break; - case FSOUND_OUTPUT_WINMM: printf("Windows Multimedia Waveout"); break; - case FSOUND_OUTPUT_DSOUND: printf("Direct Sound"); break; - case FSOUND_OUTPUT_A3D: printf("A3D"); break; - case FSOUND_OUTPUT_OSS: printf("Open Sound System"); break; - case FSOUND_OUTPUT_ESD: printf("Enlightenment Sound Daemon"); break; - case FSOUND_OUTPUT_ALSA: printf("ALSA"); break; - }; - printf(" Driver list\n"); - printf("---------------------------------------------------------\n"); - - for (i=0; i < FSOUND_GetNumDrivers(); i++) - { - printf("%d - %s\n", i+1, FSOUND_GetDriverName(i)); // print driver names - } - printf("---------------------------------------------------------\n"); // print driver names - printf("Press a corresponding number or ESC to quit\n"); - - do - { - key = getch(); - if (key == 27) exit(0); - - driver = key - '1'; - } while (driver < 0 || driver >= FSOUND_GetNumDrivers()); - - FSOUND_SetDriver(driver); // Select sound card (0 = default) - } - - // ========================================================================================== - // INITIALIZE - // ========================================================================================== - if (!FSOUND_Init(44100, 32, 0)) - { - printf("Error!\n"); - printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); - FSOUND_Close(); - return 1; - } - - // ========================================================================================== - // OPEN FSB - // ========================================================================================== - mod = FMUSIC_LoadSongEx("../../media/footsteps.fsb", 0, 0, FSOUND_NONBLOCKING, 0, 0); - if (!mod) - { - printf("Error!\n"); - printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); - FSOUND_Close(); - return 1; - } - - printf("=========================================================================\n"); - printf("Press SPACE to toggle pitch/volume variation\n"); - printf("Press ESC to quit\n"); - printf("=========================================================================\n"); - printf("\n"); - - key = 0; - do - { - printf("Pitch/volume variation: %s \r", variation ? "on" : "off"); - fflush(stdout); - - /* - Set initial defaults for both samples. Do this only once as soon as the FSB has finished loading. - */ - if ((lastopenstate != 0) && (FMUSIC_GetOpenState(mod) == 0)) - { - sample = FMUSIC_GetSample(mod, 0); - FSOUND_Sample_SetDefaultsEx(sample, -1, -1, -1, -1, 2000, 128, -1); - sample = FMUSIC_GetSample(mod, 1); - FSOUND_Sample_SetDefaultsEx(sample, -1, -1, -1, -1, 2000, 128, -1); - lastopenstate = 0; - } - - /* - Play a sample from the FSB. Do this once every frame when the FSB has finished loading. - */ - if (FMUSIC_GetOpenState(mod) == 0) - { - sample = FMUSIC_GetSample(mod, sampleindex++ & 1); - FSOUND_PlaySound(FSOUND_FREE, sample); - } - - if (kbhit()) - { - key = getch(); - if (key == ' ') - { - variation ^= 1; - } - - /* - Change the defaults/variations on both samples. - */ - if (variation) - { - sample = FMUSIC_GetSample(mod, 0); - FSOUND_Sample_SetDefaultsEx(sample, -1, -1, -1, -1, 2000, 128, -1); - sample = FMUSIC_GetSample(mod, 1); - FSOUND_Sample_SetDefaultsEx(sample, -1, -1, -1, -1, 2000, 128, -1); - } - else - { - sample = FMUSIC_GetSample(mod, 0); - FSOUND_Sample_SetDefaultsEx(sample, -1, -1, -1, -1, 0, 0, 0); - sample = FMUSIC_GetSample(mod, 1); - FSOUND_Sample_SetDefaultsEx(sample, -1, -1, -1, -1, 0, 0, 0); - } - } - - Sleep(600 + (variation ? (rand() % 100) : 50)); - - } while (key != 27); - - printf("\n"); - - FMUSIC_FreeSong(mod); - FSOUND_Close(); - - return 0; -} diff --git a/#ThirdParty/fmodapi375win/samples/fsb/fsb.dsp b/#ThirdParty/fmodapi375win/samples/fsb/fsb.dsp deleted file mode 100644 index 43c8b2f..0000000 --- a/#ThirdParty/fmodapi375win/samples/fsb/fsb.dsp +++ /dev/null @@ -1,89 +0,0 @@ -# Microsoft Developer Studio Project File - Name="fsb" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=fsb - 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 "fsb.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 "fsb.mak" CFG="fsb - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "fsb - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "fsb - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "fsb - 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 "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0xc09 /d "NDEBUG" -# ADD RSC /l 0xc09 /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:console /machine:I386 -# ADD LINK32 ..\..\api\lib\fmodvc.lib /nologo /subsystem:console /machine:I386 /out:"fsb.exe" - -!ELSEIF "$(CFG)" == "fsb - 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 "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0xc09 /d "_DEBUG" -# ADD RSC /l 0xc09 /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:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ..\..\api\lib\fmodvc.lib /nologo /subsystem:console /debug /machine:I386 /out:"fsb.exe" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "fsb - Win32 Release" -# Name "fsb - Win32 Debug" -# Begin Source File - -SOURCE=.\Main.cpp -# End Source File -# End Target -# End Project diff --git a/#ThirdParty/fmodapi375win/samples/fsb/fsb.exe b/#ThirdParty/fmodapi375win/samples/fsb/fsb.exe deleted file mode 100644 index 50522ef..0000000 Binary files a/#ThirdParty/fmodapi375win/samples/fsb/fsb.exe and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/samples/fsb/watcom.bat b/#ThirdParty/fmodapi375win/samples/fsb/watcom.bat deleted file mode 100644 index e39ffba..0000000 --- a/#ThirdParty/fmodapi375win/samples/fsb/watcom.bat +++ /dev/null @@ -1,2 +0,0 @@ -wpp386 main.cpp -wlink system nt name fsb.exe file main.obj library ..\..\api\lib\fmodwc.lib diff --git a/#ThirdParty/fmodapi375win/samples/multiple/Main.cpp b/#ThirdParty/fmodapi375win/samples/multiple/Main.cpp deleted file mode 100644 index 84e1a3a..0000000 --- a/#ThirdParty/fmodapi375win/samples/multiple/Main.cpp +++ /dev/null @@ -1,241 +0,0 @@ -/*=============================================================================================== - MULTIPLE.EXE - Copyright (c), Firelight Technologies Pty, Ltd 1999-2004. - - This example demonstrates how to use dynamic loading of fmod.dll to achieve multiple soundcard - output at the same time. If you do not have 2 soundcards you will have to select the same - device twice. - Besides this, it is a good helper to display how fmod.dll can be loaded dynamically without - having to link an import library. - - IMPORTANT!!! You must copy fmod.dll to fmod2.dll or libfmod-3.63.so to libfmod-3.63_2.so to - avoid operating systems caching the dll! -===============================================================================================*/ - -#include - -#if defined(WIN32) || defined(_WIN64) || defined(__WATCOMC__) - #include - #include -#else - #include "../../api/inc/wincompat.h" -#endif - -#include "../../api/inc/fmoddyn.h" -#include "../../api/inc/fmod.h" -#include "../../api/inc/fmod_errors.h" /* optional */ - -#if defined(WIN32) || defined(_WIN64) || defined(__CYGWIN32__) || defined(__WATCOMC__) - #define FMOD_LIB "fmod.dll" - #define FMOD_LIB2 "fmod2.dll" -#else - #define FMOD_LIB "libfmod-3.70.so" - #define FMOD_LIB2 "libfmod-3.70_2.so" -#endif - -#define FMOD_LIB_PATH "../../api/" ## FMOD_LIB -#define FMOD_LIB_PATH2 "../../api/" ## FMOD_LIB2 - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -int main() -{ - FMOD_INSTANCE *fmod1, *fmod2; - FSOUND_SAMPLE *samp1, *samp2; - int key; - int driver, i; - -/* system("copy ..\\..\\api\\fmod.dll ..\\..\\api\\fmod2.dll"); */ - - fmod1 = FMOD_CreateInstance(FMOD_LIB_PATH); - fmod2 = FMOD_CreateInstance(FMOD_LIB_PATH2); - - if (!fmod1) - { - printf("Error : Cannot find %s!\n", FMOD_LIB); - return 1; - } - if (!fmod2) - { - printf("Error : Cannot find %s!\n", FMOD_LIB2); - printf("You have to copy %s to %s first to make this work\n", FMOD_LIB, FMOD_LIB2); - return 1; - } - - if (fmod1->FSOUND_GetVersion() < FMOD_VERSION) - { - printf("Error : You are using the wrong DLL version! You should be using FMOD %.02f\n", FMOD_VERSION); - return 1; - } - - if (fmod2->FSOUND_GetVersion() < FMOD_VERSION) - { - printf("Error : You are using the wrong DLL version! You should be using FMOD %.02f\n", FMOD_VERSION); - return 1; - } - -#if defined(WIN32) || defined(_WIN64) || defined(__CYGWIN32__) || defined(__WATCOMC__) - fmod1->FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND); - fmod2->FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND); -#else - fmod1->FSOUND_SetOutput(FSOUND_OUTPUT_OSS); - fmod2->FSOUND_SetOutput(FSOUND_OUTPUT_OSS); -#endif - - /* - SELECT DRIVER 1 - */ - - /* - The following list are the drivers for the output method selected above. - */ - printf("---------------------------------------------------------\n"); - printf("Select soundcard #1\n"); - printf("---------------------------------------------------------\n"); - - for (i=0; i < fmod1->FSOUND_GetNumDrivers(); i++) - { - printf("%d - %s\n", i+1, fmod1->FSOUND_GetDriverName(i)); /* print driver names */ - } - printf("---------------------------------------------------------\n"); - printf("Press a corresponding number or ESC to quit\n"); - - do - { - key = getch(); - if (key == 27) - { - return 0; - } - driver = key - '1'; - } while (driver < 0 || driver >= fmod1->FSOUND_GetNumDrivers()); - - fmod1->FSOUND_SetDriver(driver); /* Select sound card (0 = default) */ - - printf("---------------------------------------------------------\n"); - printf("Select soundcard #2\n"); - printf("---------------------------------------------------------\n"); - - for (i=0; i < fmod2->FSOUND_GetNumDrivers(); i++) - { - printf("%d - %s\n", i+1, fmod2->FSOUND_GetDriverName(i)); /* print driver names */ - } - printf("---------------------------------------------------------\n"); - printf("Press a corresponding number or ESC to quit\n"); - - do - { - key = getch(); - if (key == 27) - { - return 0; - } - driver = key - '1'; - } while (driver < 0 || driver >= fmod2->FSOUND_GetNumDrivers()); - - fmod2->FSOUND_SetDriver(driver); /* Select sound card (0 = default) */ - - /* - INITIALIZE - */ - if (!fmod1->FSOUND_Init(44100, 32, FSOUND_INIT_USEDEFAULTMIDISYNTH)) - { - printf("Error!\n"); - printf("%s\n", FMOD_ErrorString(fmod1->FSOUND_GetError())); - return 1; - } - - /* - INITIALIZE - */ - if (!fmod2->FSOUND_Init(44100, 32, FSOUND_INIT_USEDEFAULTMIDISYNTH)) - { - printf("Error!\n"); - printf("%s\n", FMOD_ErrorString(fmod2->FSOUND_GetError())); - return 1; - } - - /* - LOAD SAMPLE (twice) - */ - - samp1 = fmod1->FSOUND_Sample_Load(FSOUND_UNMANAGED, "../../media/drumloop.wav", FSOUND_NORMAL | FSOUND_2D, 0, 0); - if (!samp1) - { - printf("Error!\n"); - printf("%s\n", FMOD_ErrorString(fmod1->FSOUND_GetError())); - return 1; - } - fmod1->FSOUND_Sample_SetMode(samp1, FSOUND_LOOP_OFF); /* this wav has loop points in it which turns looping on.. turn it off! */ - - samp2 = fmod2->FSOUND_Sample_Load(FSOUND_UNMANAGED, "../../media/drumloop.wav", FSOUND_NORMAL | FSOUND_2D, 0, 0); - if (!samp1) - { - printf("Error!\n"); - printf("%s\n", FMOD_ErrorString(fmod2->FSOUND_GetError())); - return 1; - } - fmod2->FSOUND_Sample_SetMode(samp2, FSOUND_LOOP_OFF); /* this wav has loop points in it which turns looping on.. turn it off! */ - - /* - DISPLAY HELP - */ - - printf("=========================================================================\n"); - printf("Press 1 Play 16bit sound on soundcard #1\n"); - printf(" 2 Play 16bit sound on soundcard #2\n"); - printf(" ESC Quit\n"); - printf("=========================================================================\n"); - - do - { - key = 0; - - if (kbhit()) - { - key = getch(); - - if (key == '1') - { - fmod1->FSOUND_PlaySound(FSOUND_FREE, samp1); - } - if (key == '2') - { - fmod2->FSOUND_PlaySound(FSOUND_FREE, samp2); - } - } - - Sleep(10); - - } while (key != 27); - - printf("\n"); - - /* - CLEANUP AND SHUTDOWN - */ - - fmod1->FSOUND_Sample_Free(samp1); - fmod2->FSOUND_Sample_Free(samp2); - - fmod1->FSOUND_Close(); - fmod2->FSOUND_Close(); - - FMOD_FreeInstance(fmod1); - FMOD_FreeInstance(fmod2); - - return 0; -} - diff --git a/#ThirdParty/fmodapi375win/samples/multiple/multiple.dsp b/#ThirdParty/fmodapi375win/samples/multiple/multiple.dsp deleted file mode 100644 index c4d1dfb..0000000 --- a/#ThirdParty/fmodapi375win/samples/multiple/multiple.dsp +++ /dev/null @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="multiple" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=multiple - 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 "multiple.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 "multiple.mak" CFG="multiple - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "multiple - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "multiple - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "multiple - 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 "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0xc09 /d "NDEBUG" -# ADD RSC /l 0xc09 /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 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:console /machine:I386 -# ADD LINK32 /nologo /subsystem:console /machine:I386 /out:"multiple.exe" - -!ELSEIF "$(CFG)" == "multiple - 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 "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0xc09 /d "_DEBUG" -# ADD RSC /l 0xc09 /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 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:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /out:"multiple.exe" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "multiple - Win32 Release" -# Name "multiple - Win32 Debug" -# Begin Source File - -SOURCE=.\Main.cpp -# End Source File -# End Target -# End Project diff --git a/#ThirdParty/fmodapi375win/samples/multiple/multiple.exe b/#ThirdParty/fmodapi375win/samples/multiple/multiple.exe deleted file mode 100644 index 83e9a20..0000000 Binary files a/#ThirdParty/fmodapi375win/samples/multiple/multiple.exe and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/samples/multiple/watcom.bat b/#ThirdParty/fmodapi375win/samples/multiple/watcom.bat deleted file mode 100644 index 535fdec..0000000 --- a/#ThirdParty/fmodapi375win/samples/multiple/watcom.bat +++ /dev/null @@ -1,2 +0,0 @@ -wpp386 main.cpp -wlink system nt name multiple.exe file main.obj library ..\..\api\lib\fmodwc.lib diff --git a/#ThirdParty/fmodapi375win/samples/netstream/Main.cpp b/#ThirdParty/fmodapi375win/samples/netstream/Main.cpp deleted file mode 100644 index a1b3ddb..0000000 --- a/#ThirdParty/fmodapi375win/samples/netstream/Main.cpp +++ /dev/null @@ -1,243 +0,0 @@ -//=============================================================================================== -// netstream.exe -// Copyright (c), Firelight Technologies Pty, Ltd, 1999-2004. -// -// This example shows how to play internet streams (SHOUTcast/Icecast2/HTTP) -//=============================================================================================== - -#include - -#if defined(WIN32) || defined(_WIN64) || defined(__WATCOMC__) - #include - #include -#else - #include "../../api/inc/wincompat.h" - #include -#endif - -#include "../../api/inc/fmod.h" -#include "../../api/inc/fmod_errors.h" - - -const char *status_str[] = -{ - "NOTCONNECTED", - "CONNECTING ", - "BUFFERING ", - "READY ", - "ERROR " -}; - -const char bar[56] = "=================================================="; -const char nobar[56] = " "; - -char artist[256] = ""; -char title[256] = ""; -int metanum = 0; - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -signed char F_CALLBACKAPI metacallback(char *name, char *value, void *userdata) -{ - if (!strcmp("ARTIST", name)) - { - strcpy(artist, value); - return TRUE; - } - - if (!strcmp("TITLE", name)) - { - strcpy(title, value); - metanum++; - return TRUE; - } - - return TRUE; -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -int main(int argc, char *argv[]) -{ - FSOUND_STREAM *stream; - int read_percent = 0, i, driver = 0, channel = -1, status = 0, openstate, bitrate; - unsigned int flags; - char s[256] = ""; - char key; - - - if (FSOUND_GetVersion() < FMOD_VERSION) - { - printf("Error : You are using the wrong DLL version! You should be using FMOD %.02f\n", FMOD_VERSION); - return 1; - } - - if ((argc < 2) || (strnicmp(argv[1], "http:", 5))) - { - printf("-------------------------------------------------------------\n"); - printf("FMOD netstream example.\n"); - printf("Copyright (c) Firelight Technologies Pty, Ltd, 1999-2004.\n"); - printf("-------------------------------------------------------------\n"); - printf("Syntax: netstream \n"); - printf("Example: netstream http://www.fmod.org/stream.mp3\n\n"); - return 1; - } - -#if defined(WIN32) || defined(_WIN64) || defined(__CYGWIN32__) || defined(__WATCOMC__) - FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND); -#elif defined(__linux__) - FSOUND_SetOutput(FSOUND_OUTPUT_OSS); -#endif - - // ========================================================================================== - // SELECT DRIVER - // ========================================================================================== - printf("---------------------------------------------------------\n"); - switch (FSOUND_GetOutput()) - { - case FSOUND_OUTPUT_NOSOUND: printf("NoSound"); break; - case FSOUND_OUTPUT_WINMM: printf("Windows Multimedia Waveout"); break; - case FSOUND_OUTPUT_DSOUND: printf("Direct Sound"); break; - case FSOUND_OUTPUT_A3D: printf("A3D"); break; - case FSOUND_OUTPUT_OSS: printf("Open Sound System"); break; - case FSOUND_OUTPUT_ESD: printf("Enlightenment Sound Daemon"); break; - case FSOUND_OUTPUT_ALSA: printf("ALSA"); break; - }; - printf(" Driver list\n"); - printf("---------------------------------------------------------\n"); - - for (i=0; i < FSOUND_GetNumDrivers(); i++) - { - printf("%d - %s\n", i+1, FSOUND_GetDriverName(i)); - } - printf("---------------------------------------------------------\n"); - printf("Press a corresponding number or ESC to quit\n"); - - do - { - key = getch(); - if (key == 27) exit(0); - - driver = key - '1'; - } while (driver < 0 || driver >= FSOUND_GetNumDrivers()); - - FSOUND_SetDriver(driver); - - // ========================================================================================== - // INITIALIZE - // ========================================================================================== - if (!FSOUND_Init(44100, 32, 0)) - { - printf("Error!\n"); - printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); - FSOUND_Close(); - return 1; - } - - /* - Internet streams can work with a much smaller stream buffer than normal streams because they - use another level of buffering on top of the stream buffer. - */ - FSOUND_Stream_SetBufferSize(100); - - /* - Here's where we set the size of the network buffer and some buffering parameters. - In this case we want a network buffer of 64k, we want it to prebuffer 60% of that when we first - connect, and we want it to rebuffer 80% of that whenever we encounter a buffer underrun. - */ - FSOUND_Stream_Net_SetBufferProperties(64000, 60, 80); - - /* - Open the stream using FSOUND_NONBLOCKING because the connect/buffer process might take a long time - */ - stream = FSOUND_Stream_Open(argv[1], FSOUND_NORMAL | FSOUND_NONBLOCKING, 0, 0); - if (!stream) - { - printf("Error!\n"); - printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); - FSOUND_Close(); - return 1; - } - - printf("\nPress ESC to quit...\n\n"); - - key = 0; - do - { - if (kbhit()) - { - key = getch(); - } - - /* - Play the stream if it's not already playing - */ - if (channel < 0) - { - channel = FSOUND_Stream_PlayEx(FSOUND_FREE, stream, NULL, TRUE); - FSOUND_SetPaused(channel, FALSE); - - if (channel != -1) - { - FSOUND_Stream_Net_SetMetadataCallback(stream, metacallback, 0); - } - } - - openstate = FSOUND_Stream_GetOpenState(stream); - if ((openstate == -1) || (openstate == -3)) - { - printf("\nERROR: failed to open stream!\n"); - printf("SERVER: %s\n", FSOUND_Stream_Net_GetLastServerStatus()); - break; - } - - FSOUND_Stream_Net_GetStatus(stream, &status, &read_percent, &bitrate, &flags); - - /* - Show how much of the net buffer is used and what the status is - */ - if (metanum) - { - printf("%s - %s\n", artist, title); - metanum = 0; - } - s[0] = 0; - strncat(s, bar, (read_percent >> 1) + (read_percent & 1)); - strncat(s, nobar, (100 - read_percent) >> 1); - printf("|%s| %d%% %s\r", s, read_percent, status_str[status]); - - Sleep(16); - - } while (key != 27); - - printf("\n"); - - FSOUND_Stream_Close(stream); - FSOUND_Close(); - - return 0; -} diff --git a/#ThirdParty/fmodapi375win/samples/netstream/netstream.dsp b/#ThirdParty/fmodapi375win/samples/netstream/netstream.dsp deleted file mode 100644 index 2e557cc..0000000 --- a/#ThirdParty/fmodapi375win/samples/netstream/netstream.dsp +++ /dev/null @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="netstream" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=netstream - 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 "netstream.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 "netstream.mak" CFG="netstream - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "netstream - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "netstream - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "netstream - 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 "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0xc09 /d "NDEBUG" -# ADD RSC /l 0xc09 /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:console /machine:I386 -# ADD LINK32 ..\..\api\lib\fmodvc.lib /nologo /subsystem:console /machine:I386 /out:"netstream.exe" - -!ELSEIF "$(CFG)" == "netstream - 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 "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0xc09 /d "_DEBUG" -# ADD RSC /l 0xc09 /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:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ..\..\api\lib\fmodvc.lib /nologo /subsystem:console /debug /machine:I386 /out:"netstream.exe" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "netstream - Win32 Release" -# Name "netstream - Win32 Debug" -# Begin Source File - -SOURCE=.\Main.cpp -# End Source File -# End Target -# End Project diff --git a/#ThirdParty/fmodapi375win/samples/netstream/netstream.exe b/#ThirdParty/fmodapi375win/samples/netstream/netstream.exe deleted file mode 100644 index 327e2f9..0000000 Binary files a/#ThirdParty/fmodapi375win/samples/netstream/netstream.exe and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/samples/netstream/watcom.bat b/#ThirdParty/fmodapi375win/samples/netstream/watcom.bat deleted file mode 100644 index ae4452c..0000000 --- a/#ThirdParty/fmodapi375win/samples/netstream/watcom.bat +++ /dev/null @@ -1,2 +0,0 @@ -wpp386 main.cpp -wlink system nt name netstream.exe file main.obj library ..\..\api\lib\fmodwc.lib diff --git a/#ThirdParty/fmodapi375win/samples/record/Main.cpp b/#ThirdParty/fmodapi375win/samples/record/Main.cpp deleted file mode 100644 index 8574c34..0000000 --- a/#ThirdParty/fmodapi375win/samples/record/Main.cpp +++ /dev/null @@ -1,783 +0,0 @@ -/* - RECORD.EXE - Copyright (c), Firelight Technologies Pty, Ltd, 2000-2004. - - This example shows how to record data to a static sample, or record dynamically, and have - a dsp unit processing the result. - The reverb below is taken from /samples/fmod/fmod.c -*/ - -#include -#include - -#if defined(WIN32) || defined(__WATCOMC__) || defined(_WIN32) || defined(__WIN32__) - #include - #include - #define __PACKED /*dummy*/ -#else - #include "../../api/inc/wincompat.h" - #include - #define __PACKED __attribute__((packed)) /* gcc packed */ -#endif - -#include "../../api/inc/fmod.h" -#include "../../api/inc/fmod_errors.h" /* optional */ - -#define ENABLEREVERB TRUE -#define RECORDRATE 44100 -#define RECORDLEN (RECORDRATE * 5) /* 5 seconds at RECORDRATE khz */ -#define OUTPUTRATE 44100 - -#define REVERB_NUMTAPS 7 - -typedef struct -{ - FSOUND_DSPUNIT *Unit; - char *historybuff; /* storage space for tap history */ - char *workarea; /* a place to hold 1 buffer worth of data (for reverb) */ - int delayms; /* delay of reverb tab in milliseconds */ - int volume; /* volume of reverb tab */ - int pan; /* pan of reverb tab */ - int historyoffset; /* running offset into history buffer */ - int historylen; /* size of history buffer in SAMPLES */ -} REVERBTAP; - -/* - Reverb stuff -*/ -REVERBTAP DSP_ReverbTap[REVERB_NUMTAPS]; - -/* -[ - [DESCRIPTION] - Callback to mix in one reverb tap. It copies the buffer into its own history buffer also. - - [PARAMETERS] - 'originalbuffer' Pointer to the original mixbuffer, not any buffers passed down - through the dsp chain. They are in newbuffer. - 'newbuffer' Pointer to buffer passed from previous DSP unit. - 'length' Length in SAMPLES of buffer being passed. - 'param' User parameter. In this case it is a pointer to DSP_LowPassBuffer. - - [RETURN_VALUE] - a pointer to the buffer that was passed in, with a tap mixed into it. - - [REMARKS] -] -*/ -void * F_CALLBACKAPI DSP_ReverbCallback(void *originalbuffer, void *newbuffer, int length, void *param) -{ - int mixertype = FSOUND_GetMixer(); - int count; - int bytesperoutputsample; - REVERBTAP *tap = (REVERBTAP *)param; - union sample - { - void *vptr; - signed int *dptr; - signed short *wptr; - float *fptr; - }; - - if (mixertype == FSOUND_MIXER_MMXP5 || mixertype == FSOUND_MIXER_MMXP6 || mixertype == FSOUND_MIXER_QUALITY_MMXP5 || mixertype == FSOUND_MIXER_QUALITY_MMXP6) - { - bytesperoutputsample = 4; // 16bit stereo - } - else - { - bytesperoutputsample = 8; // 32bit stereo - } - - // reverb history buffer is a ringbuffer. If the length makes the copy wrap, then split the copy - // into end part, and start part.. - if (tap->historyoffset + length > tap->historylen) - { - int taillen = tap->historylen - tap->historyoffset; - int startlen = length - taillen; - - // mix a scaled version of history buffer into output - FSOUND_DSP_MixBuffers(newbuffer, tap->historybuff + (tap->historyoffset << 2), taillen, OUTPUTRATE, tap->volume, tap->pan, FSOUND_STEREO | FSOUND_16BITS); - FSOUND_DSP_MixBuffers((char *)newbuffer+(taillen * bytesperoutputsample), tap->historybuff, startlen, OUTPUTRATE, tap->volume, tap->pan, FSOUND_STEREO | FSOUND_16BITS); - - // now copy input into reverb/history buffer - { - signed short *dest; - union sample src; - - dest = (signed short *)(tap->historybuff + (tap->historyoffset << 2)); - src.vptr = newbuffer; - - for (count=0; count < taillen * 2; count++) - { - int val; - - if (mixertype == FSOUND_MIXER_QUALITY_FPU) - { - val = (int)src.fptr[count]; - } - else if (mixertype == FSOUND_MIXER_MMXP5 || mixertype == FSOUND_MIXER_MMXP6 || mixertype == FSOUND_MIXER_QUALITY_MMXP5 || mixertype == FSOUND_MIXER_QUALITY_MMXP6) - { - val = (int)src.wptr[count]; - } - else - { - val = (int)src.dptr[count]; - } - - val = (val > 32767 ? 32767 : val < -32768 ? -32768 : val); - dest[count] = val; - } - } - { - signed short *dest; - union sample src; - - dest = (signed short *)tap->historybuff; // always 16bit - src.vptr = (char *)newbuffer + (taillen * bytesperoutputsample); - - for (count=0; count < startlen * 2; count++) - { - int val; - - if (mixertype == FSOUND_MIXER_QUALITY_FPU) - { - val = (int)src.fptr[count]; - } - else if (mixertype == FSOUND_MIXER_MMXP5 || mixertype == FSOUND_MIXER_MMXP6 || mixertype == FSOUND_MIXER_QUALITY_MMXP5 || mixertype == FSOUND_MIXER_QUALITY_MMXP6) - { - val = (int)src.wptr[count]; - } - else - { - val = (int)src.dptr[count]; - } - - val = (val > 32767 ? 32767 : val < -32768 ? -32768 : val); - dest[count] = val; - } - } - - } - // no wrapping reverb buffer, just write dest - else - { - // mix a scaled version of history buffer into output - FSOUND_DSP_MixBuffers(newbuffer, tap->historybuff + (tap->historyoffset << 2), length, OUTPUTRATE, tap->volume, tap->pan, FSOUND_STEREO | FSOUND_16BITS); - - // now copy input into reverb/history buffer - { - signed short *dest; - union sample src = { newbuffer }; - - dest = (signed short *)(tap->historybuff + (tap->historyoffset << 2)); - - for (count=0; count < length * 2; count++) - { - int val; - - if (mixertype == FSOUND_MIXER_QUALITY_FPU) - { - val = (int)src.fptr[count]; - } - else if (mixertype == FSOUND_MIXER_MMXP5 || mixertype == FSOUND_MIXER_MMXP6 || mixertype == FSOUND_MIXER_QUALITY_MMXP5 || mixertype == FSOUND_MIXER_QUALITY_MMXP6) - { - val = (int)src.wptr[count]; - } - else - { - val = (int)src.dptr[count]; - } - val = (val > 32767 ? 32767 : val < -32768 ? -32768 : val); - dest[count] = val; - } - } - } - - - tap->historyoffset += length; - if (tap->historyoffset >= tap->historylen) - { - tap->historyoffset -= tap->historylen; - } - - // reverb history has been mixed into new buffer, so return it. - return newbuffer; -} - - -/* -[ - [DESCRIPTION] - Initializes reverb, creates DSP units and history buffers for all reverb tabs - - [PARAMETERS] - - [RETURN_VALUE] - void - - [REMARKS] -] -*/ -void SetupReverb() -{ - /* - REVERB SETUP - */ - /* something to fiddle with. */ - int delay[REVERB_NUMTAPS] = { 131, 149, 173, 211, 281, 401, 457}; /* prime numbers make it sound good! */ - int volume[REVERB_NUMTAPS] = { 120, 100, 95, 90, 80, 60, 50}; - int pan[REVERB_NUMTAPS] = { 100, 128, 128, 152, 128, 100, 152}; - int count; - - for (count=0; count< REVERB_NUMTAPS; count++) - { - DSP_ReverbTap[count].delayms = delay[count]; - DSP_ReverbTap[count].volume = volume[count]; - DSP_ReverbTap[count].pan = pan[count]; - DSP_ReverbTap[count].historyoffset = 0; - DSP_ReverbTap[count].historylen = (DSP_ReverbTap[count].delayms * 44100 / 1000); - if (DSP_ReverbTap[count].historylen < FSOUND_DSP_GetBufferLength()) - DSP_ReverbTap[count].historylen = FSOUND_DSP_GetBufferLength(); /* just in case our calc is not the same. */ - - DSP_ReverbTap[count].historybuff = (char *)calloc(DSP_ReverbTap[count].historylen, 4); /* * 4 is for 16bit stereo (mmx only) */ - DSP_ReverbTap[count].workarea = NULL; - DSP_ReverbTap[count].Unit = FSOUND_DSP_Create(&DSP_ReverbCallback, FSOUND_DSP_DEFAULTPRIORITY_USER+20+(count*2), (void *)&DSP_ReverbTap[count]); - - FSOUND_DSP_SetActive(DSP_ReverbTap[count].Unit, TRUE); - } -} - - -/* -[ - [DESCRIPTION] - Shuts down and frees anything to do with the software reverb - - [PARAMETERS] - - [RETURN_VALUE] - void - - [REMARKS] -] -*/ -void CloseReverb() -{ - int count; - - for (count=0; count '4'); - - switch (key) - { -#if defined(WIN32) || defined(_WIN64) || defined(__CYGWIN32__) || defined(__WATCOMC__) - case '1' : FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND); - break; - case '2' : FSOUND_SetOutput(FSOUND_OUTPUT_WINMM); - break; - case '3' : FSOUND_SetOutput(FSOUND_OUTPUT_NOSOUND); - break; -#elif defined(__linux__) - case '1' : FSOUND_SetOutput(FSOUND_OUTPUT_OSS); - break; - case '2' : FSOUND_SetOutput(FSOUND_OUTPUT_ESD); - break; - case '3' : FSOUND_SetOutput(FSOUND_OUTPUT_ALSA); - break; -#endif - default : return 0; - } - - /* - SELECT OUTPUT DRIVER - */ - - /* The following list are the drivers for the output method selected above. */ - printf("---------------------------------------------------------\n"); - switch (FSOUND_GetOutput()) - { - case FSOUND_OUTPUT_NOSOUND: printf("NoSound"); break; - case FSOUND_OUTPUT_WINMM: printf("Windows Multimedia Waveout"); break; - case FSOUND_OUTPUT_DSOUND: printf("Direct Sound"); break; - case FSOUND_OUTPUT_OSS: printf("Open Sound System"); break; - case FSOUND_OUTPUT_ESD: printf("Enlightment Sound Daemon"); break; - case FSOUND_OUTPUT_ALSA: printf("ALSA"); break; - }; - printf(" Driver list\n"); - printf("---------------------------------------------------------\n"); - - for (i=0; i < FSOUND_GetNumDrivers(); i++) - { - printf("%d - %s\n", i+1, FSOUND_GetDriverName(i)); /* print driver names */ - } - printf("---------------------------------------------------------\n"); /* print driver names */ - printf("Press a corresponding number or ESC to quit\n"); - - do - { - key = getch(); - if (key == 27) - { - FSOUND_Close(); - return 0; - } - driver = key - '1'; - } while (driver < 0 || driver >= FSOUND_GetNumDrivers()); - - FSOUND_SetDriver(driver); /* Select sound card (0 = default) */ - - /* - SELECT MIXER - */ - - FSOUND_SetMixer(FSOUND_MIXER_QUALITY_AUTODETECT); - - /* - INITIALIZE - */ - if (!FSOUND_Init(OUTPUTRATE, 64, FSOUND_INIT_ACCURATEVULEVELS)) - { - printf("Error!\n"); - printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); - return 0; - } - - - /* - SELECT INPUT DRIVER (can be done before or after init) - */ - - /* The following list are the drivers for the output method selected above. */ - printf("---------------------------------------------------------\n"); - switch (FSOUND_GetOutput()) - { - case FSOUND_OUTPUT_NOSOUND: printf("NoSound"); break; - case FSOUND_OUTPUT_WINMM: printf("Windows Multimedia Waveout"); break; - case FSOUND_OUTPUT_DSOUND: printf("Direct Sound"); break; - case FSOUND_OUTPUT_OSS: printf("Open Sound System"); break; - case FSOUND_OUTPUT_ESD: printf("Enlightment Sound Daemon"); break; - case FSOUND_OUTPUT_ALSA: printf("ALSA"); break; - }; - printf(" Recording device driver list\n"); - printf("---------------------------------------------------------\n"); - - for (i=0; i < FSOUND_Record_GetNumDrivers(); i++) - { - printf("%d - %s\n", i+1, FSOUND_Record_GetDriverName(i)); /* print driver names */ - } - printf("---------------------------------------------------------\n"); /* print driver names */ - printf("Press a corresponding number or ESC to quit\n"); - - do - { - key = getch(); - if (key == 27) - return 0; - driver = key - '1'; - } while (driver < 0 || driver >= FSOUND_Record_GetNumDrivers()); - - if (!FSOUND_Record_SetDriver(driver)) /* Select input sound card (0 = default) */ - { - printf("Error!\n"); - printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); - FSOUND_Close(); - return 0; - } - - /* - DISPLAY HELP - */ - - printf("FSOUND Output Method : "); - switch (FSOUND_GetOutput()) - { - case FSOUND_OUTPUT_NOSOUND: printf("FSOUND_OUTPUT_NOSOUND\n"); break; - case FSOUND_OUTPUT_WINMM: printf("FSOUND_OUTPUT_WINMM\n"); break; - case FSOUND_OUTPUT_DSOUND: printf("FSOUND_OUTPUT_DSOUND\n"); break; - case FSOUND_OUTPUT_OSS: printf("FSOUND_OUTPUT_OSS\n"); break; - case FSOUND_OUTPUT_ESD: printf("FSOUND_OUTPUT_ESD\n"); break; - case FSOUND_OUTPUT_ALSA: printf("FSOUND_OUTPUT_ALSA\n"); break; - }; - - printf("FSOUND Mixer : "); - switch (FSOUND_GetMixer()) - { - case FSOUND_MIXER_BLENDMODE: printf("FSOUND_MIXER_BLENDMODE\n"); break; - case FSOUND_MIXER_MMXP5: printf("FSOUND_MIXER_MMXP5\n"); break; - case FSOUND_MIXER_MMXP6: printf("FSOUND_MIXER_MMXP6\n"); break; - case FSOUND_MIXER_QUALITY_FPU: printf("FSOUND_MIXER_QUALITY_FPU\n"); break; - case FSOUND_MIXER_QUALITY_MMXP5:printf("FSOUND_MIXER_QUALITY_MMXP5\n"); break; - case FSOUND_MIXER_QUALITY_MMXP6:printf("FSOUND_MIXER_QUALITY_MMXP6\n"); break; - }; - printf("FSOUND Driver : %s\n", FSOUND_GetDriverName(FSOUND_GetDriver())); - printf("FSOUND Record Driver : %s\n", FSOUND_Record_GetDriverName(FSOUND_Record_GetDriver())); - - /* - RECORD INTO A STATIC SAMPLE - */ - - /* - Create a sample to record into - */ - if (FSOUND_GetOutput() == FSOUND_OUTPUT_OSS) - { - samp1 = FSOUND_Sample_Alloc(FSOUND_UNMANAGED, RECORDLEN, FSOUND_MONO | FSOUND_8BITS | FSOUND_UNSIGNED, RECORDRATE, 255, 128, 255); - } - else - { - samp1 = FSOUND_Sample_Alloc(FSOUND_UNMANAGED, RECORDLEN, FSOUND_STEREO | FSOUND_16BITS , RECORDRATE, 255, 128, 255); - } - - printf("\n"); - printf("=========================================================================\n"); - printf("Press a key to start recording 5 seconds worth of data\n"); - printf("=========================================================================\n"); - - getch(); - - if (!FSOUND_Record_StartSample(samp1, FALSE)) /* it will record into this sample for 5 seconds then stop */ - { - printf("Error!\n"); - printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); - - FSOUND_Close(); - return 0; - } - - do - { - printf("Recording position = %d\r", FSOUND_Record_GetPosition()); - Sleep(50); - } while (FSOUND_Record_GetPosition() < RECORDLEN && !kbhit()); - - FSOUND_Record_Stop(); /* it already stopped anyway */ - - printf("\n=========================================================================\n"); - printf("Press a key to play back recorded data\n"); - printf("=========================================================================\n"); - - getch(); - - channel = FSOUND_PlaySound(FSOUND_FREE, samp1); - - printf("Playing back sound...\n"); - - do - { - printf("Playback position = %d\r", FSOUND_GetCurrentPosition(channel)); - Sleep(50); - } while (FSOUND_IsPlaying(channel) && !kbhit()); - - if (FSOUND_GetOutput() == FSOUND_OUTPUT_OSS) - { - FSOUND_Sample_Free(samp1); - FSOUND_Close(); - return 0; - } - - - /* - SAVED TO - */ - SaveToWav(samp1); - - printf("\nSaved to record.wav!\n"); - - - /* - REALTIME FULL DUPLEX RECORD / PLAYBACK! - */ - - printf("\n=========================================================================\n"); - printf("Press a key to do some full duplex realtime recording!\n"); - printf("(with reverb for mmx users)\n"); - printf("=========================================================================\n"); - - getch(); - - FSOUND_Sample_SetMode(samp1, FSOUND_LOOP_NORMAL); /* make it a looping sample */ - - if (!FSOUND_Record_StartSample(samp1, TRUE)) /* start recording and make it loop also */ - { - printf("Error!\n"); - printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); - - FSOUND_Close(); - return 0; - } - - /* - Increase this value if the sound sounds corrupted or the time between recording - and hearing the result is longer than it should be.. - */ - #define RECORD_DELAY_MS 25 - #define RECORD_DELAY_SAMPLES (RECORDRATE * RECORD_DELAY_MS / 1000) - - /* - Let the record cursor move forward a little bit first before we try to play it - (the position jumps in blocks, so any non 0 value will mean 1 block has been recorded) - */ - while (!FSOUND_Record_GetPosition()) - { - Sleep(1); - } - -#ifdef ENABLEREVERB - SetupReverb(); -#endif - - channel = FSOUND_PlaySound(FSOUND_FREE, samp1); /* play the sound */ - - originalfreq = FSOUND_GetFrequency(channel); - -/* printf("initial delay = %d\n", FSOUND_GetCurrentPosition(channel) - FSOUND_Record_GetPosition()); */ - - do - { - int playpos, recordpos, diff; - static int oldrecordpos = 0, oldplaypos = 0; - - playpos = FSOUND_GetCurrentPosition(channel); - recordpos = FSOUND_Record_GetPosition(); - - /* - NOTE : As the recording and playback frequencies arent guarranteed to be exactly in - sync, we have to adjust the playback frequency to keep the 2 cursors just enough - apart not to overlap. (and sound corrupted) - This code tries to keep it inside a reasonable size window just behind the record - cursor. ie [........|play window|<-delay->|<-Record cursor.............] - */ - - /* - Dont do this code if either of the cursors just wrapped - */ - if (playpos > oldplaypos && recordpos > oldrecordpos) - { - diff = playpos - recordpos; - - if (diff > -RECORD_DELAY_SAMPLES) - { - FSOUND_SetFrequency(channel, originalfreq - 1000); /* slow it down */ - } - else if (diff < -(RECORD_DELAY_SAMPLES * 2)) - { - FSOUND_SetFrequency(channel, originalfreq + 1000); /* speed it up */ - } - else - { - FSOUND_SetFrequency(channel, originalfreq); - } - } - - oldplaypos = playpos; - oldrecordpos = recordpos; - - /* - Print some info and a VU meter (vu is smoothed) - */ - { - char vu[19]; - float vuval, l, r; - static float smoothedvu = 0; - - FSOUND_GetCurrentLevels(channel, &l, &r); - vuval = (l+r) * 0.5f; - vuval *= 18.0f; - - #define VUSPEED 0.2f - - if (vuval > smoothedvu) - { - smoothedvu = vuval; - } - - smoothedvu -= VUSPEED; - if (smoothedvu < 0) - { - smoothedvu = 0; - } - - memset(vu, 0, 19); - memset(vu, '=', (int)(smoothedvu)); - - printf("Play=%6d Rec=%6d (gap=%6d, freqchange=%6d hz) VU:%-15s\r", playpos, recordpos, diff, FSOUND_GetFrequency(channel) - originalfreq, vu); - } - - Sleep(10); - } while (!kbhit()); - - getch(); - - FSOUND_StopSound(channel); - FSOUND_Record_Stop(); - -#ifdef ENABLEREVERB - CloseReverb(); -#endif - - /* - CLEANUP AND SHUTDOWN - */ - - FSOUND_Sample_Free(samp1); - FSOUND_Close(); - return 0; -} - diff --git a/#ThirdParty/fmodapi375win/samples/record/record.dsp b/#ThirdParty/fmodapi375win/samples/record/record.dsp deleted file mode 100644 index dceacc0..0000000 --- a/#ThirdParty/fmodapi375win/samples/record/record.dsp +++ /dev/null @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="record" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=record - 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 "record.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 "record.mak" CFG="record - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "record - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "record - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "record - 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 "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x809 /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 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:console /machine:I386 -# ADD LINK32 ..\..\api\lib\fmodvc.lib /nologo /subsystem:console /machine:I386 /out:"record.exe" - -!ELSEIF "$(CFG)" == "record - 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 "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x809 /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 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:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ..\..\api\lib\fmodvc.lib /nologo /subsystem:console /debug /machine:I386 /out:"record.exe" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "record - Win32 Release" -# Name "record - Win32 Debug" -# Begin Source File - -SOURCE=.\Main.cpp -# End Source File -# End Target -# End Project diff --git a/#ThirdParty/fmodapi375win/samples/record/record.exe b/#ThirdParty/fmodapi375win/samples/record/record.exe deleted file mode 100644 index 90e980a..0000000 Binary files a/#ThirdParty/fmodapi375win/samples/record/record.exe and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/samples/record/watcom.bat b/#ThirdParty/fmodapi375win/samples/record/watcom.bat deleted file mode 100644 index d4df00a..0000000 --- a/#ThirdParty/fmodapi375win/samples/record/watcom.bat +++ /dev/null @@ -1,2 +0,0 @@ -wpp386 main.cpp -wlink system nt name record.exe file main.obj library ..\..\api\lib\fmodwc.lib diff --git a/#ThirdParty/fmodapi375win/samples/simple/Main.cpp b/#ThirdParty/fmodapi375win/samples/simple/Main.cpp deleted file mode 100644 index c0adeac..0000000 --- a/#ThirdParty/fmodapi375win/samples/simple/Main.cpp +++ /dev/null @@ -1,452 +0,0 @@ -/*=============================================================================================== - SIMPLE.EXE - Copyright (c), Firelight Technologies Pty, Ltd 1999-2004. - - This example demonstrates some fundamental FMOD usage, including device enumeration, output - mode selection, user file I/O callbacks, loading and playing samples and a music file, and - calling some runtime manipulation and information functions. -===============================================================================================*/ - -#include -#if defined(WIN32) || defined(_WIN64) || defined(__WATCOMC__) - #include - #include -#elif defined(__linux__) - #include "../../api/inc/wincompat.h" -#endif -#include - -#include "../../api/inc/fmod.h" -#include "../../api/inc/fmod_errors.h" /* optional */ - -/* - File callbacks -*/ -void * F_CALLBACKAPI myopen(const char *name) -{ - return fopen(name, "rb"); -} - -void F_CALLBACKAPI myclose(void *handle) -{ - fclose((FILE *)handle); -} - -int F_CALLBACKAPI myread(void *buffer, int size, void *handle) -{ - return (int)fread(buffer, 1, size, (FILE *)handle); -} - -int F_CALLBACKAPI myseek(void *handle, int pos, signed char mode) -{ - return fseek((FILE *)handle, pos, mode); -} - -int F_CALLBACKAPI mytell(void *handle) -{ - return ftell((FILE *)handle); -} - -/* - Memory allocation callbacks -*/ -void * F_CALLBACKAPI myalloc(unsigned int size) -{ - printf("FMOD Malloc'ed %d bytes\n", size); - - return malloc(size); -} - -void * F_CALLBACKAPI myrealloc(void *data, unsigned int size) -{ - printf("FMOD Realloced'ed %d bytes\n", size); - - return realloc(data, size); -} - -void F_CALLBACKAPI myfree(void *ptr) -{ - printf("FMOD freed some memory\n"); - - free(ptr); -} - - - -void F_CALLBACKAPI ordercallback(FMUSIC_MODULE *mod, unsigned char param) -{ - printf("\nOrder Callback : param %d\n", param); -} - -void F_CALLBACKAPI instcallback(FMUSIC_MODULE *mod, unsigned char param) -{ - printf("\nInst Callback : param %d\n", param); -} - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -int main() -{ - FMUSIC_MODULE *mod = 0; - FSOUND_SAMPLE *samp1 = 0, *samp2 = 0, *samp3 = 0; - int key; - int driver, i; - - if (FSOUND_GetVersion() < FMOD_VERSION) - { - printf("Error : You are using the wrong DLL version! You should be using FMOD %.02f\n", FMOD_VERSION); - return 1; - } - - /* - SELECT OUTPUT METHOD - */ - - printf("---------------------------------------------------------\n"); - printf("Output Type\n"); - printf("---------------------------------------------------------\n"); -#if defined(WIN32) || defined(_WIN64) || defined(__CYGWIN32__) || defined(__WATCOMC__) - printf("1 - Direct Sound\n"); - printf("2 - Windows Multimedia Waveout\n"); - printf("3 - ASIO\n"); -#elif defined(__linux__) - printf("1 - OSS - Open Sound System\n"); - printf("2 - ESD - Elightment Sound Daemon\n"); - printf("3 - ALSA 0.9 - Advanced Linux Sound Architecture\n"); -#endif - - printf("4 - NoSound\n"); - printf("---------------------------------------------------------\n"); /* print driver names */ - printf("Press a corresponding number or ESC to quit\n"); - - - do - { - key = getch(); - } while (key != 27 && key < '1' && key > '4'); - - switch (key) - { -#if defined(WIN32) || defined(_WIN64) || defined(__CYGWIN32__) || defined(__WATCOMC__) - case '1' : FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND); - break; - case '2' : FSOUND_SetOutput(FSOUND_OUTPUT_WINMM); - break; - case '3' : FSOUND_SetOutput(FSOUND_OUTPUT_ASIO); - break; -#elif defined(__linux__) - case '1' : FSOUND_SetOutput(FSOUND_OUTPUT_OSS); - break; - case '2' : FSOUND_SetOutput(FSOUND_OUTPUT_ESD); - break; - case '3' : FSOUND_SetOutput(FSOUND_OUTPUT_ALSA); - break; -#endif - case '4' : FSOUND_SetOutput(FSOUND_OUTPUT_NOSOUND); - break; - - default : return 1; - } - - /* - Set custom file callbacks? This doesnt have to be done, its just here as an example. - Not MIDI files do not use file callbacks so midi loading will fail. FMUSIC_LoadSongMemory could be used to load the midi. - */ -#if 0 - FSOUND_File_SetCallbacks(myopen, myclose, myread, myseek, mytell); -#endif - - /* - Set custom memory callbacks? This is optional as well of course. - */ -#if 0 - /* user callbacks */ - if (!FSOUND_SetMemorySystem(NULL, 0, myalloc, myrealloc, myfree)) -#else - /* internal memory management - give it 1 mb and no more mallocs will come from fmod */ - if (!FSOUND_SetMemorySystem(malloc(4*1024*1024), 4*1024*1024, NULL, NULL, NULL)) -#endif - { - printf("Error!\n"); - printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); - return 1; - } - - /* - SELECT DRIVER - */ - - /* - The following list are the drivers for the output method selected above. - */ - printf("---------------------------------------------------------\n"); - switch (FSOUND_GetOutput()) - { - case FSOUND_OUTPUT_NOSOUND: printf("NoSound"); break; -#if defined(WIN32) || defined(_WIN64) || defined(__CYGWIN32__) || defined(__WATCOMC__) - case FSOUND_OUTPUT_WINMM: printf("Windows Multimedia Waveout"); break; - case FSOUND_OUTPUT_DSOUND: printf("Direct Sound"); break; - case FSOUND_OUTPUT_ASIO: printf("ASIO"); break; -#elif defined(__linux__) - case FSOUND_OUTPUT_OSS: printf("Open Sound System"); break; - case FSOUND_OUTPUT_ESD: printf("Enlightment Sound Daemon"); break; - case FSOUND_OUTPUT_ALSA: printf("ALSA"); break; -#endif - - }; - - printf(" Driver list\n"); - printf("---------------------------------------------------------\n"); - - for (i=0; i < FSOUND_GetNumDrivers(); i++) - { - printf("%d - %s\n", i+1, FSOUND_GetDriverName(i)); /* print driver names */ - } - printf("---------------------------------------------------------\n"); - printf("Press a corresponding number or ESC to quit\n"); - - do - { - key = getch(); - if (key == 27) - { - return 0; - } - driver = key - '1'; - } while (driver < 0 || driver >= FSOUND_GetNumDrivers()); - - FSOUND_SetDriver(driver); /* Select sound card (0 = default) */ - - /* - INITIALIZE - */ - if (!FSOUND_Init(44100, 32, FSOUND_INIT_USEDEFAULTMIDISYNTH)) - { - printf("Error!\n"); - printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); - return 1; - } - - /* - LOAD SONG - */ - - /* - The following list are the drivers for the output method selected above. - */ - printf("---------------------------------------------------------\n"); - printf(" Select Music Type\n"); - printf("---------------------------------------------------------\n"); - printf("1 - MOD\n"); - printf("2 - MIDI (Using Default Software Synth)\n"); - printf("---------------------------------------------------------\n"); - printf("Press a corresponding number or ESC to quit\n"); - - do - { - key = getch(); - } while (key != 27 && key < '1' && key > '2'); - - switch (key) - { - case '1' : mod = FMUSIC_LoadSong("../../media/invtro94.s3m"); - break; - case '2' : mod = FMUSIC_LoadSong("../../media/canyon.mid"); - break; - default : return 1; - } - - if (!mod) - { - printf("Error!\n"); - printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); - return 1; - } - /* - LOAD SAMPLES - */ - - /* PCM,44,100 Hz, 8 Bit, Mono */ - samp1 = FSOUND_Sample_Load(FSOUND_UNMANAGED, "../../media/drumloop.wav", FSOUND_NORMAL | FSOUND_HW2D, 0, 0); /* hardware? why not, just to show it can be done */ - if (!samp1) - { - printf("Error!\n"); - printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); - return 1; - } - FSOUND_Sample_SetMode(samp1, FSOUND_LOOP_OFF); /* this wav has loop points in it which turns looping on.. turn it off! */ - - /* PCM,22,050 Hz, 16 Bit, Mono */ - samp2 = FSOUND_Sample_Load(FSOUND_UNMANAGED, "../../media/jaguar.wav", FSOUND_NORMAL, 0, 0); - if (!samp2) - { - printf("Error!\n"); - printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); - return 1; - } - - /* PCM,22,050 Hz, 8 Bit, Stereo */ - samp3 = FSOUND_Sample_Load(FSOUND_UNMANAGED, "../../media/chimes.wav", FSOUND_NORMAL, 0, 0); - if (!samp3) - { - printf("Error!\n"); - printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); - return 1; - } - - /* - DISPLAY HELP - */ - - printf("FSOUND Output Method : "); - switch (FSOUND_GetOutput()) - { - case FSOUND_OUTPUT_NOSOUND: printf("FSOUND_OUTPUT_NOSOUND\n"); break; - case FSOUND_OUTPUT_WINMM: printf("FSOUND_OUTPUT_WINMM\n"); break; - case FSOUND_OUTPUT_DSOUND: printf("FSOUND_OUTPUT_DSOUND\n"); break; - case FSOUND_OUTPUT_ASIO: printf("FSOUND_OUTPUT_ASIO\n"); break; - case FSOUND_OUTPUT_OSS: printf("FSOUND_OUTPUT_OSS\n"); break; - case FSOUND_OUTPUT_ESD: printf("FSOUND_OUTPUT_ESD\n"); break; - case FSOUND_OUTPUT_ALSA: printf("FSOUND_OUTPUT_ALSA\n"); break; - }; - - printf("FSOUND Mixer : "); - switch (FSOUND_GetMixer()) - { - case FSOUND_MIXER_BLENDMODE: printf("FSOUND_MIXER_BLENDMODE\n"); break; - case FSOUND_MIXER_MMXP5: printf("FSOUND_MIXER_MMXP5\n"); break; - case FSOUND_MIXER_MMXP6: printf("FSOUND_MIXER_MMXP6\n"); break; - case FSOUND_MIXER_QUALITY_FPU: printf("FSOUND_MIXER_QUALITY_FPU\n"); break; - case FSOUND_MIXER_QUALITY_MMXP5: printf("FSOUND_MIXER_QUALITY_MMXP5\n"); break; - case FSOUND_MIXER_QUALITY_MMXP6: printf("FSOUND_MIXER_QUALITY_MMXP6\n"); break; - }; - printf("FSOUND Driver : %s\n", FSOUND_GetDriverName(FSOUND_GetDriver())); - - printf("=========================================================================\n"); - printf("Press 1 Play 16bit sound at any time\n"); - printf(" 2 Play 8bit sound at any time (limited to 3 at a time using FSOUND_Sample_SetMaxPlaybacks)\n"); - printf(" 3 Play 16bit STEREO sound at any time\n"); - printf(" < Rewind mod back 1 order\n"); - printf(" > FastForward mod forward 1 order\n"); - printf(" SPACE Pause/unpause music at any time\n"); - printf(" ESC Quit\n"); - printf("=========================================================================\n"); - printf("Playing \"%s\"...\n", FMUSIC_GetName(mod)); - - { - int count; - for (count=0; count < FMUSIC_GetNumSamples(mod) && count < 20; count+=2) - { - const char *a,*b; - a = FSOUND_Sample_GetName(FMUSIC_GetSample(mod, count)); - b = FSOUND_Sample_GetName(FMUSIC_GetSample(mod, count+1)); - if (!a) - a = ""; - if (!b) - b = ""; - printf("%02d %-33s ", count, a); - printf("%02d %-33s\n", count+1, b); - } - } - - FSOUND_Sample_SetMaxPlaybacks(samp2, 3); - - /* - START PLAYING MUSIC! - */ - FMUSIC_SetOrderCallback(mod, ordercallback, 1); - FMUSIC_SetInstCallback(mod, instcallback, 5); - FMUSIC_SetMasterVolume(mod, 192); - FMUSIC_SetLooping(mod, FALSE); - FMUSIC_PlaySong(mod); - - do - { - key = 0; - - printf("order = %d/%d, row = %d/%d time = %d.%02d finished %d channels = %d cpu = %.02f%% \r", - FMUSIC_GetOrder(mod), - FMUSIC_GetNumOrders(mod), - FMUSIC_GetRow(mod), - FMUSIC_GetPatternLength(mod, FMUSIC_GetOrder(mod)), - FMUSIC_GetTime(mod) / 1000, - FMUSIC_GetTime(mod) % 1000 / 10, - FMUSIC_IsFinished(mod), - FSOUND_GetChannelsPlaying(), - FSOUND_GetCPUUsage()); - - if (kbhit()) - { - key = getch(); - - if (key == ' ') - { - FMUSIC_SetPaused(mod, !FMUSIC_GetPaused(mod)); - } - if (key == '1') - { - FSOUND_PlaySound(FSOUND_FREE, samp1); - } - if (key == '2') - { - int channel; - - channel = FSOUND_PlaySoundEx(FSOUND_FREE, samp2, NULL, TRUE); - FSOUND_SetCurrentPosition(channel, FSOUND_Sample_GetLength(samp2)-1); - FSOUND_SetFrequency(channel, -22050); /* Play it backwards! */ - FSOUND_SetVolume(channel, 255); - FSOUND_SetPan(channel, 255); /* pan it all the way to the right */ - FSOUND_SetPaused(channel, FALSE); - } - if (key == '3') - { - int channel; - - channel = FSOUND_PlaySoundEx(FSOUND_FREE, samp3, NULL, TRUE); - FSOUND_SetPaused(channel, FALSE); - } - if (key == '>') - { - FMUSIC_SetOrder(mod, FMUSIC_GetOrder(mod)+1); - } - if (key == '<') - { - FMUSIC_SetOrder(mod, FMUSIC_GetOrder(mod)-1); - } - } - - Sleep(10); - - } while (key != 27); - - FMUSIC_StopSong(mod); - - printf("\n"); - - /* - CLEANUP AND SHUTDOWN - */ - FSOUND_Sample_Free(samp1); - FSOUND_Sample_Free(samp2); - FSOUND_Sample_Free(samp3); - FMUSIC_FreeSong(mod); - - FSOUND_Close(); - - - return 0; -} - - diff --git a/#ThirdParty/fmodapi375win/samples/simple/simple.dsp b/#ThirdParty/fmodapi375win/samples/simple/simple.dsp deleted file mode 100644 index 382d814..0000000 --- a/#ThirdParty/fmodapi375win/samples/simple/simple.dsp +++ /dev/null @@ -1,154 +0,0 @@ -# Microsoft Developer Studio Project File - Name="simple" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=simple - Win32 Debug64 -!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 "simple.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 "simple.mak" CFG="simple - Win32 Debug64" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "simple - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "simple - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE "simple - Win32 Debug64" (based on "Win32 (x86) Console Application") -!MESSAGE "simple - Win32 Release64" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "simple - 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 "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O1 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "PLATFORM_WINDOWS" /FD /c -# SUBTRACT CPP /YX -# 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 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:console /machine:I386 -# ADD LINK32 ..\..\api\lib\fmodvc.lib /nologo /subsystem:console /machine:I386 /out:"simple.exe" -# SUBTRACT LINK32 /map - -!ELSEIF "$(CFG)" == "simple - 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 "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /D "_DEBUG" /D "PLATFORM_WINDOWS" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FR /FD /c -# SUBTRACT CPP /YX -# 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 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:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ..\..\api\lib\fmodvc.lib user32.lib /nologo /subsystem:console /debug /machine:IX86 /out:"simple.exe" -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "simple - Win32 Debug64" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "simple___Win32_Debug64" -# PROP BASE Intermediate_Dir "simple___Win32_Debug64" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug64" -# PROP Intermediate_Dir "Debug64" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /GX /Zi /Od /D "_DEBUG" /D "PLATFORM_WINDOWS" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FR /FD /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /D "_DEBUG" /D "PLATFORM_WINDOWS" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FR /FD /c -# SUBTRACT CPP /YX -# 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 ..\..\api\lib\fmodvc.lib user32.lib /nologo /subsystem:console /debug /machine:I386 /out:"simple.exe" /pdbtype:sept -# SUBTRACT BASE LINK32 /map -# ADD LINK32 ..\..\api\lib\fmod64vc.lib /nologo /subsystem:console /debug /machine:IX86 /out:"simple64.exe" /machine:AMD64 -# SUBTRACT LINK32 /pdb:none - -!ELSEIF "$(CFG)" == "simple - Win32 Release64" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "simple___Win32_Release64" -# PROP BASE Intermediate_Dir "simple___Win32_Release64" -# PROP BASE Ignore_Export_Lib 0 -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release64" -# PROP Intermediate_Dir "Release64" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /GX /O1 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "PLATFORM_WINDOWS" /FD /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MD /W3 /GX /O1 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "PLATFORM_WINDOWS" /FD /c -# SUBTRACT CPP /YX -# 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 ..\..\api\lib\fmodvc.lib /nologo /subsystem:console /machine:I386 /out:"simple.exe" -# SUBTRACT BASE LINK32 /map -# ADD LINK32 ..\..\api\lib\fmod64vc.lib /nologo /subsystem:console /machine:IX86 /out:"simple64.exe" /machine:AMD64 -# SUBTRACT LINK32 /pdb:none - -!ENDIF - -# Begin Target - -# Name "simple - Win32 Release" -# Name "simple - Win32 Debug" -# Name "simple - Win32 Debug64" -# Name "simple - Win32 Release64" -# Begin Source File - -SOURCE=.\main.cpp -# End Source File -# End Target -# End Project diff --git a/#ThirdParty/fmodapi375win/samples/simple/simple.exe b/#ThirdParty/fmodapi375win/samples/simple/simple.exe deleted file mode 100644 index a6641ae..0000000 Binary files a/#ThirdParty/fmodapi375win/samples/simple/simple.exe and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/samples/simple/watcom.bat b/#ThirdParty/fmodapi375win/samples/simple/watcom.bat deleted file mode 100644 index 8bc8910..0000000 --- a/#ThirdParty/fmodapi375win/samples/simple/watcom.bat +++ /dev/null @@ -1,2 +0,0 @@ -wpp386 main.cpp -wlink system nt name simple.exe file main.obj library ..\..\api\lib\fmodwc.lib diff --git a/#ThirdParty/fmodapi375win/samples/simplest/Main.cpp b/#ThirdParty/fmodapi375win/samples/simplest/Main.cpp deleted file mode 100644 index e0158ee..0000000 --- a/#ThirdParty/fmodapi375win/samples/simplest/Main.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/*=============================================================================================== - SIMPLEST.EXE - Copyright (c), Firelight Technologies Pty, Ltd, 1999,2000. - - This is the simplest way to play a song through FMOD. It is basically Init, Load, Play! -===============================================================================================*/ - -#include -#include -#if defined(WIN32) || defined(_WIN64) || defined(__WATCOMC__) - #include - #include -#else - #include "../../api/inc/wincompat.h" -#endif - -#include "../../api/inc/fmod.h" -#include "../../api/inc/fmod_errors.h" /* optional */ - -int main() -{ - FMUSIC_MODULE *mod = NULL; - - if (FSOUND_GetVersion() < FMOD_VERSION) - { - printf("Error : You are using the wrong DLL version! You should be using FMOD %.02f\n", FMOD_VERSION); - exit(1); - } - - /* - INITIALIZE - */ - if (!FSOUND_Init(32000, 64, 0)) - { - printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); - exit(1); - } - - - /* - LOAD SONG - */ - mod = FMUSIC_LoadSong("../../media/invtro94.s3m"); - if (!mod) - { - printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); - exit(1); - } - FMUSIC_PlaySong(mod); - - /* - UPDATE INTERFACE - */ - - printf("Press any key to quit\n"); - printf("=========================================================================\n"); - printf("Playing %s...\n", FMUSIC_GetName(mod)); - do - { - printf("order = %d/%d, row = %d/%d channels playing = %d cpu usage = %.02f%% \r", FMUSIC_GetOrder(mod), FMUSIC_GetNumOrders(mod), FMUSIC_GetRow(mod), FMUSIC_GetPatternLength(mod, FMUSIC_GetOrder(mod)), FSOUND_GetChannelsPlaying(), FSOUND_GetCPUUsage()); - Sleep(10); - } while (!kbhit()); - - getch(); - - printf("\n"); - - /* - FREE SONG AND SHUT DOWN - */ - - FMUSIC_FreeSong(mod); - FSOUND_Close(); - - return 0; -} diff --git a/#ThirdParty/fmodapi375win/samples/simplest/Simplest.dsp b/#ThirdParty/fmodapi375win/samples/simplest/Simplest.dsp deleted file mode 100644 index 8af6467..0000000 --- a/#ThirdParty/fmodapi375win/samples/simplest/Simplest.dsp +++ /dev/null @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="simplest" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=simplest - 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 "Simplest.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 "Simplest.mak" CFG="simplest - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "simplest - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "simplest - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "simplest - 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 "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX -# 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 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:console /machine:I386 -# ADD LINK32 ..\..\api\lib\fmodvc.lib /nologo /subsystem:console /machine:I386 /out:"simplest.exe" - -!ELSEIF "$(CFG)" == "simplest - 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 "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX -# 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 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:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ..\..\api\lib\fmodvc.lib /nologo /subsystem:console /debug /machine:I386 /out:"simplest.exe" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "simplest - Win32 Release" -# Name "simplest - Win32 Debug" -# Begin Source File - -SOURCE=.\main.cpp -# End Source File -# End Target -# End Project diff --git a/#ThirdParty/fmodapi375win/samples/simplest/WATCOM.BAT b/#ThirdParty/fmodapi375win/samples/simplest/WATCOM.BAT deleted file mode 100644 index 5b11971..0000000 --- a/#ThirdParty/fmodapi375win/samples/simplest/WATCOM.BAT +++ /dev/null @@ -1,2 +0,0 @@ -wpp386 main.cpp -wlink system nt name simplest.exe file main.obj library ..\..\api\lib\fmodwc.lib diff --git a/#ThirdParty/fmodapi375win/samples/simplest/simplest.exe b/#ThirdParty/fmodapi375win/samples/simplest/simplest.exe deleted file mode 100644 index 179572b..0000000 Binary files a/#ThirdParty/fmodapi375win/samples/simplest/simplest.exe and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/samples/stream/Main.cpp b/#ThirdParty/fmodapi375win/samples/stream/Main.cpp deleted file mode 100644 index 9789ece..0000000 --- a/#ThirdParty/fmodapi375win/samples/stream/Main.cpp +++ /dev/null @@ -1,303 +0,0 @@ -//=============================================================================================== -// STREAM.EXE -// Copyright (c), Firelight Technologies Pty, Ltd, 1999-2004. -// -// This example takes a command line parameter, a wav/mp2/mp3/ogg etc file, and uses the streamer -// system to play it back. -//=============================================================================================== - -#include -#include -#include - -#if defined(WIN32) || defined(_WIN64) || defined(__WATCOMC__) - #include - #include -#else - #include "../../api/inc/wincompat.h" -#endif - -#include "../../api/inc/fmod.h" -#include "../../api/inc/fmod_errors.h" // optional - -int channel = -1; - -void *F_CALLBACKAPI myopen(const char *name) -{ - return (void *)fopen(name, "rb"); -} - -void F_CALLBACKAPI myclose(void *handle) -{ - fclose((FILE *)handle); -} - -int F_CALLBACKAPI myread(void *buffer, int size, void *handle) -{ - return fread(buffer, 1, size, (FILE *)handle); -} - -int F_CALLBACKAPI myseek(void *handle, int pos, signed char mode) -{ - return fseek((FILE *)handle, pos, mode); -} - -int F_CALLBACKAPI mytell(void *handle) -{ - return ftell((FILE *)handle); -} - - -/* -[ - [DESCRIPTION] - End of stream user callback, initialized with FSOUND_Stream_SetEndCallback or - FSOUND_Stream_SetSynchCallback - - [PARAMETERS] - 'stream' A pointer to the stream that ended. - 'buff' This is NULL for end of stream callbacks, or a string for synch callbacks. - 'len' This is reserved and is always 0 for end and synch callbacks. ignore. - 'param' This is the value passed to FSOUND_Stream_SetEndCallback or - FSOUND_Stream_SetSynchCallback as a user data value. - - [RETURN_VALUE] - TRUE or FALSE, the value is ignored. - - [REMARKS] - - [SEE_ALSO] -] -*/ -signed char F_CALLBACKAPI endcallback(FSOUND_STREAM *stream, void *buff, int len, void *param) -{ - // end of stream callback doesnt have a 'buff' value, if it doesnt it could be a synch point. - if (buff) - { - printf("\nSYNCHPOINT : \"%s\"\n", buff); - } - else - { - printf("\nSTREAM ENDED!!\n"); - } - - return TRUE; -} - - -/* -[ - [DESCRIPTION] - main entry point into streamer example. - - [PARAMETERS] - 'argc' Number of command line parameters. - 'argv' Parameter list - - [RETURN_VALUE] - void - - [REMARKS] - - [SEE_ALSO] -] -*/ -int main(int argc, char *argv[]) -{ - FSOUND_STREAM *stream; - FSOUND_SAMPLE *sptr; - char key; - - if (FSOUND_GetVersion() < FMOD_VERSION) - { - printf("Error : You are using the wrong DLL version! You should be using FMOD %.02f\n", FMOD_VERSION); - return 1; - } - - if (argc < 2) - { - printf("-------------------------------------------------------------\n"); - printf("FMOD Streamer example.\n"); - printf("Copyright (c) Firelight Technologies Pty, Ltd, 1999-2004.\n"); - printf("-------------------------------------------------------------\n"); - printf("Syntax: stream infile.[mp2 mp3 wav ogg wma asf]\n\n"); - return 1; - } - -#if defined(WIN32) || defined(_WIN64) || defined(__CYGWIN32__) || defined(__WATCOMC__) - FSOUND_SetOutput(FSOUND_OUTPUT_WINMM); -#elif defined(__linux__) - FSOUND_SetOutput(FSOUND_OUTPUT_OSS); -#endif - - // Set custom file callbacks? This doesnt have to be done, its just here as an example. - FSOUND_File_SetCallbacks(myopen, myclose, myread, myseek, mytell); - - // ========================================================================================== - // SELECT DRIVER - // ========================================================================================== - { - long i,driver=0; - char key; - - // The following list are the drivers for the output method selected above. - printf("---------------------------------------------------------\n"); - switch (FSOUND_GetOutput()) - { - case FSOUND_OUTPUT_NOSOUND: printf("NoSound"); break; - case FSOUND_OUTPUT_WINMM: printf("Windows Multimedia Waveout"); break; - case FSOUND_OUTPUT_DSOUND: printf("Direct Sound"); break; - case FSOUND_OUTPUT_A3D: printf("A3D"); break; - case FSOUND_OUTPUT_OSS: printf("Open Sound System"); break; - case FSOUND_OUTPUT_ESD: printf("Enlightenment Sound Daemon"); break; - case FSOUND_OUTPUT_ALSA: printf("ALSA"); break; - }; - printf(" Driver list\n"); - printf("---------------------------------------------------------\n"); - - for (i=0; i < FSOUND_GetNumDrivers(); i++) - { - printf("%d - %s\n", i+1, FSOUND_GetDriverName(i)); // print driver names - } - printf("---------------------------------------------------------\n"); // print driver names - printf("Press a corresponding number or ESC to quit\n"); - - do - { - key = getch(); - if (key == 27) exit(0); - - driver = key - '1'; - } while (driver < 0 || driver >= FSOUND_GetNumDrivers()); - - FSOUND_SetDriver(driver); // Select sound card (0 = default) - } - - // ========================================================================================== - // INITIALIZE - // ========================================================================================== - if (!FSOUND_Init(44100, 32, 0)) - { - printf("Error!\n"); - printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); - FSOUND_Close(); - return 1; - } - - FSOUND_Stream_SetBufferSize(1000); - - // ========================================================================================== - // OPEN STREAM (use #if 1 for streaming from memory) - // ========================================================================================== -#if 0 - { - FILE *fp; - int length; - char *data; - - fp = fopen(argv[1], "rb"); - if (!fp) - { - printf("Error!\n"); - printf("File Not Found\n"); - FSOUND_Close(); - return 1; - } - fseek(fp, 0, SEEK_END); - length = ftell(fp); - fseek(fp, 0, SEEK_SET); - - data = (char *)malloc(length); - fread(data, length, 1, fp); - fclose(fp); - - stream = FSOUND_Stream_Open(data, FSOUND_NORMAL | FSOUND_MPEGACCURATE | FSOUND_LOADMEMORY, 0, length); - - // The memory pointer MUST remain valid while streaming! - } -#else - - if (!strnicmp(argv[1], "http:", 5)) - { - printf("Connecting to %s, please wait (this may take some time)....\n", argv[1]); - } - stream = FSOUND_Stream_Open(argv[1], FSOUND_NORMAL | FSOUND_MPEGACCURATE, 0, 0); - if (!stream) - { - printf("Error!\n"); - printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); - FSOUND_Close(); - - return 1; - } - -#endif - - // ========================================================================================== - // SET AN END OF STREAM CALLBACK AND RIFF SYNCH POINTS CALLBACK - // ========================================================================================== - FSOUND_Stream_SetEndCallback(stream, endcallback, 0); - FSOUND_Stream_SetSyncCallback(stream, endcallback, 0); - - - printf("=========================================================================\n"); - printf("Press SPACE to pause/unpause\n"); - printf("Press 'f' to fast forward 2 seconds\n"); - printf("Press ESC to quit\n"); - printf("=========================================================================\n"); - printf("Playing stream...\n\n"); - - sptr = FSOUND_Stream_GetSample(stream); - if (sptr) - { - int freq; - FSOUND_Sample_GetDefaults(sptr, &freq, NULL, NULL, NULL); - printf("Name : %s\n", FSOUND_Sample_GetName(sptr)); - printf("Frequency : %d\n\n", freq); - } - - key = 0; - do - { - if (channel < 0) - { - // ========================================================================================== - // PLAY STREAM - // ========================================================================================== - channel = FSOUND_Stream_PlayEx(FSOUND_FREE, stream, NULL, TRUE); - FSOUND_SetPaused(channel, FALSE); - } - - if (kbhit()) - { - key = getch(); - if (key == ' ') - { - FSOUND_SetPaused(channel, !FSOUND_GetPaused(channel)); - } - if (key == 'f') - { - FSOUND_Stream_SetTime(stream, FSOUND_Stream_GetTime(stream) + 2000); - } - } - - printf("pos %6d/%6d time %02d:%02d/%02d:%02d cpu %5.02f%% \r", FSOUND_Stream_GetPosition(stream), - FSOUND_Stream_GetLength(stream), - FSOUND_Stream_GetTime(stream) / 1000 / 60, - FSOUND_Stream_GetTime(stream) / 1000 % 60, - FSOUND_Stream_GetLengthMs(stream) / 1000 / 60, - FSOUND_Stream_GetLengthMs(stream) / 1000 % 60, - FSOUND_GetCPUUsage()); - - Sleep(10); - - } while (key != 27); - - printf("\n"); - - FSOUND_Stream_Close(stream); - - FSOUND_Close(); - - return 0; -} diff --git a/#ThirdParty/fmodapi375win/samples/stream/WATCOM.BAT b/#ThirdParty/fmodapi375win/samples/stream/WATCOM.BAT deleted file mode 100644 index e84f9d9..0000000 --- a/#ThirdParty/fmodapi375win/samples/stream/WATCOM.BAT +++ /dev/null @@ -1,2 +0,0 @@ -wpp386 main.cpp -wlink system nt name stream.exe file main.obj library ..\..\api\lib\fmodwc.lib diff --git a/#ThirdParty/fmodapi375win/samples/stream/runme.bat b/#ThirdParty/fmodapi375win/samples/stream/runme.bat deleted file mode 100644 index e31e71e..0000000 --- a/#ThirdParty/fmodapi375win/samples/stream/runme.bat +++ /dev/null @@ -1,6 +0,0 @@ -@echo off - -echo ==================================================== -echo Stream demo showing off RIFF synch point callbacks!! -echo ==================================================== -stream.exe ../../media/jbtennis.wav diff --git a/#ThirdParty/fmodapi375win/samples/stream/stream.dsp b/#ThirdParty/fmodapi375win/samples/stream/stream.dsp deleted file mode 100644 index a998fcc..0000000 --- a/#ThirdParty/fmodapi375win/samples/stream/stream.dsp +++ /dev/null @@ -1,91 +0,0 @@ -# Microsoft Developer Studio Project File - Name="stream" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 60000 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=stream - 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 "stream.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 "stream.mak" CFG="stream - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "stream - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "stream - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "stream - 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 "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX -# 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 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:console /machine:I386 -# ADD LINK32 ..\..\api\lib\fmodvc.lib user32.lib /nologo /subsystem:console /machine:I386 /out:"stream.exe" -# SUBTRACT LINK32 /debug /nodefaultlib - -!ELSEIF "$(CFG)" == "stream - 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 "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX -# 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 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:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ..\..\api\lib\fmodvc.lib /nologo /subsystem:console /debug /machine:I386 /out:"stream.exe" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "stream - Win32 Release" -# Name "stream - Win32 Debug" -# Begin Source File - -SOURCE=.\Main.cpp -# End Source File -# End Target -# End Project diff --git a/#ThirdParty/fmodapi375win/samples/stream/stream.exe b/#ThirdParty/fmodapi375win/samples/stream/stream.exe deleted file mode 100644 index 218adae..0000000 Binary files a/#ThirdParty/fmodapi375win/samples/stream/stream.exe and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/samples/userstream/Main.cpp b/#ThirdParty/fmodapi375win/samples/userstream/Main.cpp deleted file mode 100644 index e5ce513..0000000 --- a/#ThirdParty/fmodapi375win/samples/userstream/Main.cpp +++ /dev/null @@ -1,312 +0,0 @@ -//=============================================================================================== -// USERSTREAM.EXE -// Copyright (c), Firelight Technologies Pty, Ltd, 1999-2004. -// -// This sample specifically demonstrates the user callback streaming facility, and generates a -// very strange noise! :) -//=============================================================================================== - -#include -#include - -#if defined(WIN32) || defined(_WIN64) || defined(__WATCOMC__) - #include - #include -#else - #include "../../api/inc/wincompat.h" -#endif - -#include "../../api/inc/fmod.h" -#include "../../api/inc/fmod_errors.h" // optional - - -/* -[ - [DESCRIPTION] - User dsp callback for a stream! - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -void * F_CALLBACKAPI dspcallback(void *originalbuffer, void *newbuffer, int length, void *param) -{ - int count; - signed short *stereo16bitbuffer = (signed short *)newbuffer; - - for (count=0; count>2 = 16bit stereo (4 bytes per sample) - { - *stereo16bitbuffer >>= 1; - *(stereo16bitbuffer+1) >>= 1; - - stereo16bitbuffer+=2; - } - - return newbuffer; -} - - -/* -[ - [DESCRIPTION] - User streamer callback - - [PARAMETERS] - 'stream' pointer to the stream supplying the callback - 'buff' pointer to the streamer buffer to fill. - 'len' length of the data block in BYTES - - [RETURN_VALUE] - - [REMARKS] - What a strange noise!!! - (heh heh) - - [SEE_ALSO] -] -*/ -signed char F_CALLBACKAPI streamcallback(FSOUND_STREAM *stream, void *buff, int len, void *param) -{ - int count; - static float t1 = 0, t2 = 0; // time - static float v1 = 0, v2 = 0; // velocity - signed short *stereo16bitbuffer = (signed short *)buff; - - for (count=0; count>2; count++) // >>2 = 16bit stereo (4 bytes per sample) - { - *stereo16bitbuffer++ = (signed short)(sin(t1) * 32767.0f); // left channel - *stereo16bitbuffer++ = (signed short)(sin(t2) * 32767.0f); // right channel - - t1 += 0.01f + v1; - t2 += 0.0142f + v2; - v1 += (float)(sin(t1) * 0.002f); - v2 += (float)(sin(t2) * 0.002f); - } - -// printf("callback : buff = %p, len = %d, time = %.02f param = %d\n", buff, len, (float)FSOUND_Stream_GetTime(stream) / 1000.0f, param); - - return 1; -} - - - -/* -[ - [DESCRIPTION] - End of stream user callback, initialized with FSOUND_Stream_SetEndCallback or - FSOUND_Stream_SetSynchCallback - - [PARAMETERS] - 'stream' A pointer to the stream that ended. - 'buff' This is NULL for end of stream callbacks, or a string for synch callbacks. - 'len' This is reserved and is always 0 for end and synch callbacks. ignore. - 'param' This is the value passed to FSOUND_Stream_SetEndCallback or - FSOUND_Stream_SetSynchCallback as a user data value. - - [RETURN_VALUE] - TRUE or FALSE, the value is ignored. - - [REMARKS] - - [SEE_ALSO] -] -*/ -signed char F_CALLBACKAPI endcallback(FSOUND_STREAM *stream, void *buff, int len, void *param) -{ - // end of stream callback doesnt have a 'buff' value, if it doesnt it could be a synch point. - if (buff) - { - printf("\nSYNCHPOINT : \"%s\"\n", buff); - } - else - { - printf("\nSTREAM ENDED!!\n"); - } - - return TRUE; -} - - - -/* -[ - [DESCRIPTION] - - [PARAMETERS] - - [RETURN_VALUE] - - [REMARKS] - - [SEE_ALSO] -] -*/ -int main() -{ - FSOUND_STREAM *stream; - FSOUND_DSPUNIT *dsp1,*dsp2; - char key; - - if (FSOUND_GetVersion() < FMOD_VERSION) - { - printf("Error : You are using the wrong DLL version! You should be using FMOD %.02f\n", FMOD_VERSION); - return 1; - } - - printf("-------------------------------------------------------------\n"); - printf("FSOUND Streamer example.\n"); - printf("Copyright (c) Firelight Technologies Pty, Ltd, 2001-2004.\n"); - printf("-------------------------------------------------------------\n"); - - - printf("---------------------------------------------------------\n"); - printf("Output Type\n"); - printf("---------------------------------------------------------\n"); -#if defined(WIN32) || defined(_WIN64) || defined(__CYGWIN32__) || defined(__WATCOMC__) - printf("1 - Direct Sound\n"); - printf("2 - Windows Multimedia Waveout\n"); - printf("3 - ASIO\n"); -#elif defined(__linux__) - printf("1 - OSS - Open Sound System\n"); - printf("2 - ESD - Elightment Sound Daemon\n"); - printf("3 - ALSA 0.9 - Advanced Linux Sound Architecture\n"); -#endif - printf("4 - NoSound\n"); - printf("---------------------------------------------------------\n"); // print driver names - printf("Press a corresponding number or ESC to quit\n"); - - do - { - key = getch(); - } while (key != 27 && key < '1' && key > '4'); - - switch (key) - { -#if defined(WIN32) || defined(_WIN64) || defined(__CYGWIN32__) || defined(__WATCOMC__) - case '1' : FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND); - break; - case '2' : FSOUND_SetOutput(FSOUND_OUTPUT_WINMM); - break; - case '3' : FSOUND_SetOutput(FSOUND_OUTPUT_ASIO); - break; -#elif defined(__linux__) - case '1' : FSOUND_SetOutput(FSOUND_OUTPUT_OSS); - break; - case '2' : FSOUND_SetOutput(FSOUND_OUTPUT_ESD); - break; - case '3' : FSOUND_SetOutput(FSOUND_OUTPUT_ALSA); - break; -#endif - case '4' : FSOUND_SetOutput(FSOUND_OUTPUT_NOSOUND); - break; - default : exit(0); - } - - // ========================================================================================== - // SELECT DRIVER - // ========================================================================================== - { - int i,driver=0; - char key; - - // The following list are the drivers for the output method selected above. - printf("---------------------------------------------------------\n"); - switch (FSOUND_GetOutput()) - { - case FSOUND_OUTPUT_NOSOUND: printf("NoSound"); break; - case FSOUND_OUTPUT_WINMM: printf("Windows Multimedia Waveout"); break; - case FSOUND_OUTPUT_DSOUND: printf("Direct Sound"); break; - case FSOUND_OUTPUT_ASIO: printf("ASIO"); break; - case FSOUND_OUTPUT_OSS: printf("Open Sound System"); break; - case FSOUND_OUTPUT_ESD: printf("Enlightment Sound Daemon"); break; - case FSOUND_OUTPUT_ALSA: printf("Alsa"); break; - - }; - printf(" Driver list\n"); - printf("---------------------------------------------------------\n"); - - for (i=0; i < FSOUND_GetNumDrivers(); i++) - { - printf("%d - %s\n", i+1, FSOUND_GetDriverName(i)); // print driver names - } - printf("---------------------------------------------------------\n"); // print driver names - printf("Press a corresponding number or ESC to quit\n"); - - do - { - key = getch(); - if (key == 27) exit(0); - driver = key - '1'; - } while (driver < 0 || driver >= FSOUND_GetNumDrivers()); - - FSOUND_SetDriver(driver); // Select sound card (0 = default) - } - - // ========================================================================================== - // INITIALIZE - // ========================================================================================== - if (!FSOUND_Init(44100, 16, 0)) - { - printf("Error!\n"); - printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); - return 1; - } - - // ========================================================================================== - // CREATE USER STREAM - // ========================================================================================== - stream = FSOUND_Stream_Create(streamcallback, 6*2048, FSOUND_NORMAL | FSOUND_16BITS | FSOUND_STEREO, 44100, (void *)12345); - if (!stream) - { - printf("Error!\n"); - printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); - return 1; - } - - FSOUND_Stream_SetEndCallback(stream, endcallback, 0); - - dsp1 = FSOUND_Stream_CreateDSP(stream, dspcallback, 0, 0); // priority 0 = it comes first in dsp chain. - dsp2 = FSOUND_Stream_CreateDSP(stream, dspcallback, 1, 0); // priority 1 = it comes last - - printf("Press any key to quit\n"); - printf("=========================================================================\n"); - printf("Playing stream...\n"); - - // ========================================================================================== - // PLAY STREAM - // ========================================================================================== - if (FSOUND_Stream_Play(FSOUND_FREE, stream) == -1) - { - printf("Error!\n"); - printf("%s\n", FMOD_ErrorString(FSOUND_GetError())); - return 1; - - } - - printf("******* Hit a key to active stream DSP unit #1 to halve the stream volume.\n"); - getch(); - - FSOUND_DSP_SetActive(dsp1, 1); - printf("******* Now hit a key to active stream DSP unit #2 to quarter the stream volume.\n"); - getch(); - FSOUND_DSP_SetActive(dsp2, 1); - printf("******* How hit a key to finish.\n"); - - getch(); - - printf("\n"); - - FSOUND_DSP_Free(dsp1); - FSOUND_DSP_Free(dsp2); - - FSOUND_Stream_Close(stream); - - FSOUND_Close(); - - return 0; -} diff --git a/#ThirdParty/fmodapi375win/samples/userstream/WATCOM.BAT b/#ThirdParty/fmodapi375win/samples/userstream/WATCOM.BAT deleted file mode 100644 index 9f1b692..0000000 --- a/#ThirdParty/fmodapi375win/samples/userstream/WATCOM.BAT +++ /dev/null @@ -1,2 +0,0 @@ -wpp386 main.cpp -wlink system nt name userstream.exe file main.obj library ..\..\api\lib\fmodwc.lib diff --git a/#ThirdParty/fmodapi375win/samples/userstream/userstream.dsp b/#ThirdParty/fmodapi375win/samples/userstream/userstream.dsp deleted file mode 100644 index a77545c..0000000 --- a/#ThirdParty/fmodapi375win/samples/userstream/userstream.dsp +++ /dev/null @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="userstream" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 60000 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=userstream - 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 "userstream.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 "userstream.mak" CFG="userstream - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "userstream - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "userstream - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "userstream - 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 "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX -# 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 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:console /machine:I386 -# ADD LINK32 ..\..\api\lib\fmodvc.lib /nologo /subsystem:console /machine:I386 /out:"userstream.exe" - -!ELSEIF "$(CFG)" == "userstream - 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 "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX -# 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 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:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 ..\..\api\lib\fmodvc.lib /nologo /subsystem:console /debug /machine:I386 /out:"userstream.exe" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "userstream - Win32 Release" -# Name "userstream - Win32 Debug" -# Begin Source File - -SOURCE=.\Main.cpp -# End Source File -# End Target -# End Project diff --git a/#ThirdParty/fmodapi375win/samples/userstream/userstream.exe b/#ThirdParty/fmodapi375win/samples/userstream/userstream.exe deleted file mode 100644 index 747c65f..0000000 Binary files a/#ThirdParty/fmodapi375win/samples/userstream/userstream.exe and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/samplesdelphi/3d1/Ex3d1.dpr b/#ThirdParty/fmodapi375win/samplesdelphi/3d1/Ex3d1.dpr deleted file mode 100644 index c63b465..0000000 --- a/#ThirdParty/fmodapi375win/samplesdelphi/3d1/Ex3d1.dpr +++ /dev/null @@ -1,463 +0,0 @@ -//=============================================================================================== -// ex3D1.exe -// Copyright (c), Firelight Multimedia, 1999. -// -// This test shows EAX, DS3D, A3D and Software all being used together. For vortex cards -// geometry will obstruct and relfect sounds. -// This refreshes the scene every frame. -// To see how to use geometry lists, see sample Ex3D2 which is a slight variation on this one. -// Converted to Delphi by Bocevski Dragan mailto: d_bocevski@yahoo.com -//=============================================================================================== -// History -// -// 2001/09/09 by Steve 'Sly' Williams -// - Updated to version 3.40 -// -// 2000/12/15 by Steve 'Sly' Williams -// - Updated to version 3.30 -// -// 2000/11/14 by Steve 'Sly' Williams -// - Fixed version check -// - Added FMODErrors to uses clause -// - Added check for Delphi 4 to change wVirtualKeyCode to wVirtualScanCode -// -// 2002/02/13 by Steve 'Sly' Williams -// - Updated for FMOD 3.50 -// -// 2002/12/19 by Steve 'Sly' Williams -// - Updated for FMOD 3.61 -//=============================================================================================== -program ex3d1; - -uses - fmod, fmodtypes, fmoderrors, fmodpresets -{$IFDEF MSWINDOWS} - , Windows -{$ENDIF} - ; - -{$APPTYPE CONSOLE} - -const - UPDATETIME = 50; // 50ms update for interface - NUMPOLYS = 4; - -procedure Close(samp1, samp2, samp3: PFSoundSample); -begin - // you dont need to free samples if you let fsound's sample manager look after samples, as - // it will free them all for you. - FSOUND_Sample_Free(samp1); - FSOUND_Sample_Free(samp2); - FSOUND_Sample_Free(samp3); - - FSOUND_Close(); -end; - -var - stream: PFSoundStream; - key, dw: DWORD; - driver: Integer; - enm: TFSoundOutputTypes; - h, h1: THandle; - buf: input_record; - c: coord; - s: String; - samp1: PFSoundSample = nil; - samp2: PFSoundSample = nil; - samp3: PFSoundSample = nil; - openflag, listenerflag: Boolean; - i, channel1, channel2: Longint; - listenerpos: array[0..2] of Single; - lastpos: array[0..2] of Single = (0, 0, 0); - t: Single; - pos, vel: TFSoundVector; - caps: Cardinal; - Channels2D, Channels3D, ChannelsTotal: Integer; - // COORDINATE SYSTEM : X = right, Y = up, Z = forwards. (Left handed) - poly: array[0..NUMPOLYS - 1, 0..3, 0..2] of Single = - ( - (// left wall - (-35.0, -20.0, -20.0), - (-35.0, 20.0, -20.0), - (-35.0, 20.0, 20.0), - (-35.0, -20.0, 20.0) - ), - (// front wall - (-35.0, 20.0, 20.0), - (10.0, 20.0, 20.0), - (10.0, -20.0, 20.0), - (-35.0, -20.0, 20.0) - ), - (// back wall - (-35.0, -20.0, -20.0), - (10.0, -20.0, -20.0), - (10.0, 20.0, -20.0), - (-35.0, 20.0, -20.0) - ), - (// right wall - (10.0, -20.0, -20.0), - (10.0, -20.0, 20.0), - (10.0, 20.0, 20.0), - (10.0, 20.0, -20.0) - ) - ); - doorpoly: array[0..3, 0..2] of Single = - (// hole in right wall - (10.0, -20.0, -5.0), - (10.0, -20.0, 5.0), - (10.0, 20.0, 5.0), - (10.0, 20.0, -5.0) - ); - normal: array[0..NUMPOLYS - 1, 0..2] of Single = - ( - (1.0, 0.0, 0.0), // left wall - (-1.0, 0.0, 0.0), // right wall - (0.0, 0.0, -1.0), // front wall - (0.0, 0.0, 1.0) // back wall - ); -begin - openflag := False; - listenerflag := True; - listenerpos[0] := 0; - listenerpos[1] := 0; - listenerpos[2] := 0; - t := 0; - SetLength(s, 80); - SetConsoleTitle('Example Ex3D1 (3d enviroment)'); - h := GetStdHandle(STD_INPUT_HANDLE); - h1 := GetStdHandle(STD_OUTPUT_HANDLE); - Buf.EventType := Key_Event; - c.X := 1; - c.Y := 23; - if FMOD_VERSION > FSOUND_GetVersion then - begin - WriteLn('Error: You are using FMOD version ', FSOUND_GetVersion: 3: 2, '. You should be using version ', FMOD_VERSION: 3: 2); - Exit; - end; - -// ========================================================================================== -// SELECT OUTPUT METHOD -// ========================================================================================== - - writeln; - writeln('---------------------------------------------------------'); - writeln('Output Type'); - writeln('---------------------------------------------------------'); -{$IFDEF MSWINDOWS} - writeln('1 - Direct Sound'); - writeln('2 - Windows Multimedia Waveout'); - writeln('3 - A3D'); -{$ENDIF} -{$IFDEF LINUX} - writeln('1 - Open Sound System (OSS) (Linux, Solaris, freebsd)'); - writeln('2 - Enlightment Sound Daemon (ESD, Linux, more ...)'); - writeln('3 - Alsa Sound System (Linux)'); -{$ENDIF} - writeln('4 - NoSound'); - writeln('---------------------------------------------------------'); // print driver names - writeln('Press a corresponding number or ESC to quit'); - - repeat - Sleep(50); - FlushConsoleInputBuffer(h); - repeat - ReadConsoleInput(h, buf, 1, dw); - until buf.Event.KeyEvent.bKeyDown = false; -{$IFDEF VER120} - Key := buf.Event.KeyEvent.wVirtualScanCode; -{$ELSE} - Key := buf.Event.KeyEvent.wVirtualKeyCode; -{$ENDIF} - case key of -{$IFDEF MSWINDOWS} - ord('1'): FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND); - ord('2'): FSOUND_SetOutput(FSOUND_OUTPUT_WINMM); - ord('3'): FSOUND_SetOutput(FSOUND_OUTPUT_A3D); -{$ENDIF} -{$IFDEF LINUX} - ord('1'): FSOUND_SetOutput(FSOUND_OUTPUT_OSS); - ord('2'): FSOUND_SetOutput(FSOUND_OUTPUT_ESD); - ord('3'): FSOUND_SetOutput(FSOUND_OUTPUT_ALSA); -{$ENDIF} - ord('4'): FSOUND_SetOutput(FSOUND_OUTPUT_NOSOUND); - 27: exit; - end; - until ((key >= ord('1')) and (key <= ord('4'))); - -// ========================================================================================== -// SELECT DRIVER -// ========================================================================================== - - -// The following list are the drivers for the output method selected above. - writeln('---------------------------------------------------------'); - enm := FSOUND_GetOutput(); - case enm of -{$IFDEF MSWINDOWS} - FSOUND_OUTPUT_WINMM: write('Windows Multimedia Waveout'); - FSOUND_OUTPUT_DSOUND: write('Direct Sound'); - FSOUND_OUTPUT_A3D: write('A3D'); -{$ENDIF} -{$IFDEF LINUX} - FSOUND_OUTPUT_OSS: write('Open Sound System'); - FSOUND_OUTPUT_ESD: write('Enlightenment Sound Daemon'); - FSOUND_OUTPUT_ALSA: write('Alsa'); -{$ENDIF} - FSOUND_OUTPUT_NOSOUND: write('NoSound'); - end; - writeln(' Driver list'); - writeln('---------------------------------------------------------'); - for i := 0 to FSOUND_GetNumDrivers() - 1 do - begin - writeln(i + 1, ' - ', FSOUND_GetDriverName(i)); // print driver names - - FSOUND_GetDriverCaps(i, caps); - - if caps and FSOUND_CAPS_HARDWARE <> 0 then - writeln(' * Driver supports hardware 3D sound!'); - end; - writeln('---------------------------------------------------------'); // print driver names - writeln('Press a corresponding number or ESC to quit'); - repeat - FlushConsoleInputBuffer(h); - repeat - ReadConsoleInput(h, buf, 1, dw); - until buf.Event.KeyEvent.bKeyDown = false; -{$IFDEF VER120} - Key := buf.Event.KeyEvent.wVirtualScanCode; -{$ELSE} - Key := buf.Event.KeyEvent.wVirtualKeyCode; -{$ENDIF} - if (ord(key) = 27) then exit; - driver := ord(key) - ord('1'); - until ((driver > 0) or (driver <= FSOUND_GetNumDrivers())); - FSOUND_SetDriver(driver); // Select sound card (0 = default) - - FSOUND_GetDriverCaps(FSOUND_GetDriver(), caps); - - writeln('---------------------------------------------------------'); - writeln('Driver capabilities'); - writeln('---------------------------------------------------------'); - if caps = 0 then - begin - WriteLn('- This driver will support software mode only.'); - WriteLn(' It does not properly support 3D sound hardware.'); - end - else if caps and FSOUND_CAPS_HARDWARE <> 0 then - begin - WriteLn(' * Driver supports hardware 3D sound!'); - end; - -// ========================================================================================== -// INITIALIZE -// ========================================================================================== - if not FSOUND_Init(44100, 32, 0) then - begin - writeln('Error! Initializing'); - writeln(FMOD_ErrorString(FSOUND_GetError())); - FSOUND_Close(); - Close(samp1, samp2, samp3); - Exit; - end; - -// ========================================================================================== -// LOAD SAMPLES -// ========================================================================================== - -// ========================================================================================== -// 3D MONO -// ========================================================================================== - samp1 := FSOUND_Sample_Load(FSOUND_FREE, '../../media/drumloop.wav', FSOUND_HW3D, 0, 0); - if samp1 = nil then - begin - writeln('Error! Loading sample1'); - writeln(FMOD_ErrorString(FSOUND_GetError())); - Close(samp1, samp2, samp3); - Exit; - end; - // increasing mindistance makes it louder in 3d space - FSOUND_Sample_SetMinMaxDistance(samp1, 4.0, 1000.0); - FSOUND_Sample_SetMode(samp1, FSOUND_LOOP_NORMAL); - -// ========================================================================================== -// 3D MONO -// ========================================================================================== - samp2 := FSOUND_Sample_Load(FSOUND_UNMANAGED, '../../media/jaguar.wav', FSOUND_HW3D, 0, 0); - if samp2 = nil then - begin - writeln('Error! Loading sample2'); - writeln(FMOD_ErrorString(FSOUND_GetError())); - Close(samp1, samp2, samp3); - Exit; - end; - // increasing mindistance makes it louder in 3d space - FSOUND_Sample_SetMinMaxDistance(samp2, 3.0, 1000.0); - FSOUND_Sample_SetMode(samp2, FSOUND_LOOP_NORMAL); - -// ========================================================================================== -// 3D STEREO -// ========================================================================================== - samp3 := FSOUND_Sample_Load(FSOUND_UNMANAGED, '../../media/chimes.wav', FSOUND_2D, 0, 0); - if samp3 = nil then - begin - writeln('Error! Loading 16bit Stereo sample'); - writeln(FMOD_ErrorString(FSOUND_GetError())); - Close(samp1, samp2, samp3); - Exit; - end; - -// ========================================================================================== -// DISPLAY HELP -// ========================================================================================== - - write('FSOUND Output Method : '); - case (FSOUND_GetOutput()) of -{$IFDEF MSWINDOWS} - FSOUND_OUTPUT_WINMM: writeln('FSOUND_OUTPUT_WINMM'); - FSOUND_OUTPUT_DSOUND: writeln('FSOUND_OUTPUT_DSOUND'); - FSOUND_OUTPUT_A3D: writeln('FSOUND_OUTPUT_A3D'); -{$ENDIF} -{$IFDEF LINUX} - FSOUND_OUTPUT_OSS: writeln('FSOUND_OUTPUT_OSS'); - FSOUND_OUTPUT_ESD: writeln('FSOUND_OUTPUT_ESD'); - FSOUND_OUTPUT_ALSA: writeln('FSOUND_OUTPUT_ALSA'); -{$ENDIF} - FSOUND_OUTPUT_NOSOUND: writeln('FSOUND_OUTPUT_NOSOUND'); - end; - - write('FSOUND Mixer : '); - case (FSOUND_GetMixer()) of - FSOUND_MIXER_BLENDMODE: writeln('FSOUND_MIXER_BLENDMODE'); - FSOUND_MIXER_MMXP5: writeln('FSOUND_MIXER_MMXP5'); - FSOUND_MIXER_MMXP6: writeln('FSOUND_MIXER_MMXP6'); - FSOUND_MIXER_QUALITY_FPU: writeln('FSOUND_MIXER_QUALITY_FPU'); - FSOUND_MIXER_QUALITY_MMXP5: writeln('FSOUND_MIXER_QUALITY_MMXP5'); - FSOUND_MIXER_QUALITY_MMXP6: writeln('FSOUND_MIXER_QUALITY_MMXP6'); - end; - write('FSOUND Driver : '); - writeln(FSOUND_GetDriverName(FSOUND_GetDriver())); - FSOUND_GetNumHWChannels(Channels2D, Channels3D, ChannelsTotal); - writeln('Hardware 3D channels : ', Channels3D); - - writeln('========================================================================='); - writeln('Press 1 Pause/Unpause 16bit 3D sound at any time'); - writeln(' 2 Pause/Unpause 8bit 3D sound at any time'); - writeln(' 3 Play 16bit STEREO 2D sound at any time'); - writeln(' 4 Change to reverb mode CONCERTHALL (DirectSound/SBLive only)'); - writeln(' 5 Change to reverb mode SEWERPIPE (DirectSound/SBLive only)'); - writeln(' 6 Change to reverb mode PSYCHOTIC (DirectSound/SBLive only)'); - writeln(' 7 Open/Close door on right wall (affects A3D only)'); - writeln(' <- Move listener left (in still mode)'); - writeln(' -> Move listener right (in still mode)'); - writeln(' SPACE SPACE to stop/start listener automatic movement'); - writeln(' ESC Quit'); - writeln('========================================================================='); - -// ========================================================================================== -// PLAY 2 LOOPING SOUNDS -// ========================================================================================== - - - pos.x := -10; pos.y := -0; pos.z := 0; - vel.x := 0; vel.y := 0; vel.z := 0; - channel1 := FSOUND_PlaySoundEx(FSOUND_FREE, samp1, nil, True); - FSOUND_3D_SetAttributes(channel1, @pos, @vel); - FSOUND_SetPaused(channel1, False); - - pos.x := 15; pos.y := -0; pos.z := -0; - vel.x := 0; vel.y := 0; vel.z := 0; - channel2 := FSOUND_PlaySoundEx(FSOUND_FREE, samp2, nil, True); - FSOUND_3D_SetAttributes(channel2, @pos, @vel); - FSOUND_SetPaused(channel2, False); - -// ========================================================================================== -// MAIN LOOP -// ========================================================================================== - - FSOUND_Reverb_SetProperties(FSOUND_PRESET_CONCERTHALL); -// FSOUND_Reverb_SetEnvironmentAdvanced(FSOUND_ENVIRONMENT_HALLWAY, -10000, 0, 0.0, 1.0, 0.5, -10000, .02, -10000, .04, 100.0, 100.0, 5000.0); - - repeat - FlushConsoleInputBuffer(h); - Sleep(50); - PeekConsoleInput(h, buf, 1, dw); - if dw > 0 then - begin -{$IFDEF VER120} - Key := buf.Event.KeyEvent.wVirtualScanCode; -{$ELSE} - Key := buf.Event.KeyEvent.wVirtualKeyCode; -{$ENDIF} - if (key = ord('1')) then - FSOUND_SetPaused(channel1, not FSOUND_GetPaused(channel1)); - if (key = ord('2')) then - FSOUND_SetPaused(channel2, not FSOUND_GetPaused(channel2)); - if (key = ord('3')) then - FSOUND_PlaySoundEx(FSOUND_FREE, samp3, nil, False); - if (key = ord('4')) then - FSOUND_Reverb_SetProperties(FSOUND_PRESET_CONCERTHALL); - if (key = ord('5')) then - FSOUND_Reverb_SetProperties(FSOUND_PRESET_SEWERPIPE); - if (key = ord('6')) then - FSOUND_Reverb_SetProperties(FSOUND_PRESET_PSYCHOTIC); - if (key = ord('7')) then - openflag := not openflag; - if (key = ord(' ')) then - listenerflag := not listenerflag; - if key = 27 then exit; - if not listenerflag then - begin - if (key = vk_left) then - begin - listenerpos[0] := listenerpos[0] - 1.0; - if (listenerpos[0] < -35) then - listenerpos[0] := -35; - end; - if (key = vk_right) then - begin - listenerpos[0] := listenerpos[0] + 1.0; - if (listenerpos[0] > 30) then - listenerpos[0] := 30; - end; - end; - end; - -// ========================================================================================== -// UPDATE THE LISTENER -// ========================================================================================== - if (listenerflag) then - listenerpos[0] := (sin(t * 0.05) * 33.0); // left right pingpong - - // vel = how far we moved last FRAME (m/f), then time compensate it to SECONDS (m/s). - vel.x := (listenerpos[0] - lastpos[0]) * (1000 / UPDATETIME); - vel.y := (listenerpos[1] - lastpos[1]) * (1000 / UPDATETIME); - vel.z := (listenerpos[2] - lastpos[2]) * (1000 / UPDATETIME); - // store pos for next time - lastpos[0] := listenerpos[0]; - lastpos[1] := listenerpos[1]; - lastpos[2] := listenerpos[2]; - FSOUND_3D_Listener_SetAttributes(@listenerpos[0], @vel.x, 0, 0, 1.0, 0, 1.0, 0); - t := t + (30 * (1.0 / UPDATETIME)); // 50m/s - - // print out a small visual display - SetConsoleCursorPosition(h1, c); - if openflag then - s := '|.......................<1>..................| <2> Door: Open ' - else - s := '|.......................<1>..................| <2> Door: Closed '; - s[trunc(listenerpos[0] + 35)] := 'L'; - if (openflag) then - s[10 + 35] := ':'; - SetConsoleCursorPosition(h1, c); - WriteConsole(h1, pchar(s), length(s) - 1, dw, nil); - s := ' '; - - FSOUND_Update(); - until false; - - WriteLn; - FSOUND_Stream_Close(stream); - - Close(samp1, samp2, samp3); -end. - diff --git a/#ThirdParty/fmodapi375win/samplesdelphi/FMod/about.dfm b/#ThirdParty/fmodapi375win/samplesdelphi/FMod/about.dfm deleted file mode 100644 index 3ab38fc..0000000 --- a/#ThirdParty/fmodapi375win/samplesdelphi/FMod/about.dfm +++ /dev/null @@ -1,1551 +0,0 @@ -object frmAbout: TfrmAbout - Left = 349 - Top = 285 - BorderStyle = bsDialog - Caption = 'FMOD Music System' - ClientHeight = 245 - ClientWidth = 500 - Color = clWhite - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'MS Sans Serif' - Font.Style = [] - OldCreateOrder = False - Position = poMainFormCenter - OnCreate = FormCreate - OnShow = FormShow - PixelsPerInch = 96 - TextHeight = 13 - object lblCopyright: TLabel - Left = 8 - Top = 88 - Width = 202 - Height = 13 - Caption = 'Copyright '#169' 1994-2003 Firelight Multimedia' - end - object imgLogo: TImage - Left = 0 - Top = 0 - Width = 500 - Height = 86 - Picture.Data = { - 07544269746D61702EAC0000424D2EAC0000000000003604000028000000F401 - 0000560000000100080000000000F8A70000120B0000120B0000000100000001 - 0000080400000E0E060018040000181000002500000025080000180C08001810 - 1000181800002110000025140000291800001821000021210000252500001C1B - 0B003508000035100000351800002B190C002E260000392100002E2608002F27 - 1200421800003929000039200800392612004C15000052210000422900004823 - 0A0032330300423500003B370800363514004E2D00004A39000048330C004636 - 1500523100005D2B00005A3500005A390000552F08006339000056310E005534 - 15003C420C004C420C005A420000524210003C4A0D004D4A0B00455011004E5B - 1000634200005A4A00005A4208005A4214005A4A0C005A4A18005E4E00005A5D - 0D0069330600693912006F4204006D4412006B4A0000774A00006F4A0800734A - 1100635200006B52000063520800635214006F520400844A00006F520C00734F - 1500635A0000675E0200735A000073630000675E08006F5E08006B5D0D006760 - 15007B5200007B5E0000735715007363140081540200895402007B5A08008458 - 11006C6B02007B6308006C6B12007B6B0800846300008C630000886308007E64 - 13007374070073761500846B0400847B0000886D0800846F14008A7E0100847F - 1100946903008F6B0C008E6815008E731200927D04008C8408008E7B1200908A - 0A009D6D0400986D1600998210009A920E00AA790600AC791300B48C0900CB98 - 0E004E442D005B602F0076592300725F3900717621008474220075752C007475 - 45008C6C24008C80220094792200A27E20008B723500958133008E7A41008D7C - 54008A8F210095942600A1921B009D972900B3871800AF892600B5991D00B19D - 2B0092903C0094925300AC8F4000A9935600B19E3900B4AD3800ABA05600B1B0 - 5500CA921900CB952600CFA21D00CEA02D00D1AE2000CFB12D00E0AE2000E2B1 - 2D00CBAA3C00D2B93700E5AF3900E2BD3500C9B14B00C4B35D00E3B64300DBB8 - 5400E7C42F00E4CA3E00D9C84C00ECC84700F5C33D00F4C34E00F9D33D00F7D7 - 4A00DACB5B00E8CF5D00EFC85D00EFD65A00FBCE5200F7D05E00F9D85B00FCE4 - 5700928F7600AD9E7D00BDB67100BAB89000D4BE7100E0D06F00D1C29300DCD4 - 8E00F1CE6D00EFD67300F7DE6300F8D86D00EED38000F1DE7500EDD48D00EBD6 - 9E00F7E46B00FCED6A00F7E17B00FDED7700ECE58600F4F17F00FCDE8900FFF0 - 8000F5E88E00EAE99900FBE59400F9E49F00FFEF8C00FBF78F00F8F39A00FDFD - 9A00D4CCB700E9E6B800F7EBA500F3E5BE00FFEBA900FBEBB900F9E3C800F9EF - C500F5F9A800FFFCAA00F2FAB600FFFBB500F7F7C100FFEFC600FCFCC000FBFF - C600EEE7DB00F9F2D800FFF7CE00F9F7DC00FBFFCE00FFFBDA00F7FFDE00FFFB - E200F7F8ED00F7F3F700F5F7FB00FFFFF700F1F9FF00F7FFFF00FFF7FF00FFFF - FF00111212151E120B15151215121215181518181F181F241D242829241D1E1D - 1E24242A2C2A2C2C1D2424242428282B2B3A24282C241D28282A2B2D3A423A2A - 2A41282A282B2A2B2B2D383838422D3842444C494C4C4C5259596A737A635363 - 6D615363636B6D75767A7A927B94969696A496A4A3A5A5A5A7A9ABABB4ABB4B1 - B4B3B4B3B3B7B3B7BBBEB7B3B3B3B3B3B7B7B3BBB7B7B7B3B3B3B1B1B3B3B3B3 - B6B3B3B4B1B4B0ABB0B4B0B0B0B4ABB0A7B0A6B0A7A7A6A6B0A7A6A6A6A7A6A6 - B0A7A6A6A6A6A6B0A67F7F7F7F7F7F7F7C7FA07C7F7C7E7C78654D45442D2828 - 241E2424242528282A2A2B2B282B2825282B282C2B2C2B2B2B2A3A433A383841 - 38444444444C444444444449444C4C524C524C584952585258525E595C59595E - 645E59596459645C59645959596459595959616459615961616663616367636D - 636D63636D636D696D6D8585898989908D9093959A939C9C9CA3A8A8A8A8AFAE - AFAEAFBAAFB5BABABABAC8BAC8BDBAC8BDC8CAC8BDC8BBC8B9B9C8BABDB9C8BA - BAC8BABABAB3BABAB2B5BAAEB5AFB5B5AEB5AEAEAEAEAAAEAAAEAAAAAAAAAEAA - AAAAA5AAAAA3AAA1A7A1A1A3A1A1A1A17DA17D7D7D7D7D7D7D5D4D41402E241E - 191A140B0B0B0B0B1309130A130F0A130A0F1309130913090F0A0909090A090A - 090A13090A1305130A1113121312150B1A0B1A0B1516111F2626241E211E1E1E - 1E2421241E282828282B2A2D3A2D43322A2B2A2A2B2B322D4638382D2B2B2B2B - 2B3A38383C38383A3A38413841444646464E38423A464B42434E474E474C4E47 - 4C4E4C5E475E5252525961666A637493957A6353636D6D6F76767A89927A927A - 92929696969DA29DA4A5A9A9ABABABABB1B4B1B3B6B3B7B3B7B3BCBEBFBEBFBC - B7B3B7BBB7B7BCB7BEBFBEB7B7B3B3B7B7B7B7B7B7B7B7BCB6B3B1B0B1B4B1B0 - B4B4B0B4B4A7B0B4B0B0A7B0B0B0A6A7B0B0B0B0B0B0A7B0A6A7B0A6A6A6A67F - 7F7F7FA07F7FA07FA07F7E7C7C706566584638322B3A2B3A3A2E322B3A2B3A38 - 3A32323A323A323A383C383C424A43444646464A46464C524C4C524C4E524C5E - 4C5E5E525E595E525E5E58615E5E6661665E6661665E66666166616666616461 - 6659616461616661646164616A6361636763676367636D69676D696D85696769 - 5B856F8589908D8D93959A979C9CA8A8A8ACA8AEAFAEAFB5AFBABABABABABAC8 - BABDC8BDC8BDC8BBCBC8BDC8BDC8BAC8BDC8BABDC8BABABDBABAB3BAB5BAB3BA - B3B5AEB5AFB5AEB3AEAEB5AAAEAAAEAAAEAAAAAAAAAAAAAAA3AAA3AAA3A3A6A1 - A1A1A1A17DA17D7DA17D7D7D7D5F4D5F412E281F1E1A150B160B0B0B0A0A130A - 130913090F0A0A13090A0A13090A090A13060A0A0A090A13090A1309130A1312 - 0B12131215141216121215313A3A35323C25393132313232393A3E444A384E4E - 4C4E4E4E4C46484C4A464C615E5A52464C4E49444852555E5555494E4C4E4C4E - 5E5E5E615E615E524E5E5E555E555A615E676161616166616C6A6A636A6B6C6E - 6A6B6A7B93927576778976857689899092918B92939797979DA49DA5A5A9A9A9 - B1ABB1B3B4B3B7B7B5B7BEB7BEB7BEBEBEBFCACABFBEBEBFBEBEBFBEBFBFCABF - BFB7B7BEB7BFB7BEB7BFB7BEB7B7B7B7B6B7B1B6B3B6B6B3B6B4B4B0B6B4B0B4 - B4B6B0B0B4B0B4B4B0B6B4B4B0B0B0B4A6A6A6A6A6A6A6A2A6A0A27FA0A07FA0 - 7C7C78725F5E4E463C463C443C4A383A384A464B464A4A463C484E494A4C4C54 - 4C4C524C524C5E52525E5E555E5E5A5E5E5A615F615E616161615E666766615F - 666D6666666766666C6663666C666C666C676C666C676C666366616A616A6161 - 6D616D6763676367635B6D5B6D695B845B695B84858486858989898D98919598 - 9C9C9C9DACA8AEACAEAFAFB2BAAFBABAC8BAC8BABAC8C8B9CBC8CBC8CBC8CBC8 - CBC8BDC8BDC8BDC8BDC8BDC8BDB9BABABBB5BAB5B5BAB3B5B3AEB5AEB3AEAEAE - AEAEAEAEAEAAAEAAAEAAAEAAAAAAA5AAA3AAA3A3A1A1A1A1A17DA17DA17DA17D - 7D794D41414026261E1E161A0B0B130B0A130A0F0A130A1309130A0F0A090F09 - 0A090F090A0A0A0F051309090F0A091309130A1213141214121A0B1A141A1233 - 3A332532352525312B313231323232383844384A464C4C44443E38464A4C4C4E - 5E4C4944444946464C554E5E5549484C4A464E525E4C675961525252554E4C52 - 4C4C52525252615961596461646A616A6A6C6A6A6C757A7A776F636353536967 - 696D6F856F899092919797979D9DA49DA5A5A9A9A9B1ABB1B3B3B4B3B7BCB7BC - B7BBB7BFBEBFCABFCABFBEBFB7BFBFBFBEBFBFD1BFBEBFB7BFBEB7BFBFBEBFBF - BFB7B7B7B7B6B3B6B6B3B6BCB6B6B4B6B4B6B4B0B4B6B4B0B0B4B4B4B4B4B4B0 - B4B4B4B0B4B0A6A6A6A2A2A27FA0A0A07FA0A0A07E7D7C73665F4C4E463C383C - 384A3A4A464A474A464A4A4A384A494A49514C4C4C544C555E5255595E525E5E - 5E5E5E5E5E5E5E675E615F616161665E66615F666166666D6666666666666666 - 66666666666666616666666666636463616A616A61616367615B61555B555B62 - 5657565757573F5757628457848489908D989893939D9D9C9D9DACA9AFAEAFAE - AFBAAFBABABABAC5BAC8BDC8C8BDCBC9CBCBC8CBC8CBC8CBC8CBC8C8CBBDC8BD - BDC8BDBABDBABBB5BAB5B5BAB3B5B3B5AEB3B5AEB3AEAEAEB4AEAEB4AEAAAEAA - AEAAAAAAA3AAA3A3A3A1A1A1A17DA17DA17D7D7D7D794D5F41413A2C1E1F1614 - 120E0B0B0A0B0A130913090F0A0F0A0A09130909090913090A0F090A0F0A090A - 09090A090A0A130B0B120B161214160B1A0B111F1B1E1E1526191E1E1E1E1F1E - 24212C2C282C2A413A412A2A2829242A2C2B2D382D2B2A2A2A293A2D3A414A38 - 322B32322B383841444646444438384438384A46444A424A444644444C444C4C - 4C444E4C4E4C5E5A677261554844484C4E4A56606260626868696F6F6F909091 - 7B939D9DA49DA4A5A5A5A9ABABABB1B1B3B3B3B3B3B7BCBBBFBEBFBECABFBBB7 - BBB7BFBFBFB7BFBFBFBFB7B7B7B7BFB7B7B7B7B7B7B7B7B3B3B1B6B6B1B0B6B3 - B0B4B4B1B4B0B6B4B4B4B4B0A7B0B4B0B0B4B0B4B0B0B0B4A7A7A67FA27FA27F - 7FA07FA07FA07F7E7C7D7870664C443832322B3A2B3A3A2B3A383A383A38322B - 32323239383A384A3844444444444649464C4C4C4C49524C494C524C4C525252 - 5258525852585E595E59665E6659645E64616664666459645E64596659646164 - 59616459636161616153615555554C55544A4A4A3F4A3F3C3F353F3F3F575784 - 8486848490909890989D919D9D9D9DB29DACACAFAFAFBAAFBAB9C8BAC8B9C8CB - C8CBCBC8CBCBCBCBCBCBC8CBCBC8CBCBC8CBCBBDCBBBBDB9BDBDBABABCBAB5B5 - B5BAB3AFB5B3AEB5AEAEB5AEAEAEAEAEAEB4AAAEAAABAAA8AAA3A3AAA1A3A1A1 - A195A17DA17DA17D7D7D4D5F41432E2E261E1A1A16120B0B130A130A0F0A130A - 13090F0A130609090F09090F09090F0909090F09090F0909090A130A130B150B - 150B12160B14051B1215120915120B121512151515181E181E1824241D28241E - 1F1E1F2424242C2A2A241D24241E2428282A3A2A2424242824282B382B383838 - 282B2B2B2B28322B2B322B2B322B3238383844383838383A384A825F4E38322B - 32393E3A393C393E3E3F50503F51626068686F6F90907B93939D9796A4A5A5A9 - A9ABA9AAABB1B3B2B3B2BBB9BBB2BBCABBBBB9B9BBBBBBBBBBBBBBBBBBBBBBB7 - B2B7B2BBB7B2BBB7BBB3B3B3B1B1B1B1B1ABB3B3ABB1B4ABABB4B0B0ABABB4AB - A6ABAEB4A7ABABABAEB0ABA7ABA7A2A2A0A07FA0A07EA07EA07E947E7C7C7065 - 5E45383228282528252825242528252825252825252428282B252B2B322D322D - 383838383838443844443844443844484444494C4C4C4C4C5852585258525852 - 585258585258595959595C595259595959585959595952596364615955525255 - 514C54494A544A3F3C3F3C3F353F35373F3F3F5781628484848490989098989D - 989D9D9FB2B2B2B2B2B2B8BABABABAC8BAC8B9CBC8C9C8CBCBCBCBCBCCCBCBCB - C8CBC8CBC8CBC8C8BDBDC8BDBDC8BABCBABCBAB5BAB5B3B5B3AFB5B3B5B3AEB3 - AEB5AEAEAEAEAEAEAEAAAAAAAAA8AAA1A3A3A1A1A1A17DA1A17DA17D7D794D5F - 41434131281F19161A0B0B0B0B130A0A130913090F0A13060A0A0F0909060A03 - 0A030909060A08090909090A0F0A0A0B0A130B120B1A1412161502801A1A2614 - 1E1919191E1E1E2424241E1E242424283A282B2428282424242C3A2A2C2B2528 - 2828322B3A463A2B25252B25323232384C443A3232323232323238443938384A - 3846384649443844484438394F824E3C443244554951483F573F3F393F3F3F3F - 3F5754626268696990909091919D939D9D9DA9A9A9ACB1B2B2B2B2B8B9C5B9B9 - B9BBC5B9C9C9C5C9B8B9C5CAC9C5BBC5D0CDCAC9BBB8BBBBC5CAC9C9BFBBBAC8 - C8B3B7B7B3B5BCB3B2AFB2B5BAAEB3B1B1AEB3B3AAAAB5AEB3B2B2B5B3AEAEAB - AEABA7A3A3A1A1A3A0A1A0A1A07EA0957D946C6C725F463E253A2C253A252525 - 3235254A392B3E283938393832383E444446444444444C444649454C584C584C - 58525E585E525E4C52585958595C61595C645E64646159645964596464645964 - 64596159646159616461595359595353535255524C4E544A4A4A4A3E37393F35 - 3C35373537353737373F628184848486909890989D9F919D9F9DB29FB29FB2B8 - B8BAC8BAC8C8C8B9C9C8CBC8CBCCCBCBD2CBCCCBCBCBC8CBCBC8CBCBC8CBC8BD - C8BDBDC8BDBABABAB5BAB5B5B3B5B3AFB5AFB3B5AEB3AEB3AEB5AEAEAEAEAEAE - AAAAA8AAA3A3A1A1A1A1A1A1A17DA17D7D7D794D5F41422E261E1E19160B130A - 13090A0F0A0F0A0A1309090A0F090A090A090909060908090903090909090809 - 0A090A0B0D0B13140B121314121308878F998F8E8E998F8F8F998F998E9B8E9B - 9B9B999B9B9A8E9B9A8F9A999B9B9B9B9A8F9A9B999B9A9A9A9B9B9A9B9B9A99 - 9A9E9B9E9E9A9E9A9B9B9B9B9B9E9A9E9A9B9E9B9B9B9E9A9B9EAC9B9A9EAD9B - 9A9B9E9A9E9EAC9C9F9A9E9C99989E9E9E9E9D9E9E9E9F9E9F9F9D9F9F9F9FB8 - 9FB8B8B8C5CAB9CAD0CAD0D0D3D1D7D3D3D7D3D5D3D7D7D7DCDCDDDCDDD7D7DC - DDDDDDDDDCDCD7D7DDD7D7DDD7D7D6D3D3D7DCDAD7D3D1D1D3D1D1D3D7D3D3D3 - D2D1D1D1D1D1D1D1BECAD2D3D1D1D1D3CACAD1CAD0D1BEBCBDB5B5BCB4B5B5BC - B4B5AFB3AEABA9A8AF9A9C9B8E8F988E988E988E988E4A394B3E4A4A444A464A - 4E4A4E4C4E4C4C5E4C5E525E585E5E5E5E5E5E5E5E5E5E615E5E61595E595E64 - 5E6459666164666661666C666A66666C666C66666C666366616C616A616A6164 - 61615961595553555556554E564A4A3F4A4A3C373F353735373637373737813F - 848484848690989099909D9F9D9D9FB2B2B2B8B8B8B8BABAC8BAC8C8C8C9C9C9 - D2CBCCCBCCCBCBCCCBCCCBCBCCCBCBC9CCCBCBC8C8C8C8BDC8BDBDBABABABCBA - B5BAB3B5B3B5B5AFB3B5AEB5B3AEB5AEAEB3AEAEAEAEAAAAA3AAA1AAA1A1A1A1 - A1A1A17D957D795F5D47403A2C261E1B19160B130A0F0A130A090A0F05130613 - 09090F0909090903090909030A0F090908090909080A0F0A130B0B12160B121A - 121603272721303325322731263A313A3A323C413B43434B433B463C433C3B43 - 434B4F4A3A3C383C384E4A4E5A4C4A463C4A463C4E4F5A5A5A4E5A4E4B4E4E4B - 4F4A4E4E4C564E565A555E55614E5546566782554949535B6D6367675B6D696D - 6962625B626262625B846262696969699084909098939D9C9D9DA9B2ACB2B2B2 - B2B8B3B8B7B1BBBFBBBECACACACAD1D0CBD0CBCACABBD0BBD0D3D3D0CABBBBCA - CAD0D0CABFBFBEBBBBBBBBBFB7BEBFBFB2B2BBBBBEB3B6B6B1B1B1B7B4B0B4B6 - B1B1B7B6B1B1B6B0B1B4ABA9A6A4A2A4A4A67FA27FA2A2A27E7F7B748B716A60 - 4A4B3B3C4B3C3D4B3C3C8E4B57324B324A2B4A444A4446494E444C4C454C584C - 524C5E5E615C595E595E645E61595E596159665E6666666666666A666666666A - 66666C66666C666C666C666C6166636C6663616161646153616155556156564E - 56564B544A3F3F4B3C3735373537363736373737813784818484879098989F91 - 9F9D9D9FB29FB2B8B8B8B8C5BAC8C8C5C8C8CCCBCCCBD2CCCBCCCBD2C8D2C8D2 - CBCCCBD2CBCBCCCBCBCBC8CBBDC8BDC8BDBDBABDBABCBAB5BAB3B5B3B5B3B5AF - B5B3B5AEB5AEAEAEAEAEAEAAAAA3A3A3A1A1A1A1A1A1A17D7D7D79795F4D432D - 2C281E191A1612130A0F0B0A0F0A130913091309091309090F09090903090309 - 090309090909030A08090A0B0B0B130B1312141213150A2319191426211E1919 - 21241E2128282828282D3A2D3A2A282A282A2B2B3B2D432B2B2B2B25323A444E - 4A463238322B2D384346434F463238384A3839384438443844464A4A494A3E49 - 4C48385A825B323248525153514C5B554C4E55515151504A515050503F575762 - 3F60686869846269909090919C9D9D9DA9A99DB2B2A9B2B3B3B7B7B7BBBEBDBE - BEBFBFD1CACACABECAD1D1CACACAD0CABFD1BEBFBEBEBFBBBFBFBFBBBBBBBFB1 - B7B7B0B1D0B2B2B7B3B6B6B6B1B1B1B7BCB4B0B6B6B1B1B6B6B6B1B6B0B4B1A6 - A2A2A27F7FA27F7FA0A0A0967F7E7C7878706151323A252C31253A2525253C8E - 2B3A3A32253A3E3839443E4644444C464C4C4C4C4C58494C454C4C4C4C4C5252 - 5852525852525859595C615964595C5964595964596459596459645959596459 - 61645961535959595953595253525555555256544C544A4A3F4A3C3E373C3535 - 36363637363736373781378484848490909898989F9F9F9F9FB29FB8B8B8B8C5 - B8C8B9C8C9C8C9CCCBCCD2CBD6CBD6CBD2CBD2CBCCCBD2CBCCD2CBCBC8CBCCCB - C8CBC8BDBDC8BDBDBABDBABAB5BAB5BCBAB3B5B3B5BAB3B5AFB5B5AEAEAEAEAE - AAA8AAA1A3A3A3A1A1A1A17DA17D7D795F5F47403A2C1E1E191A0B1A130B130F - 0B0F0A13050F13090F0A090909090F09090F0909030A0309090A08090A080A08 - 0B0F0B1612131513150B00050B1A09140B150B1212151215181E1D1E1D1E241F - 1E181E1F181E1D2424281D1E18241F1E1D2824282828241F2424282D2A2D2A2A - 2A24242828282A252B2B2A2A2A2A28282B25283228283A433B1D1E3248495148 - 48494B383C464A383E3E3E3E3E39393539313D3C373F3737373F626269696990 - 9093939D9D9DA9B29DB2B2B2B2B3B3BABBBCBBBDB3BBBCBECABEBFBCBBCABBCA - BEBFBEBEBEBDBBBEBEB7B7BFB7BFB7BBB9BBB8B7B7B7B7A59DA9AEB3B3B3B1B6 - ABB1AEB3B6B0B0B6B1B1B3B6B4B4B6B1B0B4ABA7A4A2A2A27F7F7F7FA1A1A1A1 - 7F947D79795D583E2A2424211E242124211E21218F2B2525242528282A282B2B - 2B2D2B382B383838383842444442444444444C45444C4549444C584C58525858 - 5258525C525C595C59595C595E58595259525952595252595253595259525953 - 5252555355555455494A544A3F3E3C3739373535363534353636373637373781 - 3784848487909099909F989F9F9FB8B8B8B8B8C5C5C5C9C8C9C9CCCBCCD2CCD2 - D2D2CCD2D2CCD6D2D2C9D2D2D2CBD2C9D2CBCBCBCBC8CBC8C8CBBDBDBDBDBABD - BABAB5BAB5BCB3BAB3B5BAB3B5B3AFB5AEAEAEAEAEAAAAA8AAA3A3A3A1A1A1A1 - 7DA17D7D795F5F41402B241E1E191A0B160B130B0F0B0A0F1309130913090A0F - 09090A030909060A030909080909090809090A0A0A0A0B0B120B120B12141316 - 1A1E1926191E261B24262626242B2A2A2D3A3B2D25282B252A2B3A4138433A2E - 2E2B3A2C2B3A433A43322B3A2D384243424647463A433A383C444A3844444643 - 43463C463C4A4C39384E4B3B3B2C4A4E55495555555B564F575A564E535E4A49 - 4A50484A3C3C3F373F373F84378462698469909090909D9D9D9DB2A9A9A9B2B2 - B8CABBBBC8CABBBBD0CAD1D0D1D1D0CACACAD0D0D1CAD1D0D3D0CDCBD0CAD1BF - BFBFBFBFBBD0B9D0B7B7BBA5858AACB3BEB7BCBABBBBB3B3B7B4B0B0BBBBBCB7 - B3B6B3B3B3B1B3ABA5A6A2A2A2A27FA0A1A1A196A07F7D8B7D7D6652463A2B25 - 28252B31253A3A253C991E3A25253A3A3C383C423A464646464646464E464C44 - 4C44464C454C4C4C4C584C585258525C52595E595C595959645959645E646459 - 6459645964595961595961596159615961596159615361555355555555565456 - 4A3F4A3C35353535353134363536363637373781378184848487909099989F98 - 9F9F9F9FB8C5B8C5B8C5C5CDC9CCC9CCD2CCD2CCD2D6D2D6D2D2D2CCD2D6CDCC - D2CCD2D2CBCCCBD2CBCBC8C8CBC8C8CBBDBDBDBABDBDBABAB5BAB5BAB5B9B5BA - B3B5BAB3AFB5AEAEAEAEAAAAA8AAA3A3A3A1A1A1957D7D7D79795F5F41412B26 - 251A151A130B160A0B0F0A1309130913090F050A0909060A0903090903090909 - 0908090A08090A080A0B0B130B131214131201223331222525322231312B312B - 3232384A384A4F3C3A3A313A3E3C474E463C3C3A383C3A4A464A5A4B4C3E464A - 444C4C5E5E5A674E484E4A4A4A4A4C4A49524C5E5E4E564A544A483E4A54443C - 4A5B696D6363625B606967846D6963636359555B606255546254575760606260 - 6269848469909090909090919D9D9D9DB2B2B2B2B8B8B8B8C5B9CDCDD0C5CABB - CDD2D2D2D4C5CDCDCDD2D2C9D2D2D2CDCDD2CBCBCACAD1BFD0C5D3C9D0CAB8D2 - E4C49AAEBEBEC8BDBABAB9B9B7B7B1B1B9C8B9BDBBBABBB3B3B3B3B3ABA9A7A5 - A7A2A4A2A6A2A1A2A27FA09494957C6A614E4A383939393939393F3239398D3F - 325B4A3E444A46484C464C4C4C4C4C4C5E4C5E5E5E5E52525E525E5961526159 - 5E61666166666661666166676A6166616A6661716C6166666D6463666366616A - 616A61676A616161616361636763555B53625556564A3F3C3F3C353536303134 - 343434343434363737813781848487909099909F9F989F9F9FC5B8C5C5C5C5C5 - CDCCC9CCCDCCD2CCD6CCD2D6D6D2D6D2D6D2D6D2D6D2CCD6CDD2D2CCCBD2CBCB - CBCBCBCBCBC8CBBDC8BDBAC8BABABABABCBABABABABAB5BAB5B5AFB5AEAEAEAE - AAAAA3AAA1A3A1A1A17DA17D7D79795F474741332E251F141A130B0D130A0F09 - 1306130913090F091309090F0909030903090908090909090A080A0A0A0A0B0B - 120B0B120B120933312125313A3222332F3A263A32323A383C3A3B3121212626 - 253C3A3B322B21313A313A3D4E4B3B32253225394446555E5E5A4E3A253A2531 - 323A3C484A4E5E4E4C4E392525253C3C4B4A353232394A626255564A393F4A57 - 62605B6363674A5650503E353525353F3F3F60606284843F3F37378490909090 - 989D9D9D9D9DB89F9F9C989C9FC4C5B89F9B9A9FADC5D6C5AD9E9CADCCD4C5C4 - 9E9E999FC4D6C9D7D2D0D2B9AC9C999CACC5CBC5CFF78EAFCAB9B89E9A9A9A9C - B5BCB1A89A9AACB8B9B8AC9A9597ACAFA8A2A3A1A3A2947EA2A29696A6A2A07E - 9496786A5948443C3E3A3E39393932574A3E4A8D393C484A464A4C4E4E554E5E - 4E5E555E4E5E67675E615E5E5E615E615E53615961645E666166616661666666 - 6666666661666171726A61726C666164616A616164616A6166636663676A6363 - 6367635B61555656544A3F393C35353535353430313430343434343436813781 - 8184848790879899999F9F9F9FC2B8C2B8C5C5C5C5CDCCCCCCD2CCD6D2D6D4D6 - CCD6D6CCD6CCD6D8D6D6D6D2D6D2D6D2D2D2C9D2C8CCCBCBCCCBCBCBC8BDBDBD - C8BDBABDB9BDBABDBABABABAB5BAB5B5AFB5AEAEAAA8AAA3A3A3A1A1A195947D - 7D79795F885F434333262615160B130B0A0F0A0F09070B13091309090A0F0909 - 090F05030903090908090908090A080B0D0A0B0B0B0B12160B12031B1A221A19 - 1E1513131A1813102426181A152F1B050914051312271B180A120B11111F101F - 2F2C110B12121215243A38433A3B3A1212160B1214151F1E263B38383A1E1E15 - 0A0B131B2F1A120E2614263382261E1E1919193D3131254B4C3C261231262019 - 0E161A26223E35503F3530230E2020343781373798989081849D9F9884374B57 - 8299C29887828382879EC7C2865781679EAD9E8681814B8699B8CDD3D0D0C59A - 8257814F83ACC4C599C6CF8EC5B88C83824B4B679CC89A5E5A4B5B9AAD9A8C3D - 825A889B9A7D7994AA78598B967C8A5D94A07E948B957059494A3A3A2C2B262B - 312B31253B3D213A8E3A253C4A322B38383846444446444946494E884E5A4C4C - 4E5E4C4C4C5E4C5E4C5E595E5952585952595E59616159616461597261646166 - 8A61596659526366616A61616A616A636A61636D636363636362555654544A3F - 39353535213425303030303434343434343481348181818487849990999F999F - 9FC2C2B8C5C2C5C5C7C5C9CCD4CCD6CCD6CCD6D6D8D6D6D6D6D8D6D6D4D6D6D6 - D6D6D2D6CCD2D6CDD2D2CBCBCBC8CBC8CBC8CBC8BDC8BDBAC8BDBABDBDBABABD - BABABAB5B5AFB5AEAEAEA8A3AAA1A3A1A1A17DA07D7D79795F5F4F433B2C261E - 1A0B0B130D0A0A0F0913060A0A0F0913090A090F09090F0906090A090909030A - 0F0A0A090A0A0B130B120B120B14020A0B110B16120BE38F071B8FF0041F1AE1 - C00A83F9F7F7F0E0C01A1BF0FBFBFEF98313E0C11F1FC3F9F8F7F1831F2A3A28 - 4B1E15E0F1F7FBF7F18080E6831F24283B2FE0FBFFFEF087071BE3F3F5F5C680 - 1A81E3F7F7ECE0C31BC6C32E331EC3E01717C6F8F8F2C6C03A352532252527F0 - F6F8FCC33436E0C3379081EA9F999884C7F6F6F4E387988FE1F7F6EFE08FC298 - C7F4F4EB99AD9EEAF3F8F6EF9BADCDCACACDADC1EFF6F8F6E38EC4C487F1E68E - B89FC2E3F4F5F5EA88AC8CCFEFF4EA999999E3F5F7F4CF8E8DC5CC9C9579EB8A - 9694C4CE7DA17E7D7D955D5E383828282421242124211E1E212124193D8C2B21 - 283232383238322D323838384838445A464E443838444438444444444C4C5849 - 4C524C4C4C5252525258525252524C6652525861734C52525252595253596164 - 6163616A61636A6363636355635555544A4A4A39353935253530213030212030 - 342034343434348134818181848790999099999F9F9FC2B8C2C5C5C5C5C7CDCC - CCCCD4CED6D4D6D6CEDAD6D6DAD6CEDAD6D6D8CED6D6D4D6D2D6D2D6D2CCD2CC - CBD2CBCBCCCBCBCBC8CBBDC8BBBDC8BDC8BDBDC8BDBABAB5AFB5AFAEAFAAA8AA - A8A3A3A1A1A1957D7D7D79795F5F47433A2E211A15140B0B0F0A0F0A070A0F13 - 090913090A0F09090909090809090909080A0908090A090D0A0A0B0B12130B14 - 120B031B1B1516191E1AF08F171B8FF0121B1BF08F17E0C3270EC3FB8723C3F0 - 801717C1F011C3C32F2FF8802726C1F1243B2B4A3C2599F28180230FC0F6F7C6 - 333D4A3A2CC6F0801B07E0E007E0C63D8183F0C180C1E6833DC1FBC327C3C33B - 4B3DC6C317C0E18080C0FBE025353C3C4A31C6C3808080F0C334C3C3818784E1 - 9F9999C3EA9999C0E0F18FC7D9C2C7C7EACFC2C1EFC1C2F5C7C4E5ECC3C3C0E0 - E2C2C9D7CBCDC4ECE1C1C2C0F4C6AD9FC0F3F5C19DADE8E1C1C299E1DB9EC1F2 - 9E9FF4C699E0C7C09F9EEEC79CC5C99A9A88F55AA892CECE79A196949595705C - 4C4A32322B2B2532253225393C323C32253C8D394832323E4C32444844484449 - 4C4C5B6D5A675E5A52494C524C525252525E595E59595E595E595E595E596159 - 5E595E6D615E59728A59596159616461616A63616A636A6A636A636C63636361 - 53555556514A4A3E373235313521353021302030203030343434343436813781 - 84878487989998999F9FC39FC2C5B8C7C5C5C7CDCED4CCD6CEDACED6D8CEDADA - D6CEDAD6D8CEDAD6D8D6D6D8CED6D4D6CCD6D2D2CCD2CCCBCBCCCBC8CBC8CBC8 - C8C8CBC8C8CBC8BDBAC8BABDBAB5AFB5AEAEAEA8AAA3A3A3A1A195A07D8B7979 - 5F82474B3A2E261E160B160B0D0A0F0913070A0A13090F0913090F0909060A03 - 090F0909090908090A0F0A0A0A0D0B0B0B0B120B13120327332727273126E38F - 23808FF01B3B23E38F17F0C0198027F08F808F80131700C0F012C3C32F9BF080 - 278180F24B5A5A854B39C6C327802317C0F2C63D3B4B4F4B3C878307178087F0 - 80E1C0818427C3C380C3C63D863DE0C380C3C6805731C3C327C3E0808027E0C3 - 334A5B574E3CE1C0012307878181C3C3819981E1C09999C3C33687878FC08FE8 - C2C2D4C4EEE2C6C3EFC1D9E3E4C7C2C1878787C0EEC4D8D7D3D2CEC699878781 - C7CFC698E1E0E0C698B8C399818781C6C7C4C1E399C7E8D999EAC181868199C1 - 93C5C79AAC8CF583A891C6C7A1A1A396979A7C66674C4E4A3E4A384A3C3E4A3A - 3E4A574A393A568D385B3E4C5B444C525E52524C52615A856D8867675E4C615E - 5561596161666D66615F6161645E666166616661666161726D5F61738B5E6161 - 616A676A666D6C6C6D6C6D736F6C6D636C636D6361635555544A543C3E353C35 - 253130253021302022303030233434343480378181878487909998999F9F9F9F - C2C5C2B8C7C5C5C7D2CED6CED4D6D8CEDAD6DACEDBDADACEDADADACEDADACED8 - D6D8D6D4D6CED2D6D2D2D2CCD2CBD2CBCCCBC8CBC8CBC8CBC8CBC8CBC8BDC8BA - BABAAFB5AFAEAEA8AAA8A3A3A1A1A1957D7D8B79725F4F433B3A261F16140B13 - 0D0A0F0A070A130F0A13090A1309090F0909030909090F0909090908090A0A08 - 0B0A0B0B13120B0B140B0927333130263122F08F2327C0F0168017E6C016E6C0 - 1A361BF08F2713C0C3C1E0F9C380C3C32C9BF017312731274B46564E3C3AC3C3 - 0E270FE0F3F1C63D824B4A4A3D14C0C3C3C0FDC380E1C0378381E0C336C6C657 - 8657C3C380C3C180573CC3C380C3C1808036C3C33D3F544B5431E1E0C3C3C3C3 - C080C3E0818781E1C0C0C0C3F0E0E0C3C3E087E1C2C3D4C4C3C6C4C2E7C1CFCF - E2C699C2C3E0E0F6E2C7D3CDDDDDC28FC3C6E0E1EFE1C28EEFC2C1F68D988FC3 - E0E0E0F4C7C4C6E69BC7C7C69FE1E0E0E0E0C3C199C7C79B9E88F7879A93C6C6 - 95A5A2969CA37971674E4A4E4A3A3E3C3E3C4A393C563A395A4A4A2B994C5A32 - 5A5A4C564E4C4E554E676788828885675A5E5A5E5E675E5E67676D6661616161 - 6161616161666161616661886C6167738A6172616663666C676C6C6C6F6C736B - 6D736C6F636D636363615B5555544A4A3C393535253525302530302122223023 - 30233434343681368181848787879899989FC39F9FC2C5C7C5C5D4C5C7D4CED6 - CFD6DACEDACFDADADACEDBDADACFDAD8DADADADADAD8DAD6D4D6D6D6D2D6CCD2 - D2CCD2CBC9CBCBC9CBC9CBCBCCCBC8C8CBC8C8BDBABABAAFB5AFAEAEA8AAA8A3 - A19AA195958B8B725F5A473C3B2E26261A160B0E130A0F090F09130913090F13 - 090F09090909030909080909090A08090A080A0A0A0B0B0B0B0B160B120B0320 - 1E1914201E14E38F0F138FE0171B17F08F13F08F1F271AE6C01FC1F9C1E0C3C0 - 1B1BC3E02C8FF00827251414254E384A3B3AC3E60A23F0F183C3C6244B2B3231 - 25C1F7C3C3E0C02323E78F373036C3C380C3C2825735C3C323C3C3172622C3C3 - 16C3C3173016C3C3263535323921F0E0C3C3E0E0C323C3C3238180F0878787C3 - F0C3E0F0E0F087EAC1999F998E99C2C0EC8FC3C2C2C4C3F5E0F0E0E099CCDDD3 - D1D4ADE0F1E0E0E0C399C2C2EFC3C1EFC28CE1F0E0E0E0C0C29BC1F0819E9FC4 - 9FEDE0E0F0C3F0E099C3C4838E82F8808D67C6C78BABA196A3977D65723E383A - 322532253225253C3C3A2B323A253C3A328E384A2A4B384E38444E464A5A5A67 - 88828867464E4C4C4C4C524E595E67595259595E596159595E53615961595E73 - 675261728A616D6161616663666D6A6A6A636C6C636B6D636C63636161555555 - 504A4A4A393C3539313525313025222120222220233020343436813681813787 - 87908799999F9F9FC29FC2B8C2C7C5C7C9CECED4CEDACEDADADADADBDADBDADB - DADBDADBDADADADADADADAD8DAD8D6D6D6D8D2D6CCD2D2CCD2CBCCCBCBC9CBCC - CBCBCCCBC8CCCBBDBABABABAAFB5AFAEAEACAAA3A3A3A1A1957D79724F473833 - 2B2626191B14130E0A0F0A0F090F130913090A0A09090A0F09090F0906090A09 - 080909090F0A0A080B0A0B0B13120B160B14020B0B0B0E0B1409F0C00702C0FE - 130704F0C01BF08F1A121BE08F1FC3C3070706878F13C3C31F8EF007041223F7 - 2C284F282B192FE6F0F8E0131A271E2A2428242426C3C117010187C023E7C019 - 1E0BE0C336C6C63D3A3CC3E00DE0E1131311C3E023C3E0002301E0C31B252231 - 2126F08F071307E0C117C3C10F200FE0873481C3E0808181C0F099EAC1878183 - CFE1C0C2E080838F9EC2CFC3818781C0C6C7CDD3CDD8C2F1C1838787C1C6C1CF - E89FC2D9E88CF0C1838F81C39F9BC1E627838CADC2E5C3838381E0E0C1D9E13D - 3D83F98F4B4BC6CF8B7F9694A397785D67382528252421242121251E19242525 - 1E3A25212B258E4E24322B38322B383E384E4E5A5A5B4E553838484438494449 - 4C5852524C494C524C524C52524C52524C524C725E4961677161735E52615961 - 6A596C6A636B6C6A6C6C636C636A636161535B5155484A3E3935393532312530 - 253025222130222020232334233436348137818481848798989FC09F9FC2C2B8 - C7B8C7D4C7CCD4CED8CEDACFDADADBDADBDADBDBDBDADBDADBDADBDADADEDADA - DAD8DAD6D6D6D6D6D2D6D2D2D2D2D2C9D2CBD6CBD6CBD2CBCBCBC8C8BDBAB9BA - AFB3AFAFAEAEAEA8A8A3A19A958B725F5E46322B26211E1A1A160B0E130F0B0A - 0F09130613090F090A0F09090903090908090F090A09030A080A0A0A0D0A130B - 12131412130B03161B1E19191519F1FBE0C3F0F1F1C3E0F9261AE6C11D251FF3 - C11EC3F9C3C3E0F7C127C6E04126F7E0C6C3E6CF3B38382D3A2F1EC1F8C0271B - 27153B2B44463B2F2FC1F8C3C3E0F8C181C1F4C6C3E1F28F3DCFC73D8632CFC6 - 80C6F7E6C3E0F78F2787F7E0C1F1F8C32331313D333DC1FBC3C3E0F387C1F8F3 - F0E0E0F8F0E1C399F6C7C3C3F6E0C2D9EFE0D9CFF6C6C1ECF7E7F2ECD9C6D9F7 - E0C6E1F6E2C5D5D3D7CEC7F2F3E0C6E1F5C7C2F2C7D4C5C6EEC1E7F1E0CFE1F5 - C5C2E5F7EDEEEEC4C7CFF5E0C7E1F5C3C2D9F5E5CFE5F5F2CECEEFC2A3A3A396 - A8A17A6572443A3A322B312B253A252B4B2B254F252B4B323C32388D383E444A - 44324E4938565A6785826767495E4C4C52525852616167595952595252525952 - 5959595E5259618A615E726D6D738A6C616A616C736A6C6C766C766E736F6C6C - 686D63636163555555564A4A4A3C393535253525252522253031302320233036 - 343436348136818784818790879F9F9F9FC2C2C2C5C2C7C5C7D4CECED8CFDADA - DBCFDADBDBDBDBDBDBDBDBDBDBDBDBDBDBDBDADEDADADAD8DAD8DAD6D8D6D6D6 - D2D2D2D2CCD2D2CCD2D2CCCBCCCBCBC8C8BABAAFBAAFAEAEAFA8AEA8A3A1A195 - 7D79725F4F4E3A3A2C211E1B140B160B0E13080F0A0F0A0A090A090909090F09 - 0909090309090909090908090A0813090B0B0B0B16120B16121609273333263B - 3A2C8F8EC6CFC33DC0C6CF8E3B438F823843469A82434B8FCFC6CFC13A3B8E87 - 433D83C3C6CFC24F4E5E5A4C473C3BE6C127271BE082823C4E4E4E3C3D3DC0C6 - E0CF9E8484849BCECFCF9B8585989A5B5B8598995B8E99C1CFCF9B82573D87E0 - C6C1C3C6274B823D4B4B4BC0C6CFC68F8187C6E3C0C087F8C3C09990C3D9D9D9 - C7C2C5D4D4E8E9E8D9C7C6E1F4C7D9EBE2C7D9CFEEEDE5E8D9D4DCDDDFD8E2CF - E5E5EBE5E4DAD9DED8D9D4CCDACEC7E4E4EBE5D9C7C5E1EEC7CEDED8CED8DBE5 - E4E9C7CCD4C5C5DADADBADB8DCD7BAA8A5A4A3A1A5A87D708B59554C4A3E383C - 443C3E4B4A484E394A464A3E4A564C4E8D5E5E49674C5E4688888588678A6788 - 525E59615E6161615E6D72616D6661536A616A64616A616A6166678A6C6D7372 - 738A8B6D716C6C6C766C747674767A767A767676736373636363635B55544E54 - 4A4A3C393931352531253121223D222230223027233680348136368181848487 - 879F9F99C29FC2C2B8C7C5C5C7CCCED9CEDADBCFDADBDBDBDBE2DBE2DBE3DBE4 - E2DBE4DBDBDBE2DBDBDEDADBDADADADADAD8D8D6D8D6CED2D6D2D6D2CCD2D2D2 - D2C9C9C8C8B9BABAAFAEBAAFAEAEA8A8AAA89A958B79795F5F4B383325211F19 - 16160B0D130B0F0A091309130A0F0A0A090A0A0F090A08090A09080909080909 - 0F0A0B0B130B0B140B0B1A0B141209273127332B312A33283D3D2E254F4B434F - 3B2A4F4B38322A5A464A433A432F43324F432A413C4B2E823A4B4F4A4E5B5E5B - 4A3D3DE3C1051B0BEDC13B4E5A383E464B4F823B4B578962636961858888856D - 63856D676354556D54855A82824B823E5A574B823D30C6C633334B5A4A4E3C57 - 4B4B5B4B354BE0C30E8080F0C03481849F999F9FB8C5C5C5C5CDC5D4C5C7D9CF - E9C7DEDED8D8DED8E2DADADAD8DCDDDCDDD8DEDAD9DEE4DCDEDADCDED8D5D2D5 - DCCDCDDDD8DCDED4C7C7DDE8C5D4D5D5D4D4CCD8C9CCCDCDD0BBACB2AFA8AEA8 - AEABA5A3A7A3A4A2A8A87D738B59614A443E3C4A3A4A43565A4A4E3E464A384A - 4A4C4A3E678D4C494E5A5A5B8D828C858885888A5E5F595E5E5E5E67596D6D5E - 6D6161596C6161616A6161665E61618A6C678A6D738A8A6C73736C73766C746C - 76747576926E736C6F6C6D63536A615555554A4A4A4A4A3F3E3C3A3531313122 - 213D223033232236233634233636368181818487849FC0999FC2C2C2C2C2C7C5 - C7D4CEDACEDBCEDBCFDBDBDBDBDBE2DBE2E2DBDBE2E2E2E4E2E4E2DBE2DBDBDA - D9DADBD8DADADADAD6D8D6D6D8D6D4D6D2D4CCD2CCD2C9C9C8C8C8BAAFBAAFAF - AFAFAAA8A8A3A1957979885F5F4F3A3A26261E161614130E130D130A13090F0A - 0A13090F0A090F0A09090909090F090A0309090A090A0F0B0B0B13140B140B16 - 0B1400171619191E1E1E261E1A1E192F26261E3D3B24282C28283A3A283B4126 - 242C2C3D2C3AC6C6402F412E2424433A4646253A252F33C3E6F7E6F7F3261E3D - 283A323E2B823C1E4B4B5B63686363676D67636C536153615B525561485B484A - 384656324A4B3C313133CFC33C3C3239384A3A3B31253A3C333383F7F2E080C3 - F8EAC286909F9F9F9FB8B8C5B8B8C5CDCDCDD4D4DDC9D5D2D5DCD8D2D8D2D2D5 - D7D2D7D7D7D5DCD8D5D6D7D2D7D7D7D7D5D3D0D1D1D1CAD1D3D3CDD5CDCDCDD5 - B8BBD1D0D1D1D3D5D0D1CABFD1BFB1B0A9ABA9A5A3A5A2A5A6A5A3A2A8A39270 - 8B584E3A322A2C3C2E252B3D433A3A2B3B383A4A38394632394E8D4F4E384A43 - 8E4E888582885A88584C4C584C5E4C674C67675E675E52525E59595E595E5E52 - 5E525E8861728A6D72887367736D6C71736F746C746E736E7A766A6F6C636363 - 6353556155514E4A4A4A4A39353E393132313D31223322273022273620342734 - 8034348181378186879FC0999FC19FC2C2C5C5C7C7CCC7D8CFDBDBDBDBDBDBE3 - DBE2E4DBE2E2E4E3DBE4E5DBE4E4E4E8E4E2DBDEDBE2DADEDBDADADEDADADADA - D6D8D6D8D6D8D6D4D6D2CCD2C9C8C8C8BAAFBAAFBAAEAFAEA8A8A195958B8888 - 5F4F3C3B31251E1B150B160B16130D130A13090F0A0A090A090A0A090A08090A - 08090A09080909090F0A0A130B140B0B120B140B150B010B080B121514121512 - 14151E15151E1E2415151515151E1E15241E241E1E1F1E1D2C248C8E1D15241D - 242C2A2A2A2A2528243B151E838FC0832F1E3B1E2824252421381E2B5B4E5155 - 485152536D616A5353525249494C494844483848323E32323225322525318286 - 2425252B2124252B322524252521193DC08E303D87C2998484989D9D9D9FB2B2 - B8C5BBC5C5CDC5CDCDCDD5CDD2D3D2D2D2D2CDD3D2D3D3D3D5D5D7D5D5D2DCD0 - D2D3D5D7D5D3D0BBD1D1CAD1D1D3D3D5D0D0D0D0BBBBD1D1D1D1D0D0D0D1BFBB - B7BFB0B0A5A7A5A5A7A5A5A2A4A4A3A2A3A38B717A584E252A25242E25241E3A - 3B2825283A2B252432322B4A38284A8D3832385A884B8282825A678244444544 - 444952674C5E67446D4C4C49524C52525258524C584C52725E6788726D728561 - 8A6A6D6A716C6C6E6C6E7473926A73766D6A63636153535B534C5B4A444A4A32 - 3935322531353D30313D22303322302720343423363434813681818487999F99 - 99C29F9FC2C5C2C7C5CECECFCEDBCFDBDBDBDBDBDBE2E2E2E4E2E4E2E4E2E4E5 - E2E4E4E4E4E8E4E2E2DEDBE2DAE4DADADEDADADADADADADAD8DAD8D6CED6D6D2 - CCCBC8C8BABAAFBAAFAFAEAEA8A89A958B8B7988724F4B3A2E26221A16140B16 - 13160A0F0A0A1309090F0A090F090A0F09090909090A09080908090A090A130D - 0B0B13140B1412160B1408161620191E211E21212115251E25322532253A283A - 25282B323C2B253A24252B3A3838384E2A462B283838464E4C4C453238383838 - 2B3C383A2A38462B462B3839464E253E5A55676C6D616A636A6A6B595364534C - 525E5E5E5E53555548493E55483E4A323A32213A254E324A3232383238483939 - 39323C35323135573F3F606990989D9D9FB2B2B2B8BBC5C9C9CCCDD4CDD4DCD4 - DAD8DCD8D8D8D7D8DCD4D4DCDDD8D8DED4D8DDD8D2DDDCD8DEDCD5D3D3D5D0D5 - D7D5D7DCD4CDCDD3D0CAD5D3D5CDD5CDD0CDD3D1D0D1B3B1B1ABABABA5A4A7A5 - A2A4A5A2A8A3957A8A615E393932254B2B32254B5B3232324B383E3248383249 - 493E44329A39384E85828585676788724C52524C5849526D5261635273525952 - 53525959535959525953596D596A8A6D7373766C8B6A766A6E73747374737476 - 9773767A6D6D6C636C6161635B525B56484A4A48393C393132333D31314B2226 - 31222733223427303623348137378181869E999999C299C2C2C2C7C5C7C7CECE - DBCFDBDBCFDBE4DBE3DBE4E2E5E2E5E2E5E2E5E2E5E2E4E8E4E2E4E2E2E2E2E2 - DEDBDEDBDADBDADADADADADADADADAD8DACED6D6CCCCC9C8C8C4BAAFBAAFAFAE - A8AAA195958B88885F82433C3324261916130E0B130D130A0F0A0A13090A090A - 09090A090A08090A09090F090A0909080A130A0B130B140B160B141216120327 - 313331312A333A3C3A3A3A3B4A434A4A4A383A433232434A464A3A4E4A433238 - 4F5A5E4E4C464644465A5E5A5E5558445E444C5E4C4C5A4C5E4E454C5E5A4C32 - 5B4C44676D856D6D8A73768A6B76766B766C6D735F726D6161616167635B5E56 - 4C564E4E4E5A5A5A394A3E4A444A4C445A67564E4A574A4B573F396250846969 - 84939D9DB2B2B2BBCAC5D0CDD6D2D2D5D8D8DADADEE4DEDEDCDDDADCDFDAD8DE - DFE4DEDEDED8DEDDD8DEDFDEDEDEDDD6D7DDD2D7DDDDDDDED8DDD5DCD3D2D0DC - D7DDDCDCDCD7D7D0D0D1BBB3B3B1B1ABA7A4B0B0B0A7A5A7B2AA9C8B8B738549 - 5B5B395B3C3E4A4B674A564C854B5A674E494E494861674C499E325B9A5B858C - 85678A855E67615E61596173616D73618B636A616A646A6A6A6463646164618A - 637389738A768B76936C7A7A76747A76747A76929C7A768B6D76736D636D6367 - 6D55855A554A4A4A4A3C39353A3C57273D812431272136802127342336303080 - 3680378186C0999999C29F9FC2C2C5C4C7C7CED9CEDBDBCFE4E1DBDBE4E5E2E5 - E4E5E2E5E4E5E2E5E2E5E4E5E4E4E2E4E4E2E4E2E2E2E2E4DEDBDADBDEDADBDA - DBDADADBDAD8DAD6D6CCCCC8C8C8C4BABAAFBAAFAEA89A95958B7988724F4F3C - 3326261A19160B0B160A130A090F0A0A0A0A0F050A0A0F0A09090908090A090F - 09080A090A0A0F0B0B14130B140B1A140B1609272F33263A333A3A252E3C3A3A - 38435A443243384343464F434E4F4E463C2D3C444B464E5E44464C46464C4C4E - 5E674E394E4C4E5E4A4E4C4C56444E5A44384B394E395585738A8A736D6D767A - 6B736B6A6D6A6773676667666D6761615551564C4A5B5B4E4C4A4E5A4A5A4E4B - 4A4A5A5A5E4E4E3C4E573C57394B3F54565762849090989DACB2B2B1BBCAD0CD - D0D2D3D5D7DCD6DEDBDFDADDDCDCDCDCDEDED6DFDEDFDEDEDCDEDCDDDCDEDFDE - E9DEDED7DADDD7D8DFDCDEDEDCDCDCDDD3D2D2DDDCDDDCDADCD2D7D7D3D7BDB5 - B3AEA7ABABB0A7A7A5B0A5AAAFAE9C8B958885565B823C823C3C4A4B853C564B - 884B4A82444A5A5A44564E3E4C5A9B888E888C8582678C8867885E5E6D675E85 - 596D6D5E9A61666161676161666161646161618A6D888B898A858B769A769289 - 76767A7A767A7695AC768A937376896D6C76616D6D558A67574E4A564A4A393C - 3D3C83334B81253333223D36223136223627308136363781869999999E9EC19F - 9FC4C4C7C5C7C7CECFDACFE2DBDBDBE1E4E2E5E2E5E2E5E5E4E5E5E2E5E8E5E4 - E5E8E5E4E8E4E4E2E4E4E4E8E4E2E2E4DBDEDBE2DBDBDBDADBDADADACED6CCCC - C8C5BAC4BAB8AFAFAEACA1A19A8B8B88885F4F3D3C2E26221A160B160B16130A - 13090F0A13090A0F09090A0F09090A0909090F090909090A0F0A130D130B0B14 - 0B140B161214091B1E1E1F2824242424251F282A3A2B2B2B382A2A2840282D38 - 2D382A28382B3A324632394432382D322B464E4E483938323A32323238323938 - 39322B323C3A2E3C4B25556F6363636D676C6D6C636F63526153615E52615E61 - 6152514856564A39554A383E394E324E324639323A4A384A32384B4A3A253C25 - 4B32253E393E37626284939D9D9DB2B2B2BBBBD0D2D0D0D5D3D4DCDAD6DADCDC - D7DCD5D6DDDAD2DEDADFDEDEDCD5DDDCD7D8DDDADFDADED6D7DDD6D2DFDCDDDE - DCD4D6DDD0D2D2DCDCDCDCD8DCD8D7DCD3D3BCB3AEABABABB0ABB0B0A6ABA4A5 - B3AE9C8B8D738D5A5A5A2582333A4F4B834A4F4B884B435A3A4632384A2A4A46 - 4B2B4A9E8E8C8882678285675A8A464E6D5E5E6D4C67674C955A614C5E5E5E52 - 5E595859525E558A85888D738A738A739C6D958B7676747A73767693AC8A7A95 - 6D8A956D6185636D6D5B8D6D5B5A54565A4A4B4B5782873A4B8330333331333D - 302731303330228036363D8181999999999E9E9FC2C2C4C4C7C7CCCED9CFDBDB - E2E2E1DBE1E4E5E5E2E5E5E4E5E5E2E5E5E5E5EAE4E5EBE2E5E4EAE4E5E2E9E4 - E4E2E4E2E2E4E2E2E4E2E2E2DBDBDADBD4D6CCD4CCC8C5C8BAAFBAAFAFAEA39A - 95958C8B885F5A4F3B3A261B191A16141613160B130A130A0F0A0A0A0A0F0A09 - 0A090908090A0F09090F09090A130A130B160B16120B1612161202160B0B1212 - 12121A151515151E1D1E28241E24181D1E1D24242828241E1E1E1E2825252B2B - 21242128242538322B2B21241E25242825252425242425241E211E3326214855 - 51605355514C675B5363485B484448494C494849483E3E39323925322532252B - 2B282B252B252B21252525282B252525212121212125211E252135373F3F8593 - 939DB2B2B8B8B9B9C8BBD0D0D5C9D4D6D8D2DCCDDDD3CDD4D7D8D2D6DCDDDCDD - DCD7D7DCD5D7DCDCDEDADCD4D2DCD5CDD8DCD8DED5D8D5D2D7CDD5D5D8D8D5D5 - D4D5D2D2D3CBBBB1B3ABABA7A7A4A6A7A4A5A4A9BAACA88B8A858E82824B2E83 - 2F263D3D8C2F8226822F324F252B2B32383238322B5A3A82AD8382825B4F825A - 888844495A5E4C614961674C985E4E5E4C525E495252524C59524C8A858A856D - 886D6D769A76928A73766E766E8B7695AC6D8A937373935E73856361676D8585 - 4E67824A844B5B828257873D8182313D3D213D3D223130223D30233D34803681 - 868F99C09999C29EC2C2C4C7C4C7CED9CFDAE2CFE2DBE4E2E5E2E1E2E3E5E5EA - E5E5E5E5EAE5E5E5ECE5E5E5E5EBE4E5E8E5E4E4E2E4E2E2E4E2E2E4E2E4E2E2 - E2DBDBD8DBD6CECCCCC9C5C8C4BAAFAFAFAFA89AA19A8B8B88725A4B3B3A261E - 1B19161616160B0F0B130A0F0B0B0F0A0A0A090A08090A0A090A0A0809090A0F - 0A0A130A0B0B140B0B1412160B14030F131B231A1A261A1E1F1B262C2E2C3128 - 251D2C1F2E292E2E3B2C2E252C262C332F2B3B3A283A2C332C3A3C3A3C3A2F33 - 2F2E3B3B2F3A2F3A2F332E332E2F2782313584696D6969675B5685675B675B5B - 5A565A565B4E5656564A4B3C3D3C4B4B3C3C3A3A3A3C3A2C253A333A31313A39 - 3A3C33333333353131352531332536373F5790989DACADB8B8B9C9D2CCD2D2D4 - CDD4D8D9D8DEDCDDD5D4D5D4DDD4D6D8DFDEDFDDDED5DDDDD7D8DDDEDEDEDED5 - D8DDD4D5DDDEDDDFDEDDD4DDDDD5D8DDDDDFDDDEDDDDDDD5D7D3CAB2B7B3B1AB - B0B0ABA6A7A7ABB2BDAFA89A8B859A8683823D8E823D823D8E3D8C3B8C3D4388 - 3A464A465A44324A4E5A3E889E9B675A5A678C675B8D445A6D67676D5E67675E - 9A67676D675E6152595E52535253678D858D8A768A768A6D93769A927676767A - 769589959F8B8A9C7389936D8A8B63676D678D855B8585578C4A5B8682868E3D - 8382353D3D31333D313D33223D30213D3336363D81998F99999EC19EC2C4C4C4 - C7D4C7CEDBD9DBDBE2E1E2E5E2E5E5E5E5E5E5E5E5E5E7E5E5ECE5E7E7ECE5EA - E5E5E5EBE5E5EBE5E4EAE4E5E2E8E4E2E4E2E4E8E2E2E2DBDAD9D6CECCCCCCC9 - C8C5BAAFAFAFAEA8A19A958C79885A5A4B3A3326191A20161A160B130D130A13 - 0A0F0A0A0F0A0A090A09090F090A0F0A0908090A0A0F0A0B130D120E0B141315 - 0B16018080172727271B2F802F2F2F3B2F3B413D41802F413B80413B3D433B3B - 2F433B43433B823D3B3B3B433B43824F4F4343433D434F3D433D3D4B433D4F43 - 4B438083815786908685868586888885888882888282678286825B5B57825782 - 4F4B824B3D4B82814F3D82433D3D3D804B3D4B814B574B4B3D354B3D4B3D3D3D - 3D3D3D81378486989F9FB8C5C5C5CCC5CCCCD9D4D9E2E2D9E2E2E8DEE9DEDEDE - D9E9D8E2E9E9E4E8DFDEDEDFDEDEE9E8E9E8DEDED8DEDDD9DFE8DFEBE8DFDEDE - DFD4DEDEDEE8DEDFDEDEE8D8DFDCD2B8BBBBB1B3B1B4B1ABABABB3B3BDAFAC9A - 9A8D9E8C8D8E828E838C83578E578E57864B4F8C4A5B4E5E854C4A675A884A8C - 8D8C9E6D855A8A67888D4C726D61678A598A6D6D9A858A9A89676D67636C6159 - 6A6367938A918D89938A927697769795767792767A9C8B8DA88D939C73899C6D - 989A6C896D678D858585855B8D82868C82838E3D868333828125823D313D3D22 - 8131228131303D378699879E999EC29EC2C2C4C7C7CED4D9CEE2DBE2E2E2E1E2 - E5E5E5E7E5E7E5E7E5ECE5E7ECE7ECEDECE7E7E5ECE5E5ECE5EBE5E5EBE5EBE2 - E5E4E5E8E4EBE2E4E2E2E2E2DBD8D9CED6CED4CCC9C9C4BABAAFAFA89A95958B - 8888675A4A3B332626201A1616161413130B130A130F0A0A0A090A0F09090A09 - 0F090A0908090A0F0A0A0A130B0B130B140B150B1612078FC0C0C0C0C0C0C0C0 - C0C0C0C19BC1C1C0C09BC0C1C09BC1C19BC0C19BC0C09BC1C1C1C19BC1C09BC0 - C1C1C19EC1AD9BC19BC19BC19BC19BC19BC19BC19BC19BC39BC1C2C2C2C2C2C2 - C2C2C2C4ADC4ADC2C1ADC1C2C29EC2C1C29EC1C2C1C19EC1C19EC1C19BC0C0C0 - C1C0C09BC0C0999BC1C0C19EC1C19EC19EC19EC1C1C099C19EC09FC3C7C5C7DE - E4E4E9E9EBEBE4EBE5EBEEEBEBEEE2E8D4E8E2D4E2E2D9DEEBE9E9E9E9E2E9E9 - DEDEE9E9EBE8E9DEDEDFDEDEE9E8DFEBE8E8DEDEE9D8DEE9E8DFE8E9E8E8DFDE - DEDFD7B8B9D0B3B3B3B3B3B1ABB1AEB3B9B8A8AC9A8D9B8D8E8E868C838E8682 - 8E828E828C825B8E4E82854E8D4E67854A8D5A8D8D888C9E5E85858D8D8D678D - 8A67798D619388859A8A8D9A9A616D6D616D63616A63858D8A8D918A9392897A - 9C9297917A8B7B76929C8D9A9F8B9A9D6F8A9C6D9A986D9A85678D8D858C855B - 9985868E86828E818E8331835731878225813D318331318133314B8183998F9E - C09EC29EC2C2C4C4C7CECFDBD9DBCFE2E2E5E5E2E3EEE5EDE5E7E5ECE5E7E5EC - E7E7F2E7F2E7ECE7ECE7E7E5EEE5EDEBE5ECE5E5EBE5EAE4EAE5E4EBE2E5E2E2 - E2DBD9D8CEDACECCCCC8C8BAAFBAAFA8A8A1958B79725A5A4A3A2E2526221A22 - 161413140A13130D130A0A0F0A090A0A0F090A090A0A090F09090A090A0F0A0B - 0B0D0B140B1413141216000700020206020602090507101311131A110A13100A - 1112121F191212131311121F1F1A1313130A1313131F1A1F2C1E15191514140B - 140D0B0E141414191E19214B223D3731363330313A3C4B554C4C3E3A4A3A2631 - 272119222121212528211926221A0D0B16130F1307130F0F08130F0F0B13141A - 1A1E191919191A171B0A0F0D1716203D81828E9E9F9EADC2AD9FC1C1C2C2C2CE - D9CEEBE9E2DAD8DEDADFD6DAE9DEE4E9E4D8DEDEDADEDEE4E9E9DEDDD8DDDCD8 - DFDEE9E9DEE8DEDEDED8DEE9E4E9DEE9DFE8E9DADFDADCB9B9CABBB3AEB1ABAB - ABAEA9B3B9AFAC9E9A859A8C878E828C838C834B834B8E828E83828C3B88824A - 8C435A824E8C3A8C8E8C883C9E5A82678C8C5A8D8C678C8D588C6D889B678D9A - 8E5F855A5E6D4E5367556D988C9A8D898D898A919C8A93958A7A7A75899C9A9A - AC8A8DA86D899C63989A61918A5B9A8C858E8D869A57828E878C8F818E863182 - 8231868335838133833026813335813D86998F999EC19EC2C4C2C4C7C7C7CED9 - CFDBE2E2E2E5EAE5E5ECEDEDE7E5E7E5E3ECE3ECE7F2E7E7E7E7E7E7E7E7ECE7 - ECE7ECE5EEE5E5EAE5E5E5EBE5E5EAE5E4EAE2E5E2E2CFE2D9DACECECCC9C8C4 - BAAFAFAFA39A9A957972675A4A3A3325262620191614160B160A130B130A0F0A - 0A0F0A0A090A0F090A0A0F090A030A0F0A13090A0B0B0B160B0B1A0B16120007 - 07090205090502051305051118101A11111011111112121A1F1811111A10121F - 1F1A110A09020305131A1A1F411E151E19140B08090808030D140B192119313F - 21352720141414142025384E524939383C2E1915140A0B0E1926212431251516 - 160D0A0F070707010100070107010001070605131A1A151E261B151313060001 - 08000F16231E2781828C999E8C573D83828398C4CFC7C5EBDADECECCDED8CCD8 - DEE4DEE4DEDADBDED8D8DEDEDEDEDEDCD8DCD8D8DEDEE4E9E2E9E2DEE9D8DBDE - E4DFE2DFE2DEE4E2DEDEDCB9B9D0BAB3B3B2ABAEABA9A9BBBAAFACAC9A859A8E - 8C8C83838383824B834B8C4B828282832B828338884B4F883C8C2A828D82885A - 5A9B3882858C4F8D8C5A888D46888C8E9A8C8C9A988D8C675B8D55676D5B6798 - 8D988D8A8D7689898B89939589767A6F769C9A9C9E8D939E73899C63989A638D - 8A6D988D888E85859985848E8C8E87868F873C83863182833D868231833D3181 - 353C863D868F8E9EC199C2C2C3C2C7C6CECECFE2CFE2E4E5E5E5E5ECE7EDEDED - EDE7E7E5ECE3E7E3ECE7F4E7F1E7E7E7ECEDE7F2ECEDECE7ECE5ECE5E5EAE5E5 - EDEBE5E5EBE5E5E8E2E2E2DBDBDBCEDACCCCC9C8BAC4BAAFAFA8A39A8B8B885A - 825A3D3B3126201A2014140B0B130E13130D130A130A0A0F0A0A090A0F090A09 - 0809090A0A0A0A0A130B0D0B140B141A0B1602130B02050B1F0A04051A111018 - 2E18111C1F1111181C1E181D241E11181F1812242C1E0A090901020309151524 - 3A24151E261A0909060202010A120B212F215457373D22160D0F090A19253C55 - 614C4438562B0B0B0A05030914261E253A24140A080606010007070707070707 - 0707070707070213151E152126210B0B090103010101070F07131B27273D8386 - 8230272F273D8CC2E8D4C4E2E9E9D9D8D4DFD4D8DFE9DEE8E8D8DEDED8DEE8DF - E8DEDEDEDADFDAD8E8E2E9EBEBE8E4E2E9DBE2EBE9EBE8EBE9EAE9E4E4E2DEC9 - C9D0BBCABDBCB2B1AEB1AECAB9AFAFAC9A8D9B988E8E838E838C87838C838E83 - 838C828C4B888E4F8C67888C5A854B8D8F88565B675B9E885B9A869A8C67888D - 678D8D9A9B8D8E9B9A9B9A856D9A6D898963899E939A988A8D908B899276938B - 917A92767A9C9A9E9A9A9A9C89939A859A9A85918D85989A868D8D869B8C8C99 - 8C878E878E8E8687863B868E3D87833D8E813C833581863D869999C19E9BC2C2 - C4C2C7C7CFCFDBE2CFE5E4E5E5E7EDEDE7EDF2EDEDE7EDE7E7E7ECE7E7F2E7F1 - ECF1E7F2F1ECF2ECF2E7ECECE7ECE7E5ECE7ECEDECEDECEDECE5ECE5EBE2E5E2 - E2E2CFDACECCCCC8C8BABAAFAFAFA89AA18D8B8C6782823D3327192216161416 - 0B0B13130B13130A0F0B130A0A0F0A0A0A090F0A090F090A0F0A0B0A0B0B0B14 - 0B0B160B1216091B261B11121F1F12122F1F112C412C1C2E2E1D182C412C1D24 - 4141182C411D1F2C3A2615090F0203010B1B262D4F32242F3B2E130609060603 - 13171E2F4B3A57623F81221B0313060F1B334B67886A524C824B120A0F060703 - 1727333B47310B080F010000178080808780808081808180170700061A19263B - 3D2E19130F010001010C808183878780801780808027801B803D87C4D9D4C7DE - DBE9E9D4DAE9D4DFE9E9E9EBE9DEE9E9DEDFE9E9E9E9E9DFDEE9DEDEEBE9EBEE - EEEBEBEBEBE2EBEBEBEBEBEBEAEBEAEBEBE4DED2CDD2CBD3D0CBBCB9BBB5B9D3 - B9C5AFAD9A9A9B9B8E8F8C8F8F8F8C838E8C998C8E8F8C8E88868E888C858A9A - 82675A8E9A8C8C6D8488859A8C9A859A8D888A98728D9A8D9A8D9A989B9C9E8D - 899F6D899A638D9E989C9891938B9193929395918B9C937A919CAD9EAC9A9CAD - 89939E8A989C8D8D9A899A9E859B8D8E98988E998E8E998F8E99878E8E35868F - 578E87868F3D81824B86873F879999C19EC1C2C2C6C4C7C7E2E1CFE4E1E4E5E5 - E7E7EDF2EDF1EDF2EDF2E7E7E7E7F2E7ECF1F2F1F2F1E7F2E7F2E7F1ECF2F2E7 - ECE7E7ECE7ECEDECF2E7ECECECE7ECE7E5E5E4E5E2E2CFDACED6CCC9C8C8AFAF - AFA8A8A89A9C958D88854B3D33311E22191614141613130E13130B130B0F0B0F - 0A0A0F0909090A0908090A090A0F0A0B0B0B0B0B140A120B140B091A271E0A1A - 2F1F111F3B1D182C4340182C431D182C432D184182291C2E432E1D2C432E1483 - FAFBFBFBFFFB9B2F5A461E3A4F2613C0FAFEFBFBFEFB87315A575784578131C0 - FBFBFBFBFBF8988873664C66674B16E0F8FFFBFEFBF83B4B4F250A0F0787E0F0 - FCFEFCFEFFFDFBFDFAF8FDFDFFF9F0C00717163B4F3B0A030007C0C3FCFCF8FD - FBFFFAFBFDF0C38117FDFBFBFBFBF7EFD9D8D9D4DEDEE4DBDEE9DAD8E8EBEBEE - E8DEDEEBDEE8EBEBEEEBE9DFE4E9DFE2E9EBEEEFEEEEEBE5EBE4EBEEEEEBEBEB - EBEBEEEBE8E9DFDACBD7CDD2D3D2B9B9BAB9BBCBC9B9C4ACAC9A9B9B998E8E8F - 8E8F8F838F8E8F8C8E8E8C8E828E988C8C8C8C9A678C858C9B85678567855B67 - 9E98899B988D8A9A6D899A999A988D9B9A999A989A9E85909E6D9A9E9C9E9391 - 8A918B9189929393939C9C938DACAD9E9C9F9EAC9A989C9A919E8B989A989A9E - 8D9B998D9B8E8E9B8E8E99998E8F988F8E578F8E818E8E838782818683828257 - 8F999BC19F9EC3C2C6C7CFCFE1CFE5EAE5E7ECE7E7E7F2E6F2E7F1EDF1EDEDF1 - E7F2E7F1F2F2F1F2F3F2F2F2F1E7F2E7F4F1E7F2F1E7F2E7E7E7F2E7F2ECF1EC - F1ECECE7ECECE5E4E2E2E2CFDACED6CCC8C8BABAAFAFA8A89AA18D8D8567823C - 3B2622221B1916130E1314131314131613130B130A0A0A0F0A1309080A09080A - 0A0A0F0B0B13140B0B140B161216021A261209112F1F10122E1C181F401D1F1D - 2E1D111C411D181D43291C1D2E1D182E3B281381FEFBFAFFFDFBC0404F381E25 - 43240AC0FAFAFEFFFFFB8331543E3F573F8122C0F8FBFFFFFFF88F6988644C5E - 672B16E0F8FDFEFDFFFB263A3A1E0680E0FDFFFFFEFFFEFDFEFDFAFBFCFAFBFA - FDFAFFF8F08F0D26382C0B02C0F0FAFBFDF8FCFDFEFAFDFCFAF8FBF087FCFFFF - FAFFFBECDED8D4DEE9D4C5E4E4D9D6D8E9EBE1E8E8D4DEDFD9DEE8E8E5E9E8DE - DEDFDED9E9E8E8EEEBEAE5E8E5E2E8EBEBEBEBEAE5EAEAEBE8E9DAD5C5CDD5D2 - D2D2BBB8B9B8C8C9B9B8C4AC9E9A9B8F8F8E8F8E8F8E8E8C8F8E8F8C838F8C99 - 8C8C8C8888858C8D828D8C8C9A8C885A67855A4A8E9B8C849A98888D67888D9A - 9B8D989B989A9998989A898D9A84989E9E989889918A9293928D939A939F9D8D - 93AC9E9C9E9C9A9F9A9A9C8D8A9A918D9A8D9A9B989A8E98998E99998E8E8E8F - 8E8E8F8E8E818E8E81988E868C8382878286868298999B9EC1C1C2C2C6C7C7E1 - D9E1E5E1ECE7E7E7E7E7E7F2E7EDF1E7F1F2F1E7EDF1E7F2E7F1F1F1F2F3F1F2 - E7F1F2F1F1F2F2F1E7F2E7E7F2E7F2E7ECF1ECF1ECE7F4E7ECE3EAE5E5E2E2D9 - CED8CECDCCC8BAAFAFAFA8A8A19A8B8B856D5A4B332F222619161614160B130B - 1613160B13160A130A13090A0A0A0F090A080A0F0A0A0A0B0F0B0B0B140B160B - 141A02091A110210181010111F1C101C401D18182C1811182C1C181F411D101D - 2C1C18242D241283FAFEFBFDFCFBC0404E381E28382109C0FAFAFEFBFFFB8725 - 54393F57373727C0F8FFFFFDFBFB8E5B73644C585E3A0EE0F8FFFBFAFFF72628 - 3A1216E0FFF9FAF9FFFAFBF9FBFBFBFFFBF8FBF9FDFAFFFBFBF8803B41240580 - F0FDFAFFFAFCFFFBFBFBFFF8FBFBFBF8F0FAFBFFFAFFFBEEDBD4C5D9D2CCC4CC - E4DED4D2E8E8E2E8D9D8D5DFD4D9E8E8E8E2DFD8D8DED8D9DFE8E2EBEAEBE8E8 - E9E2E8E8EBEBEAE9EAE8E2EADEE8DDD5C5CAD2CDC5D2CBB9B9B9CBB9C5AFADAC - 9A9A9A8E8C838E83878383838E878E83838E838383828C82828C4F8C82828C83 - 8C8267825A88823C85889B9B8E8D6788855A8D9B8E9B989B98999A8E9A9B989A - 988D8D9E989D9891899189939393939C9C9EAC939A9D9EAC8D9C9E9C9C8D9A9A - 739A8D8D9A89989A9A998D8E98999A8E8E8E8E8E8F988F8E878C8E8C838E8786 - 8386838E81868683999B9EC1C29EC3C2C6C6CFCFE1E2E3ECE7E7E7F1ECF1E7F1 - E7F1F2F1E7F1F2E7F1F2E7F1F2F1F2F3F1F1F2F3F2F1E7F1F4F1F1F2F1E7F2F1 - ECEDF1EFF1F2F4E7F4F1ECECE7ECE5E5E2E5E2CFD9CECECCC9C8BAAFAFAFA8A8 - 9AA19A8D8A82823D3B2726221B201A160B1613160B16131314130B130A0A0F0A - 0A1309080A0A080A0A0F0A0B0A0B160B16121416140B021A270B051A2F1C051A - 2E1C181C411D1D1F2E1D111C411D182C41291C1F411D182C43241381FEFBFDFF - FAFBC0424F38252B47280BC0FAFEFFFFFBFB87355A503F62573727C0FBFBFDFF - FBF78E6D73645867673816E0FAFBFFFDFFFB26333A1AC0FEF8FBFFF9FFFFFBF8 - FBF7F7F7FBFBFBF8FEFEF9FBFBFBC327431F11C1FAFBF9FAFAFDFBF8F8F7FBFB - F8FBF7FBF8FEFBFFFDFBF8F2D9DCDED8DFDCC5C4DFE9D8DADEEBEBEADEDEDFDF - D8E8E9E8EBE9E9DEDFDFDEDEE9EBE9EEEEEBE8EBEBE4EAEBEBEEEBEEEBEEE8EA - E8E9D8D8CDCDCDC9B9CDD3CBCBCBCBB9B9B8ADAF9E9A9B998E8E8F838F8E878E - 878E8E8C838F8C8C8E82838C828C4F8C82888C8E8E868C8A8882858282868EAD - 8E9A858D9A568D9B9A999A999A999E9A9E989E9A989A90999C99939191918B93 - 93938B9C9F9C9D9A9C9C9FAC8D9E9C9A9E939A938A8D9A899A899A999C988D9A - 8E98998C998E8E998E8F9A878C8E8786838E8E8384838C838682868C999B9BC1 - C2C1C2C6C6C7CFE1E1E1E5ECE7ECF1ECF1E7F1ECF1F2F1F2F1F2F2F2F2E7F2F2 - F1F2F3F4F3F1F3F2F1F1F4F1F1F4F1F1F4E7F1E7F1ECF2F1F4F2F1F4F1ECF1EC - F1ECE7E5EAE2E2D9CFDACED6C9CCBAC4AFAFAFACA89A9A8B8A82824B3D332622 - 1B1916161613160B131613160B130B130B0A0A0F0A0A0A0A080A0A090A0A0A0D - 0B0B0B0B140B16141214091B3B150A1F2F1F1019411D182C41401D29431D1C2C - 41401D2C4F401D2941401C404F2B1A83FAFFFBFDFDF8C1435F4C283A5A3A16C0 - FCFDFFFBFAFB874B695B5084843727C0FBFBFDFEFBFB8E6D8A655967724B14E0 - FBFBFDFEFFFB2F3B4B1EC3FFFBFFF9FBFBF8F3F1E6E0E0E0E3E0FBFFFEFFFEF8 - F9FBFB1B432F06F0FFFDFFFBFAFFF7F5EDE5F4F5F2EDF7F7FBFBFBFBFAFBFBEF - E2DDD8DEDFDDB8C4DFD4DAEBEEEFEFF2E8E4E9E9E2EAEEEFEEEFEBE5EBE9E4EB - EEEEF2F4F4F2ECF2EEE5EEF2F4EFEFF4F4EFE7F4EEEBDEDAD6C9DCCDCBCDD0D2 - D0D0CBC8CBC5AFADAC9E9E9A998E998E8F8E8E8F8E9887998C8C998C8E858C8C - 678C678885828D9B8D8C8D8D8A678C858567988DAD9E8A899A6D8D9E9E9A999C - 9E9C989F98939E93989F8D9E9F9C9E91919191939393919C9D9C939C9C9A9FAC - 98AC9E9A9C9A939A8D939A8D9A989A9A9E8D989B8C98998C9A8E8E8E998C8F85 - 868E838C8C86838C83868C8386828199989BC1C2C1C2C3C6C6CFE0D9E1E7ECE7 - E7F0ECF1ECF1ECF1E7F2F1F2F1F2F2F1E7F2F0ECF2F1F3F1F3F4F1F5F4F1F1F1 - F3F3F4F1F4F1E7F4E7F1F2F4F1F4F1F5F2F1F4E7E7ECE7E5E5E5E2E2CFD9D6CE - D6C8C8C8AFAFAFAC9C9A8D8A8C855A4B3D2F2722221A16161616131616121613 - 160B130D0A13090A0A0A0A080A0A080B0D09130B0B0E0B14161516191614021A - 3312091A2F1C0A1F411E182C43291D2E4129182C43291D2C4F401C2943291D40 - 472A1380FFFBFFFDFAFBC142724C2B3A5A3816C0F9FCFFFFFBFB874B85625084 - 623780C0FAFBFEFDFBFB8E857371585E88460EE0FAFBFFFFFBFB273B3B15FBFF - F9FBFDF8FBE080273B2618262F2727C0FEFEFFFEFBFBF08F821F05F9FBF9FAFE - FAFFC39B989EDADBCFE5D9C3F0FBFBFBFDFBF8F2DEDED8E9DDDCC9CDE8D4C7E9 - F4F2E3EFE5E2EBE9E2EAEFEFEEEEEBE4EBEBE5EBECEEF2F4F4EDE5EFE5E5EFF2 - F4F4F5F4F4F2EFF4ECEEE2DADED2DCCDCBCAD0D3CBD3CBBBD2C8AFADAD9E9A99 - 8E8E998C8F878C8E8C8E8C9982828E868E8288885B8D884E85889A8E8D8C8988 - 8588898567849A8985AD8A768A898D9F9A9A9E939F9A989C98919C918D9D899F - 9E9C9893918D93938B9C909C9F97929A9C93AC9F959F9C9A9C9A899C8B939A8D - 9A9A989A9E8C8D9E8C9A9B8E998D8E998F8E9983829982878E828C87828C8C4B - 8E82579B8E9E9BC1C2C1C4C6C6CFCFE1E1E5ECE7ECE7ECF1ECF0ECF1ECF0ECF1 - F2F1E7F2F1E7E7ECF0F4F1F3F1F1F3F3F1F3F1F4F1F3F3F1F1F1F4F1F4F1F4F1 - F5F1F4F3F5F1F4F2F2E7F2ECE5E5E5E2E1DAD9D6CED2CCC8AFAFAFA89A958885 - 8282823D3D332726221B201516161A16161613160B130B130D0A0A0A0A13080A - 080A0A0A0A0D0A0B0B140B161A1619161919091A261209122F1C051A2E1C181C - 412918242E1C111F411D181F431D182C411D1D2C47281A83FCFEFBFDFBFBC141 - 674C283A4E320EC0FAFAFFFFFDF8874B5B5B5084573427C0FAFFFDFEFFF88E67 - 7364445E673B0EE0F8FFFBFFFFF8272E3312FBFAFFFFF9FBF8271B263B331E2E - 43260B09E0F9F9F9FEFDFB83801C06FEF8FFF8FAFFF183857AACCCD4DECEC7C6 - 87FBFBFBFAFBFBF2E2DED4DEDCD3B8C8D5B8ADD9EBEEE2EED8DEDFDED9E8E8EA - EAE9E9D9E9DFD9E9EBEBECEBEFEBE1EBE8E9E7ECEFEFEEECEFECECEFEAEEDED8 - DCD2D2D0C9C8CAD0BDD3CBB9C9B8ACAD9C9A999A8F868E838F8C878E8E8F868E - 833C8E829A8286824E82883A8C678E9A8E888C88855B678285888D5B679A9F6D - 9A6D8D9E9A999A989E9C9893986D9C91899C849C9E91989391939193939C9193 - 9C91899C9393AC9E959F9C8A9C9A899C8B899A8A8D9C8D9A9A678D9A868E9A8E - 9A8E8E99988C9B8C828E4B868E5A868C4B86834E8C865A998E9EC1C2C1C6C1C6 - C7CFE0D9E3EAE3E7ECE7F0ECECF1ECF0ECE7F1E7F1E7F1F2ECE7E7F0ECF1F3F1 - F6F1F3F1F1F4F0F3F1F6F1F4F3F4F1ECF1ECF3F4F3F3F5F1F3F2F3F1E7F4E7ED - E7E5EAE2E2E2CFDAD4CCCCC8C4AF9E9A9A8B8A855B5A3D3D332F272226161B14 - 1616161A1716160B0B160B0B0A0B0F0A0A0A0A0A0A0A0F0A0A0B0D0B16121619 - 161919201B20020A1A0B0410181011111F1C111C401C1F182C18101F291C1F1C - 41291C1C2E1D1D2940281381FEFDFBFAFBFB9B3B4F38283244320EC0FAFDFFFF - FBF8873557563C84623023C0FCFFFDFEFFF78E5B6D524C4E5A3C0BE0FAFBFBFF - FEFB26262C0BFBFDFFF9FBFBE017151E2E241124411E1213C0F9FEFEFDFBFB87 - 1F1A05F9FFF9FBFBF8E0399192A9D3C9D8D5C4C281FBFBFBFDFBFBE7D9DEC5E2 - DDCDAFD0D7C5ADC7E2EEEBE8C7D8DFD9D9D9EAE8E8E8DED9DFD9D9DEE8E8EAEB - EAEAD9EBE2E2EAEAECECEAECEAE1EAECE8EBD9D8D5C9CDC8BBB9CBBBB2D3B9AF - B9B8ACAC9A9A8C8E8C8283838E838386838C3D838226834A835A825A444F4E2B - 883A4F8E9A4F5B6785435B88854A8D6767986D9A98678D9A989A9A989A988D89 - 8962938D688D6F9F9C98899189918991929D8A89976F7A9C938AAC9D8D9C9A6F - AC9A739C73739C856D9C8D9A98678D9A5B85988C989B8C8E8E868E864B8C3C82 - 8E4B8C8C3A828C3C88824B8C8E9E9EC2C2C2C2C6C6CFC7E1E1E5ECECE7ECE3EC - F0ECE7E7ECF0ECE7E7E7E7E7E7E7E1E7E7F0F4F1F1F3F3F1F3F0F4F3F6F1F3F1 - F4F0F4F0F4F1F1F3F3F3F3F3F3F3F3F4F1E7E7E7ECE5E5E1E2CFDBDACECECCC8 - AFADA89A9A8B8C88824B3D3B332727262222191616161B16161A160B130B0D13 - 0B0A0A0A0F0A0A0A080B0A0D0A0A0B160B161919161920192219021B2612051A - 2F1C041A2F1C101F41291C29411D1C1C41291C2941401C1D41291D29433B1783 - FCFEFBFDFBF8C143824E313A5F390EC0FAFDF9FFF8F88781575B578487340FC0 - FCFCFFFAFBF78F568D4C4E3C823B03E0F9FDFBFBFBFB263B2F15FBFFFEFDF8FB - E01B15274B2E182C41261A0AC0F9F9FEFDFBFD83411F05F9FBFDFBFBF8E03F89 - 7EB2D3D2D7DEC5C487F6FBFFFDFBFBF1E2DECEDFDFD2AFD3DCC5C2DBD9E1EEEF - DBDEE9D9E2EAE1EFEEEBE8DBE8E2E2E9EBEEEEEEEFE5E8E5E8EBECEEEEEFEEEE - ECEAECEFEAEBDED4DDC9CDD0C9CACBCACABDCBB9CAAFAF9F9C9A989B8E83874B - 8C838E864B8E828E823D8C3B8C8282883A888244883C888E8E8288828885888C - 85888D616D858A619C8D8C9E9A988D9A98918A6D6F6D6F896F6F89999D909091 - 91919193909D9391928A929D95919C9D8A9C9C899C9C73938B769A6D899A939B - 9567988D678C9A869A98888F8D829B5B5A8C3C888E4E858E3C85823C88865A85 - 8C9EC19BC6C3C2CEC6CFC7E1E4E1EEE5E1F2ECE1EFE7F4E7E3ECE3ECE7E7E7E7 - E7E7E1E7F1E7F3F1F6F0F4F3F1F4F0F4F0F6F1F6F0F4F1F4F1F4F3F3F3F3F7F3 - F3F3F3F1F4E7F1E7E7ECE3E5E2E2CFDBCED6CCC4C4AC9BA89A8D8C8582823D3B - 31262227221B20161B161916161613140B0B130B0B0F0A0B0A0D0A0A0A080A0A - 130D0B161516191B201919201922021B261E051A2F1C111A411F181D43291D2E - 41291C2C43291D2E47401D2943291D2E4F2C1383FCF9FBF8FDFBC13B5A4B333B - 674A14C0FAFAFFF9FDFD872386813C8186230FC0FCF9FCFFF8FB873A5B824B4B - 822708E0FDF0FEFBFFFB2F3D3B1AFBFAFFFAFBF8E023272F822F1E2E431F0A13 - C0F9FEFDFEFAFB83801F05FEFBFBFBF8FBE04B8597D1D7D2D8DCC59981F8FBFF - FDFAFBF5E2DEDEDEDDCDAFD7D7B8C5EEEEE1E5EEE2E4EBD9E5ECEAEFEFEEEBE8 - EBE8E4EEEBEFEFF4F4EBECEBEBEBEEF4EFF4F4EFEFEFEFEFEEEBDED8DFD2D2D2 - D0D2D0D0CBD0D0CAC9B8ADACAC9C9B9988828E3D87828C8382998298824B8C3A - 885A888C5A8A675A8A4F889A9B8885888A85888D85859A6D63858A6AAC939A9A - 85989A639189896F6F6F6F6F6F6F909D9F9091989398939C91AC939293917A9C - 9292A89F8B9C9C89A89C8A978B769C738A9A919A9A6D9A8B5B8A9A679A8D829A - 8E5B995A4B855A868C4E828D4682674E88855A858CAD9BADC2C4C2C6C7CED9E2 - E1E2EEE5E5EEE7ECE3ECE7E1ECE7E7E3ECE7ECE5ECE7E3E7E7F4F1F1F1F3F1F1 - F1F1F0F6F1F3F3F1F6F0F4F0F4F1F3F3F7F3F6F3F3F3F3F3F1F1ECE7E7E3E1E5 - E2E1DBDBCECECCC5AFADAC9B9A8D8D8882573D3D2731262722221B19161B1616 - 1A16160B13140B0D0B0A0A0A0A0B0A0D0A090A0D0B0B0B16141A1919201E2022 - 2120091B31150B1A2F1F111E411D182C432D1D2C43241828432A1D2C462D2429 - 4F2A1D2C331E0F80FFFFFFFBFAFBC02E3D3126315B4A0EC0F8FDF9FFFBF08734 - 23333630302301C0FCFCFAFBFEFB8F203D251E33270D0FC3FCFAF8FFFBF73B3B - 3B1EFBF9FFFFFFFBE01713262F26152E2F1B0B07C0F9FEF9FAFBFB87411F02FF - FBFDFEFBFBE033869A9DADC4C29F8E8780FBFBFDFDFEFBF3E2DFE2DFDFC8B9DC - D0C5C7E4E2E2E2E2E2EBE9D9E8F4EFEFEEEEE8E9EBEAE8EEEEEEEFEFEFEEECEB - EBEBEFF4F5F4F4F4F4F4F4EFEEEBE2D8DED2D2D2D3D3D3D0D0D3D3CBD0B2AFAC - 9C9E9C9A57828C3C8C578E855798828E5B4A82485A5A678A4E67675288525B8D - 9A8588888A6D6D8A8A6D9C6D6A6F916A93769D9F769393897A776F6F75756F6F - 75906F9D9F9090939193939C919D9392937A9293928B9D9D8A9C9C8A9D9C7A95 - 956F9C8A739C8A939A6D8D8D618A9A858D8D88988D828D5B5A885A5B8C4A678C - 4C5B824C85855B858D9EADC1C4C4C2CEC4C7C7DAE2E2EAE4EAEEE5EAE3EAE3EA - E5EAE5E7E5E7E5E3E5E1E5ECE7F0ECF1F1ECF3F1F1F1F1F4F0F6F3F3F1F1F1F6 - F1F3F3F3F3F7F3F8F3F3F3F3F1E7F2E7E7E3ECE3E5E2E1DBDBD6CCC4C4ADADAC - 9A8D8D8C86824B3D33272231222720161B161B141616160B160B130B0B0A0D0A - 0B0F0B0A0A0D0A0A0B0B14161A192019221922192221021A1E1509122E181112 - 2E1D111C40291F24401F181E411D1E24412D1D24421D15181E0B0F80FAFFFBFB - FAF8C00A190E0B26563920C0FAFBFEF9FDFBC1230122160E230107E0FCFCFBFF - FBF8C11616140D13080F07FCFDFBFBFBF8FB262B4315FBFFF9FFFBFBF0000209 - 1A12020A120A0600C1FCF9FFFEFBF7872E1F05F9FBFFF8FDFFF00F1E57825783 - 8283811723FAFFFEFDFDFBF2D9D9D4DEDDB9BAD3C8B8D4E8E9E2DEC7D8E9E9D9 - E1EAEAECEEEBE2E8E8D9E2EAEBEEEAECEEEAE8EBD9EBECECEFECF4ECE7ECF4EC - EAEAD9D4DCCDD4CDD2D5D0CDD0D0D1B9C9B2ACA89A938D85565A5B2582578C84 - 4E8C4A854B32673C5A555A674C676144724C4C858D85676D6D676D8A89619263 - 63767A63756391AD6F93906B92636E6B756F7575756F6F939D69909190919193 - 909C92907A767B7A7A9097A8739C9C769C97739292719773739589739A538A76 - 676D8D738D8A5B8D8C5B855A56854A4E884A5A85464E5B49676767858DAC9BAD - C4ADC2C5C4C7CCD9D9DBE2E2E2E5E8E3E8E1E2E1E5E5E5E5EAE5E5E5EAE5E1E5 - E7E7F1F1F1F1F1ECF1F1F1F1F3F1F6F1F3F1F3F1F3F3F6F3F8F3F7F6F3F8F3F3 - F1F4F0ECE7E7E1ECE2E5DBDBDBCECCC4C4AFAD9B9A9A8C8685573D3D33273122 - 2722221B201B201716161A0E13140B0B0B0B0A0A0B0B0A0F0A0A0A0B0D0B1615 - 19201A221E222122222102131E1102111F1005111F1C181C411D1C1D411C101D - 401D1C1D40401D1D411D1F1215090781FCFEF8FDFFFAC0000F0108224B3920C0 - F8FEF9FEFDFBF88F010701010F0F87FCFCF8FDFBF8F9FB8707010F071707C0FC - FCFBFDFBF8FB242B3D1EF8FBF9FFFBFAFB8007010613090303000017E0FAFEFF - FFF8FB832E1811FBFBFAFFFFF9F881171A26272323271B80C0F9FAFDFDFDFBF2 - D4D4D4D8D3AFB8D2B2B8C5DEDEC7C7C4C5D4E9E2D9E1E1EAEEE2D9E8E2D9D9E5 - EAE5EBECEAE1E8E2E2E8EAECECECECEAEAEAEAEAE8E2D8D4D2CDCDCDCDCDCDD0 - D0CDCAB8BBACAC9D958D855A4E3A3A1E3B4B82823C5B3C5A3A323C2A32323844 - 324644324638324E67885B67826D678A8A618D6A53617663766D6F93AC89896C - 6876686B6B686B686F686F9393909090919190919097907A6F777A767A7A939C - 7A979C76959373928B6C93716A938B6395616D8A63678A618A6D4E8C8556674E - 4E67484C85444E674C4E614C67676D6D8D9EACADADADADC4C4C9C5D4CED8DBDE - E2E2E2E2E2E1E2E1E2E1E5E5E5E5E5E1E5E1E5E5ECE7F1ECF1F1E7F1F1ECF3F1 - F3F3F3F3F6F0F4F3F3F3F3F7F3F8F3F8F6F3F3F3F1F1E7F1E7E3E3E3E5E2E2DB - DBCECCC4C4ADADAC9A8D8D8C86824B3D313126302722261B221B1B201B161616 - 141314130D0B0A0B0F0B0B0B0A0A0D0B130B16191619221E222221222130021A - 1B1505112F1010122F1C111F41291C2C411D1C1C41291C2C43401D2943291A1B - 818FC0C0FDFFFBFDFAFFE0C08FC0C0C08E3520C0FBFAFFFEFDF8F8FBF0C0C0C0 - C0E0FCFDF9FDF8FBF9FBF8FBE0C1C08FC1F0FCFCFDFAFBFBFBF12E464F26F0FB - FBFBFFFFFFE0871707020002070F87C3FCFCFEF9FBFBFB80411C13F9FBFBFDFE - FDFDE0C0801B1323238081C1F0FCFBFAFDFDFBF2D9D4D5DCCDB2BDD3AFB9DDD8 - E9DED4C7D6DDCEDEECEAECECEFEBD9EBE2D9E8EBEEECEFECEEEAE5EAE2EBEEEF - EFEFEFECECECECEEEAE8DED4D2D2D5CCD2D2D2CDD0D0D0B9C9B2AC9C9395855A - 4B2D3A2B4B4B835B4B824A82383C4F3C443C465A585A5E444E5E4E5A888C886D - 6D88858A8D618B6D636C6F6C89766D9F6C9F7A6F637B6F756F756F6B906B9093 - 93909198919391939097919277927A777A9292978A979C7A8B9276928B6B9573 - 6D978973916C6D8B6D6C6D678A6D558A855A67564E5B4C5A6D4E4C5B4661675E - 6D6D73898DAC9BADADADAFC4C5C5C9D4D4D8D8DADEE2DBE2E2E2E2E2E2E2E5E5 - E2E3E2E5E2E1E5E3E7E7E7F1ECF1E7F1ECF1F1F3F4F3F3F6F1F6F0F1F3F3F6F3 - F8F3F8F3F8F6F3F3F1F1F4E7E7E7E1E3E5E1E2DBCFDACCC4C4AFAD9E9A9A8C86 - 8257813C31312231222722231B1B191B16201A1616140B0B0B0B0D0A0B0B0F0B - 0B0A0B0D0B141A1619221922212130212225021B2615051F2F1C0B1F2F1D181D - 43291D2E4329182C43291D4047402D2A4741151BC1F7FBFAFDFBFFFBF9FCFBFB - FBF8FBF7C25730C0FAFEFEFFFBFCF8FBFDFEFBFFFBFDFEFAFAFBFBF8FBF9F8F9 - FDFBF9FBF8FBFCFCFCFDFBFBFBC32E4E822DC3FEFBF9FFF9F9FDFFF9F8F9FFFF - FBFDF8FDFDF9FDFBFBFBE61F431F1AE0F9FEF8FFFDF0FDFBF8FBFFFBFBFBFBFB - FBFAFBFDFDFBF8EFD8D5DFD5B9CACBBDB9CDDFDEDFE9DACCD4DEC4D9EFF5EFE7 - EFE5E8EEEAE2ECEEEFEFF2F4F2ECEBEBE2EEF4F4F5F4F4F4F4F4F4EFEEE4E2DE - D6DCD5D6D5D2D7D2D0D3D0C8CAB8AC9D9593856D563E3A4A825688825B885A5B - 4A4E5A4E4A4C5A5E554C5E525E4E5E55888A8D6D888A8A768B6D916C7676756C - 906E89936B919D77776F777777779077779090939D6993939398939391939291 - 77927A927A9292937A93977693957A7A7A739273748B8B6D8B6D6C8B6D8A766D - 738A5B856D6767564E67556788495E674C67676D6C858A8A8BADA8ADADADC4B8 - B8C9C9CDD4D6D4DADEDAD9DEDBD9DBCFE2E2E1E2E1E2E3DBE1E2E3EAE5E7F2E7 - F1F1ECE7F1ECF1F4F3F3F3F1F0F6F1F3F1F3F3F8F3F6F8F3F6F0F6F3F3F1E7F1 - E7E7E3ECE5E2E2DBDBCECEC4C4ADAD9E9A988D85865A3D3D313031273122261B - 23261722161B161616160B160B0B0B0B130D0B0A0D130A0B0B141B1422192221 - 262225302530021B33150A1A2F1F111F412C181F47401D2E4F291F2847401E2E - 4F42292D5F412623C1F7FBFCFFFDF8FDFDFDFBFFF9FBFBF7C24B30C0FFFEFEFE - FAFAFCF8F8FFFFF9FDFBFAFFFBF8FBFBF9C0FEFBFFF9FFFBFAFBFCFCFAFBF8FB - F7C028434F3BC0F7FBFBFEFDFFF9FAFFFBFDFAFAFAFAFAF8FDFAFEFFF9FBC31F - 411F11C0FEFBFBF8FDFBFAFFFFF9F8FDFFFBFBF8FAF8FFFDFDFAFBEFD9D5DDD0 - B2CABEBAAFD7DDDEE9DEDCD2DADCC5E2E5F4F4EFEEE2EAEEE8E8EEEFEFEFF4EF - ECECEEE4E8EEEFF4F4F4F6F4F4F4F4F4EEE2DEDAD6DCD8D5D8D7D5D2D2D3D3B9 - D0B2AC9C95975B6D5A4A3E3A824E5B5B4A674B5A495A4A4E564C555E5E525E61 - 615E55676D8D8A886D8D768A916C7A6B73756A6E926F92936F77759D757B7577 - 7777776F90776F939D909198939391989197919276927B927A7A7A927A939576 - 92977A7A747A7373767A7A727A6C6D7666768A6A677355675B67554E555B4C5E - 674E61674C67616D6D73897693AC9EACA8ACB8B8AFC5C5C9CDD2D8DCD8DAD8DA - DBD8D9DBD9DBDBE2E2E2E2E1DBE1E4E3ECE7EDF2F1ECE7F1ECF1F4F1F3F3F3F1 - F1F4F0F6F1F3F3F3F8F3F6F8F3F3F8F3F3F1F4E7E7E7E1E3E5E5E2E2DBCECEC5 - C4C4AD9B9C9A8C8686574B3D332731302722221B221B23191B1619161A16130E - 0B0B0B0B0D130B130A0D0A0B160B19221B212221222530253025021A1F120911 - 2E1811122F1C18184128182C431D1C1D40291C24432D242D472D331EC1F7FBFB - FAFDFCFCFCF8FDFAF9FFFEF8C33F36C1FDF9FBFDF8F8C1FCFAFBFBFEFFFAFDFD - F9FBFBF7C383C3F9F8F8FFFDFEFFFDF9FBF8FBF7C6431F47822A1BE0F8FBFBF8 - FFFBFCFCFDFBFDFCFCFDFAFDFAFEFEF9F9E61B1B412E0427E6F8FBF8F8FDFEFA - FDFDFDFDFFF9FBFBC3FCFDFAFEFDFBF2D9D2D2BCABCAB5A8B3DCD8D9DDDFC8D2 - D7D7ADCEE8E5EFF4E5E1D9EAC7D9EBEBEFEBEEEAE1EAE8E8E2EBEBEFECECF4EC - F4ECECEBE9DEDAD8D5D2D8CDD5D6D2D2D5D2D0BBBBAFAC9C959A525738322B2B - 4B3A5A4A464A383C413C383E384A444A444C4C4C4C524C4C528D8A85678A858A - 8B63896A6B6C6B737A767A9176756F75977B777577907777776F909D9190919C - 9891939C9093937A907A7A7B7A927A7A7A7A77748B927670746C746C74736A74 - 736C646D648A76616D6D615B674C554E4C4C4E4C67444C674C676D598A768A8B - 8BACACAC9CAFA9B2B9B9CAC9CDCDD2D2D2D2D6D6D4DAD6D8DAD9DBDBDBD9DBDB - DBE1E2E3E5EAE7E7E7E7ECE3E7F1F1F1F3F4F3F1F6F0F1F3F1F6F3F8F3F8F3F8 - F3F8F3F3F1F1F1F0ECE7E7ECE1E5E2E1DBD9CCC4C4C2ADAD9B9A8E8C8682813C - 35313627302727221B26221B201916161416140B140B0B0D0B0B0B0D0B0B0B0E - 0B141A201E222122252530253035020B1A0A05111F1005111F18101C2E1C181D - 411F181D2929181D412A242A462D242EC3F3F9FEF9FAFCFDFCFCFDFAFDFEFDF5 - C23430C1F6FBF8F8F7F687C1E1F8F8FBF8F8FAF8F8F6FBC08C4B3DC1F5FBFBFF - FBF8FDFBF7F7F1C04B2B4F2E2D432627C3FBF8FBF8FBFBFCFBF8FFFBFBF8FBFD - F8F7FEFEE02F041A1F111F0A3DE0F5FBF7FBFBFEFBF8F6F7FBF7F7E187F8FDFE - FFFEFBE7D9D2BBAEB4BFAA9CB8D7C7D4DFD7B2D3D2B9C4D8E2C7CFF4E5D9E2E8 - D9D9E8EAE8EAE5E2D9EAE2D9E2E8EBEAEAECE1EAECEAEAEADBD8D4D2CCCDD2CD - D4CDCCD4CDD2CAB8B9A9A88B898A494A322528253A2B3C32322B252A282A3225 - 32322D32383244384444494449856D67676D6D6D8A53766A636A636B736B7675 - 6B6F6B6392937768776B6B6F75776991939090919091919389919076776F7576 - 7574766E757476747A9274747374716C74706A717A646A6C61736D6166674961 - 5549444948444E4C67444C674C676D63768A8A8B93ACA8ACA8ACB2AEB9B2CAC5 - CACDD0CDD2CDD2D2D2CCD4D6D8D6DACEDADADBD9CFDBE2E2E3E5ECECE7E7E7E7 - E7F1E7F1F3F1F6F1F1ECF6F1F3F3F3F6F8F3F8F3F8F3F3F3F3F1F1ECF1E7E3E3 - E1E5E2E2DBCFCEC7C4C49F9E9B988E8C86824B3D3333273327302623261B2221 - 1B201A1916160B160B140B160A0E130B0E0B0B0D151416192021212530253125 - 3525021B1B1205122E18051A2F1C112C411D18244329181D43401E2C472D2B42 - 5A382B3A9BC0C1C3F9FEFBFAFBFBE0C0C1C0C1C19E603F99C2C1C1C1C2C23784 - 8FC1E1F4F5F5F7F0D9C13F8167544B578CC2E0F2F7F7F7E3E09E81334B2D322B - 474224264B3DC1E0E0F7FBF7FBF5F7FBFBF7FBFBF5E0C0804112111B431F1215 - 334F8FC2DBE5F1F1F2EFF4EFEBCFCEC23DF8FBFBFBFBFBEED4D0BBA4BCD196A8 - D0D5D4DEDFCDB9D3D3B9C5DFEBC7C7EEEBE4D9EBC7EAEFE2EFECEEE8E5EBE8E2 - EAEEEEEEEFEFECF4ECEFEEEBE9DAD8D8D2D8D7D6DCDCD8D2DCD7C9B9BBB2A895 - 8B8955563E322B324A3856484C4A383C383C38383E384A464449464C4C4C5E52 - 5E8A856D6D8D6C899261766F6C746A7677767B897692776B6F7B97779077757B - 77906F9D9190919D919191939092916F90777A777A7A777A7A767A6E7A7A6C74 - 746C747073746A71766A6A7161736C616D665567615E555E4E524E52674C5E67 - 5E67736C8A8B7A9395ACA8ACA8B2AEB2B3B9B9BBC9CACDD0CBCDCDCDCDC9D2D4 - D6D4D6D8D6CFD8CED9DBE2E1E4E5ECE3ECE5E3E7E7E7F1F1F1F1F4F1F3F1F4F0 - F6F3F3F8F3F8F6F8F3F8F3F3F3F1F1E7F0ECE7E7E3E5E2E5CFD9CECCC4C2AD9E - 9B988E8C8357814B333336273127232623221B2222191619161416131413140B - 160B0D0B0B0E0B160B14141922222130252535303535021B2F1A051A2F1F101B - 411F181F41401F294F41182947401D2C4F422B465F453847824B2F87FEFBFEFB - FBF9C00F1623203D89683E5785844B86845B3F6284853757868181378E57303E - 8967505785843B81823D353D824B213D884A2B4667473A404F2E1E2F821E1B27 - 802E1B263B2F131B2F2715193D2E121F2F2C15248256678B9C9AA8ADC4ACADA8 - C5B8C49E82F5FBF8FBF8F7EFD4D1B1ABBFBE94ACD5D5DDDDDCCAB9D7CAC5C9DE - EBE8E2DEE2E9EBD9CFEFF4ECECF4ECEAEBEEE2EAEBEEEFEFF4F4F4F4F4F4EEEE - E9DADAD8D8D6DDDCDCDED6DCDCD7D0B9B9B2A897938B5B5550393E4A4E565A49 - 5555444A4A434A4E4E4E4E555E5A5E6167616761618D6D76888D7389976A7A76 - 75767A757A7A6F927777917B7775939D77907790917790939D90919393939197 - 9091926F7B907A927A907A777A777A76747A7474717474717471717473716C73 - 636D6C63736D61676761555E52555E5567525E6D616D73768B918B9597ACA8AF - ACB2B3B2B2BBBBB9CACDCACDD0CBCDCDCDC9CDCDD4D6D4D6D4D6D9CEDACFE2E2 - E1EBE5EAE3E5E3E7E7E7F1F2F1F1F1F1ECF6F1F1F3F3F8F3F6F8F0F8F6F8F0F3 - F3F1ECF0ECE7E7E3E3E5E5DBDBCFCEC7C4C4AD9E9B9A8C8682824B3D3D353327 - 3030262227222622221B211619161614160B14160B160B0D0B0B140B14141419 - 19222625303131313535021B2F1A05152F1D051F2F2C111D432C1D2C47401D28 - 4740242C4F42384467442D5E82823183FBF8F9FEFEFBC3170F0E16576F68605B - 6D67503F6D6939628984576286843757988421356361555B844C5767884A3C3C - 6D5B4B32564425324E38292B4F432C1F824115264326181F3B2E122F3D1F051E - 431F121F2F1D152567887194A3A3A3AAAFA8B1B2BEB9AE9E82F7FBFBFBF8F7EF - CDBBA5B1B7B38BB9D7D5D7D7D3B9BBD3BBB9DDDEE9E9DEDBD8D4EEE4E2ECF4F4 - F4F4EAE2EBEBE2EAEEEFEFF4F4F4F6F4F4F4EFEEE4DEDADAD8DCD6DCDCDCD8D8 - DDD7D0B8BBB2A8938B896151483E3E4E545555515555494A444A4C4A52544C52 - 5E53615961616A636A8A6C8576936D8B937377767574757A7A7792917A6F7792 - 907777759D77907B7791779D9D907B9D919391937B9177907A907B7A7A7A7A7A - 7A7A7A7A7A7A7A767A74717473747174716C6C736C6C666C6D7361676359615E - 555E5252615E6166617376738B92959397ACA8A9AEB2B2B3B3BBB9BBBBCACACA - CAC9D0CBC9C9CDCDCDD2CDD4D2D4CCD4D9D8CFDBE2E5E5E5E2E1E3E5E7E7F1F1 - F1F1F1F4F0ECF0F6F1F3F6F8F3F8F6F3F8F6F8F1F3F0F1ECF0E3E7E7E3E3E4E1 - DBCFD8CEC4C4C29E9A988C8C8682813D3D333131272722272227222227221B20 - 1A1616160B160B0B140B0D130D0B0B161414152019222122312531353135091A - 1B12051A2E1111122E1C1124411D1F2843401824474024284F442B4C5F583844 - 4E4E2581F7FBFBFEF9FAFBC3C081838F6968605B6D6751626F63606084633F50 - 69573F57846757325552394A8567444C67524E4A6744253967382B3A5A2B2D40 - 47291E244128181F4124182C411F18112E2C1E1E2E241112431F115A8A667DA1 - A2A6A7AAAAABA4B0B1B3B29A82F7FBFBFBFBF8EEC5B2A4B1B4A3A1C9D3D1CDD3 - D0B1BBD0B2B8DCDDDFDED9D4D4D6CCE4E4EFECE1F6EAEAE8E9DFE2E8EEEAEFEE - ECEFECECEFECEEEBDEDAD8D8D4D2D4DCD4DAD8D6DDD3C9B2B2A99D8B926D553E - 32323948444A4C3E494A3E3832383E3E3E44484C495252525252596164896173 - 6F8D6E76896E736E6E75747574777A927B77767777906B90779D90776891909D - 9390909391939192907A776F77757A7A777A7A777A757A7474747374746C746C - 706B706C6A6A6C6A6C616A676C6C526152525E5252594C525952596C616C7374 - 7A8B9592A3ACA8ACA9B2AEB2B1B2BBBBB9BBBBBBBBBBBBB9BBC8C9C9C9CDCDC9 - CDC9CDCCD4CED9DBE2E2E2E1E2E1E2E3E3E7F2F1E7F1E7F0F4F0F4F3F3F3F8F3 - F8F3F3F8F0F6F0F6F3F1F4F0E7E7E7E3E3E5E5DBCFCFCECEC7C4C29E9E988E8C - 82864B4B3D3631273130262722302627222227191719161616160B160B140B16 - 0B0D160B1A141619201E2221313131253534020B1A1105051F1105101F181018 - 2C1C182940291E1D402A1D28462D2B385E443849554A3236E0FBF8FEFEFEFDF9 - F8F7F8F59E683F4A63554854513E503F605762565B503C3F674A564A4C38324B - 8232444C5C58383E5F2B323A472B1E2A4328241E401E1F24292E15182E1D111E - 2E181F1C2F1810152C1811112C242D886D8B7894A2A0A0A3A7A3A4ABB0A5A99C - 8CFBFBFCFDFEFBEDC5A5A3B4A6A1A1CBD0BFBBD0BAB2BAB2ACB9CDD4DED8C5C5 - D4D2ACC4EBEBE1EAE1EAD9D9DFD4D8D9EAEAEAE8EAEAEAEAEAEAE8DED4CDD4CD - CDCDD4D4CCD4D8D4DCC9B8A9ACA9937A896D3E252B21283C323C322B322B282A - 28252B323232383E4438444944495252527352736D7A6D6A6B636B6A6B6A6B6B - 6B6E6B6B6F7777757777777577779D77906B6F9391779091779377916F776F75 - 6B75766E6E736E6C6E6C6E73746A746C6E656C74656A74646A6A64646A61646A - 616D4C524C4C5252494C5252525961646A717A7A7A9492969CA9A9A9A9AEA9B3 - B2B3B3B9B3BBBBBBBBBBB9BBB9BBC8CAC9C9B9CDC5C9C5CDCCD4CEDADBDBDBCF - E2E2E1E5E3E5E7E7F1E7F1E3E7F0ECF0F3F3F3F3F3F8F3F8F6F8F1F3F0F3F0EC - ECF0E5E3E5E3E3CFDBCFC7C7C5C4C4C29E9B988E8686823F3D35333130272230 - 2627302630272623221B1419161614160B16140B140B0E161615161919221922 - 312530312535021A1B120A112C18051A2F1C1818411D1D2E43401D284340282B - 5E2D38445F58494967483E35C1F6FFF9FFFEFAFAFBFBFBF79E62626285555054 - 89693E3F89625484635B3F4A85553C4B5A382B3A5A5A2B58724E384E7244283C - 5F4228414F4324285A241E243D24151F3B2C181E2F2C111F411F121E2C24181E - 41454472798B7CA1A7A4A2A7AAA5A7B0B0B0A5AC9BF7FBFDFDFBFBEDB8A8ABBC - A6A3AACBD1BFD1BEB3B3CAACA9D7D5D8DDDFD2C5D7D2C4C8DBEFEFEAECEAD9E8 - DFD8DEE2EAECEEEAEEEFEAEFEAEBEBE9D4D4D2CDCDD4DCDAD8D8D8D8DDCDCAB2 - B2A99792766D4B323225384B384E4B4A4E4B383A3A43393848444C464C4C5E5E - 5E526161618A638A8A9289766B766B766E6F74756E7A7B6F7B77777B90777790 - 7777919D9090909393909193919C909276776F776F75757A76747A7476747374 - 73747374706B716C6C6C6C706A6A6A646A6164616466535E55525E5952595259 - 59596C6C6C737A7A7E929692A5A9A9A9A9B1A9B3B1B3B2B7BBBBB3BBBBB7BBB9 - BBB9BBCACBBBC9D0C9BBCDCDCDD4D2D8DAD9DBD9DBCFE1E2E3E5E3E7E7E7E7E7 - F0E7F1F4F1F3F3F3F3F3F3F0F6F6F0F6F1F3ECF0F0ECF0E3E3E1DBDBCFCFCECC - C4C7C2AD9E9B9B8E8C8382813C3D36312731302627302627302722221B22161B - 161A161614160B160B140B1419161619221E2222212231213525021B271A051F - 2F1F111A411F181D412C1D2E4F4129415F422C388245384C725E464C7355483E - 86C3F7FBFFF9FFFBFBFBF7F59E626284736360626F696062696950698D553E62 - 8A554A4B853825325A5A444F885F384F824732438238293B822D2A3A43321E33 - 4F281E214F28151E4F1E181F3B2C121E41240B32726C6476967E95A5A4A4A2A3 - AAA5A7A7B0B0B0B2ADF1F8FBFBF7F8EFACAEB4AAA4AEBCCBD1BFD1BCB3CAAEA8 - B8D7D8DDDCDFCDB9DDD3C8CEE5F2F5F4F4EFE2E4E8E4EBEEE7F6EFF5F2F4F5F4 - F2EFEEEBDBD8D8CEDADADADEDCDAD8DADCD2BBB2B8A99C928553554A48395155 - 555B5255554E4848444A4C544C555E555E61596361646D6A6C8B6D918A8A7A76 - 7A767A76757A7792897B777B777A907B7B7B7B77917B907B9D936F9D93909393 - 939C919392897B7677767A77767A75767A7476747A7A78767A78747374717174 - 716E716C6C6C6C666A6161665E61615E615E666A716C71797A7A9492969696A5 - A5B2A9ABB1A9B1B1B1B3B3BBB2B7BBB7BBB2B7BBBBB7B9BBBBBBCAB9B9C5BBC9 - CDCDD8D8D6D4DACFD8D9DBE1E5E5E5E7E7E7E5E7ECE7F0F1F1F3F3F3F3F3F3F3 - F3F0F6F0F6E7F0ECE3E3E3E3E3E3DBE1CFCECFC7C7C4C4C29E9B988E8C844B4B - 3D3533313031222730273130272627222319231A20161B142216161614141314 - 1619221922222226213121353035091B2F1A051A2F1D051F2F1F181F43291D2C - 43402C405F422A415F44384E725E585A8852515556848FC6F3FBF7F7F8F7F7F6 - 9F896985896F606089685462896850698963505689554A57884A25325A39384E - 67474A4F674628435A422A415A43283A4B2A1E3147281E1E432B15244324121E - 411F12193A2A2B4E7378707CA1947EA2A4A4A2A3A9A5A7ABB0B0B0A9B8EFF5F5 - F6F7F4E4B2A9AEA6A2BCBECBD1BFBCABBCBEA9ACCADCD2DCDDDCC5B9DDC8C4DB - E5E2E1F7F5E1E2EBE4DAE5EFF5F4F1F4F2F5F5F4F4ECEEE4DBDACFD6DADADEDE - E4DEDCDEDDD3C9B2B2A9977A766356484839546151635B555555494A44564C4E - 4C554C5E615E616764636C6C6D926D8B938B897A897A76777A7A777A7B7A907B - 7B7B7B7B907B937B907B907B9D93909191919193939C919389777A6F7A6F747A - 7674767476747A7674737474717476786C73746C6C706C6C6A6C6A666A666161 - 615E615E666166616C71737A7A7D92949696A297A5B1A9A9ABA9B0B1B1B1B3B3 - B3B3BBB7B3B7BBB3BBBBBBBBBBBBBBBBB9BBB9C9C9CDD2D2D6D8D6CED8DAD9DB - E1E4E5E5E5E5E3E5E3ECE7F1F1F1F3F4F1F3F1F3F1F3F3F1E7F0ECE1F0ECE3E3 - E3E5DBDBCFCFCEC7C4C4C2AD9B9B988E8C83573D3D3533362731273026303127 - 30272227221B201B141B191616161616161414161A201B192219212530253525 - 3525031A271205122C1111122E1C111D411D182843401D2D5F2D2A2D5A423844 - 725842458852496163503E578E8E8F99C18E8F9B8668545B766A536073635160 - 6F6154626F67505167554A3F674A32324A28323A5A4A283C5F44253A5F442A2D - 472D242A43281E2C43241E1D3A2C181D2E2418192E1E11124138464C71786578 - A07E7D96A2A2A2A3AAA396A7A7A6A6B0ACC9C4C7CCCCC4AFAEB1A27FA2B7BDBB - BFBFB1ABBEB596A8C9D0CDD7DDD2B9C8D3BAAFDEE4C7C7EAEBE2DEDBDAD9E2EE - ECECE7ECECEFECECEBEBEADED4D4D2D4D4D6D8D8D8D8DADDDCCDB9A9B29D9276 - 63553E2B25323E4A4A4E494A4E4A38323232383E384A4C4C4C4C525E5E526166 - 6D8A6A8A8A767676766B7676757576777A7777777777777B7777907777909077 - 90909D9D9090909790937A91767A6F767574766E767473746C746C74746C746C - 746C706C746C6A706A6A656A6A646A64646A5E52595E5961645E656A66717478 - 7A7D7B7E9696A496A5ABA5B0A9ABABABB1B1B1B1B3B3B3B3B1B3B3BBB3B7BBBB - BBB2BBB3B9B9B9BBCBCDCDCDD2CCD4CCD6CEDAD9DBE4E5E2E5E5E1E5E1E5E7E7 - F1F1F1F1F1F1F1F1F1F3F1F0F4F0E7F0ECE3E3E3E5E2E1CFD9CECEC7C4C4C2C2 - 9B9B988E8682814B3D3533313130273127302731273027221B221B201B201616 - 16191614140B16141916192019212230253025343535020B1E0505121F110411 - 2C1111182E1D181D41292440472D2A2B4E422A445F4C4547795844496A534955 - 61544A5B854B3C5763635B6D896A51606D534955735350546D6248516149393C - 5B4A2B3C4E2B1E254E3924325A44283247422A2A382D241D412C181F431D181F - 401D181E2E1D12182E1E111E4F474E5E70707070947D7C96A0A2A0A3A3A3A1A7 - A7A6A6A7ABA8A8AFAFB2A8A5ABB07EA2A7B7ABBBBBB1A9A7BCA594A9CDCBCACD - D2BAA9B9BBACB9D6DFDAC7C7D9DEE9D4CCD8E9EAE1EAEAECEAECEAEAEAE8DAD4 - CCC5D4C5CDCDD4D4CED4D8D6CDB8B2A8B297926C533E32242124323E3E4A383A - 3A322A25282B32323238384444444C4C4C525952616C637676736A636B6A6E6C - 6F6E75757675757775777777777775777B7777777775909D6977909091917576 - 766F766E736B6C6E6C6E6C6C746C6E706A6C6C706A706B6C6A706A6A646A6A65 - 6A64646A646452525259595959646A6C707473747A927E967E9696A2A4A9A4A9 - A4B0A9ABABABB1B2B1B1B1AEB1B1B3B1B3BBB1BBB3B9B3B9B3B9BBB9CAC8C9C9 - C9C9C9CCCDD4CED9DBE2E4E2E4E1DBE1E4E3E7E7F1E7F1F1F2F1F1F1F1ECF1F1 - ECF0ECE3E1E3E1E3CFE3DBCFCFC7CCC6C4C4C29E9B998E8C86824B3D37333336 - 273130273127333033273026231923191B161916161616141614141A14201922 - 20212225252535253535021A1B12051A2C1105112F1C1118411D1D24472D2938 - 5F402B385F44384666584546725E4C5266525364897363636F694B826D6F6167 - 7A6A60558A67555576615456856156557249323C824A384A5F441E254A2B323D - 5A2B2B3A4F38282D4F2B1D2C412C181D4129181F411D181F4118121E411E1D43 - 885F47727D7D787DA1947DA0A0A1A0A3AAA3A3A7AAAAA6A6B3AEA9B3ABA7A2A5 - A7A27EA7B7B3B1BBBFA9A7ABB3A2A3BBCBD1CBD7CAB8BDBBAFB3CDD8DFDED8D6 - D4C5EBD8C7D8EBEEEEECEAEFEEECEEEAEBE8DED4C5CDCDCDCDD4D8D8D8D8DADC - CDB9AFA5A9A3926353483A2B32324A48554C564A463A32323232384844484C4C - 525252595964596A6A6A6C897A76766E766B74756E757A7577757777777B907B - 7B7B7B7B90777B907B909090B290779190979075767675766E6E736E736B716E - 6C6C6C6C746A706B6C6A6C706C6A706A6A6A656A6A6464646464525959595964 - 6A6A7070747A7C7A7E7E7E96A2A4A4A4A5A5A4A5B0A5B0ABABB1B1ABB1AEB1B1 - B1AEB1B3B3B3B3B3B3BBB1BBB3B9BBBBCBCBCAC9C8C9C9C9C9CCD8CEDBD9DBE2 - DBDBE2E2E1E5E5E7F1E7F1F2F1E7F1F1F1F1F0E7E7F0E1E7E3E1E3E2E1CFCFCF - CEC7C7C4C6ADC29E9B8E8C8C86823D3D3D3D3133303327342736273330273123 - 221B22162216161916191616141614161919221921222125303535353535091B - 2F1B0A1F2E1D0B1F2F2C181D41401E2A47422D465F58383C7245384C725C4C52 - 885E52668A6A616A766F6C76766D5B85896F678593766868896D5B67896D5684 - 8863566D88524A4B884E3C4E725A323A4E2B253A5F462B4B5F4228324F42242E - 43411F2C4329182C431D182E4126182E4F43385A79664D727D7D787DA3947DA1 - A2A0A2A3A7A5A5A3AEAAA7A7B4B1AEB3B0A6A6B4B0A2A0B5B6B7B3B7B7A9B6B5 - ABA3B1CBCACBCAD1BBB3CABBA7B9D7DCDDDCDCDCCCC9DCDADBE9EBEEEFEFEFF4 - EFEFEFEEEEE9D9D4CCD4D5CDD4DCD8DEDADEDEDDCDB9B2ACA99D927363554B3A - 3E4E565B675B5B5B5A4E4E4A464A554C555261616166636A6C6C6F6C6B6C768B - 897A7A76777A75777A7B777B7B7B907B7B7B7B7B7B917B937B90937B90937B9D - 909D91937B919077917A777A757A747674767473746C74737471746C70747174 - 71746C6C6C706A6A656A6A646A6464616A6A6A6C707473747A7C7A7E927E9696 - A296A4A4A4A5A9B0A5B0A9B0B0B1ABB2B1B3B1AEB1B1B3B3B3B7B9B3BBB3B3B9 - B3BBBABEBDCAC9CAC9CBC9C9CDD2D6D4DADBDADBDBDBDBE2E1E4E5E7E7E7E7F1 - E7F1F2F1E7F1E7E7F0ECE3E1E1E3E1CFE1E2CFCFCEC7CCC4C4C29E9B8E8E8C82 - 81574B3D353336273330332733273627313123262222161B1917191720162016 - 16191614192019222121303535393639373C031B2F1A051A2E1F111A411F181F - 412D1D2A5F422D4672583846724C444C7259526D895B445B8A6149637A6D6B6D - 9076566D6F6B626D916F606989695B627A6D545B89635567765E3E56675A3E4E - 725E384B822A1E284F47283B824228414F2B242A4F3A1E28432B1E24432B1E24 - 4F2C2C4388584C5E7A5D65797D7D7D7CA17E7EA0A1A2A0A2A4A4A5A5AAAAABB0 - B1A7A5AAA7B0A7ABA2A0A3BCBCB7B6B7B4ABB7B4A4A5B3CAD1D1CACAB5B3BEAE - B2CADCD8D7DCDCCDD6D6C4CCE9EEEEEAECEFEFF2F4ECEFEEEEE8D4D4D4D4CDD4 - D5D8DADCDADEDED6C5B8B2A5A8977A7363513839394A555363535B5B554E4948 - 4949494955525E616161666A6A6C6A6E736A6E7A7A76747475757A77777B777B - 7B7B7B7B7B917B7B917B7B907B7B937B77907B90776F9D9191777B6F7B7B777A - 75777A76747674736E74736C7471746C746C6C6C716C746C716C6C6C6C6C666C - 656A6A6A6C6C71747374787A7C7B7E7B7E967E7F96A2A2A4A4A4A5A6ABABABAB - ABABB1B1ABB1B1B1B1B1B3B1B3B1B3B3B3B2B3B3BBB3BBBBBDCBBBC8C8B9C8C9 - C9CDCCD4D6D8CFDADACFDBD9E4E1E5E5E3E7E7E7E7F1E7F1F1F0E7F0E3E3E1E3 - E1E1E2E1DBCFD9CFC7CCC6C4C29E9B9A8E868386823D3D3C3D33333336273627 - 3336273127302622221B22192319171916161B14161616192319202122313535 - 353F39373937021A1B11091A1F1204122F1C1118411D1F2A47422A385F453846 - 6745384972583E556355554E6D5548677360616F6D63546976605168896B6062 - 6F6251636F615057856149557153324A674C3849674532435A46242838241D2C - 4F38282E4F2A1E28432B1E1E422A1E1E462B1E244F322D465F5E585878786679 - 7D7D787CA07C7DA0A07F7EA0A2967FA2AEA3A2A7B0ABA3A7A7A6A2A2A0A2A3B5 - B4B4B4B1A7B4A7A4A2ABBBB3BEBEBEB7ABB3ABA5A9CBD2D5DCDCD2CBCDC8C4C4 - CEEEEEECECE3ECEEECECECEAE8D9D4CCCDCDCDD4CDD4DDDEDADCDCD2B8ACA896 - A592766452393232255051516755514C4A39323939323E484449495252526459 - 64636A6A6C6B6A7675746F6B6E75756E757777777777779077777B907B7B7B7B - 917B77907B907B90907B909D906F9075779075777576756F736E736B6C6C6C6B - 6C6C6C6A6A6C6A6C6A6A6C6A6A636C6C6C6D6A6C6C6C636A6A6C6B6C74767A7A - 7A7E7B947E969696A296A4A4A5A4A4A5A5A5A9A5A9A9A9A9B2A9A9A9B1A9B1AB - B1B2ABB2B1B2B2B3B2BABBB9BBBAC8B9C8B8C5BAC9C9CCD2CED4D6CEDACEDBDB - CFE2E3E3E5E6E7E3E7E7E7E7E7E6E7E7E3E3E3E1E1E3CFE1CFCFCFCEC7C7C4C4 - C29B998D8E868282573D3D3D333633362727332736273336272222221B221B20 - 191720191B2016201619162019221922253535393535353F353F02131A0B040B - 1F1005131C11111C2E1C1D2443292A425C4532385E4232385E4C44496D524849 - 6D5248546D616061896854626F5351556F6D60626D635055635348566D55484E - 725239434E442B465E422D38472D2B3246291E24421D1F24432824243B281E2C - 43241E2E4F2A1E384E4442585C5C457278655D787D7D787D947E7C94A0A07E96 - A27F7EA3A6A2A2A5A7A4A2A2A7A7A07EA2A7AAABB4B6ABA7B1ABA6A0A5B3A9B7 - CAB7B3A7BCB5A5A1B9D0B9D6D7D2B9BACBB9A8ADD8CEEFEFE1ECEAE5E8D9EAE9 - D8CDB8B9BBC5D0C5C5D4D4D8D4D6D7C9B2A9A596927A66523E2B2119253C4A3E - 564A4A3232322524252532323239443E444C4952525959536A6A636B636B6A6B - 636B6B6B6F6B756F756F7777777777777777907777907B7790776F9077906F6F - 9D90696F69686F696F686D6D696D636D636D6A6D6363636363616261625B5B5B - 5B6162635B636763676963636D686D766F7676777A7B927A9692969696979697 - A397A59DA4A5A5A9A5A5A9A9A9A9A9A9B2A9B2B2B2B2B2B2A9B2B2B2B8B8B9B9 - B9B9B9B8B8BAC5C5C9CCD6CCD6CECCCECECECFCFDBE1E5E3E3E6E3E7E7E7EDE3 - E7E7E3E3E3E1E2E1CFD9CFE2CFD9CEC7C7C5C4C29E9E9A8F8C868357814B3733 - 36333127363336313380313027302623222216221B20191616201A1B1416201A - 2022222130353535373937373F370217271005132E11051A2F18101F41291C2D - 432D2D425F5C384E5F4C38495F5E445E88615161766150566F615B69896F5168 - 85635462766F6269896355638563505B85524A556D5E3856674638465F443846 - 5F4438465F4428415A2D282B4224242C472B243A4F2D242C5F2D2A4E6745445C - 7166455D797070797D7D787EA0947D94A07EA0A1A2A096A2A3A6A0A7ABA4A2A3 - A7A77CA0A4B0AEBCB4B0A7A7B3B6A1A2AEB7B3BBBFB7ABAABCB4A0A5BBCBCDD2 - D7D2BAB9D1BAACC9DAD8E2E7E3ECE5EAEEEBE9E9D8C5C8BBB9CACDCDD4D4D8D9 - DCDCDCC9B2A99796967A6C5238323221325654565B554E56463C3C323A3C3848 - 494C4C4C5E5261596464636A6C6C6C6B6E766B6E757575757575757577777777 - 9077907B77907B7B917B907B7B90927B90776F90AC9D9F9D9FAC9F9D9F9F9D9D - 9C9D9C9D9C9C9D9CA89C9D9C9C9C9A9C9A9C9A9C9C9C9C9A9C9C9C9C9C9C9D9C - 9D9CA89DA8A89DA8A8A9A8A9ACABA9A9B2AEB2B1B2B3B2B5B9B3BBB3BBBBBBB3 - B9BBBBBBBBBBBBBEBBCABBBBCABBD0C8D0D0D3D2D1D2D0D2CBCDC9CBD2D6D2D6 - D6D6D6D8DAD8DBDBE2E5E5E5E6E5E6E5E7EDE7E7E7E6E5E3E3E5E1E2E1CFD9CF - CFC7CEC7C4C7C4C29E9B998E8C8357574B3D3D353D3627313627338031313627 - 3027222223221B20191720192016221616191420192221303535353537353739 - 373F091F3B1A101A4118051F411C181D43401D3A5F422B46795C4C4E71524C52 - 73614C67766655637A63516376636063896F686977696363896E6269926F636D - 766C5469736355637361485B7252444C7258384C7245444C6758384F885F464F - 5B38282D473828325F452A38884D44888B665965797865717D7D707D94947C7D - A0947CA1A3A094A0A2A5A1A1A7A4A3A6A7A6A3AAABA27EA3B4B4AAB3B4A7A5AA - B4A77EA7B5B7B3B3BFB7AAB4BEA7A3AECAD1D0D2D7D0B3BDD0B8AED2DDDACFEB - F2F4F4EDEEEFE5EBDACCC5C8C8C9CDC7D8D9DBDAE2DDD2B9B29DA597927B7361 - 483E483E556D636D6C636361554C4C484949494C4E5E5E616166666C6C73746C - 747474747A7475747A7774777A777B7B7B777B90777B7B907B7B907B7B7B7B7B - 907B7B7B927B92779277907A7A897A7A7A7A7A7A7A7A7D767A7A7C7A7A797A7A - 787A7A747A747A747A7478747474747A7C7A7A7C7A7A7A7E7A9494967E96A096 - 7F96A2A296A4A4A3A4A5A5A4A7A5ABA5ABA5ABABAEABAEAEB3AEB1AEB3AEB3B1 - AEB3AEB3B3BBB3BBB5BBB5B9BCB9BDCBCBCBD2D0CDC9CDCDCDD4C9D4D9DAD9E2 - E2E1E2E3E5E3E5E3E3E5E3E1CFE1CFCFD9CFCFCFCEC7CEC4C7C4C2AD9B9B988E - 8C828281573D363D313336313333363D3680313027302322221B22201B192016 - 19161B201B1416201922223125353535373937373F3F051B2F180A1F2F18101B - 411F181D43401D435F2D2D58725C445E885244527259496173636163766A5362 - 766368639076696F896C6869766D68698976686D766D53628A63556176614C5B - 885E4C58725E444E725E384C665E2A465F4742465F4638465F462D465F5C424C - 79665C8BA3795C6579705D717D78787D947E7C94A17E9494A0947EA3A27FA0A3 - A6A5A2A3A7A4A7A2A27E94A7ABABA7B3B4ABA7B3ABA2A0AEBEB7B7BBB7B3ABB4 - B4A1A2B2CAD0D0D0D3BBBABBB5AEB9D6DDE9D4D9EBEEEFE5E5ECEEDBC7C5C5C5 - C8C9CCD4C7D9D8D9DEDFD4B9B2A597967B766F56554A3E48556D6D6B6D6A6361 - 554C4C4849544C56525E616161666A6C6C6C746C7476747A757A777A7A777B7A - 7B7B7B7B7B917B7B7B907B7B7B907B917B917B917B9292929292967B9292927A - 92927A8B7A7A7A7A7A747A7C797C7A7C7A7C7A787A7C747C747C747C747C7B7C - 7E7C7E7E7B7E7E7A7E9494967E967EA07E7F967FA0967FA27FA2A2A2A4A2A4A6 - A5A6A7A4A7A7A5A7A9A7ABABABABAEABB3ABAEB1ABB3B3B3BCB3BCBCBCBCB3B5 - BAB3BABCBDBDBBC9BBBBB9B9C5CAD4CDD4DAD9DBD9E4E5E3E5E3E3E5E3E3E1DB - E1CFCFCFCFCFC7CFC7C7C4C7C4C4AD9E9B9A8E8E868281573D4B3D3633363380 - 31363D273D3D30273027222322221B2216231920162216191619201920222231 - 3530353537353F353F370313270A05131F1205132F1810182F291F2D4F402A46 - 5F58384E6745444C6745445E6D5E54617661515B6D53556289696D6989695662 - 766354628963635B8A61545A6D554C56725E445A675E384E5F5838475F463846 - 5F4438475F452D47724742425F454247724D4247795D5C799C7965707D795D79 - 7D7D7278947D7894A07D7CA0A3A0947EA2A3A0A1A3A2A0A1A6A4A3A07FA0A1AB - B4ABA7AAABA5A5A7A5A2A2B4B5B3B3B3B7ABB4B4A7A2A5BCCACABBCACAB1B3BB - A9A8BDD3D6DECCC7D9CEEBEEE8E9E9C7B8C4B8B8C5C5C9D4D4C7D4D4DCCDB8AC - 9D96977B766D554A312532324A575B5B5B564E4A3C4A3A323A3939393E4A4850 - 5255535559636363636B636B6C6B6F6B6F6B766B756F756F7577776F90759077 - 9077779077907590779077777575777B757777777A7576777674767A747A747A - 747A7A787A74787476747C747C777C747C747C747C777C7B7C7E7A7A7E7A7E7A - 967E969496967E967E96A296A2A2A2A4A2A4A5A4A5A4A5A6A5A4A5B0A4ABA5AB - ABA9ABABABB1ABABB1B1B3AEB3B3B3B3B3B3B3B3B5B3BAB9BDBDCBB9C8C5C8C5 - C9C5CDCCD4D4DACFDACFE1DBE3E1DBE1E1CFE3E1CFE1D9CFCFC7CEC7C7CCC6C4 - C4C4AD9B9B988E8C8C815A4B3D3D3733363333363D27363D3336273627222722 - 232023192319201622161920161916201922313035353535373937373F3F020B - 1B0A020B1F05050A1F1110122E1D182C4740282D5F42384E674C384C6744384E - 6D52485B736151566D5251566F61626D6F6354566D63546285635B6185674856 - 6D4C484C6758394E5F44444667452D445F382D385F422D435F422D4245422D42 - 5F452D45724D4258725D4D79A37D5C6679654D667D6571787D7C707D947C7C7C - 7C7E7C947F7E94A0A2A07EA0A2A27C7EA07EA2A3ABA7A3A4A7A4A2A3A27FA2B3 - ABB4ABB1B1A4ABA2A2A2A7B3BBB7B2CAB1AEBBA9A3A9BAD2D3D2CCD4DEC7C7E9 - E4E2D8C4C4B8C4B9B8C5C5C5C7D4CED4D4C5B2AC9D977B766D553833241E2131 - 3C4B574B4B483A333A262626262E2125312C32323938484C544C565555556762 - 6367696D6F6F696F696F6F6F906F6F906F906F906F90906F90909090906F9090 - 909090906F906F906F897676896F6F736F737373736C7371736C736D6C6C7378 - 7178737873787A797A7C8B7E8B947A948B9492948B9592959594969596949695 - 969796A397A396A397A5A397A4A3A597A5A5A5A5A9A9A5A9A9A9A9A9A9A9B2B3 - B2B2BAB2B3B2B2AFB2BAB8BAB9C5BAC8B9BAB8BAC4C9CCCCCECECECFCFCFDBCF - E1CFE5CFE1CFCFCFCFCFC7CFC7CEC7C6CCC6C4C4C4C49E9B9B988E8683824B81 - 4B353D333D363327363D3380353D3027302722272223192319201B1920162216 - 2014201922193035253535353735373E373703161F120912261805132E181018 - 41291D3A472D2A385F58384E725244556652385573525163766351606D535160 - 6D6855698963606976635462766C606D766355556D5349527152484E6D45445E - 5F584447724C444C665C3845724D4458725C425C725D455E795D585F78656579 - A39670787978707D7D787079947C787C967D7CA0A0A07EA0A2A094A1A2A094A2 - A37F7E7EA7A2A3A7ABABA3A3B0A7A2A2A2A9A7B4B3B3B3ABB4A9A7A2A6A9B4BC - BBBEB3B7B1B3AEA5A9B5CBD3D6D2D2D4DCD4C7E4EBEFEBDBDBDADBDAE4DAE4EB - E5EBE5EEE4DBDAD2C9C9C4C4ADC2C19BC1C18FC19FC1C2C2C2C1C19EC1C19BC0 - 9BC0C1C19BC1C1C1C1C2C1ADC1ADC2ADC2C2ADC2ADC2ADC2C2ADC2C2ADC2C2C2 - C2C2C2C4C2C4C2C4C2C4C2C4C4C4C4C4C2C4C2C2C2C29FC2C2C4C2C2C2ADC2C2 - ADC2C2ADC2ADC2ADADC4ADC2ADC4ADADC4ADADC4ADC4AFC4ADC4AFC4AFC4AFC4 - C4AFC4C4B8C4C4B8C4BAC4BAC5BAC4BAC4BAB9C8BAC8C8C5C8C9C8C8C9C9C8C9 - C8C9C8C8C9C9D2CCCDCBD2CCCDD2CDD2D2D2D6D2D6D7D6D6D6D6D6D6D6D6D6DA - D6D6D6D6D6D6D6D6D6D6D6DBDBDBE4E4E4E4E4E4E5E2E5E4E1E2E2CFCFCFCFCE - CFC7CCC7CCC4CCC4C4AD9B9B9A8E868C82574B4B3D3C3D363333363380313336 - 333D303127302322272217221923142216201B20191614202022223130353535 - 373937373F3E091F331A051F2F18051F2F1D112C434124425F463842665C4456 - 735952617359486185645163926C5463896360536F6F6069926F67697A6F6062 - 896F636F8A7653698A6152617364495B7259525E7959445E72584452715C455E - 725C455C715D585C7966456479705C717D70707CA17E787A7D7D6579947C787D - 967E789496967C94A09694A2A3A294A1A3A2A0A3A37E947FA7A3A3A7B1A7A5A5 - B4A5A096A5B4ABBCB4B7ABABB3B0A6A2A7B4B3B7BEB7BEB1ABBEABA1ABBDD0CB - D3D2DCD2D7DECECFDBEED8C4C7C4C4C4CCC7CEDBDBCFE4E5CECCC4AC9A9C9A89 - 88823D3D2F273D82835B86835B814B3D803D803B803B803D8082808280828282 - 8382868285828688868C8C868C8D868C8D8C8D898E8D8E908E8D8E98988E988D - 988E988E988D98988798988E9886988D8D98898E8D8D858D86898C898C898D8A - 8C8A8D858A8D8C8A8D8C8D8A8D8C8D8D9A8D9A8D958D9A958D9A959A9A9C9A9A - 9A9A9A9A9A9C9A979C9C9CA89CA89CAC9CAC9CAC9CACACACACACACACAFADACAF - ADAFADAFADAFB8B8C4B8B8B8AFB8AFB8C4B8C5C4C5CCC5C8C5C8C4C8C8CCCCCC - CECECECFCFDBDBCFDBCFE2CFDBCFCFCFCECFCECEC7CEC6CCC4C4C4C4C4AD9B9A - 9A8E8C8682814B4B3D3D3C3D36333D333633368035803027302727222319221B - 20162216201A201B201920192220312235353535353739373F370A1B2F15111A - 411A111A2F1F111D412A2C415A463844665C3E5E726152617361496173635163 - 89746062896B55686F6D606F916D686D906C60697663636D8A6C556D76615255 - 73644967735E4C5E7959585A795E495E715D445F795D58597965455C79665E66 - 7D5D66727D7C657A96967C7C7D7C6578947D787D947E7C94A17E94A0A0A094A0 - A2A094A0A3A1A0A0A07EA0A2AAA6A3AAA7A7A2AAABA47EA7ABA7B4ABBCB3A7AB - B3AB7EA2B0BCB3B7B7BEB1B1BCB3A5A0BABECBCBD3D3D2D2D7D6DCDADAC5DAC4 - AFCCC4C4C4CCC7D8DBD8CFD6CCC4ACA89C95898A675A3D3B3B333A8282858285 - 825A4B4B3D3D3D3B3B3B3D434B4F4F825A825B6767886D886D8A8A898A89898A - 89898989898989899189908D9090918D90919098909191918D91908D918D9090 - 8D908D898B8D8B898B898A898B898B8A8B8A8A8A8A7A8A8B8A768B8A8B8B8B8B - 8B8B8B8B8B958D959A9795959592979597959797979C9797A19CA39CA39DA397 - A39DA3A8A5A8A5A8A5A8A8A8A8A8A8AEACA9AEACAEACAEB2AFB2B2AFB3B2B2AF - B3B2AFB9B9B9B9B9B9B9BABABAB8C8C4C8C8CCCCCCCCCECCCED6CFD6CFD8CECF - CEC7C7CEC7C6CCC7CCC4CCC4C4C4C4ADADAD9B9A8E8C8682823D4B3D3C3D3533 - 333627363380353D3D3633273023222322231B202319162016201A2016201620 - 192230313035353437393735373F091A26120A122E12051A2F11111F4024242D - 4F422D386645444E6D5E4C537261484C6D525053766354636D6351606D685169 - 896C626D896354696F5951638A6C4C638859526172593E5A72584C587258445E - 72584652665D445C725D455C715D5858795D585E796558667878657894947C7D - 9478657D7D7C797D947C787D96947C94A07E7D7EA07E7DA0A3A07C7EA0947EA1 - A4A3A2A3A6A3A7A5A27F7CA5ABB4ABABB5A7A4A7ABA27EA4B3B6B3B3BCB7A7AB - BCA796A2B5BEBABBCBCBCBD0D7D2C9D7D2AF9CD3AFADAFADC4ADD4C7C5CCD6CC - C4AFA393928A73674E392A261E24324F4B5A5B5A4A4A3A3A2E252C2124262B25 - 3A32383846444C4C5E52616166636367636D6D6F6D6D6F76896F76896F6F896F - 906F896F896F90899089899089908990898989897A89897A89768A768A767376 - 7376737A737A797A7A8B737A7A8B797A797A798B7A8B7A8B8B94929492959492 - 94949495969495A19695A1969596A19696A197A297A297A3A297A596A397A5A5 - A3A5A5A5AAA8A9A9A8ABA9AEAEB2AEB1B2AEB3B2AEB2B3AFB3B9B5B9B9BAB9B8 - AFB9BAB8C8C5C8C9C9CCCCCCCCD6CECECECECECCC7CECCC7C5CCC4CCC4C4C4C4 - C4C4ADADAD9B9E9A8C8C86824B4B3D3C3D3C3335333336333D36333633362736 - 23232223221B2023161B20162016201619161920221930253435353535373739 - 3737020B1A0902091F0505051A1005111F1D1828432D2A2D4542383E5E4C444C - 6752384A67493E54735348566D514854635150546D62545B765548576D513E4C - 6D5E4A5A6D584C5E66453246674238445F452D465F453845664542425D4D4258 - 664D42455F5C4445715D455F79705D70947D7970787865657D785D7D7D78787D - 7D7D787DA07E7C7CA07E7DA0A17C787DA07F96A0A2A2A0A1A4A2A3A07F967FA3 - ABABA3A7B4A4A3A7A77E7FA7B4ABABB3B7ABA5B4B396A0A5BCBCB3BDCBBEB9CB - CBD0BACBB895959CCBAF9CADACC5C4C5C7C4C9BAAC9C9794767352462B241518 - 15182839384A4E3A322525241E191512151524242428282B2B383844494C524C - 595553535961536363636363636963686D68696963696F696F696F696F696F69 - 6F6F6D6F736F73736D7376737373737171737371737973797871797873737873 - 73787A797A797A797C7A7D7A7D8B7E8B94949494949494949494A19495A09595 - A19596A0A196A196A3A1A396A3A2A3A1A3A2A3A2A5A3A5A3A7A5AAA5A7A9AAA9 - AEABB2AEB3AEB3AEAEB3AEB3AFB5AFBAB3AFB3AFBAAFB3B9B9C8C8C5C8C9C9C9 - CCCCC9CCCCCCCCCCC4CCC4CCC4C5C4C4C4C4C4AFADC4ADADAC9B9A9A8C828482 - 3D4B3C3B3C3333333131312736333D363D803134273023221622231917201619 - 17201B2014162016222022223135353535353737393709132711090B1F120913 - 2F11101A2E2C182E47402D465F42384E675E445572554956675548566D63555B - 895954638560545689675B6D896D545B8963555B6D5E5567885E4C677266385A - 725E465E7258465E725E425E725D445E795D4D5E7966455C795F585E79795C72 - 797D5D73949478947D70657D9478797D947D7D7D947D7C7DA0947CA0A1A0A094 - A07C7CA0A1A0A0A2A3A294A0A7A7A07EA0A2A4AAA7ABA4AAABA7A7A7A27FA3AB - B3B4B1BCB7ABA7B1AE7F96B3BCBCBBBCCABDB9BED0CBCBCBB5A8A19CACCBADC4 - ADC4CCC5C5C9C8BAA8A397957A6C6747382C282424284B4E5A5B5B574A3C3533 - 33312626222625253A3A3A3A463E464C565255616763686769636D696D6F696F - 696F856F696F6F6F6F896F896F89896F907690896F89898989898A8A8A7A8A8B - 8B8A8B7A8A8B738B738A7976798B797D8B7D8B7D8B7A8B7D7A7D7A7D927D9492 - 7D94959495949494959496959496959695A196A196A1A197A1A1A2A396A396A3 - A3A397A4A3A3A5A3A3A4A7A5A3A5A5A7A9AAA9ABABABAEAEAEB2AEAEB3AEB5AE - B5B3BAB5AFBAB2AFB2BAB8BAB9B9C8B9C8C8C9C9C9C9CCCCCCC5CCC4C5C5C4C5 - C4C4C5C4AFADC4ADAFADADAC9B9E9A8D8C85824B4B3D3C3C3B353A3133333336 - 3380353D36333627272322222316221720162016201B20171420161920221922 - 303134353735353F37390A262F1E111A2F1D051B411F181F4140183B5F422B4E - 725832558A5952677361495B73535160736351698A6F5563896B5169766D6885 - 897660698A6361638A615E678A6452668B6652677961585E7966455F795E5861 - 7965585F79665C66797059667D715C718B7866727D78707D9494947C7D7E787A - 7D7E7D7D94947894A1947D94A07D7CA0A096947DA094A0A1A2A2A0A3A7A2A0A7 - AAA294A0A2A6A3A7B4ABAAABAAABA6A2A3A7ABB4B4B5B7B3B4ABB3A7A7A1ABB3 - B7BCB7BBBEBEBBCAD0D0CBBDA8A896A395ACD6ADC5C4C5CEC5CCC8AFA8A89796 - 8B76725B4F463A383C4E675B8585856257574B3D3D3D36333B333D3C3D4B4B5A - 575A5B5A635B6D696D6D856F6F85896F8990856F90896F909089908992899191 - 918992918D918B91919191918B91918B918B8B898B898B898A7A8B898B8B7A8B - 8B7A8B7A7A797A7A797A947A9492947A949492949694969696969596969695A1 - 97A197A196A197A197A197A297A597A3A5A3A3A5A3A3A5A3A5A5A3A5AAA8A7A8 - AAA5AAA8AEA9AEAEACAEAEB2B1AEAEB1AEB3B2B3B5B2B5B2BAB3BAB3BAB3BAB9 - BAC8BAC8C8C5C8C8C9C9C8C8C5C8C5C5BAC4BAC4B8C4AFC4AFC4AFADADAC9BAC - 9B9A9A8D8C8282573D4B3B3C3B3333313333363333363D363336272730272322 - 1B22231622161B20162016201616201420222021223035253535373537350526 - 2F15101A2F18051F2F18111D412C1E2A822D2D466758324E7359516173615161 - 855350536F63515B766353626F635060896355688A6F5562765351617361495E - 7366525E71644C617264585E7166445E725C495C715D4C5E7965585C71705859 - 797059667D705D727D7D707C94967C94967C657D947C707D7D7C7C7D94947C7D - A0947DA0A07C7D94A0A094A1A3A2A0A2A2A1A0AAA67F7EA0A7A6A3A7AAABA7A7 - AAAAA0A0A2AAA7ABB3B7ABABABB4AAA2A4A7ABBCB7B7B3B7BBBFBBBECABECAAE - AAA3A3A1AF95ACCEC4CCC4C5D6C5AFAFA89795957A6D675F43383A2B46566767 - 88855B5B4A4B4B3C3D3331333133333D3D4B3D4B5A575A5B5B676D636D856F6D - 856F6F856F896F89896F90896F90899089907A9089919189929091899189917A - 90917A907A89928B918B918B918B898B8A928B8B8B7A8B958B92948B927D927A - 947A9492949294949296949696959695969596969796A197A397A396A397A196 - A196A396A397A497A5A5A39DA4A8A5A5A8A5A8A5A8A9A8AAA9AEAEA9AEA9AEA9 - AEAEB2ABB2B3B3B3B2B5B9B3B2AEB2AFBAB9BABAB9BAB9BABAC8C8C8C8C8C8C8 - C8BAC4B9C4B8C4B8C4AFC4AFADAFADACADACAC9A9A9A9A8C88865A4B3D3C3D3C - 3B333A313331273D36333D36333627362723222322231B202316201B201B2016 - 161416201B20222021302134353535353735091B2F1109122F1105132F111018 - 2F1D182C472D2A425F58324E67524C5E6D6144566D4948546D53545B6F675555 - 856350626D5B555B8A635662855355618859485E88594C5F7964465A795E4C5E - 725D4C5F7258455E725C455F795D585E795D586679655C667D654D667D786579 - 9494947D947D7078947C707D947D7D7DA17D7D7DA1949494A07E7C7DA1A094A0 - A0A094A0A2A2A0A1A27E7EA0A7A4A3A6AAA6A2A3A7A47EA0A7A7A7AEB7B4A9A7 - B1ABA47EA7A5B0B6B3B7B0B3B7B7B1B3BBBBB596A7A17EA3A89C959ADCC5C4C5 - C8AFA8A89A957A73665A4F3A2E2C2C243A43675A88675A4C4A3A3A332E262C26 - 242C2628253A2B3A3A444A46554E5561615B616D616D6D6D6D6D6F736F857676 - 896F76896F89897A896F89899076897A898976907676897A8976767676767376 - 737673767679767A797A797A797A797A7A7A797D7D7A7D7D8B7D949294949495 - 949694959294959294969596969696A19696A196A196A196A196A3A396A3A2A3 - 97A4A3A5A2A5A3A5A5A5A5A5A5A5A5AAA9AAA9AEA9AEA9AEAEB1AEB2B3B2AEB2 - AFB2AEB2B3AFB3B9BAB9BABAB8BABAC8B9BAC8C5BAC4BAAFB8ADB8AFADAFAFAD - AFACACAD9CAC9B9C9A8D8D8C8582574B3B3C3C333A3333312E313133363D3633 - 3336273027222322231B2223162223162016161616161416201B202222222130 - 353435353535030B1A0A05051F0505091A1005111F1818182D2A282A45452B32 - 4C4438485E5E3E4E5B48394863524A546755515461553E5067514A566D553E56 - 6D55484E674C444C5F44444C725C44466758424C5F5C2D45724238456645424C - 5F4D454C72584558705D455C795D5C6679785D787D7D7D7A7D785D707D707079 - 7D7870787D7D7894A07D787C7C7C787DA07E7C94A07EA07EA1A27E7C7F7EA1A0 - A6A07FA2A5A2A0A5A7A078A2AAA6A3ABABA5A2A7ABA57F7EA7A7A5B0B6B3B0B1 - B7ABA9B1BEBEA5A0A3A2A0A3A197959AADCCC5ADB8AC9CA1957666594C44281D - 18121811242D47445F5E38382B2528241E1E181518151E1E241E28282A2B3238 - 384444494C525259615E61616A676A63676A636D636D63636D636D696D6D6F63 - 6D6D696D6D686F636F6A6D6A6C6D736C73736D736D7373737173737173717378 - 7374717378737D797A797D7A7D7D8B7D7D948B949495947A9492949492949494 - 9496949694969496969496A19696A396A396A396A196A2A196A2A2A3A2A3A4A5 - A3A5A5A5A5A5A9A8A5A9AAA9AEAEA9AEAEA9AEAEA9AEA9AEAEB2B3AFB3AFBAB2 - BAAFB9BAB9BAB8BAAFB8AFAFAFAFACAFACACACACACACAC9CAC9A9C9A9A8D8D88 - 825B4B3C3C3B3A333A3131313131333133363D31363127302322232223221B22 - 231B202314162016161416142019202022212230253035353535} - end - object Label1: TLabel - Left = 8 - Top = 112 - Width = 58 - Height = 13 - Caption = 'API Version:' - end - object lblAPIVersion: TLabel - Left = 116 - Top = 112 - Width = 62 - Height = 13 - Caption = 'lblAPIVersion' - end - object Label3: TLabel - Left = 8 - Top = 128 - Width = 61 - Height = 13 - Caption = 'DLL Version:' - end - object lblDLLVersion: TLabel - Left = 116 - Top = 128 - Width = 65 - Height = 13 - Caption = 'lblDLLVersion' - end - object Label5: TLabel - Left = 8 - Top = 168 - Width = 83 - Height = 13 - Caption = 'FSOUND Output:' - end - object Label6: TLabel - Left = 8 - Top = 184 - Width = 76 - Height = 13 - Caption = 'FSOUND Mixer:' - end - object Label7: TLabel - Left = 416 - Top = 88 - Width = 72 - Height = 13 - Alignment = taRightJustify - Caption = 'Contact Details' - end - object lblEmail: TLabel - Left = 371 - Top = 104 - Width = 117 - Height = 13 - Cursor = crHandPoint - Alignment = taRightJustify - Caption = 'mailto:support@fmod.org' - Font.Charset = DEFAULT_CHARSET - Font.Color = clBlue - Font.Height = -11 - Font.Name = 'MS Sans Serif' - Font.Style = [fsUnderline] - ParentFont = False - OnClick = lblEmailClick - end - object lblWeb: TLabel - Left = 389 - Top = 120 - Width = 99 - Height = 13 - Cursor = crHandPoint - Alignment = taRightJustify - Caption = 'http://www.fmod.org' - Font.Charset = DEFAULT_CHARSET - Font.Color = clBlue - Font.Height = -11 - Font.Name = 'MS Sans Serif' - Font.Style = [fsUnderline] - ParentFont = False - OnClick = lblEmailClick - end - object Label10: TLabel - Left = 8 - Top = 200 - Width = 77 - Height = 13 - Caption = 'FASTCD Player:' - end - object lblOutput: TLabel - Left = 116 - Top = 168 - Width = 42 - Height = 13 - Caption = 'lblOutput' - end - object lblMixer: TLabel - Left = 116 - Top = 184 - Width = 35 - Height = 13 - Caption = 'lblMixer' - end - object lblFastCD: TLabel - Left = 116 - Top = 200 - Width = 277 - Height = 41 - AutoSize = False - Caption = - 'A *non polling* player that prevents CD hardware interrupting fo' + - 'reground applications' - WordWrap = True - end - object Label2: TLabel - Left = 8 - Top = 152 - Width = 79 - Height = 13 - Caption = 'FSOUND Driver:' - end - object lblDriver: TLabel - Left = 116 - Top = 152 - Width = 38 - Height = 13 - Caption = 'lblDriver' - end - object btnClose: TButton - Left = 412 - Top = 208 - Width = 75 - Height = 25 - Cancel = True - Caption = 'Close' - Default = True - ModalResult = 1 - TabOrder = 0 - end -end diff --git a/#ThirdParty/fmodapi375win/samplesdelphi/FMod/about.pas b/#ThirdParty/fmodapi375win/samplesdelphi/FMod/about.pas deleted file mode 100644 index 4de1b7e..0000000 --- a/#ThirdParty/fmodapi375win/samplesdelphi/FMod/about.pas +++ /dev/null @@ -1,108 +0,0 @@ -unit about; - -{$WARN UNSAFE_TYPE OFF} - -interface - -uses - Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, - StdCtrls, ExtCtrls; - -type - TfrmAbout = class(TForm) - lblCopyright: TLabel; - imgLogo: TImage; - Label1: TLabel; - btnClose: TButton; - lblAPIVersion: TLabel; - Label3: TLabel; - lblDLLVersion: TLabel; - Label5: TLabel; - Label6: TLabel; - Label7: TLabel; - lblEmail: TLabel; - lblWeb: TLabel; - Label10: TLabel; - lblOutput: TLabel; - lblMixer: TLabel; - lblFastCD: TLabel; - Label2: TLabel; - lblDriver: TLabel; - procedure FormShow(Sender: TObject); - procedure FormCreate(Sender: TObject); - procedure lblEmailClick(Sender: TObject); - private - { Private declarations } - public - { Public declarations } - end; - -var - frmAbout: TfrmAbout; - -implementation - -{$R *.DFM} - -uses - fmod, fmodtypes, ShellApi; - -const - OutputTypes: array [TFSoundOutputTypes] of String = - ( - 'FSOUND_OUTPUT_NOSOUND', - 'FSOUND_OUTPUT_WINMM', - 'FSOUND_OUTPUT_DSOUND', - 'FSOUND_OUTPUT_A3D', - 'FSOUND_OUTPUT_OSS', - 'FSOUND_OUTPUT_ESD', - 'FSOUND_OUTPUT_ALSA', - 'FSOUND_OUTPUT_ASIO', - 'FSOUND_OUTPUT_XBOX', - 'FSOUND_OUTPUT_PS2', - 'FSOUND_OUTPUT_MAC', - 'FSOUND_OUTPUT_GC', - 'FSOUND_OUTPUT_NOSOUND_REALTIME' - ); - - MixerTypes: array [TFSoundMixerTypes] of String = - ( - 'FSOUND_MIXER_AUTODETECT', - 'FSOUND_MIXER_BLENDMODE', - 'FSOUND_MIXER_MMXP5', - 'FSOUND_MIXER_MMXP6', - - 'FSOUND_MIXER_QUALITY_AUTODETECT', - 'FSOUND_MIXER_QUALITY_FPU', - 'FSOUND_MIXER_QUALITY_MMXP5', - 'FSOUND_MIXER_QUALITY_MMXP6', - - 'FSOUND_MIXER_MONO', - 'FSOUND_MIXER_QUALITY_MONO', - - 'FSOUND_MIXER_MAX' - ); - -procedure TfrmAbout.FormShow(Sender: TObject); -var - Channels2D, Channels3D, ChannelsTotal: Integer; -begin - FSOUND_GetNumHWChannels(Channels2D, Channels3D, ChannelsTotal); - lblAPIVersion.Caption := Format('%3.2f', [FMOD_VERSION]); - lblDLLVersion.Caption := Format('%3.2f', [FSOUND_GetVersion]); - lblDriver.Caption := FSOUND_GetDriverName(FSOUND_GetDriver); - lblOutput.Caption := Format('%s at %dHz', [OutputTypes[FSOUND_GetOutput], FSOUND_GetOutputRate]); - lblMixer.Caption := Format('%s using up to %d channels (%d in hardware)', [MixerTypes[FSOUND_GetMixer], FSOUND_GetMaxChannels, ChannelsTotal]); -end; - -procedure TfrmAbout.FormCreate(Sender: TObject); -begin - DesktopFont := True; -end; - -procedure TfrmAbout.lblEmailClick(Sender: TObject); -begin - ShellExecute(Application.MainForm.Handle, 'open', PChar((Sender as TLabel).Caption), nil, nil, SW_SHOWNORMAL); -end; - -end. diff --git a/#ThirdParty/fmodapi375win/samplesdelphi/FMod/config.dfm b/#ThirdParty/fmodapi375win/samplesdelphi/FMod/config.dfm deleted file mode 100644 index 67c60d8..0000000 --- a/#ThirdParty/fmodapi375win/samplesdelphi/FMod/config.dfm +++ /dev/null @@ -1,153 +0,0 @@ -object frmConfig: TfrmConfig - Left = 191 - Top = 107 - ActiveControl = cbxOutputType - BorderStyle = bsDialog - Caption = 'FMOD Configuration' - ClientHeight = 290 - ClientWidth = 281 - Color = clBtnFace - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'MS Sans Serif' - Font.Style = [] - OldCreateOrder = False - Position = poMainFormCenter - OnClose = FormClose - OnCreate = FormCreate - OnShow = FormShow - DesignSize = ( - 281 - 290) - PixelsPerInch = 96 - TextHeight = 13 - object lblOutputType: TLabel - Left = 12 - Top = 12 - Width = 55 - Height = 13 - Caption = 'Output type' - end - object lblOutputDevice: TLabel - Left = 12 - Top = 60 - Width = 67 - Height = 13 - Caption = 'Output device' - end - object lblMixerType: TLabel - Left = 12 - Top = 108 - Width = 48 - Height = 13 - Caption = 'Mixer type' - end - object lblOutputRate: TLabel - Left = 12 - Top = 156 - Width = 53 - Height = 13 - Caption = 'Output rate' - end - object btnOk: TButton - Left = 109 - Top = 256 - Width = 75 - Height = 25 - Anchors = [akRight, akBottom] - Caption = 'Ok' - Default = True - ModalResult = 1 - TabOrder = 4 - OnClick = btnOkClick - end - object btnCancel: TButton - Left = 193 - Top = 256 - Width = 75 - Height = 25 - Anchors = [akRight, akBottom] - Cancel = True - Caption = 'Cancel' - ModalResult = 2 - TabOrder = 5 - OnClick = btnCancelClick - end - object cbxOutputType: TComboBox - Left = 8 - Top = 28 - Width = 258 - Height = 21 - Style = csDropDownList - Anchors = [akLeft, akTop, akRight] - ItemHeight = 13 - TabOrder = 0 - OnChange = cbxOutputTypeChange - Items.Strings = ( - 'Window Multimedia WaveOut' - 'DirectSound' - 'A3D') - end - object cbxOutputDevice: TComboBox - Left = 8 - Top = 76 - Width = 258 - Height = 21 - Style = csDropDownList - Anchors = [akLeft, akTop, akRight] - ItemHeight = 13 - TabOrder = 1 - end - object cbxMixerType: TComboBox - Left = 8 - Top = 124 - Width = 258 - Height = 21 - Style = csDropDownList - Anchors = [akLeft, akTop, akRight] - ItemHeight = 13 - TabOrder = 2 - Items.Strings = ( - 'Auto-detect' - 'Non-MMX blendmode mixer' - 'MMX, Pentium optimized blendmode mixer' - 'MMX, PPro/P2/P3 optimized mixer' - 'Auto-detect interpolating mixer' - 'Interpolating FPU mixer' - 'Interpolating Pentium mixer' - 'Interpolating PPro/P2/P3 mixer') - end - object cbxOutputRate: TComboBox - Left = 8 - Top = 172 - Width = 258 - Height = 21 - Style = csDropDownList - Anchors = [akLeft, akTop, akRight] - ItemHeight = 13 - TabOrder = 3 - Items.Strings = ( - '48000Hz' - '44100Hz' - '22050Hz' - '11025Hz' - '8000Hz') - end - object chkSoftwareMIDI: TCheckBox - Left = 8 - Top = 204 - Width = 257 - Height = 17 - Caption = 'Force software MIDI decoding' - TabOrder = 6 - end - object chkGlobalFocus: TCheckBox - Left = 8 - Top = 228 - Width = 257 - Height = 17 - Caption = 'Global focus (DSOUND only)' - TabOrder = 7 - end -end diff --git a/#ThirdParty/fmodapi375win/samplesdelphi/FMod/config.pas b/#ThirdParty/fmodapi375win/samplesdelphi/FMod/config.pas deleted file mode 100644 index 08c4f83..0000000 --- a/#ThirdParty/fmodapi375win/samplesdelphi/FMod/config.pas +++ /dev/null @@ -1,147 +0,0 @@ -unit config; - -interface - -uses - Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, - StdCtrls, fmodtypes; - -type - TfrmConfig = class(TForm) - btnOk: TButton; - btnCancel: TButton; - lblOutputType: TLabel; - cbxOutputType: TComboBox; - lblOutputDevice: TLabel; - cbxOutputDevice: TComboBox; - lblMixerType: TLabel; - cbxMixerType: TComboBox; - lblOutputRate: TLabel; - cbxOutputRate: TComboBox; - chkSoftwareMIDI: TCheckBox; - chkGlobalFocus: TCheckBox; - procedure FormCreate(Sender: TObject); - procedure cbxOutputTypeChange(Sender: TObject); - procedure FormShow(Sender: TObject); - procedure btnOkClick(Sender: TObject); - procedure btnCancelClick(Sender: TObject); - procedure FormClose(Sender: TObject; var Action: TCloseAction); - private - OldOutputType: TFSoundOutputTypes; - OldDriverIndex: Integer; - OldMixer: TFSoundMixerTypes; - OldOutputRate: Integer; - procedure PopulateDevices; - public - end; - -var - frmConfig: TfrmConfig; - -implementation - -{$R *.DFM} - -uses - fmod; - -procedure TfrmConfig.FormCreate(Sender: TObject); -begin - DesktopFont := True; -end; - -const - OutputTypes: array [0..2] of TFSoundOutputTypes = - (FSOUND_OUTPUT_WINMM, FSOUND_OUTPUT_DSOUND, FSOUND_OUTPUT_A3D); - OutputRates: array [0..4] of Integer = (48000, 44100, 22050, 11025, 8000); - -procedure TfrmConfig.cbxOutputTypeChange(Sender: TObject); -begin - FSOUND_SetOutput(OutputTypes[cbxOutputType.ItemIndex]); - chkGlobalFocus.Enabled := OutputTypes[cbxOutputType.ItemIndex] = FSOUND_OUTPUT_DSOUND; - { Repopulate device combobox } - PopulateDevices; -end; - -procedure TfrmConfig.PopulateDevices; -var - DriverCount: Integer; - Driver: Integer; -begin - cbxOutputDevice.Items.Clear; - DriverCount := FSOUND_GetNumDrivers; - if DriverCount > 0 then - begin - for Driver := 0 to DriverCount - 1 do - cbxOutputDevice.Items.Add(FSOUND_GetDriverName(Driver)); - cbxOutputDevice.ItemIndex := 0; - end; - btnOk.Enabled := DriverCount > 0; -end; - -procedure TfrmConfig.FormShow(Sender: TObject); -begin - OldOutputType := FSOUND_GetOutput; - case OldOutputType of - FSOUND_OUTPUT_NOSOUND, - FSOUND_OUTPUT_WINMM: - cbxOutputType.ItemIndex := 0; - FSOUND_OUTPUT_DSOUND: - cbxOutputType.ItemIndex := 1; - FSOUND_OUTPUT_A3D: - cbxOutputType.ItemIndex := 2; - end; - chkGlobalFocus.Enabled := OutputTypes[cbxOutputType.ItemIndex] = FSOUND_OUTPUT_DSOUND; - PopulateDevices; - OldDriverIndex := FSOUND_GetDriver; - cbxOutputDevice.ItemIndex := OldDriverIndex; - OldMixer := FSOUND_GetMixer; - cbxMixerType.ItemIndex := Ord(OldMixer); - case FSOUND_GetOutputRate of - 8000: - cbxOutputRate.ItemIndex := 4; - 11025: - cbxOutputRate.ItemIndex := 3; - 22050: - cbxOutputRate.ItemIndex := 2; - 44100: - cbxOutputRate.ItemIndex := 1; - 48000: - cbxOutputRate.ItemIndex := 0; - end; - OldOutputRate := FSOUND_GetOutputRate; - { Now close FMOD. } - FSOUND_Close; -end; - -procedure TfrmConfig.btnOkClick(Sender: TObject); -var - Flags: Cardinal; -begin - FSOUND_SetOutput(OutputTypes[cbxOutputType.ItemIndex]); - FSOUND_SetDriver(cbxOutputDevice.ItemIndex); - FSOUND_SetMixer(TFSoundMixerTypes(cbxMixerType.ItemIndex)); - Flags := 0; - if chkSoftwareMIDI.Checked then - Flags := Flags or FSOUND_INIT_USEDEFAULTMIDISYNTH; - if chkGlobalFocus.Checked then - Flags := Flags or FSOUND_INIT_GLOBALFOCUS; - FSOUND_Init(OutputRates[cbxOutputRate.ItemIndex], 128, Flags); -end; - -procedure TfrmConfig.btnCancelClick(Sender: TObject); -begin - { Reset the old output type, driver and mixer. } - FSOUND_SetOutput(OldOutputType); - FSOUND_SetDriver(OldDriverIndex); - FSOUND_SetMixer(OldMixer); - FSOUND_Init(OldOutputRate, FSOUND_GetMaxChannels, 0); -end; - -procedure TfrmConfig.FormClose(Sender: TObject; var Action: TCloseAction); -begin - if ModalResult <> mrOk then - btnCancelClick(nil); -end; - -end. diff --git a/#ThirdParty/fmodapi375win/samplesdelphi/FMod/main.dfm b/#ThirdParty/fmodapi375win/samplesdelphi/FMod/main.dfm deleted file mode 100644 index 82d2da0..0000000 Binary files a/#ThirdParty/fmodapi375win/samplesdelphi/FMod/main.dfm and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/samplesdelphi/FMod/main.pas b/#ThirdParty/fmodapi375win/samplesdelphi/FMod/main.pas deleted file mode 100644 index 978a78d..0000000 --- a/#ThirdParty/fmodapi375win/samplesdelphi/FMod/main.pas +++ /dev/null @@ -1,634 +0,0 @@ -unit main; - -{$WARN UNSAFE_TYPE OFF} - -interface - -uses - Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, - StdCtrls, fmodtypes, ExtCtrls, ComCtrls, spectrum; - -const - MAX_SONGS = 512; - -type - TSongType = record - Module: PFMusicModule; - Stream: PFSoundStream; - Channel: Integer; - Playing: Boolean; - end; - - TfrmMain = class(TForm) - dlgOpen: TOpenDialog; - grpFiles: TGroupBox; - lbxFiles: TListBox; - btnLoad: TButton; - btnDelete: TButton; - btnPlay: TButton; - btnStop: TButton; - btnExit: TButton; - btnAbout: TButton; - btnConfig: TButton; - grpCD: TGroupBox; - grpFilters: TGroupBox; - pnlChannels: TPanel; - pnlCPU: TPanel; - chkLowPass: TCheckBox; - chkEcho: TCheckBox; - chkReverb: TCheckBox; - chkPreverb: TCheckBox; - Label9: TLabel; - Label10: TLabel; - btnPlayCD: TButton; - btnPauseCD: TButton; - btnStopCD: TButton; - btnPrevTrack: TButton; - btnNextTrack: TButton; - btnEjectCD: TButton; - lblChannels: TLabel; - lblCPU: TLabel; - rdoContinuous: TRadioButton; - rdoRandom: TRadioButton; - rdoLooping: TRadioButton; - Label21: TLabel; - lblCDTrack: TLabel; - lblCDStatus: TLabel; - tmrMain: TTimer; - chkPlaylist: TCheckBox; - grpSongInfo: TGroupBox; - Label1: TLabel; - lblSongName: TLabel; - Label2: TLabel; - lblSongType: TLabel; - Label3: TLabel; - lblSongSpeed: TLabel; - Label4: TLabel; - lblSongBPM: TLabel; - Label5: TLabel; - lblSongOrder: TLabel; - btnPrevOrder: TButton; - btnNextOrder: TButton; - Label6: TLabel; - lblSongPattern: TLabel; - Label7: TLabel; - lblSongRow: TLabel; - Label8: TLabel; - lblSongMasterVolume: TLabel; - trkMasterVolume: TTrackBar; - pgrSong: TProgressBar; - pnlSpectrum: TPanel; - procedure btnLoadClick(Sender: TObject); - procedure FormCreate(Sender: TObject); - procedure btnPlayClick(Sender: TObject); - procedure btnStopClick(Sender: TObject); - procedure FormClose(Sender: TObject; var Action: TCloseAction); - procedure tmrMainTimer(Sender: TObject); - procedure lbxFilesClick(Sender: TObject); - procedure trkMasterVolumeChange(Sender: TObject); - procedure btnExitClick(Sender: TObject); - procedure btnAboutClick(Sender: TObject); - procedure btnPrevOrderClick(Sender: TObject); - procedure btnNextOrderClick(Sender: TObject); - procedure btnConfigClick(Sender: TObject); - procedure btnEjectCDClick(Sender: TObject); - procedure btnPlayCDClick(Sender: TObject); - procedure btnStopCDClick(Sender: TObject); - procedure btnPauseCDClick(Sender: TObject); - procedure btnPrevTrackClick(Sender: TObject); - procedure btnNextTrackClick(Sender: TObject); - procedure pnlSpectrumClick(Sender: TObject); - procedure btnDeleteClick(Sender: TObject); - private - FSongs: array [0..MAX_SONGS - 1] of TSongType; - FSettingMasterVolume: Boolean; - FTrackNumber: Integer; - FCDPaused: Boolean; - FCDPlaying: Boolean; - FNumTracks: Integer; - FSpectrum: TMiniSpectrum; - procedure ShowStaticSongInfo(Index: Integer); - procedure ShowDynamicSongInfo(Index: Integer); - procedure ShowCDInfo; - procedure ShowSpectrum; - public - { Public declarations } - end; - -var - frmMain: TfrmMain; - -implementation - -{$R *.DFM} - -uses - fmod, fmoderrors, about, config; - -const - MusicTypes: array [TFMusicTypes] of String = - ('None', 'Protracker/FastTracker', 'ScreamTracker 3', 'FastTracker 2', 'Impulse Tracker', 'Midi', 'FMOD Sample Bank'); - -procedure TfrmMain.btnLoadClick(Sender: TObject); -var - Index: Integer; - Module: PFMusicModule; - Stream: PFSoundStream; - SongCount: Integer; -begin - if dlgOpen.Execute then - begin - for Index := 0 to dlgOpen.Files.Count - 1 do - begin - SongCount := lbxFiles.Items.Count; - - if SongCount = MAX_SONGS then - begin - Application.MessageBox(PChar(Format('Limit of %d songs reached', [MAX_SONGS])), 'Load error', MB_OK or MB_ICONHAND); - Exit; - end; - - Stream := nil; - Module := FMUSIC_LoadSong(PChar(dlgOpen.Files[Index])); - if Module = nil then - begin - Stream := FSOUND_Stream_Open(PChar(dlgOpen.Files[Index]), FSOUND_NORMAL or FSOUND_LOOP_NORMAL, 0, 0); - end; - - if (Module = nil) and (Stream = nil) then - begin - Application.MessageBox(FMOD_ErrorString(FSOUND_GetError), 'Load error', MB_OK or MB_ICONHAND); - Continue; - end; - - if Module <> nil then - begin - FMUSIC_SetMasterVolume(Module, 255); - if (FMUSIC_GetType(Module) = FMUSIC_TYPE_MOD) or (FMUSIC_GetType(Module) = FMUSIC_TYPE_S3M) then - FMUSIC_SetPanSeperation(Module, 0.15); // 15% crossover - end; - - FSongs[SongCount].Module := Module; - FSongs[SongCount].Stream := Stream; - FSongs[SongCount].Playing := False; - - lbxFiles.Items.Add(ExtractFileName(dlgOpen.Files[Index])); - lbxFiles.ItemIndex := SongCount; - end; - end; - lbxFilesClick(nil); -end; - -procedure TfrmMain.FormCreate(Sender: TObject); -var - Index: Integer; -begin - DesktopFont := True; - - FMOD_Load(nil); - - { Check version numbers } - if FMOD_VERSION > FSOUND_GetVersion then - begin - Application.MessageBox(PChar(Format('API version %3.2f is newer than DLL version %3.2f', [FMOD_VERSION, FSOUND_GetVersion])), 'Version mismatch', MB_OK or MB_ICONERROR); - Halt; - end; - - { Initialize FSOUND } - try - if not FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND) then - raise Exception.Create('FSOUND_SetOutput failed'); - if not FSOUND_SetDriver(0) then - raise Exception.Create('FSOUND_SetDriver failed'); - if not FSOUND_SetMixer(FSOUND_MIXER_QUALITY_AUTODETECT) then - raise Exception.Create('FSOUND_SetMixer failed'); - if not FSOUND_SetHWND(Handle) then - raise Exception.Create('FSOUND_SetHWND failed'); - except - Application.MessageBox(FMOD_ErrorString(FSOUND_GetError), 'Initialization', MB_OK or MB_ICONHAND); - raise; - end; - - if not FSOUND_Init(22050, 128, 0) then - begin - Application.MessageBox(FMOD_ErrorString(FSOUND_GetError), 'FSOUND_Init', MB_OK or MB_ICONHAND); - Halt; - end; - - { Initialize song list to empty } - for Index := 0 to MAX_SONGS - 1 do - begin - FSongs[Index].Module := nil; - FSongs[Index].Stream := nil; - FSongs[Index].Channel := -1; - end; - - FTrackNumber := 0; - FNumTracks := 0; - FCDPaused := False; - FCDPlaying := False; - - FSpectrum := TMiniSpectrum.Create(nil); - FSpectrum.Parent := pnlSpectrum; - FSpectrum.Align := alClient; - FSpectrum.Enabled := False; - FSpectrum.OnClick := pnlSpectrumClick; - - ShowStaticSongInfo(-1); - ShowDynamicSongInfo(-1); - ShowCDInfo; - - dlgOpen.Filter := 'All song types|*.MOD;*.S3M;*.XM;*.IT;*.MID;*.RMI;*.SGT;*.WAV;*.MP2;*.MP3;*.OGG;*.WMA;*.ASF|Microsoft WAV (*.WAV)|*.WAV|MP2/MP3 (*.MP3 *.MP2)|*.MP2;*.MP3|Ogg Vorbis (*.OGG)|*.OGG|Windows Media Format (*.WMA *.ASF)|*.WMA;*.ASF' + - '|MIDI/DirectMusic Files (*.MID,*.RMI,*.SGT)|*.MID;*.RMI;*.SGT|Impulse Tracker (*.IT)|*.IT|FastTracker2 (*.XM)|*.XM|ScreamTracker 3 (*.S3M)|*.S3M|Protracker/FastTracker (*.MOD)|*.MOD|All files (*.*)|*.*'; -end; - -procedure TfrmMain.btnPlayClick(Sender: TObject); -var - Index: Integer; -begin - Index := lbxFiles.ItemIndex; - - if Index < 0 then - Exit; - - if FSongs[Index].Playing then - btnStopClick(Sender); - - if FSongs[Index].Module <> nil then - begin - FSongs[Index].Playing := FMUSIC_PlaySong(FSongs[Index].Module); - if not FSongs[Index].Playing then - Application.MessageBox(FMOD_ErrorString(FSOUND_GetError), 'Play song', MB_OK or MB_ICONHAND); - end - else if FSongs[Index].Stream <> nil then - begin - FSongs[Index].Channel := FSOUND_Stream_Play(FSOUND_FREE, FSongs[Index].Stream); - FSongs[Index].Playing := FSongs[Index].Channel >= 0; - if not FSongs[Index].Playing then - begin - Application.MessageBox(FMOD_ErrorString(FSOUND_GetError), 'Play stream', MB_OK or MB_ICONHAND); - end - else - begin - FSOUND_SetPan(FSongs[Index].Channel, FSOUND_STEREOPAN); - FSOUND_SetVolume(FSongs[Index].Channel, 255); - end; - end; - ShowStaticSongInfo(Index); -end; - -procedure TfrmMain.btnStopClick(Sender: TObject); -var - Index: Integer; -begin - Index := lbxFiles.ItemIndex; - - if Index < 0 then - Exit; - - if FSongs[Index].Module <> nil then - FMUSIC_StopSong(FSongs[Index].Module) - else if FSongs[Index].Stream <> nil then - FSOUND_Stream_Stop(FSongs[Index].Stream); - FSongs[Index].Channel := -1; - FSongs[Index].Playing := False; -end; - -procedure TfrmMain.FormClose(Sender: TObject; var Action: TCloseAction); -var - Index: Integer; -begin - FMUSIC_StopAllSongs(); - for Index := 0 to MAX_SONGS - 1 do - begin - if FSongs[Index].Module <> nil then - begin - FMUSIC_FreeSong(FSongs[Index].Module); - end - else if FSongs[Index].Stream <> nil then - begin - FSOUND_Stream_Stop(FSongs[Index].Stream); - FSOUND_Stream_Close(FSongs[Index].Stream); - end; - end; - FSpectrum.Free; - - FMOD_Unload; -end; - -procedure TfrmMain.ShowStaticSongInfo(Index: Integer); -var - Module: PFMusicModule; - Stream: PFSoundStream; -begin - if Index < 0 then - begin - lblSongName.Caption := ''; - lblSongType.Caption := ''; - lblSongMasterVolume.Caption := ''; - pgrSong.Position := 0; - end - else - begin - Module := FSongs[Index].Module; - Stream := FSongs[Index].Stream; - if Module <> nil then - begin - lblSongName.Caption := FMUSIC_GetName(Module); - lblSongType.Caption := MusicTypes[FMUSIC_GetType(Module)] + Format(' (%d channel)', [FMUSIC_GetNumChannels(Module)]); - lblSongMasterVolume.Caption := Format('%3.3d', [FMUSIC_GetMasterVolume(Module)]); - FSettingMasterVolume := True; - trkMasterVolume.Position := FMUSIC_GetMasterVolume(Module); - FSettingMasterVolume := False; - pgrSong.Max := FMUSIC_GetNumOrders(Module); - end - else if Stream <> nil then - begin - lblSongName.Caption := lbxFiles.Items[Index]; - lblSongType.Caption := 'Stream'; - lblSongMasterVolume.Caption := Format('%3.3d', [FSOUND_GetVolume(FSongs[Index].Channel)]); - FSettingMasterVolume := True; - trkMasterVolume.Position := FSOUND_GetVolume(FSongs[Index].Channel); - FSettingMasterVolume := False; - pgrSong.Max := FSOUND_Stream_GetLength(Stream); - lblSongSpeed.Caption := ''; - lblSongBPM.Caption := ''; - lblSongOrder.Caption := ''; - lblSongPattern.Caption := ''; - lblSongRow.Caption := ''; - end - end; -end; - -procedure TfrmMain.tmrMainTimer(Sender: TObject); -var - Index: Integer; -begin - lblCPU.Caption := Format('%.1f%%', [FSOUND_GetCPUUsage]); - lblChannels.Caption := Format('%3.3d', [FSOUND_GetChannelsPlaying]); - Index := lbxFiles.ItemIndex; - if Index > -1 then - begin - ShowSpectrum; - ShowDynamicSongInfo(Index); - if FMUSIC_IsFinished(FSongs[Index].Module) and chkPlaylist.Checked then - begin - btnStopClick(nil); - Inc(Index); - if Index >= lbxFiles.Items.Count then - Index := 0; - lbxFiles.ItemIndex := Index; - lbxFilesClick(nil); - btnPlayClick(nil); - end; - end; - { Update CD info } - TTimer(Sender).Tag := TTimer(Sender).Tag + LongInt(TTimer(Sender).Interval); - if TTimer(Sender).Tag > 1000 then - begin - TTimer(Sender).Tag := 0; - ShowCDInfo; - end; -end; - -procedure TfrmMain.lbxFilesClick(Sender: TObject); -begin - ShowStaticSongInfo(lbxFiles.ItemIndex); -end; - -procedure TfrmMain.ShowDynamicSongInfo(Index: Integer); -var - Module: PFMusicModule; - Stream: PFSoundStream; - Channel: Integer; -begin - if Index < 0 then - begin - lblSongSpeed.Caption := ''; - lblSongBPM.Caption := ''; - lblSongOrder.Caption := ''; - lblSongPattern.Caption := ''; - lblSongRow.Caption := ''; - pgrSong.Position := 0; - end - else - begin - Module := FSongs[Index].Module; - Stream := FSongs[Index].Stream; - Channel := FSongs[Index].Channel; - if (Module <> nil) and (FMUSIC_IsPlaying(Module)) then - begin - lblSongSpeed.Caption := Format('%3.3d', [FMUSIC_GetSpeed(Module)]); - lblSongBPM.Caption := Format('%3.3d', [FMUSIC_GetBPM(Module)]); - lblSongOrder.Caption := Format('%3.3d/%3.3d', [FMUSIC_GetOrder(Module), FMUSIC_GetNumOrders(Module)]); - lblSongPattern.Caption := Format('%3.3d/%3.3d', [FMUSIC_GetPattern(Module), FMUSIC_GetNumPatterns(Module)]); - lblSongRow.Caption := Format('%3.3d/%3.3d', [FMUSIC_GetRow(Module), 64]); - pgrSong.Position := FMUSIC_GetOrder(Module); - end - else if (Stream <> nil) and (FSOUND_IsPlaying(Channel)) then - begin - pgrSong.Position := FSOUND_Stream_GetPosition(Stream); - end - end; -end; - -procedure TfrmMain.trkMasterVolumeChange(Sender: TObject); -var - Index: Integer; -begin - if not FSettingMasterVolume then - begin - Index := lbxFiles.ItemIndex; - if Index > -1 then - begin - if FSongs[Index].Module <> nil then - begin - FMUSIC_SetMasterVolume(FSongs[Index].Module, trkMasterVolume.Position); - lblSongMasterVolume.Caption := Format('%3.3d', [trkMasterVolume.Position]); - end - else if FSongs[Index].Stream <> nil then - begin - FSOUND_SetVolume(FSongs[Index].Channel, trkMasterVolume.Position); - lblSongMasterVolume.Caption := Format('%3.3d', [trkMasterVolume.Position]); - end; - end; - end; -end; - -procedure TfrmMain.btnExitClick(Sender: TObject); -begin - Close; -end; - -procedure TfrmMain.btnAboutClick(Sender: TObject); -begin - frmAbout := TfrmAbout.Create(nil); - try - frmAbout.ShowModal; - finally - frmAbout.Free; - end; -end; - -procedure TfrmMain.btnPrevOrderClick(Sender: TObject); -var - Index: Integer; - Order: DWORD; -begin - Index := lbxFiles.ItemIndex; - if Index < 0 then - Exit; - if FSongs[Index].Module = nil then - Exit; - Order := FMUSIC_GetOrder(FSongs[Index].Module); - if Order > 0 then - FMUSIC_SetOrder(FSongs[Index].Module, Order - 1); -end; - -procedure TfrmMain.btnNextOrderClick(Sender: TObject); -var - Index: Integer; - Order: Integer; -begin - Index := lbxFiles.ItemIndex; - if Index < 0 then - Exit; - if FSongs[Index].Module = nil then - Exit; - Order := FMUSIC_GetOrder(FSongs[Index].Module); - if Order < FMUSIC_GetNumOrders(FSongs[Index].Module) then - FMUSIC_SetOrder(FSongs[Index].Module, Order + 1); -end; - -procedure TfrmMain.btnConfigClick(Sender: TObject); -var - SpectrumEnabled: Boolean; -begin - SpectrumEnabled := FSpectrum.Enabled; - FSpectrum.Enabled := False; - frmConfig := TfrmConfig.Create(nil); - try - frmConfig.ShowModal; - finally - frmConfig.Free; - end; - FSpectrum.Enabled := SpectrumEnabled; -end; - -procedure TfrmMain.btnEjectCDClick(Sender: TObject); -begin - FSOUND_CD_OpenTray(0, 1); - FTrackNumber := 0; - FCDPaused := False; - FCDPlaying := False; - FNumTracks := 0; -end; - -procedure TfrmMain.btnPlayCDClick(Sender: TObject); -begin - if FTrackNumber > 0 then - begin - if FCDPaused then - FSOUND_CD_SetPaused(0, False) - else - FSOUND_CD_Play(0, FTrackNumber); - FCDPaused := False; - FCDPlaying := True; - end; -end; - -procedure TfrmMain.ShowCDInfo; -begin - FTrackNumber := FSOUND_CD_GetTrack(0); - FNumTracks := FSOUND_CD_GetNumTracks(0); - lblCDTrack.Caption := Format('%02d/%02d', [FTrackNumber, FNumTracks]); - tmrMain.Tag := 0; -end; - -procedure TfrmMain.btnStopCDClick(Sender: TObject); -begin - FSOUND_CD_Stop(0); - FCDPaused := False; - FCDPlaying := False; -end; - -procedure TfrmMain.btnPauseCDClick(Sender: TObject); -begin - if FCDPlaying then - begin - FSOUND_CD_SetPaused(0, not FCDPaused); - FCDPaused := FSOUND_CD_GetPaused(0); - end; -end; - -procedure TfrmMain.btnPrevTrackClick(Sender: TObject); -begin - if FTrackNumber > 1 then - begin - Dec(FTrackNumber); - if FCDPlaying then - FSOUND_CD_Play(0, FTrackNumber); - ShowCDInfo; - end; -end; - -procedure TfrmMain.btnNextTrackClick(Sender: TObject); -begin - if FTrackNumber < FNumTracks then - begin - Inc(FTrackNumber); - if FCDPlaying then - FSOUND_CD_Play(0, FTrackNumber); - ShowCDInfo; - end; -end; - -procedure TfrmMain.ShowSpectrum; -begin - if FSpectrum.Enabled then - FSpectrum.Draw; -end; - -procedure TfrmMain.pnlSpectrumClick(Sender: TObject); -begin - if FSpectrum.Enabled then - begin - if FSpectrum.Style = ssSmooth then - FSpectrum.Style := ssBlock - else - FSpectrum.Enabled := False; - end - else - begin - FSpectrum.Enabled := True; - FSpectrum.Style := ssSmooth; - end; -end; - -procedure TfrmMain.btnDeleteClick(Sender: TObject); -var - Index, Index2: Integer; -begin - Index := lbxFiles.ItemIndex; - if Index < 0 then - Exit; - - btnStopClick(nil); - lbxFiles.Items.Delete(Index); - // Move all following items up one position - if lbxFiles.Items.Count > 0 then - begin - if Index < lbxFiles.Items.Count - 1 then - begin - for Index2 := Index to lbxFiles.Items.Count - 2 do - FSongs[Index2] := FSongs[Index2 + 1]; - end; - if Index < lbxFiles.Items.Count then - lbxFiles.ItemIndex := Index - else - lbxFiles.ItemIndex := lbxFiles.Items.Count - 1; - end; - lbxFilesClick(nil); -end; - -end. diff --git a/#ThirdParty/fmodapi375win/samplesdelphi/FMod/spectrum.pas b/#ThirdParty/fmodapi375win/samplesdelphi/FMod/spectrum.pas deleted file mode 100644 index 98161f4..0000000 --- a/#ThirdParty/fmodapi375win/samplesdelphi/FMod/spectrum.pas +++ /dev/null @@ -1,208 +0,0 @@ -unit spectrum; - -interface - -uses - Windows, Classes, Controls, Messages, Graphics; - -type - TSpectrumStyle = (ssSmooth, ssBlock); - - TMiniSpectrum = class(TGraphicControl) - private - FGradient: TBitmap; - FBuffer: TBitmap; - FScale: Single; - FStyle: TSpectrumStyle; - FValues: array [0..127] of Single; - procedure SetStyle(const Value: TSpectrumStyle); - protected - procedure Paint; override; - procedure Resize; override; - procedure SetEnabled(Value: Boolean); override; - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - procedure Draw; - published - property Align; - property Scale: Single read FScale write FScale; - property Style: TSpectrumStyle read FStyle write SetStyle; - property OnClick; - end; - -implementation - -uses - fmod, fmodtypes; - -{ TMiniSpectrum } - -constructor TMiniSpectrum.Create(AOwner: TComponent); -var - X, Y: Integer; - R, G, B: Integer; - C: TColor; -begin - inherited; - Color := clBlack; - Width := 80; - Height := 32; - FScale := 4.0; - FStyle := ssSmooth; - Enabled := False; - - // Create draw buffer - FBuffer := TBitmap.Create; - FBuffer.PixelFormat := pf32bit; - FBuffer.Width := Width; - FBuffer.Height := Height; - - // Create gradient bitmap - FGradient := TBitmap.Create; - FGradient.PixelFormat := pf32bit; - FGradient.Width := 4; - FGradient.Height := 32; - - R := 255; - G := 0; - B := 0; - - for Y := 0 to 31 do - begin - if Y > 15 then - Dec(R, 16) - else - Inc(G, 16); - if R < 0 then - R := 0; - if G > 255 then - G := 255; - C := TColor(RGB(R, G, B)); - for X := 0 to 2 do - FGradient.Canvas.Pixels[X, Y] := C; - FGradient.Canvas.Pixels[3, Y] := TColor(0); - end; -end; - -destructor TMiniSpectrum.Destroy; -begin - FGradient.Free; - FBuffer.Free; - inherited; -end; - -type - PSingleArray = ^TSingleArray; - TSingleArray = array [0..0] of Single; - -procedure TMiniSpectrum.Draw; -var - Data: PSingleArray; - PeakData: Single; - W, X, Y: Integer; - ARect: TRect; -begin - FBuffer.Canvas.Brush.Color := Color; - FBuffer.Canvas.FillRect(BoundsRect); - - if Enabled then - begin - Data := PSingleArray(FSOUND_DSP_GetSpectrum); - - // Get the peak value of each block of four values - for X := 0 to 127 do - begin - W := X * 4; - FValues[X] := Data^[W]; - if Data^[W + 1] > FValues[X] then - FValues[X] := Data^[W + 1]; - if Data^[W + 2] > FValues[X] then - FValues[X] := Data^[W + 2]; - if Data^[W + 3] > FValues[X] then - FValues[X] := Data^[W + 3]; - FValues[X] := FValues[X] * FScale; - if FValues[X] > 1.0 then - FValues[X] := 1.0; - end; - - W := Width; - if W > 128 then - W := 128; - - case FStyle of - ssSmooth: - begin - X := 0; - while X < W do - begin - if FValues[X] > 0.0 then - begin - Y := Height - Trunc(FValues[X] * 1.0 * Height); - FBuffer.Canvas.CopyRect(Rect(X, Y, X + 1, Height), FGradient.Canvas, Rect(0, Y, 1, FGradient.Height)); - end; - Inc(X); - end; - end; - ssBlock: - begin - // Sixteen values for every column - PeakData := 0; - X := 0; - while X < W do - begin - if PeakData < FValues[X] then - PeakData := FValues[X]; - if (X and 3 = 3) and (PeakData > 0.0) then - begin - Y := Height - Trunc(PeakData * 1.0 * Height); - PeakData := 0; - FBuffer.Canvas.CopyRect(Rect(X, Y, X + 4, Height), FGradient.Canvas, Rect(0, Y, 4, FGradient.Height)); - end; - Inc(X); - end; - end; - end; - end - else - begin - FBuffer.Canvas.Font.Color := clWhite; - ARect := BoundsRect; - DrawText(FBuffer.Canvas.Handle, 'Click for spectrum', -1, ARect, DT_WORDBREAK or DT_NOPREFIX or DT_VCENTER or DT_CENTER); - end; - - // Copy the buffer to the control - Canvas.Draw(0, 0, FBuffer); -end; - -procedure TMiniSpectrum.Paint; -begin - Draw; -end; - -procedure TMiniSpectrum.Resize; -begin - inherited; - if Assigned(FBuffer) then - begin - FBuffer.Width := Width; - FBuffer.Height := Height; - end; -end; - -procedure TMiniSpectrum.SetEnabled(Value: Boolean); -begin - inherited; - FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit, Value); -end; - -procedure TMiniSpectrum.SetStyle(const Value: TSpectrumStyle); -begin - if FStyle <> Value then - begin - FStyle := Value; - ZeroMemory(@FValues, SizeOf(FValues)); - end; -end; - -end. diff --git a/#ThirdParty/fmodapi375win/samplesdelphi/FMod/testbed.dpr b/#ThirdParty/fmodapi375win/samplesdelphi/FMod/testbed.dpr deleted file mode 100644 index ca0e9fe..0000000 --- a/#ThirdParty/fmodapi375win/samplesdelphi/FMod/testbed.dpr +++ /dev/null @@ -1,17 +0,0 @@ -program testbed; - -uses - Forms, - main in 'main.pas' {frmMain}, - about in 'about.pas' {frmAbout}, - config in 'config.pas' {frmConfig}, - spectrum in 'spectrum.pas'; - -{$R *.RES} - -begin - Application.Initialize; - Application.Title := 'FMOD'; - Application.CreateForm(TfrmMain, frmMain); - Application.Run; -end. diff --git a/#ThirdParty/fmodapi375win/samplesdelphi/FMod/testbed.res b/#ThirdParty/fmodapi375win/samplesdelphi/FMod/testbed.res deleted file mode 100644 index d8a5528..0000000 Binary files a/#ThirdParty/fmodapi375win/samplesdelphi/FMod/testbed.res and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/samplesdelphi/Readme.txt b/#ThirdParty/fmodapi375win/samplesdelphi/Readme.txt deleted file mode 100644 index 751ee9e..0000000 --- a/#ThirdParty/fmodapi375win/samplesdelphi/Readme.txt +++ /dev/null @@ -1,11 +0,0 @@ -Some notes about the Delphi examples: -- The managing of the input and output (console that is) is done in a rather strange way. Don't be confused by all the Windows API calls because it's only a replacement of readkey and writeln (combined with gotoxy ...). -- The record sample has a bug in the full-duplex record stage with MMX reverb. The bug is an access violation in the DSP callback function. I have not tracked it down yet. -- The spectrum display in the FMOD testbed has some issues. These are being worked on. - -Original Delphi conversions by Dragan Bocevski -d_bocevski@yahoo.com or d_bocevski@hotpop.com. - -Updated examples and maintenance by Steve 'Sly' Williams -stevewilliams@kromestudios.com - \ No newline at end of file diff --git a/#ThirdParty/fmodapi375win/samplesdelphi/Simple/simple.dpr b/#ThirdParty/fmodapi375win/samplesdelphi/Simple/simple.dpr deleted file mode 100644 index 454bc41..0000000 --- a/#ThirdParty/fmodapi375win/samplesdelphi/Simple/simple.dpr +++ /dev/null @@ -1,300 +0,0 @@ -//=============================================================================================== -// SIMPLE.EXE -// Copyright (c), Firelight Multimedia, 1999-2000. -// -// This example demonstrates some fundamental FMOD usage, including device enumeration, output -// mode selection, loading and playing samples and a music file, and -// calling some runtime manipulation and information functions. -// Converted to Delphi by Bocevski Dragan mailto: d_bocevski@yahoo.com -//=============================================================================================== -// History -// -// 2001/09/09 by Steve 'Sly' Williams -// - Updated to version 3.40 -// -// 2000/12/15 by Steve 'Sly' Williams -// - Updated to version 3.30 -// -// 2000/11/14 by Steve 'Sly' Williams -// - Fixed version check -// - Added FMODErrors to uses clause -// - Added check for Delphi 4 to change wVirtualKeyCode to wVirtualScanCode -// -// 2002/02/13 by Steve 'Sly' Williams -// - Updated for FMOD 3.50 -// -// 2002/12/19 by Steve 'Sly' Williams -// - Updated for FMOD 3.61 -//=============================================================================================== -program simple; - -uses - fmod, fmodtypes, fmoderrors, Windows; - -{$APPTYPE CONSOLE} - -var - dw, key: dword; - driver: Integer; - i: Longint; - enm: TFSoundOutputTypes; - h, h1: THandle; - buf: input_record; - c: coord; - s, sorder, srow, stime, schp, scpu: string; - channel: Integer; - samp1, samp2, samp3: PFSoundSample; - mdl: PFMusicModule; - paused: Boolean; -begin - SetLength(s, 80); - SetConsoleTitle('Example Simple (song player)'); - h := GetStdHandle(STD_INPUT_HANDLE); - h1 := GetStdHandle(STD_OUTPUT_HANDLE); - Buf.EventType := Key_Event; - if FMOD_VERSION > FSOUND_GetVersion then - begin - WriteLn('Error: You are using FMOD version ', FSOUND_GetVersion: 3: 2, '. You should be using version ', FMOD_VERSION: 3: 2); - Exit; - end; - - writeln('---------------------------------------------------------'); - writeln('Output Type'); - writeln('---------------------------------------------------------'); - - writeln('1 - Direct Sound'); - writeln('2 - Windows Multimedia Waveout'); - writeln('3 - A3D'); - writeln('4 - NoSound'); - writeln('---------------------------------------------------------'); // print driver names - writeln('Press a corresponding number or ESC to quit'); - repeat - Sleep(50); - FlushConsoleInputBuffer(h); - repeat - ReadConsoleInput(h, buf, 1, dw); - until buf.Event.KeyEvent.bKeyDown = false; -{$IFDEF VER120} - Key := buf.Event.KeyEvent.wVirtualScanCode; -{$ELSE} - Key := buf.Event.KeyEvent.wVirtualKeyCode; -{$ENDIF} - case key of - ord('1'): FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND); - ord('2'): FSOUND_SetOutput(FSOUND_OUTPUT_WINMM); - ord('3'): FSOUND_SetOutput(FSOUND_OUTPUT_A3D); - ord('4'): FSOUND_SetOutput(FSOUND_OUTPUT_NOSOUND); - 27: exit; - end; - until ((key >= ord('1')) and (key <= ord('4'))); - -// ========================================================================================== -// SELECT DRIVER -// ========================================================================================== - - -// The following list are the drivers for the output method selected above. - writeln('---------------------------------------------------------'); - enm := FSOUND_GetOutput(); - case enm of - FSOUND_OUTPUT_NOSOUND: write('NoSound'); - FSOUND_OUTPUT_WINMM: write('Windows Multimedia Waveout'); - FSOUND_OUTPUT_DSOUND: write('Direct Sound'); - FSOUND_OUTPUT_A3D: write('A3D'); - end; - writeln(' Driver list'); - writeln('---------------------------------------------------------'); - for i := 0 to FSOUND_GetNumDrivers() - 1 do - writeln(i + 1, ' - ', FSOUND_GetDriverName(i)); // print driver names - writeln('---------------------------------------------------------'); // print driver names - writeln('Press a corresponding number or ESC to quit'); - repeat - FlushConsoleInputBuffer(h); - repeat - ReadConsoleInput(h, buf, 1, dw); - until buf.Event.KeyEvent.bKeyDown = false; -{$IFDEF VER120} - Key := buf.Event.KeyEvent.wVirtualScanCode; -{$ELSE} - Key := buf.Event.KeyEvent.wVirtualKeyCode; -{$ENDIF} - if (ord(key) = 27) then exit; - driver := ord(key) - ord('1'); - until ((driver > 0) or (driver <= FSOUND_GetNumDrivers())); - FSOUND_SetDriver(driver); // Select sound card (0 = default) - -// ========================================================================================== -// SELECT MIXER -// ========================================================================================== - - FSOUND_SetMixer(FSOUND_MIXER_QUALITY_AUTODETECT); - -// ========================================================================================== -// INITIALIZE -// ========================================================================================== - if not FSOUND_Init(44100, 64, 0) then - begin - writeln('Error! Initializing'); - writeln(FMOD_ErrorString(FSOUND_GetError())); - FSOUND_Close(); - exit; - end; - -// ========================================================================================== -// LOAD SONG -// ========================================================================================== - - mdl := FMUSIC_LoadSong('../../media/invtro94.s3m'); - if mdl = nil then - begin - writeln('Error! Loading song'); - writeln(FMOD_ErrorString(FSOUND_GetError())); - FSOUND_Close(); - exit; - end; - -// ========================================================================================== -// LOAD SAMPLES -// ========================================================================================== - - // 8bit mono - samp1 := FSOUND_Sample_Load(FSOUND_FREE, '../../media/jaguar.wav', FSOUND_2D, 0, 0); - if samp1 = nil then - begin - writeln('Error! Loading sample1'); - writeln(FMOD_ErrorString(FSOUND_GetError())); - FSOUND_Close(); - exit; - end; - - // 16bit mono - samp2 := FSOUND_Sample_Load(FSOUND_FREE, '../../media/drumloop.wav', FSOUND_2D, 0, 0); - if samp2 = nil then - begin - writeln('Error! Loading sample2'); - writeln(FMOD_ErrorString(FSOUND_GetError())); - FSOUND_Close(); - exit; - end; - - // 16bit stereo - samp3 := FSOUND_Sample_Load(FSOUND_FREE, '../../media/chimes.wav', FSOUND_2D, 0, 0); - if samp2 = nil then - begin - writeln('Error! Loading sample3'); - writeln(FMOD_ErrorString(FSOUND_GetError())); - FSOUND_Close(); - exit; - end; - -// ========================================================================================== -// DISPLAY HELP -// ========================================================================================== - - write('FSOUND Output Method : '); - case (FSOUND_GetOutput()) of - FSOUND_OUTPUT_NOSOUND: writeln('FSOUND_OUTPUT_NOSOUND'); - FSOUND_OUTPUT_WINMM: writeln('FSOUND_OUTPUT_WINMM'); - FSOUND_OUTPUT_DSOUND: writeln('FSOUND_OUTPUT_DSOUND'); - FSOUND_OUTPUT_A3D: writeln('FSOUND_OUTPUT_A3D'); - end; - - write('FSOUND Mixer : '); - case (FSOUND_GetMixer()) of - FSOUND_MIXER_BLENDMODE: writeln('FSOUND_MIXER_BLENDMODE'); - FSOUND_MIXER_MMXP5: writeln('FSOUND_MIXER_MMXP5'); - FSOUND_MIXER_MMXP6: writeln('FSOUND_MIXER_MMXP6'); - FSOUND_MIXER_QUALITY_FPU: writeln('FSOUND_MIXER_QUALITY_FPU'); - FSOUND_MIXER_QUALITY_MMXP5: writeln('FSOUND_MIXER_QUALITY_MMXP5'); - FSOUND_MIXER_QUALITY_MMXP6: writeln('FSOUND_MIXER_QUALITY_MMXP6'); - end; - writeln('FSOUND Driver : ', FSOUND_GetDriverName(FSOUND_GetDriver())); - - - - writeln('========================================================================='); - writeln(' 1 Play 16bit sound at any time'); - writeln(' 2 Play 8bit sound at any time'); - writeln(' 3 Play 16bit STEREO sound at any time'); - writeln(' Left arrow Rewind mod back 1 order'); - writeln(' Right arrow FastForward mod forward 1 order'); - writeln(' SPACE Pause/unpause music at any time'); - writeln(' ESC Quit'); - writeln('========================================================================='); - writeln('Playing ...', FMUSIC_GetName(mdl)); - -// ========================================================================================== -// START PLAYING! -// ========================================================================================== - FMUSIC_PlaySong(mdl); - - FMUSIC_SetPanSeperation(mdl, 0.15); // 15% crossover - - GetConsoleMode(h, dw); - SetConsoleMode(h, dw or ENABLE_PROCESSED_OUTPUT or ENABLE_PROCESSED_INPUT); - c.X := 1; - c.Y := 24; - repeat - FlushConsoleInputBuffer(h); - Sleep(50); - dw := 0; - PeekConsoleInput(h, buf, 1, dw); - if buf.Event.KeyEvent.bKeyDown then - begin -{$IFDEF VER120} - Key := buf.Event.KeyEvent.wVirtualScanCode; -{$ELSE} - Key := buf.Event.KeyEvent.wVirtualKeyCode; -{$ENDIF} - if dw = 1 then - if key <> 0 then - begin - if key = Ord('1') then - FSOUND_PlaySound(FSOUND_FREE, samp1) - else if key = Ord('2') then - FSOUND_PlaySound(FSOUND_FREE, samp2) - else if key = Ord('3') then - begin - channel := FSOUND_PlaySound(FSOUND_FREE, samp3); - FSOUND_SetPan(channel, FSOUND_STEREOPAN); - end - else if key = Ord(' ') then - begin - paused := FMUSIC_GetPaused(mdl); - FMUSIC_SetPaused(mdl, not paused); - end - else if key = VK_LEFT then - FMUSIC_SetOrder(mdl, FMUSIC_GetOrder(mdl) - 1) - else if key = VK_RIGHT then - FMUSIC_SetOrder(mdl, FMUSIC_GetOrder(mdl) + 1) - else if key = 27 then - begin - WriteLn; - FSOUND_Close(); - Exit; - end; - end; - end; -// key:=0; - SetConsoleCursorPosition(h1, c); - str(FMUSIC_GetOrder(mdl), sorder); - str(FMUSIC_GetRow(mdl), srow); - str((FMUSIC_GetTime(mdl) / 1000): 6: 3, stime); - str(FSOUND_GetChannelsPlaying(), schp); - str(FSOUND_GetCPUUsage(): 7: 5, scpu); - s := 'order = ' + sorder + ' row = ' + srow + ' time = ' + stime + ' channels playing = ' + schp + ' cpu usage = ' + scpu; - WriteConsole(h1, pchar(s), length(s) - 1, dw, nil); - s := ' '; - until false; - -// ========================================================================================== -// CLEANUP AND SHUTDOWN -// ========================================================================================== - - FSOUND_Sample_Free(samp1); - FSOUND_Sample_Free(samp2); - FSOUND_Sample_Free(samp3); - FMUSIC_FreeSong(mdl); - FSOUND_Close(); -end. - diff --git a/#ThirdParty/fmodapi375win/samplesdelphi/Simplest/simplest.dpr b/#ThirdParty/fmodapi375win/samplesdelphi/Simplest/simplest.dpr deleted file mode 100644 index 41241d1..0000000 --- a/#ThirdParty/fmodapi375win/samplesdelphi/Simplest/simplest.dpr +++ /dev/null @@ -1,126 +0,0 @@ -//=============================================================================================== -// SIMPLEST.EXE -// Copyright (c), Firelight Multimedia, 1999-2000. -// -// This is the simplest way to play a song through FMOD. It is basically Init, Load, Play! -// Converted to Delphi by Bocevski Dragan mailto: d_bocevski@yahoo.com -//=============================================================================================== -// History -// -// 2001/09/09 by Steve 'Sly' Williams -// - Updated to version 3.40 -// -// 2000/11/14 by Steve 'Sly' Williams -// - Fixed version check -// - Added FMODErrors to uses clause -// - Added check for Delphi 4 to change wVirtualKeyCode to wVirtualScanCode -// -// 2002/02/13 by Steve 'Sly' Williams -// - Updated for FMOD 3.50 -// -// 2002/12/19 by Steve 'Sly' Williams -// - Updated for FMOD 3.61 -//=============================================================================================== -program simplest; - -uses - fmod, fmodtypes, fmoderrors, Windows; - -{$APPTYPE CONSOLE} - -var - key: DWORD; - dw: dword; - h, h1: THandle; - buf: input_record; - c: coord; - s, sorder, srow, schp, scpu: string; - mdl: PFMusicModule; -begin - SetLength(s, 80); - SetConsoleTitle(pchar('Example Simplest (song player)')); - h := GetStdHandle(STD_INPUT_HANDLE); - h1 := GetStdHandle(STD_OUTPUT_HANDLE); - Buf.EventType := Key_Event; - if FMOD_VERSION > FSOUND_GetVersion then - begin - WriteLn('Error: You are using FMOD version ', FSOUND_GetVersion: 3: 2, '. You should be using version ', FMOD_VERSION: 3: 2); - Exit; - end; - -// ========================================================================================== -// INITIALIZE -// ========================================================================================== - if not FSOUND_Init(44100, 32, 0) then - begin - writeln('Error! Initializing'); - writeln(FMOD_ErrorString(FSOUND_GetError())); - FSOUND_Close(); - exit; - end; - -// ========================================================================================== -// LOAD SONG -// ========================================================================================== - - mdl := FMUSIC_LoadSong('../../media/invtro94.s3m'); {can be xm, s3m...} - if mdl = nil then - begin - writeln('Error! Loading song'); - writeln(FMOD_ErrorString(FSOUND_GetError())); - FSOUND_Close(); - exit; - end; - -// ========================================================================================== -// START PLAYING! -// ========================================================================================== - FMUSIC_PlaySong(mdl); - writeln('Press ESC to quit'); - writeln('Playing ...', FMUSIC_GetName(mdl)); - - GetConsoleMode(h, dw); - SetConsoleMode(h, dw or ENABLE_PROCESSED_OUTPUT or ENABLE_PROCESSED_INPUT); - c.X := 1; - c.Y := 4; - repeat - FlushConsoleInputBuffer(h); - Sleep(50); - dw := 0; - PeekConsoleInput(h, buf, 1, dw); - if buf.Event.KeyEvent.bKeyDown then - begin -{$IFDEF VER120} - Key := buf.Event.KeyEvent.wVirtualScanCode; -{$ELSE} - Key := buf.Event.KeyEvent.wVirtualKeyCode; -{$ENDIF} - if dw = 1 then //can be done much more elegant cause it just - if key <> 0 then //reads if ESC has been pressed. - begin //don't let be confused by all the windows raw API code - if key = 27 then //I couldn't find the READKEY function :) - begin - writeln; - FSOUND_Close(); - exit; - end; - end; - end; - SetConsoleCursorPosition(h1, c); - str(FMUSIC_GetOrder(mdl), sorder); - str(FMUSIC_GetRow(mdl), srow); - str(FSOUND_GetChannelsPlaying(), schp); - str(FSOUND_GetCPUUsage(): 7: 5, scpu); - s := 'order = ' + sorder + ' row = ' + srow + ' channels playing = ' + schp + ' cpu usage = ' + scpu; - WriteConsole(h1, pchar(s), length(s) - 1, dw, nil); - s := ' '; - until false; - -// ========================================================================================== -// CLEANUP AND SHUTDOWN -// ========================================================================================== - - FMUSIC_FreeSong(mdl); - FSOUND_Close(); -end. - diff --git a/#ThirdParty/fmodapi375win/samplesdelphi/Stream1/stream1.dpr b/#ThirdParty/fmodapi375win/samplesdelphi/Stream1/stream1.dpr deleted file mode 100644 index 99cd962..0000000 --- a/#ThirdParty/fmodapi375win/samplesdelphi/Stream1/stream1.dpr +++ /dev/null @@ -1,189 +0,0 @@ -//=============================================================================================== -// STREAM.EXE -// Copyright (c), Firelight Multimedia, 1999-2000. -// -// This example takes a command line parameter, an mp3 file, and uses the streamer system to play -// it back. -// Converted to Delphi by Bocevski Dragan mailto: d_bocevski@yahoo.com -//=============================================================================================== -// History -// -// 2001/09/09 by Steve 'Sly' Williams -// - Updated to version 3.40 -// -// 2000/12/15 by Steve 'Sly' Williams -// - Updated to version 3.30 -// -// 2000/11/14 by Steve 'Sly' Williams -// - Fixed version check -// - Added FMODErrors to uses clause -// - Added check for Delphi 4 to change wVirtualKeyCode to wVirtualScanCode -// -// 2002/12/19 by Steve 'Sly' Williams -// - Updated to version 3.61 -//=============================================================================================== -program stream1; - -uses - fmod, fmodtypes, fmoderrors, Windows; - -{$APPTYPE CONSOLE} - -var - stream: PFSoundStream; - channel: Integer; - key: DWORD; - dw: dword; - driver: Integer; - i: Longint; - enm: TFSoundOutputTypes; - h, h1: THandle; - buf: input_record; - c: coord; - s, position, time, cpu: string; -begin - SetLength(s, 80); - SetConsoleTitle('Example Stream1 (mp3 player)'); - h := GetStdHandle(STD_INPUT_HANDLE); - h1 := GetStdHandle(STD_OUTPUT_HANDLE); - Buf.EventType := Key_Event; - if FMOD_VERSION > FSOUND_GetVersion then - begin - WriteLn('Error: You are using FMOD version ', FSOUND_GetVersion: 3: 2, '. You should be using version ', FMOD_VERSION: 3: 2); - Exit; - end; - if (paramcount < 1) then - begin - writeln('-------------------------------------------------------------'); - writeln('FMOD MP3 Streamer example.'); - writeln('Copyright (c) Firelight Multimedia, 1999.'); - writeln('-------------------------------------------------------------'); - writeln('Syntax: stream infile.mp3'); - writeln; - exit; - end; -// FSOUND_SetOutput(FSOUND_OUTPUT_A3D); -// FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND); - FSOUND_SetOutput(FSOUND_OUTPUT_WINMM); - -// ========================================================================================== -// SELECT DRIVER -// ========================================================================================== - - -// The following list are the drivers for the output method selected above. - writeln('---------------------------------------------------------'); - enm := FSOUND_GetOutput(); - case enm of - - FSOUND_OUTPUT_NOSOUND: write('NoSound'); - FSOUND_OUTPUT_WINMM: write('Windows Multimedia Waveout'); - FSOUND_OUTPUT_DSOUND: write('Direct Sound'); - FSOUND_OUTPUT_A3D: write('A3D'); - end; - writeln(' Driver list'); - writeln('---------------------------------------------------------'); - for i := 0 to FSOUND_GetNumDrivers() - 1 do - writeln(i + 1, ' - ', FSOUND_GetDriverName(i)); // print driver names - writeln('---------------------------------------------------------'); // print driver names - writeln('Press a corresponding number or ESC to quit'); - repeat - FlushConsoleInputBuffer(h); - repeat - ReadConsoleInput(h, buf, 1, dw); - until buf.Event.KeyEvent.bKeyDown = false; -{$IFDEF VER120} - Key := buf.Event.KeyEvent.wVirtualScanCode; -{$ELSE} - Key := buf.Event.KeyEvent.wVirtualKeyCode; -{$ENDIF} - if (ord(key) = 27) then exit; - driver := ord(key) - ord('1'); - until ((driver > 0) or (driver <= FSOUND_GetNumDrivers())); - FSOUND_SetDriver(driver); // Select sound card (0 = default) - -// ========================================================================================== -// INITIALIZE -// ========================================================================================== - if not FSOUND_Init(44100, 16, 0) then - begin - writeln('Error! Initializing'); - writeln(FMOD_ErrorString(FSOUND_GetError())); - FSOUND_Close(); - exit; - end; - -// ========================================================================================== -// OPEN STREAM -// ========================================================================================== - stream := FSOUND_Stream_Open(PChar(ParamStr(1)), FSOUND_LOOP_NORMAL or FSOUND_NORMAL, 0, 0); - if stream = nil then - begin - writeln('Error! Opening file'); - writeln(FMOD_ErrorString(FSOUND_GetError())); - FSOUND_Close(); - exit; - end; - -// ========================================================================================== -// PLAY STREAM -// ========================================================================================== - channel := FSOUND_Stream_Play(FSOUND_FREE, stream); - if channel < 0 then - begin - writeln('Error! Play'); - writeln(FMOD_ErrorString(FSOUND_GetError())); - FSOUND_Close(); - exit; - end; - writeln; - writeln('========================================================================='); - writeln('Press SPACE to pause/unpause'); - writeln('Press ESC to quit'); - writeln('========================================================================='); - writeln('Playing stream...'); - GetConsoleMode(h, dw); - SetConsoleMode(h, dw or ENABLE_PROCESSED_OUTPUT or ENABLE_PROCESSED_INPUT); - c.X := 1; - c.Y := 20; - repeat - FlushConsoleInputBuffer(h); - Sleep(50); - dw := 0; - PeekConsoleInput(h, buf, 1, dw); - if buf.Event.KeyEvent.bKeyDown then - begin -{$IFDEF VER120} - Key := buf.Event.KeyEvent.wVirtualScanCode; -{$ELSE} - Key := buf.Event.KeyEvent.wVirtualKeyCode; -{$ENDIF} - if dw = 1 then - if key <> 0 then - if key = 32 then - begin - FSOUND_SetPaused(channel, not FSOUND_GetPaused(channel)); - key := 0; - end else if key = 27 then - begin - writeln; - FSOUND_Stream_Close(stream); - FSOUND_Close(); - exit; - end; - end; - SetConsoleCursorPosition(h1, c); - str(FSOUND_Stream_GetPosition(stream): 7, position); - str((FSOUND_Stream_GetTime(stream) / 1000): 6: 3, time); - str(FSOUND_GetCPUUsage(): 7: 5, cpu); - if FSOUND_GetPaused(channel) then - s := 'position = ' + position + ' time = ' + time + ' PAUSED ' + ' cpu usage = ' + cpu - else s := 'position = ' + position + ' time = ' + time + ' cpu usage = ' + cpu + ' '; - WriteConsole(h1, pchar(s), length(s) - 1, dw, nil); - s := ' '; - until key = 27; - writeln; - FSOUND_Stream_Close(stream); - FSOUND_Close(); -end. - diff --git a/#ThirdParty/fmodapi375win/samplesdelphi/simplegui/main.dfm b/#ThirdParty/fmodapi375win/samplesdelphi/simplegui/main.dfm deleted file mode 100644 index d66e6e3..0000000 --- a/#ThirdParty/fmodapi375win/samplesdelphi/simplegui/main.dfm +++ /dev/null @@ -1,176 +0,0 @@ -object frmMain: TfrmMain - Left = 206 - Top = 122 - ActiveControl = lbxOutput - BorderIcons = [biSystemMenu] - BorderStyle = bsSingle - Caption = 'FMOD Simple Sample' - ClientHeight = 320 - ClientWidth = 353 - Color = clBtnFace - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'MS Sans Serif' - Font.Style = [] - OldCreateOrder = False - OnClose = FormClose - OnCreate = FormCreate - PixelsPerInch = 96 - TextHeight = 13 - object lblOutput: TLabel - Left = 12 - Top = 12 - Width = 32 - Height = 13 - Caption = '&Output' - FocusControl = lbxOutput - end - object lblDriver: TLabel - Left = 184 - Top = 12 - Width = 28 - Height = 13 - Caption = '&Driver' - FocusControl = lbxDriver - end - object lblCPUUsage: TLabel - Left = 12 - Top = 260 - Width = 25 - Height = 13 - Caption = 'CPU:' - end - object lblCPU: TLabel - Left = 52 - Top = 260 - Width = 3 - Height = 13 - end - object lblPlaySound: TLabel - Left = 16 - Top = 172 - Width = 57 - Height = 13 - Caption = 'Play sounds' - end - object pnlButtons: TPanel - Left = 0 - Top = 279 - Width = 353 - Height = 41 - Align = alBottom - BevelOuter = bvNone - TabOrder = 6 - object bvlButtons: TBevel - Left = 0 - Top = 0 - Width = 353 - Height = 2 - Align = alTop - end - object btnClose: TButton - Left = 260 - Top = 8 - Width = 75 - Height = 25 - Cancel = True - Caption = 'Close' - TabOrder = 0 - OnClick = btnCloseClick - end - end - object lbxOutput: TListBox - Left = 8 - Top = 28 - Width = 161 - Height = 97 - ItemHeight = 13 - TabOrder = 0 - OnClick = lbxOutputClick - end - object lbxDriver: TListBox - Left = 180 - Top = 28 - Width = 161 - Height = 97 - ItemHeight = 13 - TabOrder = 1 - end - object btnInit: TButton - Left = 12 - Top = 136 - Width = 75 - Height = 25 - Caption = '&Init' - TabOrder = 2 - OnClick = btnInitClick - end - object btnDeinit: TButton - Left = 96 - Top = 136 - Width = 75 - Height = 25 - Caption = 'D&einit' - Enabled = False - TabOrder = 3 - OnClick = btnDeinitClick - end - object btnPlay: TButton - Left = 180 - Top = 136 - Width = 75 - Height = 25 - Caption = '&Play' - Enabled = False - TabOrder = 4 - OnClick = btnPlayClick - end - object btnStop: TButton - Left = 264 - Top = 136 - Width = 75 - Height = 25 - Caption = '&Stop' - Enabled = False - TabOrder = 5 - OnClick = btnStopClick - end - object btn16bit: TButton - Left = 12 - Top = 192 - Width = 75 - Height = 25 - Caption = '16bit' - Enabled = False - TabOrder = 7 - OnClick = btn16bitClick - end - object btn8bit: TButton - Left = 96 - Top = 192 - Width = 75 - Height = 25 - Caption = '8bit' - Enabled = False - TabOrder = 8 - OnClick = btn8bitClick - end - object btn16bitstereo: TButton - Left = 180 - Top = 192 - Width = 75 - Height = 25 - Caption = '16bit stereo' - Enabled = False - TabOrder = 9 - OnClick = btn16bitstereoClick - end - object tmrMain: TTimer - Enabled = False - Interval = 100 - OnTimer = tmrMainTimer - Left = 304 - Top = 180 - end -end diff --git a/#ThirdParty/fmodapi375win/samplesdelphi/simplegui/main.pas b/#ThirdParty/fmodapi375win/samplesdelphi/simplegui/main.pas deleted file mode 100644 index e6ac4b1..0000000 --- a/#ThirdParty/fmodapi375win/samplesdelphi/simplegui/main.pas +++ /dev/null @@ -1,369 +0,0 @@ -unit main; - -{ Disable warning for unsafe types in Delphi 7 } -{$IFDEF VER150} -{$WARN UNSAFE_TYPE OFF} -{$ENDIF} - -interface - -uses - Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, - Dialogs, StdCtrls, ExtCtrls, fmod, fmodtypes; - -type - TfrmMain = class(TForm) - pnlButtons: TPanel; - btnClose: TButton; - bvlButtons: TBevel; - lblOutput: TLabel; - lbxOutput: TListBox; - lbxDriver: TListBox; - lblDriver: TLabel; - btnInit: TButton; - btnDeinit: TButton; - btnPlay: TButton; - btnStop: TButton; - lblCPUUsage: TLabel; - lblCPU: TLabel; - tmrMain: TTimer; - btn16bit: TButton; - btn8bit: TButton; - btn16bitstereo: TButton; - lblPlaySound: TLabel; - procedure FormCreate(Sender: TObject); - procedure lbxOutputClick(Sender: TObject); - procedure btnInitClick(Sender: TObject); - procedure btnDeinitClick(Sender: TObject); - procedure tmrMainTimer(Sender: TObject); - procedure FormClose(Sender: TObject; var Action: TCloseAction); - procedure btnPlayClick(Sender: TObject); - procedure btnStopClick(Sender: TObject); - procedure btn16bitClick(Sender: TObject); - procedure btn8bitClick(Sender: TObject); - procedure btn16bitstereoClick(Sender: TObject); - procedure btnCloseClick(Sender: TObject); - private - FInitialised: Boolean; - FPlaying: Boolean; - FMusic: PFMusicModule; - FSound1: PFSoundSample; - FSound2: PFSoundSample; - FSound3: PFSoundSample; - function Load: Boolean; - procedure Unload; - public - { Public declarations } - end; - -var - frmMain: TfrmMain; - -implementation - -uses - fmoderrors; - -{$R *.dfm} - -type - TOutput = record - Value: TFSoundOutputTypes; - Name: String; - end; - -const -{$IFDEF MSWINDOWS} - Output: array [0..4] of TOutput = - ( - ( Value: FSOUND_OUTPUT_DSOUND; Name: 'DirectSound' ), - ( Value: FSOUND_OUTPUT_WINMM; Name: 'Windows Multimedia' ), - ( Value: FSOUND_OUTPUT_A3D; Name: 'A3D' ), - ( Value: FSOUND_OUTPUT_ASIO; Name: 'ASIO' ), - ( Value: FSOUND_OUTPUT_NOSOUND; Name: 'No sound' ) - ); -{$ELSE} -{$IFDEF LINUX} - Output: array [0..3] of TOutput = - ( - ( Value: FSOUND_OUTPUT_OSS; Name: 'Open Sound System' ), - ( Value: FSOUND_OUTPUT_ESD; Name: 'Enlightenment Sound Daemon' ), - ( Value: FSOUND_OUTPUT_ALSA; Name: 'ALSA' ), - ( Value: FSOUND_OUTPUT_NOSOUND; Name: 'No sound' ) - ); -{$ENDIF} -{$ENDIF} - -procedure TfrmMain.FormCreate(Sender: TObject); -var - Index: Integer; -begin - { Use the default Windows desktop font } - DesktopFont := True; - - FMOD_Load(nil); - - { Populate the list of output types with both the name and enumeration value } - { Use a typecasting trick to store an integer value as an object } - for Index := Low(Output) to High(Output) do - lbxOutput.Items.AddObject(Output[Index].Name, TObject(Output[Index].Value)); - - { Pre-select the first output type in the list } - lbxOutput.ItemIndex := 0; - lbxOutputClick(nil); -end; - -procedure TfrmMain.lbxOutputClick(Sender: TObject); -var - Index: Integer; -begin - { Clear the existing list } - lbxDriver.Items.Clear; - - { If no output type is selected, then exit } - if lbxOutput.ItemIndex < 0 then - Exit; - - { Set the output type } - FSOUND_SetOutput(TFSoundOutputTypes(lbxOutput.Items.Objects[lbxOutput.ItemIndex])); - - { Get the list of available drivers } - for Index := 0 to FSOUND_GetNumDrivers - 1 do - lbxDriver.Items.Add(FSOUND_GetDriverName(Index)); - - { Select the first driver in the list } - if lbxDriver.Items.Count > 0 then - lbxDriver.ItemIndex := 0; -end; - -procedure TfrmMain.btnInitClick(Sender: TObject); -begin - { Make sure an output type is selected } - if lbxOutput.ItemIndex < 0 then - begin - MessageDlg('Must select an output type', mtError, [mbOk], 0); - lbxOutput.SetFocus; - Exit; - end; - - { Make sure a driver is selected } - if lbxDriver.ItemIndex < 0 then - begin - MessageDlg('Must select a driver', mtError, [mbOk], 0); - lbxDriver.SetFocus; - Exit; - end; - - { Set the output type } - FSOUND_SetOutput(TFSoundOutputTypes(lbxOutput.Items.Objects[lbxOutput.ItemIndex])); - - { Set the driver } - FSOUND_SetDriver(lbxDriver.ItemIndex); - - { Set the mixer } - FSOUND_SetMixer(FSOUND_MIXER_QUALITY_AUTODETECT); - - { Initialise FMOD at 22.5kHz, 32 software channels and no special flags } - FInitialised := FSOUND_Init(22500, 32, 0); - - if not FInitialised then - begin - MessageDlg('FMOD initialisation failed'#13 + FMOD_ErrorString(FSOUND_GetError), mtError, [mbOk], 0); - Exit; - end; - - { Set the enabled state of the buttons } - btnInit.Enabled := False; - btnDeinit.Enabled := True; - btnPlay.Enabled := True; - btnStop.Enabled := False; - lbxOutput.Enabled := False; - lbxDriver.Enabled := False; - - { Enable the timer to display song and CPU usage information } - tmrMain.Enabled := True; -end; - -procedure TfrmMain.btnDeinitClick(Sender: TObject); -begin - if not FInitialised then - Exit; - - { Press the stop button } - btnStopClick(nil); - - { Close FMOD } - FSOUND_Close; - FInitialised := False; - - { Set the enabled state of the buttons } - btnInit.Enabled := True; - btnDeinit.Enabled := False; - btnPlay.Enabled := False; - btnStop.Enabled := False; - lbxOutput.Enabled := True; - lbxDriver.Enabled := True; - - { Stop the timer since we do not need the song and CPU information any more } - tmrMain.Enabled := False; - lblCPU.Caption := ''; -end; - -procedure TfrmMain.tmrMainTimer(Sender: TObject); -begin - { What percentage of CPU is FMOD using? } - lblCPU.Caption := Format('%0.1f%%', [FSOUND_GetCPUUsage]); -end; - -procedure TfrmMain.FormClose(Sender: TObject; var Action: TCloseAction); -begin - { If the form is being closed, then act as if the stop and deinit buttons - have been pressed } - btnStopClick(nil); - btnDeinitClick(nil); -end; - -procedure TfrmMain.btnPlayClick(Sender: TObject); -begin - if FPlaying then - Exit; - - { Load the music and samples } - if not Load then - Exit; - - { Play the music } - FMUSIC_PlaySong(FMusic); - FMUSIC_SetPanSeperation(FMusic, 0.15); { 15% crossover } - - FPlaying := True; - - { Set the enabled state of the buttons } - btnPlay.Enabled := False; - btnStop.Enabled := True; - btn16bit.Enabled := True; - btn8bit.Enabled := True; - btn16bitstereo.Enabled := True; -end; - -procedure TfrmMain.btnStopClick(Sender: TObject); -begin - if not FPlaying then - Exit; - - { Unload the music and samples } - Unload; - - FPlaying := False; - - { Set the enabled state of the buttons } - btnPlay.Enabled := True; - btnStop.Enabled := False; - btn16bit.Enabled := False; - btn8bit.Enabled := False; - btn16bitstereo.Enabled := False; -end; - -function TfrmMain.Load: Boolean; -begin - { Assume it will fail } - Result := False; - - { Music } - FMusic := FMUSIC_LoadSong('../../media/invtro94.s3m'); - if FMusic = nil then - begin - MessageDlg('Failed to load music'#13 + FMOD_ErrorString(FSOUND_GetError), mtError, [mbOk], 0); - Unload; - Exit; - end; - - { 16bit sound } - FSound1 := FSOUND_Sample_Load(FSOUND_FREE, '../../media/jaguar.wav', FSOUND_2D, 0, 0); - if FSound1 = nil then - begin - MessageDlg('Failed to load jaguar.wav'#13 + FMOD_ErrorString(FSOUND_GetError), mtError, [mbOk], 0); - Unload; - Exit; - end; - - { 8bit sound } - FSound2 := FSOUND_Sample_Load(FSOUND_FREE, '../../media/drumloop.wav', FSOUND_2D, 0, 0); - if FSound2 = nil then - begin - MessageDlg('Failed to load drumloop.wav'#13 + FMOD_ErrorString(FSOUND_GetError), mtError, [mbOk], 0); - Unload; - Exit; - end; - - { 16bit stereo sound } - FSound3 := FSOUND_Sample_Load(FSOUND_FREE, '../../media/chimes.wav', FSOUND_2D, 0, 0); - if FSound3 = nil then - begin - MessageDlg('Failed to load chimes.wav'#13 + FMOD_ErrorString(FSOUND_GetError), mtError, [mbOk], 0); - Unload; - Exit; - end; - - { We got this far, so it all succeeded } - Result := True; -end; - -procedure TfrmMain.Unload; -begin - { Free the music } - if FMusic <> nil then - begin - FMUSIC_FreeSong(FMusic); - FMusic := nil; - end; - - { Free the 16bit sample } - if FSound1 <> nil then - begin - FSOUND_Sample_Free(FSound1); - FSound1 := nil; - end; - - { Free the 8bit sample } - if FSound2 <> nil then - begin - FSOUND_Sample_Free(FSound2); - FSound2 := nil; - end; - - { Free the 16bit stereo sample } - if FSound2 <> nil then - begin - FSOUND_Sample_Free(FSound2); - FSound2 := nil; - end; -end; - -procedure TfrmMain.btn16bitClick(Sender: TObject); -begin - { Play the 16bit sound } - FSOUND_PlaySound(FSOUND_FREE, FSound1) -end; - -procedure TfrmMain.btn8bitClick(Sender: TObject); -begin - { Play the 8bit sound } - FSOUND_PlaySound(FSOUND_FREE, FSound2) -end; - -procedure TfrmMain.btn16bitstereoClick(Sender: TObject); -var - Channel: Integer; -begin - { Play the 16bit stereo sound } - Channel := FSOUND_PlaySound(FSOUND_FREE, FSound3); - FSOUND_SetPan(Channel, FSOUND_STEREOPAN); -end; - -procedure TfrmMain.btnCloseClick(Sender: TObject); -begin - Close; -end; - -end. diff --git a/#ThirdParty/fmodapi375win/samplesdelphi/simplegui/simple.dpr b/#ThirdParty/fmodapi375win/samplesdelphi/simplegui/simple.dpr deleted file mode 100644 index 3a27da0..0000000 --- a/#ThirdParty/fmodapi375win/samplesdelphi/simplegui/simple.dpr +++ /dev/null @@ -1,13 +0,0 @@ -program simple; - -uses - Forms, - main in 'main.pas' {frmMain}; - -{$R *.res} - -begin - Application.Initialize; - Application.CreateForm(TfrmMain, frmMain); - Application.Run; -end. diff --git a/#ThirdParty/fmodapi375win/samplesdelphi/stream2/stream2.dpr b/#ThirdParty/fmodapi375win/samplesdelphi/stream2/stream2.dpr deleted file mode 100644 index e2c0951..0000000 --- a/#ThirdParty/fmodapi375win/samplesdelphi/stream2/stream2.dpr +++ /dev/null @@ -1,271 +0,0 @@ -//=============================================================================================== -// STREAM2.EXE -// Copyright (c), Firelight Multimedia, 1999-2000. -// -// This sample specifically demonstrates the user callback streaming facility, and generates a -// very strange noise! :) -// Converted to Delphi by Steve 'Sly' Williams -//=============================================================================================== -// History -// -// 2001/09/09 by Steve 'Sly' Williams -// - Updated to version 3.40 -// -// 2000/12/15 by Steve 'Sly' Williams -// - Updated to version 3.30 -// -// 2000/11/13 by Steve 'Sly' Williams -// - Fixed version check -// - Updated to use FMODErrors.pas -// - Added check for Delphi 4 to change wVirtualKeyCode to wVirtualScanCode -// -// 2000/06/04 by Steve 'Sly' Williams -// - Conversion of stream2 -// -// 2002/02/13 by Steve 'Sly' Williams -// - Updated for Delphi 6 compatability (writeable constants) -// -// 2002/12/19 by Steve 'Sly' Williams -// - Updated to version 3.61 -//=============================================================================================== - -program stream2; - -uses - Windows, fmod, fmodtypes, fmoderrors, SysUtils; - -{$APPTYPE CONSOLE} - -{$IFDEF VER140} -{$DEFINE COMPILER6_UP} -{$ELSE} - {$IFDEF VER150} - {$DEFINE COMPILER6_UP} - {$ENDIF} -{$ENDIF} - -type - PSmallInt = ^SmallInt; - -var - h: THandle; - dw: DWORD; - Status, Time, CPU, LenStr, BuffStr: String; - -function StreamCallback(Stream: PFSoundStream; Buff: Pointer; Len, Param: Integer): ByteBool; stdcall; -{$IFDEF COMPILER6_UP}{$J+}{$ENDIF} -const - Time1: Single = 0.0; - Time2: Single = 0.0; - Velocity1: Single = 0.0; - Velocity2: Single = 0.0; -{$IFDEF COMPILER6_UP}{$J-}{$ENDIF} -var - Count: Integer; - Buffer: PChar; -begin - Buffer := PChar(Buff); - Count := 0; - - while Count < (Len shr 2) do { >>2 = 16bit stereo (4 bytes per sample) } - begin - PSmallInt(Buffer)^ := Trunc(Sin(Time1) * 32767.0); { Left channel } - Inc(Buffer, 2); - PSmallInt(Buffer)^ := Trunc(Sin(Time2) * 32767.0); { Right channel } - Inc(Buffer, 2); - - Time1 := Time1 + 0.1 + Velocity1; - Time2 := Time2 + 0.142 + Velocity2; - Velocity1 := Velocity1 + (Sin(Time1) * 0.02); - Velocity2 := Velocity2 + (Sin(Time2) * 0.02); - - Inc(Count); - end; - - Str(FSOUND_Stream_GetTime(Stream) / 1000: 6: 3, Time); - Str(FSOUND_GetCPUUsage: 7: 5, CPU); - Str(Integer(Buff), BuffStr); - Str(Len, LenStr); - Status := 'Callback: Buff=' + BuffStr + ' Len=' + LenStr + ' Time=' + Time + ' CPU=' + CPU; - WriteLn(Status); - - // Must return true for the stream to continue - Result := True; -end; - -const - OutputTypes: array [0..3] of String = - ('Direct Sound', 'Windows Multimedia Waveout', 'A3D', 'NoSound'); -var - Stream: PFSoundStream; - Channel: Integer; - Key: DWORD; - Output, Driver: Integer; - Index: Longint; - Buf: input_record; -begin - SetConsoleTitle('Example Stream2 (streaming callback)'); - h := GetStdHandle(STD_INPUT_HANDLE); - Buf.EventType := Key_Event; - if FMOD_VERSION > FSOUND_GetVersion then - begin - WriteLn('Error: You are using FMOD version ', FSOUND_GetVersion:3:2, '. You should be using version ', FMOD_VERSION:3:2); - Exit; - end; - - WriteLn('-------------------------------------------------------------'); - WriteLn('FSOUND Streamer example.'); - WriteLn('Copyright (c) Firelight Multimedia, 1999.'); - WriteLn('-------------------------------------------------------------'); - -// ========================================================================================== -// SELECT OUTPUT -// ========================================================================================== - - WriteLn('---------------------------------------------------------'); - WriteLn('Output Type'); - WriteLn('---------------------------------------------------------'); - WriteLn('1 - ', OutputTypes[0]); - WriteLn('2 - ', OutputTypes[1]); - WriteLn('3 - ', OutputTypes[2]); - WriteLn('4 - ', OutputTypes[3]); - WriteLn('---------------------------------------------------------'); - WriteLn('Press a corresponding number or ESC to quit'); - - Output := High(Output); - repeat - FlushConsoleInputBuffer(h); - repeat - ReadConsoleInput(h, buf, 1, dw); - until not buf.Event.KeyEvent.bKeyDown; -{$IFDEF VER120} - Key := buf.Event.KeyEvent.wVirtualScanCode; -{$ELSE} - Key := buf.Event.KeyEvent.wVirtualKeyCode; -{$ENDIF} - if Ord(Key) = 27 then - Exit; - if Key >= Ord('1') then - begin - Output := Ord(Key) - Ord('1'); - case Output of - 0: FSOUND_SetOutput(FSOUND_OUTPUT_DSOUND); - 1: FSOUND_SetOutput(FSOUND_OUTPUT_WINMM); - 2: FSOUND_SetOutput(FSOUND_OUTPUT_A3D); - 3: FSOUND_SetOutput(FSOUND_OUTPUT_NOSOUND); - end; - end; - until Output < 4; - -// ========================================================================================== -// SELECT DRIVER -// ========================================================================================== - -// The following list are the drivers for the output method selected above. - WriteLn('---------------------------------------------------------'); - case FSOUND_GetOutput of - FSOUND_OUTPUT_NOSOUND: Write(OutputTypes[3]); - FSOUND_OUTPUT_WINMM: Write(OutputTypes[1]); - FSOUND_OUTPUT_DSOUND: Write(OutputTypes[0]); - FSOUND_OUTPUT_A3D: Write(OutputTypes[2]); - end; - WriteLn(' Driver list'); - WriteLn('---------------------------------------------------------'); - for Index := 0 to FSOUND_GetNumDrivers - 1 do - WriteLn(Index + 1, ' - ', FSOUND_GetDriverName(Index)); // print driver names - WriteLn('---------------------------------------------------------'); // print driver names - WriteLn('Press a corresponding number or ESC to quit'); - - Driver := High(Driver); - repeat - FlushConsoleInputBuffer(h); - repeat - ReadConsoleInput(h, buf, 1, dw); - until not buf.Event.KeyEvent.bKeyDown; -{$IFDEF VER120} - Key := buf.Event.KeyEvent.wVirtualScanCode; -{$ELSE} - Key := buf.Event.KeyEvent.wVirtualKeyCode; -{$ENDIF} - if Ord(Key) = 27 then - Exit; - if Key >= Ord('1') then - begin - Driver := Ord(Key) - Ord('1'); - if Driver < FSOUND_GetNumDrivers then - FSOUND_SetDriver(Driver); // Select sound card (0 = default) - end; - until Driver < FSOUND_GetNumDrivers; - -// ========================================================================================== -// INITIALIZE -// ========================================================================================== - if not FSOUND_Init(44100, 16, 0) then - begin - WriteLn('Error! Initializing'); - WriteLn(FMOD_ErrorString(FSOUND_GetError)); - FSOUND_Close; - Exit; - end; - -// ========================================================================================== -// OPEN STREAM -// ========================================================================================== - Stream := FSOUND_Stream_Create(StreamCallback, 1000 * 2 * 2, FSOUND_NORMAL or FSOUND_16BITS or FSOUND_STEREO, 22050, 12345); - if Stream = nil then - begin - WriteLn('Error! Opening stream'); - WriteLn(FMOD_ErrorString(FSOUND_GetError)); - FSOUND_Close; - Exit; - end; - -// ========================================================================================== -// PLAY STREAM -// ========================================================================================== - WriteLn; - WriteLn('========================================================================='); - WriteLn('Press SPACE to pause/unpause'); - WriteLn('Press ESC to quit'); - WriteLn('========================================================================='); - WriteLn('Playing stream...'); - - Channel := FSOUND_Stream_Play(FSOUND_FREE, Stream); - if Channel < 0 then - begin - WriteLn; - WriteLn('Error! Play'); - WriteLn(FMOD_ErrorString(FSOUND_GetError)); - FSOUND_Close; - Exit; - end; - - GetConsoleMode(h, dw); - SetConsoleMode(h, dw or ENABLE_PROCESSED_OUTPUT or ENABLE_PROCESSED_INPUT); - repeat - FlushConsoleInputBuffer(h); - Sleep(50); - dw := 0; - PeekConsoleInput(h, buf, 1, dw); - if buf.Event.KeyEvent.bKeyDown then - begin -{$IFDEF VER120} - Key := buf.Event.KeyEvent.wVirtualScanCode; -{$ELSE} - Key := buf.Event.KeyEvent.wVirtualKeyCode; -{$ENDIF} - if dw = 1 then - begin - if Key = 32 then - begin - FSOUND_SetPaused(Channel, not FSOUND_GetPaused(Channel)); - Key := 0; - end; - end; - end; - until Key = 27; - WriteLn; - FSOUND_Stream_Close(Stream); - FSOUND_Close; -end. - diff --git a/#ThirdParty/fmodapi375win/samplesvb/simplest/Form1.frm b/#ThirdParty/fmodapi375win/samplesvb/simplest/Form1.frm deleted file mode 100644 index 5868a96..0000000 --- a/#ThirdParty/fmodapi375win/samplesvb/simplest/Form1.frm +++ /dev/null @@ -1,441 +0,0 @@ -VERSION 5.00 -Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx" -Begin VB.Form Form1 - Caption = "FMod VB Example - Simplest" - ClientHeight = 5355 - ClientLeft = 60 - ClientTop = 375 - ClientWidth = 8550 - LinkTopic = "Form1" - ScaleHeight = 5355 - ScaleWidth = 8550 - StartUpPosition = 3 'Windows Default - Begin MSComDlg.CommonDialog CommonDialog1 - Left = 1320 - Top = 2640 - _ExtentX = 847 - _ExtentY = 847 - _Version = 393216 - End - Begin VB.Frame Frame5 - Caption = "2c. Samples (wav, mp3, ogg, wma)" - Height = 1455 - Left = 2280 - TabIndex = 12 - Top = 3600 - Width = 3855 - Begin VB.CommandButton cmdCloseSample - Caption = "4 - Close Sample" - Enabled = 0 'False - Height = 375 - Left = 240 - TabIndex = 18 - Top = 840 - Width = 1455 - End - Begin VB.CommandButton cmdstopSample - Caption = "3 - Stop Sample" - Enabled = 0 'False - Height = 375 - Left = 2040 - TabIndex = 15 - Top = 840 - Width = 1455 - End - Begin VB.CommandButton cmdPlaySample - Caption = "2 - Play Sample" - Enabled = 0 'False - Height = 375 - Left = 2040 - TabIndex = 14 - Top = 360 - Width = 1455 - End - Begin VB.CommandButton cmdOpenSample - Caption = "1 - Open Sample" - Enabled = 0 'False - Height = 375 - Left = 240 - TabIndex = 13 - Top = 360 - Width = 1455 - End - End - Begin VB.Frame Frame4 - Caption = "3. Close FMod" - Height = 975 - Left = 6360 - TabIndex = 10 - Top = 240 - Width = 1935 - Begin VB.CommandButton cmdClose - Caption = "FSOUND_Close" - Enabled = 0 'False - Height = 375 - Left = 240 - TabIndex = 11 - Top = 360 - Width = 1455 - End - End - Begin VB.Frame Frame3 - Caption = "2b. Streams (wav, mp3, ogg, wma)" - Height = 1455 - Left = 2280 - TabIndex = 6 - Top = 1920 - Width = 3855 - Begin VB.CommandButton cmdCloseStream - Caption = "4 - Close Stream" - Enabled = 0 'False - Height = 375 - Left = 240 - TabIndex = 17 - Top = 840 - Width = 1455 - End - Begin VB.CommandButton cmdOpenStream - Caption = "1 - Open Stream" - Enabled = 0 'False - Height = 375 - Left = 240 - TabIndex = 9 - Top = 360 - Width = 1455 - End - Begin VB.CommandButton cmdPlayStream - Caption = "2 - Play Stream" - Enabled = 0 'False - Height = 375 - Left = 2040 - TabIndex = 8 - Top = 360 - Width = 1455 - End - Begin VB.CommandButton cmdStopStream - Caption = "3 - Stop Stream" - Enabled = 0 'False - Height = 375 - Left = 2040 - TabIndex = 7 - Top = 840 - Width = 1455 - End - End - Begin VB.Frame Frame2 - Caption = "2a. Songs (s3m, it, xm, mod)" - Height = 1455 - Left = 2280 - TabIndex = 2 - Top = 240 - Width = 3855 - Begin VB.CommandButton cmdCloseSong - Caption = "4 - Close Song" - Enabled = 0 'False - Height = 375 - Left = 240 - TabIndex = 16 - Top = 840 - Width = 1455 - End - Begin VB.CommandButton cmdStopSong - Caption = "3 - Stop Song" - Enabled = 0 'False - Height = 375 - Left = 2040 - TabIndex = 5 - Top = 840 - Width = 1455 - End - Begin VB.CommandButton cmdPlaySong - Caption = "2 - Play Song" - Enabled = 0 'False - Height = 375 - Left = 2040 - TabIndex = 4 - Top = 360 - Width = 1455 - End - Begin VB.CommandButton cmdOpenSong - Caption = "1 - Open Song" - Enabled = 0 'False - Height = 375 - Left = 240 - TabIndex = 3 - Top = 360 - Width = 1455 - End - End - Begin VB.Frame Frame1 - Caption = "1. Initialize FMod" - Height = 975 - Left = 240 - TabIndex = 0 - Top = 240 - Width = 1935 - Begin VB.CommandButton cmdInit - Caption = "FSOUND_Init" - Height = 375 - Left = 240 - TabIndex = 1 - Top = 360 - Width = 1455 - End - End -End -Attribute VB_Name = "Form1" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Option Explicit - -'Public declarations of variables holding songs, samples and streams -Dim songHandle As Long -Dim sampleHandle As Long -Dim sampleChannel As Long -Dim streamHandle As Long -Dim streamChannel As Long - -Private Sub cmdClose_Click() -'You always have to close fmod before exiting your program -FSOUND_Close - -'Switch which buttons are enabled -cmdInit.Enabled = True -cmdClose.Enabled = False -cmdOpenSong.Enabled = False -cmdPlaySong.Enabled = False -cmdStopSong.Enabled = False -cmdCloseSong.Enabled = False -cmdOpenStream.Enabled = False -cmdPlayStream.Enabled = False -cmdStopStream.Enabled = False -cmdCloseStream.Enabled = False -cmdOpenSample.Enabled = False -cmdPlaySample.Enabled = False -cmdstopSample.Enabled = False -cmdCloseSample.Enabled = False -End Sub - -Private Sub cmdCloseSample_Click() -FSOUND_Sample_Free sampleHandle -'You should manually set the handle to 0 after closing the song -'This way, you can see if the song is loaded or not -sampleHandle = 0 - -cmdCloseSample.Enabled = False -cmdOpenSample.Enabled = True -cmdPlaySample.Enabled = False -cmdstopSample.Enabled = False -End Sub - -Private Sub cmdCloseSong_Click() -FMUSIC_FreeSong songHandle -'You should manually set the handle to 0 after closing the song -'This way, you can see if the song is loaded or not -songHandle = 0 - -cmdCloseSong.Enabled = False -cmdOpenSong.Enabled = True -cmdPlaySong.Enabled = False -cmdStopSong.Enabled = False -End Sub - -Private Sub cmdCloseStream_Click() -FSOUND_Stream_Close streamHandle -'You should manually set the handle to 0 after closing the song -'This way, you can see if the song is loaded or not -streamHandle = 0 - -cmdCloseStream.Enabled = False -cmdOpenStream.Enabled = True -cmdPlayStream.Enabled = False -cmdStopStream.Enabled = False -End Sub - -Private Sub cmdInit_Click() -'This is the first thing you have to do before you can start working with fmod -Dim result As Boolean -result = FSOUND_Init(44100, 32, 0) -If result Then - 'Successfully initialized - 'Update buttons - cmdInit.Enabled = False - cmdClose.Enabled = True - cmdOpenSong.Enabled = True - cmdOpenStream.Enabled = True - cmdOpenSample.Enabled = True -Else - 'An error occured - MsgBox "An error occured initializing fmod!" & vbCrLf & _ - FSOUND_GetErrorString(FSOUND_GetError), vbOKOnly -End If - -End Sub - -Private Sub cmdOpenSample_Click() -'Samples should be used for things such as sound effects -'Samples are completely loaded into memory when loading -'When you load a compressed file such as an mp3 as a sample -'it will be decompressed first, and then stored to memory - -CommonDialog1.Filter = "All Supported Samples (*.wav, *.mp3, *.ogg, *.wma)|*.wav;*.ogg;*.mp3;*.wma" -CommonDialog1.ShowOpen - -If Not FileExist(CommonDialog1.filename) Then - MsgBox "File doesn't exist or no file selected" - Exit Sub -End If - -sampleHandle = FSOUND_Sample_Load(fsound_free, CommonDialog1.filename, FSOUND_NORMAL, 0, 0) - -If sampleHandle <> 0 Then - 'Loading was successful - cmdCloseSample.Enabled = True - cmdOpenSample.Enabled = False - cmdPlaySample.Enabled = True -Else - 'Something went wrong - MsgBox "An error occured opening the sample!" & vbCrLf & _ - FSOUND_GetErrorString(FSOUND_GetError), vbOKOnly -End If - -End Sub - -Private Sub cmdOpenSong_Click() -'The FMUSIC_* part of fmod handles modules or music files -CommonDialog1.Filter = "All Supported Modules (*.s3m, *.it, *.xm, *.mod)|*.s3m;*.it;*.xm;*.mod" -CommonDialog1.ShowOpen - -If Not FileExist(CommonDialog1.filename) Then - MsgBox "File doesn't exist or no file selected" - Exit Sub -End If - -songHandle = FMUSIC_LoadSong(CommonDialog1.filename) -If songHandle <> 0 Then - 'Loading was successful - cmdCloseSong.Enabled = True - cmdOpenSong.Enabled = False - cmdPlaySong.Enabled = True -Else - 'Something went wrong - MsgBox "An error occured opening the song!" & vbCrLf & _ - FSOUND_GetErrorString(FSOUND_GetError), vbOKOnly -End If - -End Sub - -Private Sub cmdOpenStream_Click() -'Streams are not loaded completely into memory -'When playing a stream, fmod loads only the part that is currently playing into memory -'It should be used if you want to play music with fmod - -CommonDialog1.Filter = "All Supported Streams (*.wav, *.mp3, *.ogg, *.wma)|*.wav;*.ogg;*.mp3;*.wma" -CommonDialog1.ShowOpen - -If Not FileExist(CommonDialog1.filename) Then - MsgBox "File doesn't exist or no file selected" - Exit Sub -End If - -streamHandle = FSOUND_Stream_Open(CommonDialog1.filename, FSOUND_NORMAL, 0, 0) - -If streamHandle <> 0 Then - 'Loading was successful - cmdCloseStream.Enabled = True - cmdOpenStream.Enabled = False - cmdPlayStream.Enabled = True -Else - 'Something went wrong - MsgBox "An error occured opening the stream!" & vbCrLf & _ - FSOUND_GetErrorString(FSOUND_GetError), vbOKOnly -End If - -End Sub - -Private Sub cmdPlaySample_Click() -'You should always use FSOUND_FREE as the first paramter -'This lets fmod choose a free channel and play the sample in it -'Each sample can be played more than once if necessary -'If you need to keep track of each sample that is playing, -'You will need as much variables as times you want to play the sample -'to store the sample channels in -sampleChannel = FSOUND_PlaySound(fsound_free, sampleHandle) - -If sampleChannel <> 0 Then - 'Playing - cmdPlaySample.Enabled = False - cmdstopSample.Enabled = True -Else - 'Something went wrong - MsgBox "An error occured playing the sample!" & vbCrLf & _ - FSOUND_GetErrorString(FSOUND_GetError), vbOKOnly -End If -End Sub - -Private Sub cmdPlaySong_Click() -Dim result As Boolean -result = FMUSIC_PlaySong(songHandle) -If result Then - 'Playing - cmdPlaySong.Enabled = False - cmdStopSong.Enabled = True -Else - 'Something went wrong - MsgBox "An error occured playing the song!" & vbCrLf & _ - FSOUND_GetErrorString(FSOUND_GetError), vbOKOnly -End If -End Sub - -Private Sub cmdPlayStream_Click() -'You should always use FSOUND_FREE as the first paramter -'This lets fmod choose a free channel and play the stream in it -'Each stream can be played only once -streamChannel = FSOUND_Stream_Play(fsound_free, streamHandle) - -If streamChannel <> 0 Then - 'Playing - cmdPlayStream.Enabled = False - cmdStopStream.Enabled = True -Else - 'Something went wrong - MsgBox "An error occured playing the stream!" & vbCrLf & _ - FSOUND_GetErrorString(FSOUND_GetError), vbOKOnly -End If -End Sub - -Private Sub cmdstopSample_Click() -FSOUND_StopSound sampleChannel -'After a sample has been stopped, the channel is not active anymore -sampleChannel = 0 - -cmdPlaySample.Enabled = True -cmdstopSample.Enabled = False -End Sub - -Private Sub cmdStopSong_Click() -FMUSIC_StopSong songHandle -cmdPlaySong.Enabled = True -cmdStopSong.Enabled = False -End Sub - -Private Function FileExist(ByVal FileN As String) As Boolean -'This function checks if the given file exists -On Error GoTo errorhandler -If Dir$(FileN) = vbNullString Then FileExist = False Else FileExist = True -If FileN = "" Then FileExist = False -Exit Function -errorhandler: -FileExist = False -End Function - -Private Sub cmdStopStream_Click() -FSOUND_Stream_Stop streamHandle -'After a stream has been stopped, the channel is not active anymore -streamChannel = 0 - -cmdPlayStream.Enabled = True -cmdStopStream.Enabled = False -End Sub diff --git a/#ThirdParty/fmodapi375win/samplesvb/simplest/Project1.vbp b/#ThirdParty/fmodapi375win/samplesvb/simplest/Project1.vbp deleted file mode 100644 index 80801aa..0000000 --- a/#ThirdParty/fmodapi375win/samplesvb/simplest/Project1.vbp +++ /dev/null @@ -1,35 +0,0 @@ -Type=Exe -Form=Form1.frm -Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\WINDOWS\System32\STDOLE2.TLB#OLE Automation -Module=FMod; ..\..\API\vb\fmod.bas -Object={F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0; Comdlg32.ocx -Startup="Form1" -ExeName32="Simplest.exe" -Command32="" -Name="Simplest" -HelpContextID="0" -CompatibleMode="0" -MajorVer=1 -MinorVer=0 -RevisionVer=0 -AutoIncrementVer=0 -ServerSupportFiles=0 -VersionCompanyName="Interbrew" -CompilationType=0 -OptimizationType=0 -FavorPentiumPro(tm)=0 -CodeViewDebugInfo=0 -NoAliasing=0 -BoundsCheck=0 -OverflowCheck=0 -FlPointCheck=0 -FDIVCheck=0 -UnroundedFP=0 -StartMode=0 -Unattended=0 -Retained=0 -ThreadPerObject=0 -MaxNumberOfThreads=1 - -[MS Transaction Server] -AutoRefresh=1 diff --git a/#ThirdParty/fmodapi375win/tools/FSBANK.HLP b/#ThirdParty/fmodapi375win/tools/FSBANK.HLP deleted file mode 100644 index e9d66b0..0000000 Binary files a/#ThirdParty/fmodapi375win/tools/FSBANK.HLP and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/tools/asioconfig.exe b/#ThirdParty/fmodapi375win/tools/asioconfig.exe deleted file mode 100644 index eeead27..0000000 Binary files a/#ThirdParty/fmodapi375win/tools/asioconfig.exe and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/tools/fsbank.exe b/#ThirdParty/fmodapi375win/tools/fsbank.exe deleted file mode 100644 index 3c117ae..0000000 Binary files a/#ThirdParty/fmodapi375win/tools/fsbank.exe and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/tools/fsbankcl.exe b/#ThirdParty/fmodapi375win/tools/fsbankcl.exe deleted file mode 100644 index cd3e575..0000000 Binary files a/#ThirdParty/fmodapi375win/tools/fsbankcl.exe and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/tools/fsbanklib/drumloop.wav b/#ThirdParty/fmodapi375win/tools/fsbanklib/drumloop.wav deleted file mode 100644 index b35e216..0000000 Binary files a/#ThirdParty/fmodapi375win/tools/fsbanklib/drumloop.wav and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/tools/fsbanklib/example.cpp b/#ThirdParty/fmodapi375win/tools/fsbanklib/example.cpp deleted file mode 100644 index 58e308f..0000000 --- a/#ThirdParty/fmodapi375win/tools/fsbanklib/example.cpp +++ /dev/null @@ -1,71 +0,0 @@ -#include "fsbanklib.h" - -#include - -#define NUMFILES 2 - -char *files[NUMFILES] = -{ - "jbtennis.wav", - "drumloop.wav" -}; - -void __stdcall Update(int index, int memused, void *userdata) -{ - printf("UPDATE : File %s, memory used %d kb\n", files[index], memused / 1024); -} - -void __stdcall Debug(const char *debugstring, void *userdata) -{ - printf("DEBUG : %s\n", debugstring); -} - -void main() -{ - FSBANK_RESULT result; - - result = FSBank_Init(); - if (result != FSBANK_OK) - { - printf("ERROR\n"); - return; - } - - result = FSBank_SetUpdateCallback(Update, 0); - if (result != FSBANK_OK) - { - printf("ERROR\n"); - return; - } - - result = FSBank_SetDebugCallback(Debug, 0); - if (result != FSBANK_OK) - { - printf("ERROR\n"); - return; - } - -#if 1 - /* - This version compiles the wavs into 1 fsb. - */ - result = FSBank_Build(FSBANK_BUILDMODE_SINGLE, FSBANK_FORMAT_PCM, FSBANK_PLATFORM_CROSS, 0, "test.fsb", NUMFILES, &files[0], 0, 0, 0, 1, 0); -#else - /* - This version compiles the wavs into their own fsb. 1 each. - */ - result = FSBank_Build(FSBANK_BUILDMODE_MULTI, FSBANK_FORMAT_PCM, FSBANK_PLATFORM_CROSS, 0, ".", NUMFILES, &files[0], 0, 0, 0, 1, 0); -#endif - if (result != FSBANK_OK) - { - printf("ERROR\n"); - return; - } - - result = FSBank_Close(); - if (result != FSBANK_OK) - { - printf("ERROR\n"); - return; - } -} \ No newline at end of file diff --git a/#ThirdParty/fmodapi375win/tools/fsbanklib/example.dsp b/#ThirdParty/fmodapi375win/tools/fsbanklib/example.dsp deleted file mode 100644 index 8344a0a..0000000 --- a/#ThirdParty/fmodapi375win/tools/fsbanklib/example.dsp +++ /dev/null @@ -1,90 +0,0 @@ -# Microsoft Developer Studio Project File - Name="example" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=example - 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 "example.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 "example.mak" CFG="example - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "example - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "example - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -CPP=cwcl.exe -RSC=rc.exe - -!IF "$(CFG)" == "example - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "example___Win32_Release" -# PROP BASE Intermediate_Dir "example___Win32_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0xc09 /d "NDEBUG" -# ADD RSC /l 0xc09 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=cwlink.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 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:console /machine:I386 -# ADD LINK32 fsbanklibMT.lib wsock32.lib msacm32.lib user32.lib advapi32.lib winmm.lib ole32.lib comdlg32.lib shell32.lib comctl32.lib ..\..\api\lib\fmodvc.lib /nologo /subsystem:console /machine:I386 /out:"example.exe" - -!ELSEIF "$(CFG)" == "example - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "example___Win32_Debug" -# PROP BASE Intermediate_Dir "example___Win32_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0xc09 /d "_DEBUG" -# ADD RSC /l 0xc09 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=cwlink.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 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:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 fsbanklibMT.lib wsock32.lib msacm32.lib user32.lib advapi32.lib winmm.lib ole32.lib comdlg32.lib shell32.lib comctl32.lib ..\..\api\lib\fmodvc.lib /nologo /subsystem:console /debug /machine:I386 /out:"example.exe" /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "example - Win32 Release" -# Name "example - Win32 Debug" -# Begin Source File - -SOURCE=.\example.cpp -# End Source File -# End Target -# End Project diff --git a/#ThirdParty/fmodapi375win/tools/fsbanklib/fsbanklib.chm b/#ThirdParty/fmodapi375win/tools/fsbanklib/fsbanklib.chm deleted file mode 100644 index fab9b61..0000000 Binary files a/#ThirdParty/fmodapi375win/tools/fsbanklib/fsbanklib.chm and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/tools/fsbanklib/fsbanklib.h b/#ThirdParty/fmodapi375win/tools/fsbanklib/fsbanklib.h deleted file mode 100644 index c8eed6e..0000000 --- a/#ThirdParty/fmodapi375win/tools/fsbanklib/fsbanklib.h +++ /dev/null @@ -1,149 +0,0 @@ -#ifndef _FSBANKLIB_H -#define _FSBANKLIB_H - -/* -[ENUM] -[ - [DESCRIPTION] - Errorcode returned by all FSBank commands - - [SEE_ALSO] -] -*/ -typedef enum FSBANK_RESULT -{ - FSBANK_OK, - FSBANK_ERR_INIT, // Failed to initialize - FSBANK_ERR_UNINITIALIZED, // FSBank_Init hasnt been called yet. - FSBANK_ERR_FILE_DIRNOTFILE, // The target is an existing file. The specified build mode requires a destination directory, not a file. - FSBANK_ERR_FILE_DESTFILE, // Cannot create destination file. File may be in use or read only - FSBANK_ERR_FILE_WORKING, // Cannot create working file. File may be in use or read only - FSBANK_ERR_FILE_HEADER, // Cannot create destination c header file. File may be in use or read only - FSBANK_ERR_FILE_EOF, // End of file was encountered unexpectedly. - FSBANK_ERR_FILE_OS, // An operating system based file error was encountered. Could cause corruption or failure of FSB to be created. - FSBANK_ERR_INVALID_PARAM, // An invalid parameter was passed to this function - FSBANK_ERR_INVALID_FORMAT, // A dll was missing for this format or the environment wasnt set up properly. - FSBANK_ERR_CANCELLED, // The build process was cancelled during compilation by the user. - FSBANK_ERR_COMPILATION_ABORTED // Compilation aborted due to error -} FSBANK_RESULT; - - -/* -[ENUM] -[ - [DESCRIPTION] - Describes the target build type or method of creating the FSB file(s). - - [SEE_ALSO] - FSBank_Build -] -*/ -typedef enum FSBANK_BUILDMODE -{ - FSBANK_BUILDMODE_SINGLE = 0, // This creates a single FSB file with multiple sounds in it, or a standard sound bank. - FSBANK_BUILDMODE_MULTI, // This creates multiple FSB files with 1 sound in each. The destfile_or_dir parameter of FSBank_Build is then interpreted as a directory and not a file. - FSBANK_BUILDMODE_INTERLEAVED, // This creates a single FSB file with a single sound in it, but with all the source files interleaved/multiplexed into it so that when it is played, all files play at once, and are given a channel each. -} FSBANK_BUILDMODE; - - -/* -[ENUM] -[ - [DESCRIPTION] - Describes the target platform. - - [SEE_ALSO] - FSBank_Build -] -*/ -typedef enum FSBANK_PLATFORM -{ - FSBANK_PLATFORM_PS2 = 0, // Sony PlayStation 2 - FSBANK_PLATFORM_GC, // Nintendo GameCube - FSBANK_PLATFORM_XBOX, // Microsoft XBox - FSBANK_PLATFORM_CROSS, // Cross platform. Only PCM is truly supported on all platforms. - FSBANK_PLATFORM_MAX -} FSBANK_PLATFORM; - - -/* -[ENUM] -[ - [DESCRIPTION] - Describes the target format. - - [SEE_ALSO] - FSBank_Build -] -*/ -typedef enum FSBANK_FORMAT -{ - FSBANK_FORMAT_VAG = 0, // VAG (SPU2) (3.5:1) PlayStation 2 Only. Hardware decompression, no cpu hit. - FSBANK_FORMAT_GCADPCM, // GCADPCM (3.5:1) GameCube Only. Hardware decompression, no cpu hit. - FSBANK_FORMAT_XADPCM, // XADPCM (3.5:1) XBox only. Hardware decompression, no cpu hit. - FSBANK_FORMAT_PCM, // PCM (1:1) All Platforms. - FSBANK_FORMAT_SOURCE, // Retain original format. All platforms (except PlayStation 2 unless using pcm wav files). - FSBANK_FORMAT_IMAADPCM, // IMA ADPCM (3.5:1) All platforms except PlayStation 2. - FSBANK_FORMAT_MAX, -} FSBANK_FORMAT; - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Structure containing default values for various sample attributes. - - [SEE_ALSO] - FSBank_Build -] -*/ -typedef struct _FSBANK_SAMPLE_DEFAULTS -{ - float mindistance; // Minimum volume distance in "units" - float maxdistance; // Maximum volume distance in "units" - int deffreq; // Sample default speed in hz - int defvol; // Sample default volume - int defpan; // Sample default pan - int defpri; // Sample priority. 0 = low priority, 255=high priority - int varfreq; // Frequency variation in hz - int varvol; // Volume variation - int varpan; // Pan variation - unsigned int mode; // FSOUND_MODES bits. Bits allowed are FSOUND_LOOP_NORMAL, FSOUND_LOOP_BIDI, FSOUND_2D, FSOUND_HW2D and FSOUND_HW3D - -} FSBANK_SAMPLE_DEFAULTS; - - -typedef void (__stdcall *FSBANK_UPDATECALLBACK)(int index, int memused, void *userdata); -typedef void (__stdcall *FSBANK_DEBUGCALLBACK)(const char *debugstring, void *userdata); - - -#ifdef __cplusplus -extern "C" { -#endif - -FSBANK_RESULT FSBank_Init(); -FSBANK_RESULT FSBank_Close(); -FSBANK_RESULT FSBank_IsFormatAllowed(FSBANK_FORMAT format); -FSBANK_RESULT FSBank_Build(FSBANK_BUILDMODE buildmode, - FSBANK_FORMAT format, - FSBANK_PLATFORM platform, - int basicheaders, - const char *destfile_or_dir, - int numsrcfiles, - char **srcfile, - FSBANK_SAMPLE_DEFAULTS **defaults, - int dupdirstructure, - const char *srcdir, - int createincludes, - int abortonerror); -FSBANK_RESULT FSBank_SetUpdateCallback(FSBANK_UPDATECALLBACK callback, void *userdata); -FSBANK_RESULT FSBank_SetDebugCallback(FSBANK_DEBUGCALLBACK callback, void *userdata); -FSBANK_RESULT FSBank_SetBuildCancel(int cancel); -FSBANK_RESULT FSBank_GetBuildCancel(int *cancel); - -#ifdef __cplusplus -} -#endif - -#endif \ No newline at end of file diff --git a/#ThirdParty/fmodapi375win/tools/fsbanklib/fsbanklib.txt b/#ThirdParty/fmodapi375win/tools/fsbanklib/fsbanklib.txt deleted file mode 100644 index 54ffad2..0000000 --- a/#ThirdParty/fmodapi375win/tools/fsbanklib/fsbanklib.txt +++ /dev/null @@ -1,5 +0,0 @@ -FSBank library is for msvc or msvc compatible linkers only. - -fsbanklibMT.lib - fsbank library MULTITHREADED. (c runtime linked statically) -fsbanklibMTD.lib - fsbank library MULTITHREADED DLL. (c runtime linked dynamically) - diff --git a/#ThirdParty/fmodapi375win/tools/fsbanklib/fsbanklibMT.lib b/#ThirdParty/fmodapi375win/tools/fsbanklib/fsbanklibMT.lib deleted file mode 100644 index 7518cb2..0000000 Binary files a/#ThirdParty/fmodapi375win/tools/fsbanklib/fsbanklibMT.lib and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/tools/fsbanklib/fsbanklibMTD.lib b/#ThirdParty/fmodapi375win/tools/fsbanklib/fsbanklibMTD.lib deleted file mode 100644 index cdb24fb..0000000 Binary files a/#ThirdParty/fmodapi375win/tools/fsbanklib/fsbanklibMTD.lib and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/tools/fsbanklib/jbtennis.wav b/#ThirdParty/fmodapi375win/tools/fsbanklib/jbtennis.wav deleted file mode 100644 index 77e710c..0000000 Binary files a/#ThirdParty/fmodapi375win/tools/fsbanklib/jbtennis.wav and /dev/null differ diff --git a/#ThirdParty/fmodapi375win/tools/readme.txt b/#ThirdParty/fmodapi375win/tools/readme.txt deleted file mode 100644 index d784a2f..0000000 --- a/#ThirdParty/fmodapi375win/tools/readme.txt +++ /dev/null @@ -1,192 +0,0 @@ - - -------------------------------- - FMOD Sample Bank/Stream Compiler - v1.27 - Copyright Firelight Technologies 2002-2004. - -------------------------------- - -Index. ------- - -1. Introduction. -2. Using it to generate 1 FSB file, or multiple single FSB files! -3. Hit 'Build' and notice the RAM usage bar graph. -4. Error dialog box -5. Using FSB files in your program. - 5.1 As a static sample bank. - 5.2 For streaming. -6. Using list files -7. Command line options -8. Support - - - - -1. Introduction. ----------------- -This tool takes wav files, mp3 files, ogg files, aiff files etc, and converts them -to the .FSB format (FMOD Sample Bank). -It will compress them in the native format of the machine. - - -2. Using it to generate 1 FSB file, or multiple single FSB files! --------------------------------------------------------------- -If you look to the top of the dialog, you will see a menu item called 'Build Mode'. -In this you can tell FSBank to write out 1 packed FSB file with all your sounds in it, -or alternatively write out 1 FSB for each sound you provide. This is useful for streams. - -- The default mode is 'Generate Single FSB File' - -This means if you provide a source directory to compile from, it will compile every sound -in that directory structure recursively, into a single .FSB file. -This is mainly used for sample banks, or packing streams into a single file for indexed streaming. - -- The second mode type is 'Generate Multiple FSB Files' - -This mode means that for every sound in your specified source directory, it will generate -an equivalent FSB file in the specified destination directory. This would only realistically be -used for streams, as a sort of 'batch converter'. -It will build all files into the directory you specify by default. If you want to recreate -the directory structure from the source directory, click 'Rebuild source directory tree to -destination' - -- The third mode is 'Generate Single Interleaved FSB file' - -This mode means it will take all input files, and interleave them into one FSB file. -For example, a normal stereo stream is interleaved as LRLRLRLR etc. -This is what it would look like if you provided 2 mono files or 1 stereo file as the source. -If you specify more, for example 4 mono files, and a stereo file, the resulting FSB looks like -this : 123456123456123456. -What this means is multiple audio tracks can be played back as one stream, and seeking is eliminated. -Each channel within this multitrack stream can have its attributes modified (ie volume/pan) so you -can use this feature for interactive music, or mood based ambiences. Many other uses could be found. - - - - -3. Hit 'Build' and notice the RAM usage bar graph. ------------------------------------------------ -Press the big 'Build' button and it will start compiling. - -Notice the RAM usage bar graph below. If you intend to load the FSB into ram for sample -playback (not streamed), then you will have to make sure the graph does not go red. This -means you will have overflowed sound ram and you will not fit all of your sounds in. - -On PlayStation 2, SPU2 ram has 1,790kb available for sound if you are using full reverb. -If you uncheck 'Reverb Core0 enabled' or 'Reverb Core1 enabled' you gain 128k to give 1,918kb free. -If you uncheck 'Reverb Core1 enabled' and 'Reverb Core0 enabled' you gain 256k to give 2,046kb free. -Note disabling reverb has to be coupled in the code by using FSOUND_REVERB_FLAGS_CORE0 and/or -FSOUND_REVERB_FLAGS_CORE1 in the call to FSOUND_Init. - -If you intend to use the FSB file(s) for streaming purposes, ignore the ram usage warnings as -streams can be of unlimited size. - - - - -4. Error dialog box --------------------- - -When the build has completed, a list of warnings will appear. - - -'Memory for this platform has been exceeded' - -If your usage is intended for static loading into memory for sample playback. You have overrun -the hardware memory. -If you intend to use the file(s) for streaming then ignore this message. On PlayStation 2, Streams -use 4k of SPU2 memory if targeted for SPU2 (and not IOP). - - - - -5. Using FSB files in your program. ------------------------------------ - -5.1 As a static sample bank. ----------------------------- -To load a bank use FMUSIC_LoadSong. - -To get access to the individual samples (FSOUND_SAMPLE) use FMUSIC_GetSample. - -The C header contains #defines to reference the sound from your code with FMUSIC_GetSample. - -You can even preview a .FSB file from your program with FMUSIC_PlaySong! -It will simply play through all sounds in the bank sequentially and then stop. - -5.2 For streaming. ------------------- - -To open an FSB file as a stream use FSOUND_Stream_OpenFile. - -call FSOUND_Stream_Play to play the first stream in the FSB file. - -call FSOUND_Stream_SetSubStream to make the stream seek to the relevant file. -use the #defines generated by FSBank in this function. -calling this will stop the stream if it is already playing. - -FSOUND_Stream_SetSubStreamSentence can be used to 'stitch', or 'sentence' multiple substreams together. - - - - -6. Using list files ------------------------- - -You can specify a text file for the build source rather than a directory. This text file must contain -a list of the files you want to build into an FSB. Each file must start on a new line. You can also -specify sample defaults for each file in the list by appending them to the filename in a comma-seperated -list. Here's an example list file : - -jungle.wav -goonie.wav, deffreq=22050, defvol=128, defpan=128, defpri= 128, varfreq=2000, varvol=128 -freddo.wav, deffreq=44100, varfreq=4000, mindistance=500.0 -blarg.wav, fsound_2d, fsound_loop_normal - - -The defaults that you can specify are : - -deffreq Frequency in hz e.g. deffreq = 44100 -defvol Volume (0 - 255) e.g. defvol = 255 -defpan Pan (0 - 255) e.g. defpan = 128 -defpri Priority (0 - 255) e.g. defpri = 128 -varfreq Frequency variation in hz e.g. varfreq = 2000 -varvol Volume variation (0 - 255) e.g. varvol = 128 -varpan Pan variation (0 - 255) e.g. varpan = 64 -fsound_2d See FSOUND_2D mode bit e.g. fsound_2d -fsound_hw2d See FSOUND_HW2D mode bit e.g. fsound_hw2d -fsound_hw3d See FSOUND_HW3D mode bit e.g. fsound_hw3d -fsound_loop_normal See FSOUND_LOOP_NORMAL mode bit e.g. fsound_loop_normal -fsound_loop_bidi See FSOUND_LOOP_BIDI mode bit e.g. fsound_loop_bidi -mindistance Minimum volume distance in "units" (See FSOUND_Sample_SetMinMaxDistance) e.g. mindistance = 1.0 -maxdistance Maximum volume distance in "units" (See FSOUND_Sample_SetMinMaxDistance) e.g. maxdistance = 1000.0 - - - - -7. Command Line Options ------------------------- - -Usage: fsbank <-o dest> [-p ps2|gc|xbox|cross] [-f vag|gcadpcm|xadpcm|pcm|source] [-m s|m|i] [-d] [-r 0|1] [-h] [-b] [-?] [-a] - - -o dest Destination FSB file/directory - source Source directory or list file - -p ps2|gc|xbox|cross Target platform (default = cross) - -f vag|gcadpcm|xadpcm|pcm|source|adpcm Target format (default = pcm) - -m s|m|i Build mode : - s = Single FSB (default) - m = Multiple FSBs - i = single Interleaved FSB - -d Rebuild dir structure (Multiple FSB only) (default = off) - -r 0|1 Disable reverbcore 0 or 1 (ps2 only) (default = both enabled) - -h Hidden mode - don't display the FSBank window at all (default = off) - -b Use small headers (default = off) - -a Abort compilation if an error is encountered (default = off) - -? Display command line help - -OutputDebugString is used to display errors and progress while in hidden mode. - - -8. Support ----------- -Write to support@fmod.org for questions and help. diff --git a/#ThirdParty/libSDL/BUGS.txt b/#ThirdParty/libSDL/BUGS.txt deleted file mode 100644 index 7ef5538..0000000 --- a/#ThirdParty/libSDL/BUGS.txt +++ /dev/null @@ -1,16 +0,0 @@ - -Bugs are now managed in the SDL bug tracker, here: - - http://bugzilla.libsdl.org/ - -You may report bugs there, and search to see if a given issue has already - been reported, discussed, and maybe even fixed. - - -You may also find help on the SDL mailing list. Subscription information: - - http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org - -Bug reports are welcome here, but we really appreciate if you use Bugzilla, as - bugs discussed on the mailing list may be forgotten or missed. - diff --git a/#ThirdParty/libSDL/COPYING.txt b/#ThirdParty/libSDL/COPYING.txt deleted file mode 100644 index 04f14ee..0000000 --- a/#ThirdParty/libSDL/COPYING.txt +++ /dev/null @@ -1,20 +0,0 @@ - -Simple DirectMedia Layer -Copyright (C) 1997-2016 Sam Lantinga - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any damages -arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. - diff --git a/#ThirdParty/libSDL/README-SDL.txt b/#ThirdParty/libSDL/README-SDL.txt deleted file mode 100644 index 0630395..0000000 --- a/#ThirdParty/libSDL/README-SDL.txt +++ /dev/null @@ -1,13 +0,0 @@ - -Please distribute this file with the SDL runtime environment: - -The Simple DirectMedia Layer (SDL for short) is a cross-platform library -designed to make it easy to write multi-media software, such as games and -emulators. - -The Simple DirectMedia Layer library source code is available from: -http://www.libsdl.org/ - -This library is distributed under the terms of the zlib license: -http://www.zlib.net/zlib_license.html - diff --git a/#ThirdParty/libSDL/README.txt b/#ThirdParty/libSDL/README.txt deleted file mode 100644 index 84c335c..0000000 --- a/#ThirdParty/libSDL/README.txt +++ /dev/null @@ -1,21 +0,0 @@ - - Simple DirectMedia Layer - - (SDL) - - Version 2.0 - ---- -http://www.libsdl.org/ - -Simple DirectMedia Layer is a cross-platform development library designed -to provide low level access to audio, keyboard, mouse, joystick, and graphics -hardware via OpenGL and Direct3D. It is used by video playback software, -emulators, and popular games including Valve's award winning catalog -and many Humble Bundle games. - -More extensive documentation is available in the docs directory, starting -with README.md - -Enjoy! - Sam Lantinga (slouken@libsdl.org) diff --git a/#ThirdParty/libSDL/WhatsNew.txt b/#ThirdParty/libSDL/WhatsNew.txt deleted file mode 100644 index 698ebf7..0000000 --- a/#ThirdParty/libSDL/WhatsNew.txt +++ /dev/null @@ -1,199 +0,0 @@ - -This is a list of major changes in SDL's version history. - ---------------------------------------------------------------------------- -2.0.4: ---------------------------------------------------------------------------- - -General: -* Added support for web applications using Emscripten, see docs/README-emscripten.md for more information -* Added support for web applications using Native Client (NaCl), see docs/README-nacl.md for more information -* Added an API to queue audio instead of using the audio callback: - SDL_QueueAudio(), SDL_GetQueuedAudioSize(), SDL_ClearQueuedAudio() -* Added events for audio device hot plug support: - SDL_AUDIODEVICEADDED, SDL_AUDIODEVICEREMOVED -* Added SDL_PointInRect() -* Added SDL_HasAVX2() to detect CPUs with AVX2 support -* Added SDL_SetWindowHitTest() to let apps treat parts of their SDL window like traditional window decorations (drag areas, resize areas) -* Added SDL_GetGrabbedWindow() to get the window that currently has input grab, if any -* Added SDL_RenderIsClipEnabled() to tell whether clipping is currently enabled in a renderer -* Added SDL_CaptureMouse() to capture the mouse to get events while the mouse is not in your window -* Added SDL_WarpMouseGlobal() to warp the mouse cursor in global screen space -* Added SDL_GetGlobalMouseState() to get the current mouse state outside of an SDL window -* Added a direction field to mouse wheel events to tell whether they are flipped (natural) or not -* Added GL_CONTEXT_RELEASE_BEHAVIOR GL attribute (maps to [WGL|GLX]_ARB_context_flush_control extension) -* Added EGL_KHR_create_context support to allow OpenGL ES version selection on some platforms -* Added NV12 and NV21 YUV texture support for OpenGL and OpenGL ES 2.0 renderers -* Added a Vivante video driver that is used on various SoC platforms -* Added an event SDL_RENDER_DEVICE_RESET that is sent from the D3D renderers when the D3D device is lost, and from Android's event loop when the GLES context had to be recreated -* Added a hint SDL_HINT_NO_SIGNAL_HANDLERS to disable SDL's built in signal handling -* Added a hint SDL_HINT_THREAD_STACK_SIZE to set the stack size of SDL's threads -* Added SDL_sqrtf(), SDL_tan(), and SDL_tanf() to the stdlib routines -* Improved support for WAV and BMP files with unusual chunks in them -* Renamed SDL_assert_data to SDL_AssertData and SDL_assert_state to SDL_AssertState -* Added a hint SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN to prevent window interaction while cursor is hidden -* Added SDL_GetDisplayDPI() to get the DPI information for a display -* Added SDL_JoystickCurrentPowerLevel() to get the battery level of a joystick -* Added SDL_JoystickFromInstanceID(), as a helper function, to get the SDL_Joystick* that an event is referring to. -* Added SDL_GameControllerFromInstanceID(), as a helper function, to get the SDL_GameController* that an event is referring to. - -Windows: -* Added support for Windows Phone 8.1 and Windows 10/UWP (Universal Windows Platform) -* Timer resolution is now 1 ms by default, adjustable with the SDL_HINT_TIMER_RESOLUTION hint -* SDLmain no longer depends on the C runtime, so you can use the same .lib in both Debug and Release builds -* Added SDL_SetWindowsMessageHook() to set a function to be called for every windows message before TranslateMessage() -* Added a hint SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP to control whether SDL_PumpEvents() processes the Windows message loop -* You can distinguish between real mouse and touch events by looking for SDL_TOUCH_MOUSEID in the mouse event "which" field -* SDL_SysWMinfo now contains the window HDC -* Added support for Unicode command line options -* Prevent beeping when Alt-key combos are pressed -* SDL_SetTextInputRect() re-positions the OS-rendered IME -* Added a hint SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 to prevent generating SDL_WINDOWEVENT_CLOSE events when Alt-F4 is pressed -* Added a hint SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING to use the old axis and button mapping for XInput devices (deprecated) - -Mac OS X: -* Implemented drag-and-drop support -* Improved joystick hot-plug detection -* The SDL_WINDOWEVENT_EXPOSED window event is triggered in the appropriate situations -* Fixed relative mouse mode when the application loses/regains focus -* Fixed bugs related to transitioning to and from Spaces-aware fullscreen-desktop mode -* Fixed the refresh rate of display modes -* SDL_SysWMInfo is now ARC-compatible -* Added a hint SDL_HINT_MAC_BACKGROUND_APP to prevent forcing the application to become a foreground process - -Linux: -* Enabled building with Mir and Wayland support by default. -* Added IBus IME support -* Added a hint SDL_HINT_IME_INTERNAL_EDITING to control whether IBus should handle text editing internally instead of sending SDL_TEXTEDITING events -* Added a hint SDL_HINT_VIDEO_X11_NET_WM_PING to allow disabling _NET_WM_PING protocol handling in SDL_CreateWindow() -* Added support for multiple audio devices when using Pulseaudio -* Fixed duplicate mouse events when using relative mouse motion - -iOS: -* Added support for iOS 8 -* The SDL_WINDOW_ALLOW_HIGHDPI window flag now enables high-dpi support, and SDL_GL_GetDrawableSize() or SDL_GetRendererOutputSize() gets the window resolution in pixels -* SDL_GetWindowSize() and display mode sizes are in the "DPI-independent points" / "screen coordinates" coordinate space rather than pixels (matches OS X behavior) -* Added native resolution support for the iPhone 6 Plus -* Added support for MFi game controllers -* Added support for the hint SDL_HINT_ACCELEROMETER_AS_JOYSTICK -* Added sRGB OpenGL ES context support on iOS 7+ -* Added support for SDL_DisableScreenSaver(), SDL_EnableScreenSaver() and the hint SDL_HINT_VIDEO_ALLOW_SCREENSAVER -* SDL_SysWMinfo now contains the OpenGL ES framebuffer and color renderbuffer objects used by the window's active GLES view -* Fixed various rotation and orientation issues -* Fixed memory leaks - -Android: -* Added a hint SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH to prevent mouse events from being registered as touch events -* Added hints SDL_HINT_ANDROID_APK_EXPANSION_MAIN_FILE_VERSION and SDL_HINT_ANDROID_APK_EXPANSION_PATCH_FILE_VERSION -* Added support for SDL_DisableScreenSaver(), SDL_EnableScreenSaver() and the hint SDL_HINT_VIDEO_ALLOW_SCREENSAVER -* Added support for SDL_ShowMessageBox() and SDL_ShowSimpleMessageBox() - -Raspberry Pi: -* Added support for the Raspberry Pi 2 - - ---------------------------------------------------------------------------- -2.0.3: ---------------------------------------------------------------------------- - -Mac OS X: -* Fixed creating an OpenGL context by default on Mac OS X 10.6 - - ---------------------------------------------------------------------------- -2.0.2: ---------------------------------------------------------------------------- -General: -* Added SDL_GL_ResetAttributes() to reset OpenGL attributes to default values -* Added an API to load a database of game controller mappings from a file: - SDL_GameControllerAddMappingsFromFile(), SDL_GameControllerAddMappingsFromRW() -* Added game controller mappings for the PS4 and OUYA controllers -* Added SDL_GetDefaultAssertionHandler() and SDL_GetAssertionHandler() -* Added SDL_DetachThread() -* Added SDL_HasAVX() to determine if the CPU has AVX features -* Added SDL_vsscanf(), SDL_acos(), and SDL_asin() to the stdlib routines -* EGL can now create/manage OpenGL and OpenGL ES 1.x/2.x contexts, and share - them using SDL_GL_SHARE_WITH_CURRENT_CONTEXT -* Added a field "clicks" to the mouse button event which records whether the event is a single click, double click, etc. -* The screensaver is now disabled by default, and there is a hint SDL_HINT_VIDEO_ALLOW_SCREENSAVER that can change that behavior. -* Added a hint SDL_HINT_MOUSE_RELATIVE_MODE_WARP to specify whether mouse relative mode should be emulated using mouse warping. -* testgl2 does not need to link with libGL anymore -* Added testgles2 test program to demonstrate working with OpenGL ES 2.0 -* Added controllermap test program to visually map a game controller - -Windows: -* Support for OpenGL ES 2.x contexts using either WGL or EGL (natively via - the driver or emulated through ANGLE) -* Added a hint SDL_HINT_VIDEO_WIN_D3DCOMPILER to specify which D3D shader compiler to use for OpenGL ES 2 support through ANGLE -* Added a hint SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT that is useful when creating multiple windows that should share the same OpenGL context. -* Added an event SDL_RENDER_TARGETS_RESET that is sent when D3D9 render targets are reset after the device has been restored. - -Mac OS X: -* Added a hint SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK to control whether Ctrl+click should be treated as a right click on Mac OS X. This is off by default. - -Linux: -* Fixed fullscreen and focused behavior when receiving NotifyGrab events -* Added experimental Wayland and Mir support, disabled by default - -Android: -* Joystick support (minimum SDK version required to build SDL is now 12, - the required runtime version remains at 10, but on such devices joystick - support won't be available). -* Hotplugging support for joysticks -* Added a hint SDL_HINT_ACCELEROMETER_AS_JOYSTICK to control whether the accelerometer should be listed as a 3 axis joystick, which it will by default. - - ---------------------------------------------------------------------------- -2.0.1: ---------------------------------------------------------------------------- - -General: -* Added an API to get common filesystem paths in SDL_filesystem.h: - SDL_GetBasePath(), SDL_GetPrefPath() -* Added an API to do optimized YV12 and IYUV texture updates: - SDL_UpdateYUVTexture() -* Added an API to get the amount of RAM on the system: - SDL_GetSystemRAM() -* Added a macro to perform timestamp comparisons with SDL_GetTicks(): - SDL_TICKS_PASSED() -* Dramatically improved OpenGL ES 2.0 rendering performance -* Added OpenGL attribute SDL_GL_FRAMEBUFFER_SRGB_CAPABLE - -Windows: -* Created a static library configuration for the Visual Studio 2010 project -* Added a hint to create the Direct3D device with support for multi-threading: - SDL_HINT_RENDER_DIRECT3D_THREADSAFE -* Added a function to get the D3D9 adapter index for a display: - SDL_Direct3D9GetAdapterIndex() -* Added a function to get the D3D9 device for a D3D9 renderer: - SDL_RenderGetD3D9Device() -* Fixed building SDL with the mingw32 toolchain (mingw-w64 is preferred) -* Fixed crash when using two XInput controllers at the same time -* Fixed detecting a mixture of XInput and DirectInput controllers -* Fixed clearing a D3D render target larger than the window -* Improved support for format specifiers in SDL_snprintf() - -Mac OS X: -* Added support for retina displays: - Create your window with the SDL_WINDOW_ALLOW_HIGHDPI flag, and then use SDL_GL_GetDrawableSize() to find the actual drawable size. You are responsible for scaling mouse and drawing coordinates appropriately. -* Fixed mouse warping in fullscreen mode -* Right mouse click is emulated by holding the Ctrl key while left clicking - -Linux: -* Fixed float audio support with the PulseAudio driver -* Fixed missing line endpoints in the OpenGL renderer on some drivers -* X11 symbols are no longer defined to avoid collisions when linking statically - -iOS: -* Fixed status bar visibility on iOS 7 -* Flipped the accelerometer Y axis to match expected values - -Android: -IMPORTANT: You MUST get the updated SDLActivity.java to match C code -* Moved EGL initialization to native code -* Fixed the accelerometer axis rotation relative to the device rotation -* Fixed race conditions when handling the EGL context on pause/resume -* Touch devices are available for enumeration immediately after init - -Raspberry Pi: -* Added support for the Raspberry Pi, see README-raspberrypi.txt for details diff --git a/#ThirdParty/libSDL/Wiki.url b/#ThirdParty/libSDL/Wiki.url deleted file mode 100644 index 8b77ceb..0000000 --- a/#ThirdParty/libSDL/Wiki.url +++ /dev/null @@ -1,5 +0,0 @@ -[{000214A0-0000-0000-C000-000000000046}] -Prop3=19,2 -[InternetShortcut] -IDList= -URL=http://wiki.libsdl.org/FrontPage diff --git a/#ThirdParty/libSDL/docs/README-android.md b/#ThirdParty/libSDL/docs/README-android.md deleted file mode 100644 index a4b3821..0000000 --- a/#ThirdParty/libSDL/docs/README-android.md +++ /dev/null @@ -1,464 +0,0 @@ -Android -================================================================================ - -Requirements: - -Android SDK (version 12 or later) -http://developer.android.com/sdk/index.html - -Android NDK r7 or later -http://developer.android.com/tools/sdk/ndk/index.html - -Minimum API level supported by SDL: 10 (Android 2.3.3) -Joystick support is available for API level >=12 devices. - -================================================================================ - How the port works -================================================================================ - -- Android applications are Java-based, optionally with parts written in C -- As SDL apps are C-based, we use a small Java shim that uses JNI to talk to - the SDL library -- This means that your application C code must be placed inside an Android - Java project, along with some C support code that communicates with Java -- This eventually produces a standard Android .apk package - -The Android Java code implements an "Activity" and can be found in: -android-project/src/org/libsdl/app/SDLActivity.java - -The Java code loads your game code, the SDL shared library, and -dispatches to native functions implemented in the SDL library: -src/core/android/SDL_android.c - -Your project must include some glue code that starts your main() routine: -src/main/android/SDL_android_main.c - - -================================================================================ - Building an app -================================================================================ - -For simple projects you can use the script located at build-scripts/androidbuild.sh - -There's two ways of using it: - - androidbuild.sh com.yourcompany.yourapp < sources.list - androidbuild.sh com.yourcompany.yourapp source1.c source2.c ...sourceN.c - -sources.list should be a text file with a source file name in each line -Filenames should be specified relative to the current directory, for example if -you are in the build-scripts directory and want to create the testgles.c test, you'll -run: - - ./androidbuild.sh org.libsdl.testgles ../test/testgles.c - -One limitation of this script is that all sources provided will be aggregated into -a single directory, thus all your source files should have a unique name. - -Once the project is complete the script will tell you where the debug APK is located. -If you want to create a signed release APK, you can use the project created by this -utility to generate it. - -Finally, a word of caution: re running androidbuild.sh wipes any changes you may have -done in the build directory for the app! - - -For more complex projects, follow these instructions: - -1. Copy the android-project directory wherever you want to keep your projects - and rename it to the name of your project. -2. Move or symlink this SDL directory into the /jni directory -3. Edit /jni/src/Android.mk to include your source files -4. Run 'ndk-build' (a script provided by the NDK). This compiles the C source - -If you want to use the Eclipse IDE, skip to the Eclipse section below. - -5. Create /local.properties and use that to point to the Android SDK directory, by writing a line with the following form: - - sdk.dir=PATH_TO_ANDROID_SDK - -6. Run 'ant debug' in android/project. This compiles the .java and eventually - creates a .apk with the native code embedded -7. 'ant debug install' will push the apk to the device or emulator (if connected) - -Here's an explanation of the files in the Android project, so you can customize them: - - android-project/ - AndroidManifest.xml - package manifest. Among others, it contains the class name - of the main Activity and the package name of the application. - build.properties - empty - build.xml - build description file, used by ant. The actual application name - is specified here. - default.properties - holds the target ABI for the application, android-10 and up - project.properties - holds the target ABI for the application, android-10 and up - local.properties - holds the SDK path, you should change this to the path to your SDK - jni/ - directory holding native code - jni/Android.mk - Android makefile that can call recursively the Android.mk files - in all subdirectories - jni/SDL/ - (symlink to) directory holding the SDL library files - jni/SDL/Android.mk - Android makefile for creating the SDL shared library - jni/src/ - directory holding your C/C++ source - jni/src/Android.mk - Android makefile that you should customize to include your - source code and any library references - res/ - directory holding resources for your application - res/drawable-* - directories holding icons for different phone hardware. Could be - one dir called "drawable". - res/layout/main.xml - Usually contains a file main.xml, which declares the screen layout. - We don't need it because we use the SDL video output. - res/values/strings.xml - strings used in your application, including the application name - shown on the phone. - src/org/libsdl/app/SDLActivity.java - the Java class handling the initialization and binding - to SDL. Be very careful changing this, as the SDL library relies - on this implementation. - - -================================================================================ - Build an app with static linking of libSDL -================================================================================ - -This build uses the Android NDK module system. - -Instructions: -1. Copy the android-project directory wherever you want to keep your projects - and rename it to the name of your project. -2. Rename /jni/src/Android_static.mk to /jni/src/Android.mk - (overwrite the existing one) -3. Edit /jni/src/Android.mk to include your source files -4. create and export an environment variable named NDK_MODULE_PATH that points - to the parent directory of this SDL directory. e.g.: - - export NDK_MODULE_PATH="$PWD"/.. - -5. Edit /src/org/libsdl/app/SDLActivity.java and remove the call to - System.loadLibrary("SDL2"). -6. Run 'ndk-build' (a script provided by the NDK). This compiles the C source - - -================================================================================ - Customizing your application name -================================================================================ - -To customize your application name, edit AndroidManifest.xml and replace -"org.libsdl.app" with an identifier for your product package. - -Then create a Java class extending SDLActivity and place it in a directory -under src matching your package, e.g. - - src/com/gamemaker/game/MyGame.java - -Here's an example of a minimal class file: - - --- MyGame.java -------------------------- - package com.gamemaker.game; - - import org.libsdl.app.SDLActivity; - - /** - * A sample wrapper class that just calls SDLActivity - */ - - public class MyGame extends SDLActivity { } - - ------------------------------------------ - -Then replace "SDLActivity" in AndroidManifest.xml with the name of your -class, .e.g. "MyGame" - -================================================================================ - Customizing your application icon -================================================================================ - -Conceptually changing your icon is just replacing the "ic_launcher.png" files in -the drawable directories under the res directory. There are four directories for -different screen sizes. These can be replaced with one dir called "drawable", -containing an icon file "ic_launcher.png" with dimensions 48x48 or 72x72. - -You may need to change the name of your icon in AndroidManifest.xml to match -this icon filename. - -================================================================================ - Loading assets -================================================================================ - -Any files you put in the "assets" directory of your android-project directory -will get bundled into the application package and you can load them using the -standard functions in SDL_rwops.h. - -There are also a few Android specific functions that allow you to get other -useful paths for saving and loading data: -* SDL_AndroidGetInternalStoragePath() -* SDL_AndroidGetExternalStorageState() -* SDL_AndroidGetExternalStoragePath() - -See SDL_system.h for more details on these functions. - -The asset packaging system will, by default, compress certain file extensions. -SDL includes two asset file access mechanisms, the preferred one is the so -called "File Descriptor" method, which is faster and doesn't involve the Dalvik -GC, but given this method does not work on compressed assets, there is also the -"Input Stream" method, which is automatically used as a fall back by SDL. You -may want to keep this fact in mind when building your APK, specially when large -files are involved. -For more information on which extensions get compressed by default and how to -disable this behaviour, see for example: - -http://ponystyle.com/blog/2010/03/26/dealing-with-asset-compression-in-android-apps/ - -================================================================================ - Pause / Resume behaviour -================================================================================ - -If SDL is compiled with SDL_ANDROID_BLOCK_ON_PAUSE defined (the default), -the event loop will block itself when the app is paused (ie, when the user -returns to the main Android dashboard). Blocking is better in terms of battery -use, and it allows your app to spring back to life instantaneously after resume -(versus polling for a resume message). - -Upon resume, SDL will attempt to restore the GL context automatically. -In modern devices (Android 3.0 and up) this will most likely succeed and your -app can continue to operate as it was. - -However, there's a chance (on older hardware, or on systems under heavy load), -where the GL context can not be restored. In that case you have to listen for -a specific message, (which is not yet implemented!) and restore your textures -manually or quit the app (which is actually the kind of behaviour you'll see -under iOS, if the OS can not restore your GL context it will just kill your app) - -================================================================================ - Threads and the Java VM -================================================================================ - -For a quick tour on how Linux native threads interoperate with the Java VM, take -a look here: http://developer.android.com/guide/practices/jni.html - -If you want to use threads in your SDL app, it's strongly recommended that you -do so by creating them using SDL functions. This way, the required attach/detach -handling is managed by SDL automagically. If you have threads created by other -means and they make calls to SDL functions, make sure that you call -Android_JNI_SetupThread() before doing anything else otherwise SDL will attach -your thread automatically anyway (when you make an SDL call), but it'll never -detach it. - -================================================================================ - Using STL -================================================================================ - -You can use STL in your project by creating an Application.mk file in the jni -folder and adding the following line: - - APP_STL := stlport_static - -For more information check out CPLUSPLUS-SUPPORT.html in the NDK documentation. - -================================================================================ - Additional documentation -================================================================================ - -The documentation in the NDK docs directory is very helpful in understanding the -build process and how to work with native code on the Android platform. - -The best place to start is with docs/OVERVIEW.TXT - - -================================================================================ - Using Eclipse -================================================================================ - -First make sure that you've installed Eclipse and the Android extensions as described here: - http://developer.android.com/tools/sdk/eclipse-adt.html - -Once you've copied the SDL android project and customized it, you can create an Eclipse project from it: - * File -> New -> Other - * Select the Android -> Android Project wizard and click Next - * Enter the name you'd like your project to have - * Select "Create project from existing source" and browse for your project directory - * Make sure the Build Target is set to Android 3.1 (API 12) - * Click Finish - - -================================================================================ - Using the emulator -================================================================================ - -There are some good tips and tricks for getting the most out of the -emulator here: http://developer.android.com/tools/devices/emulator.html - -Especially useful is the info on setting up OpenGL ES 2.0 emulation. - -Notice that this software emulator is incredibly slow and needs a lot of disk space. -Using a real device works better. - -================================================================================ - Troubleshooting -================================================================================ - -You can create and run an emulator from the Eclipse IDE: - * Window -> Android SDK and AVD Manager - -You can see if adb can see any devices with the following command: - - adb devices - -You can see the output of log messages on the default device with: - - adb logcat - -You can push files to the device with: - - adb push local_file remote_path_and_file - -You can push files to the SD Card at /sdcard, for example: - - adb push moose.dat /sdcard/moose.dat - -You can see the files on the SD card with a shell command: - - adb shell ls /sdcard/ - -You can start a command shell on the default device with: - - adb shell - -You can remove the library files of your project (and not the SDL lib files) with: - - ndk-build clean - -You can do a build with the following command: - - ndk-build - -You can see the complete command line that ndk-build is using by passing V=1 on the command line: - - ndk-build V=1 - -If your application crashes in native code, you can use addr2line to convert the -addresses in the stack trace to lines in your code. - -For example, if your crash looks like this: - - I/DEBUG ( 31): signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 400085d0 - I/DEBUG ( 31): r0 00000000 r1 00001000 r2 00000003 r3 400085d4 - I/DEBUG ( 31): r4 400085d0 r5 40008000 r6 afd41504 r7 436c6a7c - I/DEBUG ( 31): r8 436c6b30 r9 435c6fb0 10 435c6f9c fp 4168d82c - I/DEBUG ( 31): ip 8346aff0 sp 436c6a60 lr afd1c8ff pc afd1c902 cpsr 60000030 - I/DEBUG ( 31): #00 pc 0001c902 /system/lib/libc.so - I/DEBUG ( 31): #01 pc 0001ccf6 /system/lib/libc.so - I/DEBUG ( 31): #02 pc 000014bc /data/data/org.libsdl.app/lib/libmain.so - I/DEBUG ( 31): #03 pc 00001506 /data/data/org.libsdl.app/lib/libmain.so - -You can see that there's a crash in the C library being called from the main code. -I run addr2line with the debug version of my code: - - arm-eabi-addr2line -C -f -e obj/local/armeabi/libmain.so - -and then paste in the number after "pc" in the call stack, from the line that I care about: -000014bc - -I get output from addr2line showing that it's in the quit function, in testspriteminimal.c, on line 23. - -You can add logging to your code to help show what's happening: - - #include - - __android_log_print(ANDROID_LOG_INFO, "foo", "Something happened! x = %d", x); - -If you need to build without optimization turned on, you can create a file called -"Application.mk" in the jni directory, with the following line in it: - - APP_OPTIM := debug - - -================================================================================ - Memory debugging -================================================================================ - -The best (and slowest) way to debug memory issues on Android is valgrind. -Valgrind has support for Android out of the box, just grab code using: - - svn co svn://svn.valgrind.org/valgrind/trunk valgrind - -... and follow the instructions in the file README.android to build it. - -One thing I needed to do on Mac OS X was change the path to the toolchain, -and add ranlib to the environment variables: -export RANLIB=$NDKROOT/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin/arm-linux-androideabi-ranlib - -Once valgrind is built, you can create a wrapper script to launch your -application with it, changing org.libsdl.app to your package identifier: - - --- start_valgrind_app ------------------- - #!/system/bin/sh - export TMPDIR=/data/data/org.libsdl.app - exec /data/local/Inst/bin/valgrind --log-file=/sdcard/valgrind.log --error-limit=no $* - ------------------------------------------ - -Then push it to the device: - - adb push start_valgrind_app /data/local - -and make it executable: - - adb shell chmod 755 /data/local/start_valgrind_app - -and tell Android to use the script to launch your application: - - adb shell setprop wrap.org.libsdl.app "logwrapper /data/local/start_valgrind_app" - -If the setprop command says "could not set property", it's likely that -your package name is too long and you should make it shorter by changing -AndroidManifest.xml and the path to your class file in android-project/src - -You can then launch your application normally and waaaaaaaiiittt for it. -You can monitor the startup process with the logcat command above, and -when it's done (or even while it's running) you can grab the valgrind -output file: - - adb pull /sdcard/valgrind.log - -When you're done instrumenting with valgrind, you can disable the wrapper: - - adb shell setprop wrap.org.libsdl.app "" - -================================================================================ - Why is API level 10 the minimum required? -================================================================================ - -API level 10 is the minimum required level at runtime (that is, on the device) -because SDL requires some functionality for running not -available on older devices. Since the incorporation of joystick support into SDL, -the minimum SDK required to *build* SDL is version 12. Devices running API levels -10-11 are still supported, only with the joystick functionality disabled. - -Support for native OpenGL ES and ES2 applications was introduced in the NDK for -API level 4 and 8. EGL was made a stable API in the NDK for API level 9, which -has since then been obsoleted, with the recommendation to developers to bump the -required API level to 10. -As of this writing, according to http://developer.android.com/about/dashboards/index.html -about 90% of the Android devices accessing Google Play support API level 10 or -higher (March 2013). - -================================================================================ - A note regarding the use of the "dirty rectangles" rendering technique -================================================================================ - -If your app uses a variation of the "dirty rectangles" rendering technique, -where you only update a portion of the screen on each frame, you may notice a -variety of visual glitches on Android, that are not present on other platforms. -This is caused by SDL's use of EGL as the support system to handle OpenGL ES/ES2 -contexts, in particular the use of the eglSwapBuffers function. As stated in the -documentation for the function "The contents of ancillary buffers are always -undefined after calling eglSwapBuffers". -Setting the EGL_SWAP_BEHAVIOR attribute of the surface to EGL_BUFFER_PRESERVED -is not possible for SDL as it requires EGL 1.4, available only on the API level -17+, so the only workaround available on this platform is to redraw the entire -screen each frame. - -Reference: http://www.khronos.org/registry/egl/specs/EGLTechNote0001.html - -================================================================================ - Known issues -================================================================================ - -- The number of buttons reported for each joystick is hardcoded to be 36, which -is the current maximum number of buttons Android can report. - diff --git a/#ThirdParty/libSDL/docs/README-cmake.md b/#ThirdParty/libSDL/docs/README-cmake.md deleted file mode 100644 index 5b440c5..0000000 --- a/#ThirdParty/libSDL/docs/README-cmake.md +++ /dev/null @@ -1,32 +0,0 @@ -CMake -================================================================================ -(www.cmake.org) - -SDL's build system was traditionally based on autotools. Over time, this -approach has suffered from several issues across the different supported -platforms. -To solve these problems, a new build system based on CMake is under development. -It works in parallel to the legacy system, so users can experiment with it -without complication. -While still experimental, the build system should be usable on the following -platforms: - -* FreeBSD -* Linux -* VS.NET 2010 -* MinGW and Msys -* OS X with support for XCode - - -================================================================================ -Usage -================================================================================ - -Assuming the source for SDL is located at ~/sdl - - cd ~ - mkdir build - cd build - cmake ../sdl - -This will build the static and dynamic versions of SDL in the ~/build directory. diff --git a/#ThirdParty/libSDL/docs/README-directfb.md b/#ThirdParty/libSDL/docs/README-directfb.md deleted file mode 100644 index 7df8bb8..0000000 --- a/#ThirdParty/libSDL/docs/README-directfb.md +++ /dev/null @@ -1,107 +0,0 @@ -DirectFB -======== - -Supports: - -- Hardware YUV overlays -- OpenGL - software only -- 2D/3D accelerations (depends on directfb driver) -- multiple displays -- windows - -What you need: - -* DirectFB 1.0.1, 1.2.x, 1.3.0 -* Kernel-Framebuffer support: required: vesafb, radeonfb .... -* Mesa 7.0.x - optional for OpenGL - -/etc/directfbrc - -This file should contain the following lines to make -your joystick work and avoid crashes: ------------------------- -disable-module=joystick -disable-module=cle266 -disable-module=cyber5k -no-linux-input-grab ------------------------- - -To disable to use x11 backend when DISPLAY variable is found use - -export SDL_DIRECTFB_X11_CHECK=0 - -To disable the use of linux input devices, i.e. multimice/multikeyboard support, -use - -export SDL_DIRECTFB_LINUX_INPUT=0 - -To use hardware accelerated YUV-overlays for YUV-textures, use: - -export SDL_DIRECTFB_YUV_DIRECT=1 - -This is disabled by default. It will only support one -YUV texture, namely the first. Every other YUV texture will be -rendered in software. - -In addition, you may use (directfb-1.2.x) - -export SDL_DIRECTFB_YUV_UNDERLAY=1 - -to make the YUV texture an underlay. This will make the cursor to -be shown. - -Simple Window Manager -===================== - -The driver has support for a very, very basic window manager you may -want to use when running with "wm=default". Use - -export SDL_DIRECTFB_WM=1 - -to enable basic window borders. In order to have the window title rendered, -you need to have the following font installed: - -/usr/share/fonts/truetype/freefont/FreeSans.ttf - -OpenGL Support -============== - -The following instructions will give you *software* OpenGL. However this -works at least on all directfb supported platforms. - -As of this writing 20100802 you need to pull Mesa from git and do the following: - ------------------------- -git clone git://anongit.freedesktop.org/git/mesa/mesa -cd mesa -git checkout 2c9fdaf7292423c157fc79b5ce43f0f199dd753a ------------------------- - -Edit configs/linux-directfb so that the Directories-section looks like ------------------------- -# Directories -SRC_DIRS = mesa glu -GLU_DIRS = sgi -DRIVER_DIRS = directfb -PROGRAM_DIRS = ------------------------- - -make linux-directfb -make - -echo Installing - please enter sudo pw. - -sudo make install INSTALL_DIR=/usr/local/dfb_GL -cd src/mesa/drivers/directfb -make -sudo make install INSTALL_DIR=/usr/local/dfb_GL ------------------------- - -To run the SDL - testprograms: - -export SDL_VIDEODRIVER=directfb -export LD_LIBRARY_PATH=/usr/local/dfb_GL/lib -export LD_PRELOAD=/usr/local/dfb_GL/libGL.so.7 - -./testgl - diff --git a/#ThirdParty/libSDL/docs/README-dynapi.md b/#ThirdParty/libSDL/docs/README-dynapi.md deleted file mode 100644 index bfaecb3..0000000 --- a/#ThirdParty/libSDL/docs/README-dynapi.md +++ /dev/null @@ -1,130 +0,0 @@ -Dynamic API -================================================================================ -Originally posted by Ryan at: - https://plus.google.com/103391075724026391227/posts/TB8UfnDYu4U - -Background: - -- The Steam Runtime has (at least in theory) a really kick-ass build of SDL2, - but developers are shipping their own SDL2 with individual Steam games. - These games might stop getting updates, but a newer SDL2 might be needed later. - Certainly we'll always be fixing bugs in SDL, even if a new video target isn't - ever needed, and these fixes won't make it to a game shipping its own SDL. -- Even if we replace the SDL2 in those games with a compatible one, that is to - say, edit a developer's Steam depot (yuck!), there are developers that are - statically linking SDL2 that we can't do this for. We can't even force the - dynamic loader to ignore their SDL2 in this case, of course. -- If you don't ship an SDL2 with the game in some form, people that disabled the - Steam Runtime, or just tried to run the game from the command line instead of - Steam might find themselves unable to run the game, due to a missing dependency. -- If you want to ship on non-Steam platforms like GOG or Humble Bundle, or target - generic Linux boxes that may or may not have SDL2 installed, you have to ship - the library or risk a total failure to launch. So now, you might have to have - a non-Steam build plus a Steam build (that is, one with and one without SDL2 - included), which is inconvenient if you could have had one universal build - that works everywhere. -- We like the zlib license, but the biggest complaint from the open source - community about the license change is the static linking. The LGPL forced this - as a legal, not technical issue, but zlib doesn't care. Even those that aren't - concerned about the GNU freedoms found themselves solving the same problems: - swapping in a newer SDL to an older game often times can save the day. - Static linking stops this dead. - -So here's what we did: - -SDL now has, internally, a table of function pointers. So, this is what SDL_Init -now looks like: - - UInt32 SDL_Init(Uint32 flags) - { - return jump_table.SDL_Init(flags); - } - -Except that is all done with a bunch of macro magic so we don't have to maintain -every one of these. - -What is jump_table.SDL_init()? Eventually, that's a function pointer of the real -SDL_Init() that you've been calling all this time. But at startup, it looks more -like this: - - Uint32 SDL_Init_DEFAULT(Uint32 flags) - { - SDL_InitDynamicAPI(); - return jump_table.SDL_Init(flags); - } - -SDL_InitDynamicAPI() fills in jump_table with all the actual SDL function -pointers, which means that this _DEFAULT function never gets called again. -First call to any SDL function sets the whole thing up. - -So you might be asking, what was the value in that? Isn't this what the operating -system's dynamic loader was supposed to do for us? Yes, but now we've got this -level of indirection, we can do things like this: - - export SDL_DYNAMIC_API=/my/actual/libSDL-2.0.so.0 - ./MyGameThatIsStaticallyLinkedToSDL2 - -And now, this game that is staticallly linked to SDL, can still be overridden -with a newer, or better, SDL. The statically linked one will only be used as -far as calling into the jump table in this case. But in cases where no override -is desired, the statically linked version will provide its own jump table, -and everyone is happy. - -So now: -- Developers can statically link SDL, and users can still replace it. - (We'd still rather you ship a shared library, though!) -- Developers can ship an SDL with their game, Valve can override it for, say, - new features on SteamOS, or distros can override it for their own needs, - but it'll also just work in the default case. -- Developers can ship the same package to everyone (Humble Bundle, GOG, etc), - and it'll do the right thing. -- End users (and Valve) can update a game's SDL in almost any case, - to keep abandoned games running on newer platforms. -- Everyone develops with SDL exactly as they have been doing all along. - Same headers, same ABI. Just get the latest version to enable this magic. - - -A little more about SDL_InitDynamicAPI(): - -Internally, InitAPI does some locking to make sure everything waits until a -single thread initializes everything (although even SDL_CreateThread() goes -through here before spinning a thread, too), and then decides if it should use -an external SDL library. If not, it sets up the jump table using the current -SDL's function pointers (which might be statically linked into a program, or in -a shared library of its own). If so, it loads that library and looks for and -calls a single function: - - SInt32 SDL_DYNAPI_entry(Uint32 version, void *table, Uint32 tablesize); - -That function takes a version number (more on that in a moment), the address of -the jump table, and the size, in bytes, of the table. -Now, we've got policy here: this table's layout never changes; new stuff gets -added to the end. Therefore SDL_DYNAPI_entry() knows that it can provide all -the needed functions if tablesize <= sizeof its own jump table. If tablesize is -bigger (say, SDL 2.0.4 is trying to load SDL 2.0.3), then we know to abort, but -if it's smaller, we know we can provide the entire API that the caller needs. - -The version variable is a failsafe switch. -Right now it's always 1. This number changes when there are major API changes -(so we know if the tablesize might be smaller, or entries in it have changed). -Right now SDL_DYNAPI_entry gives up if the version doesn't match, but it's not -inconceivable to have a small dispatch library that only supplies this one -function and loads different, otherwise-incompatible SDL libraries and has the -right one initialize the jump table based on the version. For something that -must generically catch lots of different versions of SDL over time, like the -Steam Client, this isn't a bad option. - -Finally, I'm sure some people are reading this and thinking, -"I don't want that overhead in my project!" -To which I would point out that the extra function call through the jump table -probably wouldn't even show up in a profile, but lucky you: this can all be -disabled. You can build SDL without this if you absolutely must, but we would -encourage you not to do that. However, on heavily locked down platforms like -iOS, or maybe when debugging, it makes sense to disable it. The way this is -designed in SDL, you just have to change one #define, and the entire system -vaporizes out, and SDL functions exactly like it always did. Most of it is -macro magic, so the system is contained to one C file and a few headers. -However, this is on by default and you have to edit a header file to turn it -off. Our hopes is that if we make it easy to disable, but not too easy, -everyone will ultimately be able to get what they want, but we've gently -nudged everyone towards what we think is the best solution. diff --git a/#ThirdParty/libSDL/docs/README-emscripten.md b/#ThirdParty/libSDL/docs/README-emscripten.md deleted file mode 100644 index 62012db..0000000 --- a/#ThirdParty/libSDL/docs/README-emscripten.md +++ /dev/null @@ -1,37 +0,0 @@ -Emscripten -================================================================================ - -Build: - - $ mkdir build - $ cd build - $ emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --enable-cpuinfo=false CFLAGS="-O2" - $ emmake make - -Or with cmake: - - $ mkdir build - $ cd build - $ emcmake cmake .. - $ emmake make - -To build one of the tests: - - $ cd test/ - $ emcc -O2 --js-opts 0 -g4 testdraw2.c -I../include ../build/.libs/libSDL2.a ../build/libSDL2_test.a -o a.html - -Uses GLES2 renderer or software - -tests: https://dl.dropboxusercontent.com/u/17360362/SDL2-em/index.html - -Some other SDL2 libraries can be easily built (assuming SDL2 is installed somewhere): - -SDL_mixer (http://www.libsdl.org/projects/SDL_mixer/): - - $ EMCONFIGURE_JS=1 emconfigure ../configure - build as usual... - -SDL_gfx (http://cms.ferzkopp.net/index.php/software/13-sdl-gfx): - - $ EMCONFIGURE_JS=1 emconfigure ../configure --disable-mmx - build as usual... diff --git a/#ThirdParty/libSDL/docs/README-gesture.md b/#ThirdParty/libSDL/docs/README-gesture.md deleted file mode 100644 index 7e9f95b..0000000 --- a/#ThirdParty/libSDL/docs/README-gesture.md +++ /dev/null @@ -1,71 +0,0 @@ -Dollar Gestures -=========================================================================== -SDL provides an implementation of the $1 gesture recognition system. This allows for recording, saving, loading, and performing single stroke gestures. - -Gestures can be performed with any number of fingers (the centroid of the fingers must follow the path of the gesture), but the number of fingers must be constant (a finger cannot go down in the middle of a gesture). The path of a gesture is considered the path from the time when the final finger went down, to the first time any finger comes up. - -Dollar gestures are assigned an Id based on a hash function. This is guaranteed to remain constant for a given gesture. There is a (small) chance that two different gestures will be assigned the same ID. In this case, simply re-recording one of the gestures should result in a different ID. - -Recording: ----------- -To begin recording on a touch device call: -SDL_RecordGesture(SDL_TouchID touchId), where touchId is the id of the touch device you wish to record on, or -1 to record on all connected devices. - -Recording terminates as soon as a finger comes up. Recording is acknowledged by an SDL_DOLLARRECORD event. -A SDL_DOLLARRECORD event is a dgesture with the following fields: - -* event.dgesture.touchId - the Id of the touch used to record the gesture. -* event.dgesture.gestureId - the unique id of the recorded gesture. - - -Performing: ------------ -As long as there is a dollar gesture assigned to a touch, every finger-up event will also cause an SDL_DOLLARGESTURE event with the following fields: - -* event.dgesture.touchId - the Id of the touch which performed the gesture. -* event.dgesture.gestureId - the unique id of the closest gesture to the performed stroke. -* event.dgesture.error - the difference between the gesture template and the actual performed gesture. Lower error is a better match. -* event.dgesture.numFingers - the number of fingers used to draw the stroke. - -Most programs will want to define an appropriate error threshold and check to be sure that the error of a gesture is not abnormally high (an indicator that no gesture was performed). - - - -Saving: -------- -To save a template, call SDL_SaveDollarTemplate(gestureId, dst) where gestureId is the id of the gesture you want to save, and dst is an SDL_RWops pointer to the file where the gesture will be stored. - -To save all currently loaded templates, call SDL_SaveAllDollarTemplates(dst) where dst is an SDL_RWops pointer to the file where the gesture will be stored. - -Both functions return the number of gestures successfully saved. - - -Loading: --------- -To load templates from a file, call SDL_LoadDollarTemplates(touchId,src) where touchId is the id of the touch to load to (or -1 to load to all touch devices), and src is an SDL_RWops pointer to a gesture save file. - -SDL_LoadDollarTemplates returns the number of templates successfully loaded. - - - -=========================================================================== -Multi Gestures -=========================================================================== -SDL provides simple support for pinch/rotate/swipe gestures. -Every time a finger is moved an SDL_MULTIGESTURE event is sent with the following fields: - -* event.mgesture.touchId - the Id of the touch on which the gesture was performed. -* event.mgesture.x - the normalized x coordinate of the gesture. (0..1) -* event.mgesture.y - the normalized y coordinate of the gesture. (0..1) -* event.mgesture.dTheta - the amount that the fingers rotated during this motion. -* event.mgesture.dDist - the amount that the fingers pinched during this motion. -* event.mgesture.numFingers - the number of fingers used in the gesture. - - -=========================================================================== -Notes -=========================================================================== -For a complete example see test/testgesture.c - -Please direct questions/comments to: - jim.tla+sdl_touch@gmail.com diff --git a/#ThirdParty/libSDL/docs/README-hg.md b/#ThirdParty/libSDL/docs/README-hg.md deleted file mode 100644 index 6e18bab..0000000 --- a/#ThirdParty/libSDL/docs/README-hg.md +++ /dev/null @@ -1,25 +0,0 @@ -Mercurial -========= - -The latest development version of SDL is available via Mercurial. -Mercurial allows you to get up-to-the-minute fixes and enhancements; -as a developer works on a source tree, you can use "hg" to mirror that -source tree instead of waiting for an official release. Please look -at the Mercurial website ( http://mercurial.selenic.com/ ) for more -information on using hg, where you can also download software for -Mac OS X, Windows, and Unix systems. - - hg clone http://hg.libsdl.org/SDL - -If you are building SDL with an IDE, you will need to copy the file -include/SDL_config.h.default to include/SDL_config.h before building. - -If you are building SDL via configure, you will need to run autogen.sh -before running configure. - -There is a web interface to the subversion repository at: - http://hg.libsdl.org/SDL/ - -There is an RSS feed available at that URL, for those that want to -track commits in real time. - diff --git a/#ThirdParty/libSDL/docs/README-ios.md b/#ThirdParty/libSDL/docs/README-ios.md deleted file mode 100644 index a0afffb..0000000 --- a/#ThirdParty/libSDL/docs/README-ios.md +++ /dev/null @@ -1,266 +0,0 @@ -iOS -====== - -============================================================================== -Building the Simple DirectMedia Layer for iOS 5.1+ -============================================================================== - -Requirements: Mac OS X 10.8 or later and the iOS 7+ SDK. - -Instructions: -1. Open SDL.xcodeproj (located in Xcode-iOS/SDL) in Xcode. -2. Select your desired target, and hit build. - -There are three build targets: -- libSDL.a: - Build SDL as a statically linked library -- testsdl: - Build a test program (there are known test failures which are fine) -- Template: - Package a project template together with the SDL for iPhone static libraries and copies of the SDL headers. The template includes proper references to the SDL library and headers, skeleton code for a basic SDL program, and placeholder graphics for the application icon and startup screen. - - -============================================================================== -Build SDL for iOS from the command line -============================================================================== - -1. cd (PATH WHERE THE SDL CODE IS)/build-scripts -2. ./iosbuild.sh - -If everything goes fine, you should see a build/ios directory, inside there's -two directories "lib" and "include". -"include" contains a copy of the SDL headers that you'll need for your project, -make sure to configure XCode to look for headers there. -"lib" contains find two files, libSDL2.a and libSDL2main.a, you have to add both -to your XCode project. These libraries contain three architectures in them, -armv6 for legacy devices, armv7, and i386 (for the simulator). -By default, iosbuild.sh will autodetect the SDK version you have installed using -xcodebuild -showsdks, and build for iOS >= 3.0, you can override this behaviour -by setting the MIN_OS_VERSION variable, ie: - -MIN_OS_VERSION=4.2 ./iosbuild.sh - -============================================================================== -Using the Simple DirectMedia Layer for iOS -============================================================================== - -FIXME: This needs to be updated for the latest methods - -Here is the easiest method: -1. Build the SDL library (libSDL2.a) and the iPhone SDL Application template. -2. Install the iPhone SDL Application template by copying it to one of Xcode's template directories. I recommend creating a directory called "SDL" in "/Developer/Platforms/iOS.platform/Developer/Library/Xcode/Project Templates/" and placing it there. -3. Start a new project using the template. The project should be immediately ready for use with SDL. - -Here is a more manual method: -1. Create a new iOS view based application. -2. Build the SDL static library (libSDL2.a) for iOS and include them in your project. Xcode will ignore the library that is not currently of the correct architecture, hence your app will work both on iOS and in the iOS Simulator. -3. Include the SDL header files in your project. -4. Remove the ApplicationDelegate.h and ApplicationDelegate.m files -- SDL for iOS provides its own UIApplicationDelegate. Remove MainWindow.xib -- SDL for iOS produces its user interface programmatically. -5. Delete the contents of main.m and program your app as a regular SDL program instead. You may replace main.m with your own main.c, but you must tell Xcode not to use the project prefix file, as it includes Objective-C code. - -============================================================================== -Notes -- Retina / High-DPI and window sizes -============================================================================== - -Window and display mode sizes in SDL are in "screen coordinates" (or "points", -in Apple's terminology) rather than in pixels. On iOS this means that a window -created on an iPhone 6 will have a size in screen coordinates of 375 x 667, -rather than a size in pixels of 750 x 1334. All iOS apps are expected to -size their content based on screen coordinates / points rather than pixels, -as this allows different iOS devices to have different pixel densities -(Retina versus non-Retina screens, etc.) without apps caring too much. - -By default SDL will not use the full pixel density of the screen on -Retina/high-dpi capable devices. Use the SDL_WINDOW_ALLOW_HIGHDPI flag when -creating your window to enable high-dpi support. - -When high-dpi support is enabled, SDL_GetWindowSize and display mode sizes -will still be in "screen coordinates" rather than pixels, but the window will -have a much greater pixel density when the device supports it, and the -SDL_GL_GetDrawableSize or SDL_GetRendererOutputSize functions (depending on -whether raw OpenGL or the SDL_Render API is used) can be queried to determine -the size in pixels of the drawable screen framebuffer. - -Some OpenGL ES functions such as glViewport expect sizes in pixels rather than -sizes in screen coordinates. When doing 2D rendering with OpenGL ES, an -orthographic projection matrix using the size in screen coordinates -(SDL_GetWindowSize) can be used in order to display content at the same scale -no matter whether a Retina device is used or not. - -============================================================================== -Notes -- Application events -============================================================================== - -On iOS the application goes through a fixed life cycle and you will get -notifications of state changes via application events. When these events -are delivered you must handle them in an event callback because the OS may -not give you any processing time after the events are delivered. - -e.g. - - int HandleAppEvents(void *userdata, SDL_Event *event) - { - switch (event->type) - { - case SDL_APP_TERMINATING: - /* Terminate the app. - Shut everything down before returning from this function. - */ - return 0; - case SDL_APP_LOWMEMORY: - /* You will get this when your app is paused and iOS wants more memory. - Release as much memory as possible. - */ - return 0; - case SDL_APP_WILLENTERBACKGROUND: - /* Prepare your app to go into the background. Stop loops, etc. - This gets called when the user hits the home button, or gets a call. - */ - return 0; - case SDL_APP_DIDENTERBACKGROUND: - /* This will get called if the user accepted whatever sent your app to the background. - If the user got a phone call and canceled it, you'll instead get an SDL_APP_DIDENTERFOREGROUND event and restart your loops. - When you get this, you have 5 seconds to save all your state or the app will be terminated. - Your app is NOT active at this point. - */ - return 0; - case SDL_APP_WILLENTERFOREGROUND: - /* This call happens when your app is coming back to the foreground. - Restore all your state here. - */ - return 0; - case SDL_APP_DIDENTERFOREGROUND: - /* Restart your loops here. - Your app is interactive and getting CPU again. - */ - return 0; - default: - /* No special processing, add it to the event queue */ - return 1; - } - } - - int main(int argc, char *argv[]) - { - SDL_SetEventFilter(HandleAppEvents, NULL); - - ... run your main loop - - return 0; - } - - -============================================================================== -Notes -- Accelerometer as Joystick -============================================================================== - -SDL for iPhone supports polling the built in accelerometer as a joystick device. For an example on how to do this, see the accelerometer.c in the demos directory. - -The main thing to note when using the accelerometer with SDL is that while the iPhone natively reports accelerometer as floating point values in units of g-force, SDL_JoystickGetAxis reports joystick values as signed integers. Hence, in order to convert between the two, some clamping and scaling is necessary on the part of the iPhone SDL joystick driver. To convert SDL_JoystickGetAxis reported values BACK to units of g-force, simply multiply the values by SDL_IPHONE_MAX_GFORCE / 0x7FFF. - -============================================================================== -Notes -- OpenGL ES -============================================================================== - -Your SDL application for iOS uses OpenGL ES for video by default. - -OpenGL ES for iOS supports several display pixel formats, such as RGBA8 and RGB565, which provide a 32 bit and 16 bit color buffer respectively. By default, the implementation uses RGB565, but you may use RGBA8 by setting each color component to 8 bits in SDL_GL_SetAttribute. - -If your application doesn't use OpenGL's depth buffer, you may find significant performance improvement by setting SDL_GL_DEPTH_SIZE to 0. - -Finally, if your application completely redraws the screen each frame, you may find significant performance improvement by setting the attribute SDL_GL_RETAINED_BACKING to 0. - -OpenGL ES on iOS doesn't use the traditional system-framebuffer setup provided in other operating systems. Special care must be taken because of this: - -- The drawable Renderbuffer must be bound to the GL_RENDERBUFFER binding point when SDL_GL_SwapWindow is called. -- The drawable Framebuffer Object must be bound while rendering to the screen and when SDL_GL_SwapWindow is called. -- If multisample antialiasing (MSAA) is used and glReadPixels is used on the screen, the drawable framebuffer must be resolved to the MSAA resolve framebuffer (via glBlitFramebuffer or glResolveMultisampleFramebufferAPPLE), and the MSAA resolve framebuffer must be bound to the GL_READ_FRAMEBUFFER binding point, before glReadPixels is called. - -The above objects can be obtained via SDL_GetWindowWMInfo (in SDL_syswm.h). - -============================================================================== -Notes -- Keyboard -============================================================================== - -The SDL keyboard API has been extended to support on-screen keyboards: - -void SDL_StartTextInput() - -- enables text events and reveals the onscreen keyboard. - -void SDL_StopTextInput() - -- disables text events and hides the onscreen keyboard. - -SDL_bool SDL_IsTextInputActive() - -- returns whether or not text events are enabled (and the onscreen keyboard is visible) - - -============================================================================== -Notes -- Reading and Writing files -============================================================================== - -Each application installed on iPhone resides in a sandbox which includes its own Application Home directory. Your application may not access files outside this directory. - -Once your application is installed its directory tree looks like: - - MySDLApp Home/ - MySDLApp.app - Documents/ - Library/ - Preferences/ - tmp/ - -When your SDL based iPhone application starts up, it sets the working directory to the main bundle (MySDLApp Home/MySDLApp.app), where your application resources are stored. You cannot write to this directory. Instead, I advise you to write document files to "../Documents/" and preferences to "../Library/Preferences". - -More information on this subject is available here: -http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Introduction/Introduction.html - -============================================================================== -Notes -- iPhone SDL limitations -============================================================================== - -Windows: - Full-size, single window applications only. You cannot create multi-window SDL applications for iPhone OS. The application window will fill the display, though you have the option of turning on or off the menu-bar (pass SDL_CreateWindow the flag SDL_WINDOW_BORDERLESS). - -Textures: - The optimal texture formats on iOS are SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGR888, and SDL_PIXELFORMAT_RGB24 pixel formats. - -Loading Shared Objects: - This is disabled by default since it seems to break the terms of the iOS SDK agreement for iOS versions prior to iOS 8. It can be re-enabled in SDL_config_iphoneos.h. - -============================================================================== -Game Center -============================================================================== - -Game Center integration might require that you break up your main loop in order to yield control back to the system. In other words, instead of running an endless main loop, you run each frame in a callback function, using: - - int SDL_iPhoneSetAnimationCallback(SDL_Window * window, int interval, void (*callback)(void*), void *callbackParam); - -This will set up the given function to be called back on the animation callback, and then you have to return from main() to let the Cocoa event loop run. - -e.g. - - extern "C" - void ShowFrame(void*) - { - ... do event handling, frame logic and rendering ... - } - - int main(int argc, char *argv[]) - { - ... initialize game ... - - #if __IPHONEOS__ - // Initialize the Game Center for scoring and matchmaking - InitGameCenter(); - - // Set up the game to run in the window animation callback on iOS - // so that Game Center and so forth works correctly. - SDL_iPhoneSetAnimationCallback(window, 1, ShowFrame, NULL); - #else - while ( running ) { - ShowFrame(0); - DelayFrame(); - } - #endif - return 0; - } diff --git a/#ThirdParty/libSDL/docs/README-linux.md b/#ThirdParty/libSDL/docs/README-linux.md deleted file mode 100644 index fddabf5..0000000 --- a/#ThirdParty/libSDL/docs/README-linux.md +++ /dev/null @@ -1,82 +0,0 @@ -Linux -================================================================================ - -By default SDL will only link against glibc, the rest of the features will be -enabled dynamically at runtime depending on the available features on the target -system. So, for example if you built SDL with Xinerama support and the target -system does not have the Xinerama libraries installed, it will be disabled -at runtime, and you won't get a missing library error, at least with the -default configuration parameters. - - -================================================================================ -Build Dependencies -================================================================================ - -Ubuntu 13.04, all available features enabled: - -sudo apt-get install build-essential mercurial make cmake autoconf automake \ -libtool libasound2-dev libpulse-dev libaudio-dev libx11-dev libxext-dev \ -libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxxf86vm-dev \ -libxss-dev libgl1-mesa-dev libesd0-dev libdbus-1-dev libudev-dev \ -libgles1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libibus-1.0-dev - -Ubuntu 14.04 can also add "libwayland-dev libmirclient-dev libxkbcommon-dev" -to that command line for Wayland and Mir support. - -NOTES: -- This includes all the audio targets except arts, because Ubuntu pulled the - artsc0-dev package, but in theory SDL still supports it. -- DirectFB isn't included because the configure script (currently) fails to find - it at all. You can do "sudo apt-get install libdirectfb-dev" and fix the - configure script to include DirectFB support. Send patches. :) - - -================================================================================ -Joystick does not work -================================================================================ - -If you compiled or are using a version of SDL with udev support (and you should!) -there's a few issues that may cause SDL to fail to detect your joystick. To -debug this, start by installing the evtest utility. On Ubuntu/Debian: - - sudo apt-get install evtest - -Then run: - - sudo evtest - -You'll hopefully see your joystick listed along with a name like "/dev/input/eventXX" -Now run: - - cat /dev/input/event/XX - -If you get a permission error, you need to set a udev rule to change the mode of -your device (see below) - -Also, try: - - sudo udevadm info --query=all --name=input/eventXX - -If you see a line stating ID_INPUT_JOYSTICK=1, great, if you don't see it, -you need to set up an udev rule to force this variable. - -A combined rule for the Saitek Pro Flight Rudder Pedals to fix both issues looks -like: - - SUBSYSTEM=="input", ATTRS{idProduct}=="0763", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1" - SUBSYSTEM=="input", ATTRS{idProduct}=="0764", ATTRS{idVendor}=="06a3", MODE="0666", ENV{ID_INPUT_JOYSTICK}="1" - -You can set up similar rules for your device by changing the values listed in -idProduct and idVendor. To obtain these values, try: - - sudo udevadm info -a --name=input/eventXX | grep idVendor - sudo udevadm info -a --name=input/eventXX | grep idProduct - -If multiple values come up for each of these, the one you want is the first one of each. - -On other systems which ship with an older udev (such as CentOS), you may need -to set up a rule such as: - - SUBSYSTEM=="input", ENV{ID_CLASS}=="joystick", ENV{ID_INPUT_JOYSTICK}="1" - diff --git a/#ThirdParty/libSDL/docs/README-macosx.md b/#ThirdParty/libSDL/docs/README-macosx.md deleted file mode 100644 index 747e1e6..0000000 --- a/#ThirdParty/libSDL/docs/README-macosx.md +++ /dev/null @@ -1,230 +0,0 @@ -Mac OS X -============================================================================== - -These instructions are for people using Apple's Mac OS X (pronounced -"ten"). - -From the developer's point of view, OS X is a sort of hybrid Mac and -Unix system, and you have the option of using either traditional -command line tools or Apple's IDE Xcode. - -To build SDL using the command line, use the standard configure and make -process: - - ./configure - make - sudo make install - -You can also build SDL as a Universal library (a single binary for both -32-bit and 64-bit Intel architectures), on Mac OS X 10.7 and newer, by using -the gcc-fat.sh script in build-scripts: - - mkdir mybuild - cd mybuild - CC=$PWD/../build-scripts/gcc-fat.sh CXX=$PWD/../build-scripts/g++fat.sh ../configure - make - sudo make install - -This script builds SDL with 10.5 ABI compatibility on i386 and 10.6 -ABI compatibility on x86_64 architectures. For best compatibility you -should compile your application the same way. - -Please note that building SDL requires at least Xcode 4.6 and the 10.7 SDK -(even if you target back to 10.5 systems). PowerPC support for Mac OS X has -been officially dropped as of SDL 2.0.2. - -To use the library once it's built, you essential have two possibilities: -use the traditional autoconf/automake/make method, or use Xcode. - -============================================================================== -Caveats for using SDL with Mac OS X -============================================================================== - -Some things you have to be aware of when using SDL on Mac OS X: - -- If you register your own NSApplicationDelegate (using [NSApp setDelegate:]), - SDL will not register its own. This means that SDL will not terminate using - SDL_Quit if it receives a termination request, it will terminate like a - normal app, and it will not send a SDL_DROPFILE when you request to open a - file with the app. To solve these issues, put the following code in your - NSApplicationDelegate implementation: - - - - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender - { - if (SDL_GetEventState(SDL_QUIT) == SDL_ENABLE) { - SDL_Event event; - event.type = SDL_QUIT; - SDL_PushEvent(&event); - } - - return NSTerminateCancel; - } - - - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename - { - if (SDL_GetEventState(SDL_DROPFILE) == SDL_ENABLE) { - SDL_Event event; - event.type = SDL_DROPFILE; - event.drop.file = SDL_strdup([filename UTF8String]); - return (SDL_PushEvent(&event) > 0); - } - - return NO; - } - -============================================================================== -Using the Simple DirectMedia Layer with a traditional Makefile -============================================================================== - -An existing autoconf/automake build system for your SDL app has good chances -to work almost unchanged on OS X. However, to produce a "real" Mac OS X binary -that you can distribute to users, you need to put the generated binary into a -so called "bundle", which basically is a fancy folder with a name like -"MyCoolGame.app". - -To get this build automatically, add something like the following rule to -your Makefile.am: - -bundle_contents = APP_NAME.app/Contents -APP_NAME_bundle: EXE_NAME - mkdir -p $(bundle_contents)/MacOS - mkdir -p $(bundle_contents)/Resources - echo "APPL????" > $(bundle_contents)/PkgInfo - $(INSTALL_PROGRAM) $< $(bundle_contents)/MacOS/ - -You should replace EXE_NAME with the name of the executable. APP_NAME is what -will be visible to the user in the Finder. Usually it will be the same -as EXE_NAME but capitalized. E.g. if EXE_NAME is "testgame" then APP_NAME -usually is "TestGame". You might also want to use @PACKAGE@ to use the package -name as specified in your configure.in file. - -If your project builds more than one application, you will have to do a bit -more. For each of your target applications, you need a separate rule. - -If you want the created bundles to be installed, you may want to add this -rule to your Makefile.am: - -install-exec-hook: APP_NAME_bundle - rm -rf $(DESTDIR)$(prefix)/Applications/APP_NAME.app - mkdir -p $(DESTDIR)$(prefix)/Applications/ - cp -r $< /$(DESTDIR)$(prefix)Applications/ - -This rule takes the Bundle created by the rule from step 3 and installs them -into $(DESTDIR)$(prefix)/Applications/. - -Again, if you want to install multiple applications, you will have to augment -the make rule accordingly. - - -But beware! That is only part of the story! With the above, you end up with -a bare bone .app bundle, which is double clickable from the Finder. But -there are some more things you should do before shipping your product... - -1) The bundle right now probably is dynamically linked against SDL. That - means that when you copy it to another computer, *it will not run*, - unless you also install SDL on that other computer. A good solution - for this dilemma is to static link against SDL. On OS X, you can - achieve that by linking against the libraries listed by - sdl-config --static-libs - instead of those listed by - sdl-config --libs - Depending on how exactly SDL is integrated into your build systems, the - way to achieve that varies, so I won't describe it here in detail -2) Add an 'Info.plist' to your application. That is a special XML file which - contains some meta-information about your application (like some copyright - information, the version of your app, the name of an optional icon file, - and other things). Part of that information is displayed by the Finder - when you click on the .app, or if you look at the "Get Info" window. - More information about Info.plist files can be found on Apple's homepage. - - -As a final remark, let me add that I use some of the techniques (and some -variations of them) in Exult and ScummVM; both are available in source on -the net, so feel free to take a peek at them for inspiration! - - -============================================================================== -Using the Simple DirectMedia Layer with Xcode -============================================================================== - -These instructions are for using Apple's Xcode IDE to build SDL applications. - -- First steps - -The first thing to do is to unpack the Xcode.tar.gz archive in the -top level SDL directory (where the Xcode.tar.gz archive resides). -Because Stuffit Expander will unpack the archive into a subdirectory, -you should unpack the archive manually from the command line: - cd [path_to_SDL_source] - tar zxf Xcode.tar.gz -This will create a new folder called Xcode, which you can browse -normally from the Finder. - -- Building the Framework - -The SDL Library is packaged as a framework bundle, an organized -relocatable folder hierarchy of executable code, interface headers, -and additional resources. For practical purposes, you can think of a -framework as a more user and system-friendly shared library, whose library -file behaves more or less like a standard UNIX shared library. - -To build the framework, simply open the framework project and build it. -By default, the framework bundle "SDL.framework" is installed in -/Library/Frameworks. Therefore, the testers and project stationary expect -it to be located there. However, it will function the same in any of the -following locations: - - ~/Library/Frameworks - /Local/Library/Frameworks - /System/Library/Frameworks - -- Build Options - There are two "Build Styles" (See the "Targets" tab) for SDL. - "Deployment" should be used if you aren't tweaking the SDL library. - "Development" should be used to debug SDL apps or the library itself. - -- Building the Testers - Open the SDLTest project and build away! - -- Using the Project Stationary - Copy the stationary to the indicated folders to access it from - the "New Project" and "Add target" menus. What could be easier? - -- Setting up a new project by hand - Some of you won't want to use the Stationary so I'll give some tips: - * Create a new "Cocoa Application" - * Add src/main/macosx/SDLMain.m , .h and .nib to your project - * Remove "main.c" from your project - * Remove "MainMenu.nib" from your project - * Add "$(HOME)/Library/Frameworks/SDL.framework/Headers" to include path - * Add "$(HOME)/Library/Frameworks" to the frameworks search path - * Add "-framework SDL -framework Foundation -framework AppKit" to "OTHER_LDFLAGS" - * Set the "Main Nib File" under "Application Settings" to "SDLMain.nib" - * Add your files - * Clean and build - -- Building from command line - Use pbxbuild in the same directory as your .pbproj file - -- Running your app - You can send command line args to your app by either invoking it from - the command line (in *.app/Contents/MacOS) or by entering them in the - "Executables" panel of the target settings. - -- Implementation Notes - Some things that may be of interest about how it all works... - * Working directory - As defined in the SDL_main.m file, the working directory of your SDL app - is by default set to its parent. You may wish to change this to better - suit your needs. - * You have a Cocoa App! - Your SDL app is essentially a Cocoa application. When your app - starts up and the libraries finish loading, a Cocoa procedure is called, - which sets up the working directory and calls your main() method. - You are free to modify your Cocoa app with generally no consequence - to SDL. You cannot, however, easily change the SDL window itself. - Functionality may be added in the future to help this. - - -Known bugs are listed in the file "BUGS" diff --git a/#ThirdParty/libSDL/docs/README-nacl.md b/#ThirdParty/libSDL/docs/README-nacl.md deleted file mode 100644 index 4c9432b..0000000 --- a/#ThirdParty/libSDL/docs/README-nacl.md +++ /dev/null @@ -1,103 +0,0 @@ -Native Client -================================================================================ - -Requirements: - -* Native Client SDK (https://developer.chrome.com/native-client), - (tested with Pepper version 33 or higher). - -The SDL backend for Chrome's Native Client has been tested only with the PNaCl -toolchain, which generates binaries designed to run on ARM and x86_32/64 -platforms. This does not mean it won't work with the other toolchains! - -================================================================================ -Building SDL for NaCl -================================================================================ - -Set up the right environment variables (see naclbuild.sh), then configure SDL with: - - configure --host=pnacl --prefix some/install/destination - -Then "make". - -As an example of how to create a deployable app a Makefile project is provided -in test/nacl/Makefile, which includes some monkey patching of the common.mk file -provided by NaCl, without which linking properly to SDL won't work (the search -path can't be modified externally, so the linker won't find SDL's binaries unless -you dump them into the SDK path, which is inconvenient). -Also provided in test/nacl is the required support file, such as index.html, -manifest.json, etc. -SDL apps for NaCl run on a worker thread using the ppapi_simple infrastructure. -This allows for blocking calls on all the relevant systems (OpenGL ES, filesystem), -hiding the asynchronous nature of the browser behind the scenes...which is not the -same as making it disappear! - - -================================================================================ -Running tests -================================================================================ - -Due to the nature of NaCl programs, building and running SDL tests is not as -straightforward as one would hope. The script naclbuild.sh in build-scripts -automates the process and should serve as a guide for users of SDL trying to build -their own applications. - -Basic usage: - - ./naclbuild.sh path/to/pepper/toolchain (i.e. ~/naclsdk/pepper_35) - -This will build testgles2.c by default. - -If you want to build a different test, for example testrendercopyex.c: - - SOURCES=~/sdl/SDL/test/testrendercopyex.c ./naclbuild.sh ~/naclsdk/pepper_35 - -Once the build finishes, you have to serve the contents with a web server (the -script will give you instructions on how to do that with Python). - -================================================================================ -RWops and nacl_io -================================================================================ - -SDL_RWops work transparently with nacl_io. Two functions control the mount points: - - int mount(const char* source, const char* target, - const char* filesystemtype, - unsigned long mountflags, const void *data); - int umount(const char *target); - - For convenience, SDL will by default mount an httpfs tree at / before calling -the app's main function. Such setting can be overridden by calling: - - umount("/"); - -And then mounting a different filesystem at / - -It's important to consider that the asynchronous nature of file operations on a -browser is hidden from the application, effectively providing the developer with -a set of blocking file operations just like you get in a regular desktop -environment, which eases the job of porting to Native Client, but also introduces -a set of challenges of its own, in particular when big file sizes and slow -connections are involved. - -For more information on how nacl_io and mount points work, see: - - https://developer.chrome.com/native-client/devguide/coding/nacl_io - https://src.chromium.org/chrome/trunk/src/native_client_sdk/src/libraries/nacl_io/nacl_io.h - -To be able to save into the directory "/save/" (like backup of game) : - - mount("", "/save", "html5fs", 0, "type=PERSISTENT"); - -And add to manifest.json : - - "permissions": [ - "unlimitedStorage" - ] - -================================================================================ -TODO - Known Issues -================================================================================ -* Testing of all systems with a real application (something other than SDL's tests) -* Key events don't seem to work properly - diff --git a/#ThirdParty/libSDL/docs/README-pandora.md b/#ThirdParty/libSDL/docs/README-pandora.md deleted file mode 100644 index e50e0c2..0000000 --- a/#ThirdParty/libSDL/docs/README-pandora.md +++ /dev/null @@ -1,17 +0,0 @@ -Pandora -===================================================================== - -( http://openpandora.org/ ) -- A pandora specific video driver was written to allow SDL 2.0 with OpenGL ES -support to work on the pandora under the framebuffer. This driver do not have -input support for now, so if you use it you will have to add your own control code. -The video driver name is "pandora" so if you have problem running it from -the framebuffer, try to set the following variable before starting your application : -"export SDL_VIDEODRIVER=pandora" - -- OpenGL ES support was added to the x11 driver, so it's working like the normal -x11 driver one with OpenGLX support, with SDL input event's etc.. - - -David Carré (Cpasjuste) -cpasjuste@gmail.com diff --git a/#ThirdParty/libSDL/docs/README-platforms.md b/#ThirdParty/libSDL/docs/README-platforms.md deleted file mode 100644 index 14454ec..0000000 --- a/#ThirdParty/libSDL/docs/README-platforms.md +++ /dev/null @@ -1,8 +0,0 @@ -Platforms -========= - -We maintain the list of supported platforms on our wiki now, and how to -build and install SDL for those platforms: - - https://wiki.libsdl.org/Installation - diff --git a/#ThirdParty/libSDL/docs/README-porting.md b/#ThirdParty/libSDL/docs/README-porting.md deleted file mode 100644 index f13f83b..0000000 --- a/#ThirdParty/libSDL/docs/README-porting.md +++ /dev/null @@ -1,64 +0,0 @@ -Porting -======= - -* Porting To A New Platform - - The first thing you have to do when porting to a new platform, is look at -include/SDL_platform.h and create an entry there for your operating system. -The standard format is __PLATFORM__, where PLATFORM is the name of the OS. -Ideally SDL_platform.h will be able to auto-detect the system it's building -on based on C preprocessor symbols. - -There are two basic ways of building SDL at the moment: - -1. The "UNIX" way: ./configure; make; make install - - If you have a GNUish system, then you might try this. Edit configure.in, - take a look at the large section labelled: - "Set up the configuration based on the host platform!" - Add a section for your platform, and then re-run autogen.sh and build! - -2. Using an IDE: - - If you're using an IDE or other non-configure build system, you'll probably - want to create a custom SDL_config.h for your platform. Edit SDL_config.h, - add a section for your platform, and create a custom SDL_config_{platform}.h, - based on SDL_config.h.minimal and SDL_config.h.in - - Add the top level include directory to the header search path, and then add - the following sources to the project: - src/*.c - src/atomic/*.c - src/audio/*.c - src/cpuinfo/*.c - src/events/*.c - src/file/*.c - src/haptic/*.c - src/joystick/*.c - src/power/*.c - src/render/*.c - src/stdlib/*.c - src/thread/*.c - src/timer/*.c - src/video/*.c - src/audio/disk/*.c - src/audio/dummy/*.c - src/filesystem/dummy/*.c - src/video/dummy/*.c - src/haptic/dummy/*.c - src/joystick/dummy/*.c - src/main/dummy/*.c - src/thread/generic/*.c - src/timer/dummy/*.c - src/loadso/dummy/*.c - - -Once you have a working library without any drivers, you can go back to each -of the major subsystems and start implementing drivers for your platform. - -If you have any questions, don't hesitate to ask on the SDL mailing list: - http://www.libsdl.org/mailing-list.php - -Enjoy! - Sam Lantinga (slouken@libsdl.org) - diff --git a/#ThirdParty/libSDL/docs/README-psp.md b/#ThirdParty/libSDL/docs/README-psp.md deleted file mode 100644 index 41fc904..0000000 --- a/#ThirdParty/libSDL/docs/README-psp.md +++ /dev/null @@ -1,19 +0,0 @@ -PSP -====== -SDL port for the Sony PSP contributed by - Captian Lex - -Credit to - Marcus R.Brown,Jim Paris,Matthew H for the original SDL 1.2 for PSP - Geecko for his PSP GU lib "Glib2d" - -Building --------- -To build for the PSP, make sure psp-config is in the path and run: - make -f Makefile.psp - - - -To Do ------- -PSP Screen Keyboard diff --git a/#ThirdParty/libSDL/docs/README-raspberrypi.md b/#ThirdParty/libSDL/docs/README-raspberrypi.md deleted file mode 100644 index ade3c81..0000000 --- a/#ThirdParty/libSDL/docs/README-raspberrypi.md +++ /dev/null @@ -1,178 +0,0 @@ -Raspberry Pi -================================================================================ - -Requirements: - -Raspbian (other Linux distros may work as well). - -================================================================================ - Features -================================================================================ - -* Works without X11 -* Hardware accelerated OpenGL ES 2.x -* Sound via ALSA -* Input (mouse/keyboard/joystick) via EVDEV -* Hotplugging of input devices via UDEV - - -================================================================================ - Raspbian Build Dependencies -================================================================================ - -sudo apt-get install libudev-dev libasound2-dev libdbus-1-dev - -You also need the VideoCore binary stuff that ships in /opt/vc for EGL and -OpenGL ES 2.x, it usually comes pre installed, but in any case: - -sudo apt-get install libraspberrypi0 libraspberrypi-bin libraspberrypi-dev - -================================================================================ - Cross compiling from x86 Linux -================================================================================ - -To cross compile SDL for Raspbian from your desktop machine, you'll need a -Raspbian system root and the cross compilation tools. We'll assume these tools -will be placed in /opt/rpi-tools - - sudo git clone --depth 1 https://github.com/raspberrypi/tools /opt/rpi-tools - -You'll also need a Rasbian binary image. -Get it from: http://downloads.raspberrypi.org/raspbian_latest -After unzipping, you'll get file with a name like: -wheezy-raspbian.img -Let's assume the sysroot will be built in /opt/rpi-sysroot. - - export SYSROOT=/opt/rpi-sysroot - sudo kpartx -a -v .img - sudo mount -o loop /dev/mapper/loop0p2 /mnt - sudo cp -r /mnt $SYSROOT - sudo apt-get install qemu binfmt-support qemu-user-static - sudo cp /usr/bin/qemu-arm-static $SYSROOT/usr/bin - sudo mount --bind /dev $SYSROOT/dev - sudo mount --bind /proc $SYSROOT/proc - sudo mount --bind /sys $SYSROOT/sys - -Now, before chrooting into the ARM sysroot, you'll need to apply a workaround, -edit $SYSROOT/etc/ld.so.preload and comment out all lines in it. - - sudo chroot $SYSROOT - apt-get install libudev-dev libasound2-dev libdbus-1-dev libraspberrypi0 libraspberrypi-bin libraspberrypi-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxxf86vm-dev libxss-dev - exit - sudo umount $SYSROOT/dev - sudo umount $SYSROOT/proc - sudo umount $SYSROOT/sys - sudo umount /mnt - -There's one more fix required, as the libdl.so symlink uses an absolute path -which doesn't quite work in our setup. - - sudo rm -rf $SYSROOT/usr/lib/arm-linux-gnueabihf/libdl.so - sudo ln -s ../../../lib/arm-linux-gnueabihf/libdl.so.2 $SYSROOT/usr/lib/arm-linux-gnueabihf/libdl.so - -The final step is compiling SDL itself. - - export CC="/opt/rpi-tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc --sysroot=$SYSROOT -I$SYSROOT/opt/vc/include -I$SYSROOT/usr/include -I$SYSROOT/opt/vc/include/interface/vcos/pthreads -I$SYSROOT/opt/vc/include/interface/vmcs_host/linux" - cd - mkdir -p build;cd build - LDFLAGS="-L$SYSROOT/opt/vc/lib" ../configure --with-sysroot=$SYSROOT --host=arm-raspberry-linux-gnueabihf --prefix=$PWD/rpi-sdl2-installed --disable-pulseaudio --disable-esd - make - make install - -To be able to deploy this to /usr/local in the Raspbian system you need to fix up a few paths: - - perl -w -pi -e "s#$PWD/rpi-sdl2-installed#/usr/local#g;" ./rpi-sdl2-installed/lib/libSDL2.la ./rpi-sdl2-installed/lib/pkgconfig/sdl2.pc ./rpi-sdl2-installed/bin/sdl2-config - -================================================================================ - Apps don't work or poor video/audio performance -================================================================================ - -If you get sound problems, buffer underruns, etc, run "sudo rpi-update" to -update the RPi's firmware. Note that doing so will fix these problems, but it -will also render the CMA - Dynamic Memory Split functionality useless. - -Also, by default the Raspbian distro configures the GPU RAM at 64MB, this is too -low in general, specially if a 1080p TV is hooked up. - -See here how to configure this setting: http://elinux.org/RPiconfig - -Using a fixed gpu_mem=128 is the best option (specially if you updated the -firmware, using CMA probably won't work, at least it's the current case). - -================================================================================ - No input -================================================================================ - -Make sure you belong to the "input" group. - - sudo usermod -aG input `whoami` - -================================================================================ - No HDMI Audio -================================================================================ - -If you notice that ALSA works but there's no audio over HDMI, try adding: - - hdmi_drive=2 - -to your config.txt file and reboot. - -Reference: http://www.raspberrypi.org/phpBB3/viewtopic.php?t=5062 - -================================================================================ - Text Input API support -================================================================================ - -The Text Input API is supported, with translation of scan codes done via the -kernel symbol tables. For this to work, SDL needs access to a valid console. -If you notice there's no SDL_TEXTINPUT message being emitted, double check that -your app has read access to one of the following: - -* /proc/self/fd/0 -* /dev/tty -* /dev/tty[0...6] -* /dev/vc/0 -* /dev/console - -This is usually not a problem if you run from the physical terminal (as opposed -to running from a pseudo terminal, such as via SSH). If running from a PTS, a -quick workaround is to run your app as root or add yourself to the tty group, -then re login to the system. - - sudo usermod -aG tty `whoami` - -The keyboard layout used by SDL is the same as the one the kernel uses. -To configure the layout on Raspbian: - - sudo dpkg-reconfigure keyboard-configuration - -To configure the locale, which controls which keys are interpreted as letters, -this determining the CAPS LOCK behavior: - - sudo dpkg-reconfigure locales - -================================================================================ - OpenGL problems -================================================================================ - -If you have desktop OpenGL headers installed at build time in your RPi or cross -compilation environment, support for it will be built in. However, the chipset -does not actually have support for it, which causes issues in certain SDL apps -since the presence of OpenGL support supersedes the ES/ES2 variants. -The workaround is to disable OpenGL at configuration time: - - ./configure --disable-video-opengl - -Or if the application uses the Render functions, you can use the SDL_RENDER_DRIVER -environment variable: - - export SDL_RENDER_DRIVER=opengles2 - -================================================================================ - Notes -================================================================================ - -* When launching apps remotely (via SSH), SDL can prevent local keystrokes from - leaking into the console only if it has root privileges. Launching apps locally - does not suffer from this issue. - - diff --git a/#ThirdParty/libSDL/docs/README-touch.md b/#ThirdParty/libSDL/docs/README-touch.md deleted file mode 100644 index e76e2d3..0000000 --- a/#ThirdParty/libSDL/docs/README-touch.md +++ /dev/null @@ -1,86 +0,0 @@ -Touch -=========================================================================== -System Specific Notes -=========================================================================== -Linux: -The linux touch system is currently based off event streams, and proc/bus/devices. The active user must be given permissions to read /dev/input/TOUCHDEVICE, where TOUCHDEVICE is the event stream for your device. Currently only Wacom tablets are supported. If you have an unsupported tablet contact me at jim.tla+sdl_touch@gmail.com and I will help you get support for it. - -Mac: -The Mac and iPhone APIs are pretty. If your touch device supports them then you'll be fine. If it doesn't, then there isn't much we can do. - -iPhone: -Works out of box. - -Windows: -Unfortunately there is no windows support as of yet. Support for Windows 7 is planned, but we currently have no way to test. If you have a Windows 7 WM_TOUCH supported device, and are willing to help test please contact me at jim.tla+sdl_touch@gmail.com - -=========================================================================== -Events -=========================================================================== -SDL_FINGERDOWN: -Sent when a finger (or stylus) is placed on a touch device. -Fields: -* event.tfinger.touchId - the Id of the touch device. -* event.tfinger.fingerId - the Id of the finger which just went down. -* event.tfinger.x - the x coordinate of the touch (0..1) -* event.tfinger.y - the y coordinate of the touch (0..1) -* event.tfinger.pressure - the pressure of the touch (0..1) - -SDL_FINGERMOTION: -Sent when a finger (or stylus) is moved on the touch device. -Fields: -Same as SDL_FINGERDOWN but with additional: -* event.tfinger.dx - change in x coordinate during this motion event. -* event.tfinger.dy - change in y coordinate during this motion event. - -SDL_FINGERUP: -Sent when a finger (or stylus) is lifted from the touch device. -Fields: -Same as SDL_FINGERDOWN. - - -=========================================================================== -Functions -=========================================================================== -SDL provides the ability to access the underlying Finger structures. -These structures should _never_ be modified. - -The following functions are included from SDL_touch.h - -To get a SDL_TouchID call SDL_GetTouchDevice(index). -This returns a SDL_TouchID. -IMPORTANT: If the touch has been removed, or there is no touch with the given ID, SDL_GetTouchID will return 0. Be sure to check for this! - -The number of touch devices can be queried with SDL_GetNumTouchDevices(). - -A SDL_TouchID may be used to get pointers to SDL_Finger. - -SDL_GetNumTouchFingers(touchID) may be used to get the number of fingers currently down on the device. - -The most common reason to access SDL_Finger is to query the fingers outside the event. In most cases accessing the fingers is using the event. This would be accomplished by code like the following: - - float x = event.tfinger.x; - float y = event.tfinger.y; - - - -To get a SDL_Finger, call SDL_GetTouchFinger(touchID,index), where touchID is a SDL_TouchID, and index is the requested finger. -This returns a SDL_Finger*, or NULL if the finger does not exist, or has been removed. -A SDL_Finger is guaranteed to be persistent for the duration of a touch, but it will be de-allocated as soon as the finger is removed. This occurs when the SDL_FINGERUP event is _added_ to the event queue, and thus _before_ the SDL_FINGERUP event is polled. -As a result, be very careful to check for NULL return values. - -A SDL_Finger has the following fields: -* x,y,pressure: - The current coordinates of the touch. -* pressure: - The pressure of the touch. - - -=========================================================================== -Notes -=========================================================================== -For a complete example see test/testgesture.c - -Please direct questions/comments to: - jim.tla+sdl_touch@gmail.com - (original author, API was changed since) diff --git a/#ThirdParty/libSDL/docs/README-wince.md b/#ThirdParty/libSDL/docs/README-wince.md deleted file mode 100644 index c543ed6..0000000 --- a/#ThirdParty/libSDL/docs/README-wince.md +++ /dev/null @@ -1,10 +0,0 @@ -WinCE -===== - -Windows CE is no longer supported by SDL. - -We have left the CE support in SDL 1.2 for those that must have it, and we -have support for Windows Phone 8 and WinRT in SDL2, as of SDL 2.0.3. - ---ryan. - diff --git a/#ThirdParty/libSDL/docs/README-windows.md b/#ThirdParty/libSDL/docs/README-windows.md deleted file mode 100644 index 076b155..0000000 --- a/#ThirdParty/libSDL/docs/README-windows.md +++ /dev/null @@ -1,41 +0,0 @@ -Windows -================================================================================ - -================================================================================ -OpenGL ES 2.x support -================================================================================ - -SDL has support for OpenGL ES 2.x under Windows via two alternative -implementations. -The most straightforward method consists in running your app in a system with -a graphic card paired with a relatively recent (as of November of 2013) driver -which supports the WGL_EXT_create_context_es2_profile extension. Vendors known -to ship said extension on Windows currently include nVidia and Intel. - -The other method involves using the ANGLE library (https://code.google.com/p/angleproject/) -If an OpenGL ES 2.x context is requested and no WGL_EXT_create_context_es2_profile -extension is found, SDL will try to load the libEGL.dll library provided by -ANGLE. -To obtain the ANGLE binaries, you can either compile from source from -https://chromium.googlesource.com/angle/angle or copy the relevant binaries from -a recent Chrome/Chromium install for Windows. The files you need are: - - * libEGL.dll - * libGLESv2.dll - * d3dcompiler_46.dll (supports Windows Vista or later, better shader compiler) - or... - * d3dcompiler_43.dll (supports Windows XP or later) - -If you compile ANGLE from source, you can configure it so it does not need the -d3dcompiler_* DLL at all (for details on this, see their documentation). -However, by default SDL will try to preload the d3dcompiler_46.dll to -comply with ANGLE's requirements. If you wish SDL to preload d3dcompiler_43.dll (to -support Windows XP) or to skip this step at all, you can use the -SDL_HINT_VIDEO_WIN_D3DCOMPILER hint (see SDL_hints.h for more details). - -Known Bugs: - - * SDL_GL_SetSwapInterval is currently a no op when using ANGLE. It appears - that there's a bug in the library which prevents the window contents from - refreshing if this is set to anything other than the default value. - diff --git a/#ThirdParty/libSDL/docs/README-winrt.md b/#ThirdParty/libSDL/docs/README-winrt.md deleted file mode 100644 index 741def6..0000000 --- a/#ThirdParty/libSDL/docs/README-winrt.md +++ /dev/null @@ -1,468 +0,0 @@ -WinRT -===== - -This port allows SDL applications to run on Microsoft's platforms that require -use of "Windows Runtime", aka. "WinRT", APIs. WinRT apps are currently -full-screen only, and run in what Microsoft sometimes refers to as their -"Modern" (formerly, "Metro"), environment. For Windows 8.x, Microsoft may also -refer to them as "Windows Store" apps, due to them being distributed, -primarily, via a Microsoft-run online store (of the same name). - -Some of the operating systems that include WinRT, are: - -* Windows 10, via its Universal Windows Platform (UWP) APIs -* Windows 8.x -* Windows RT 8.x (aka. Windows 8.x for ARM processors) -* Windows Phone 8.x - - -Requirements ------------- - -* Microsoft Visual C++ (aka Visual Studio), either 2015, 2013, or 2012 - - Free, "Community" or "Express" editions may be used, so long as they - include support for either "Windows Store" or "Windows Phone" apps. - "Express" versions marked as supporting "Windows Desktop" development - typically do not include support for creating WinRT apps, to note. - (The "Community" editions of Visual C++ do, however, support both - desktop/Win32 and WinRT development). - - Visual C++ 2012 can only build apps that target versions 8.0 of Windows, - or Windows Phone. 8.0-targetted apps will run on devices running 8.1 - editions of Windows, however they will not be able to take advantage of - 8.1-specific features. - - Visual C++ 2013 cannot create app projects that target Windows 8.0. - Visual C++ 2013 Update 4, can create app projects for Windows Phone 8.0, - Windows Phone 8.1, and Windows 8.1, but not Windows 8.0. An optional - Visual Studio add-in, "Tools for Maintaining Store apps for Windows 8", - allows Visual C++ 2013 to load and build Windows 8.0 projects that were - created with Visual C++ 2012, so long as Visual C++ 2012 is installed - on the same machine. More details on targeting different versions of - Windows can found at the following web pages: - - [Develop apps by using Visual Studio 2013](http://msdn.microsoft.com/en-us/library/windows/apps/br211384.aspx) - - [To add the Tools for Maintaining Store apps for Windows 8](http://msdn.microsoft.com/en-us/library/windows/apps/dn263114.aspx#AddMaintenanceTools) -* A valid Microsoft account - This requirement is not imposed by SDL, but - rather by Microsoft's Visual C++ toolchain. This is required to launch or - debug apps. - - -Status ------- - -Here is a rough list of what works, and what doens't: - -* What works: - * compilation via Visual C++ 2012 through 2015 - * compile-time platform detection for SDL programs. The C/C++ #define, - `__WINRT__`, will be set to 1 (by SDL) when compiling for WinRT. - * GPU-accelerated 2D rendering, via SDL_Renderer. - * OpenGL ES 2, via the ANGLE library (included separately from SDL) - * software rendering, via either SDL_Surface (optionally in conjunction with - SDL_GetWindowSurface() and SDL_UpdateWindowSurface()) or via the - SDL_Renderer APIs - * threads - * timers (via SDL_GetTicks(), SDL_AddTimer(), SDL_GetPerformanceCounter(), - SDL_GetPerformanceFrequency(), etc.) - * file I/O via SDL_RWops - * mouse input (unsupported on Windows Phone) - * audio, via a modified version of SDL's XAudio2 backend - * .DLL file loading. Libraries *MUST* be packaged inside applications. Loading - anything outside of the app is not supported. - * system path retrieval via SDL's filesystem APIs - * game controllers. Support is provided via the SDL_Joystick and - SDL_GameController APIs, and is backed by Microsoft's XInput API. - * multi-touch input - * app events. SDL_APP_WILLENTER* and SDL_APP_DIDENTER* events get sent out as - appropriate. - * window events - * using Direct3D 11.x APIs outside of SDL. Non-XAML / Direct3D-only apps can - choose to render content directly via Direct3D, using SDL to manage the - internal WinRT window, as well as input and audio. (Use - SDL_GetWindowWMInfo() to get the WinRT 'CoreWindow', and pass it into - IDXGIFactory2::CreateSwapChainForCoreWindow() as appropriate.) - -* What partially works: - * keyboard input. Most of WinRT's documented virtual keys are supported, as - well as many keys with documented hardware scancodes. - * SDLmain. WinRT uses a different signature for each app's main() function. - SDL-based apps that use this port must compile in SDL_winrt_main_NonXAML.cpp - (in `SDL\src\main\winrt\`) directly in order for their C-style main() - functions to be called. - -* What doesn't work: - * compilation with anything other than Visual C++ - * programmatically-created custom cursors. These don't appear to be supported - by WinRT. Different OS-provided cursors can, however, be created via - SDL_CreateSystemCursor() (unsupported on Windows Phone) - * SDL_WarpMouseInWindow() or SDL_WarpMouseGlobal(). This are not currently - supported by WinRT itself. - * joysticks and game controllers that aren't supported by Microsoft's XInput - API. - * turning off VSync when rendering on Windows Phone. Attempts to turn VSync - off on Windows Phone result either in Direct3D not drawing anything, or it - forcing VSync back on. As such, SDL_RENDERER_PRESENTVSYNC will always get - turned-on on Windows Phone. This limitation is not present in non-Phone - WinRT (such as Windows 8.x), where turning off VSync appears to work. - * probably anything else that's not listed as supported - - - -Upgrade Notes -------------- - -#### SDL_GetPrefPath() usage when upgrading WinRT apps from SDL 2.0.3 - -SDL 2.0.4 fixes two bugs found in the WinRT version of SDL_GetPrefPath(). -The fixes may affect older, SDL 2.0.3-based apps' save data. Please note -that these changes only apply to SDL-based WinRT apps, and not to apps for -any other platform. - -1. SDL_GetPrefPath() would return an invalid path, one in which the path's - directory had not been created. Attempts to create files there - (via fopen(), for example), would fail, unless that directory was - explicitly created beforehand. - -2. SDL_GetPrefPath(), for non-WinPhone-based apps, would return a path inside - a WinRT 'Roaming' folder, the contents of which get automatically - synchronized across multiple devices. This process can occur while an - application runs, and can cause existing save-data to be overwritten - at unexpected times, with data from other devices. (Windows Phone apps - written with SDL 2.0.3 did not utilize a Roaming folder, due to API - restrictions in Windows Phone 8.0). - - -SDL_GetPrefPath(), starting with SDL 2.0.4, addresses these by: - -1. making sure that SDL_GetPrefPath() returns a directory in which data - can be written to immediately, without first needing to create directories. - -2. basing SDL_GetPrefPath() off of a different, non-Roaming folder, the - contents of which do not automatically get synchronized across devices - (and which require less work to use safely, in terms of data integrity). - -Apps that wish to get their Roaming folder's path can do so either by using -SDL_WinRTGetFSPathUTF8(), SDL_WinRTGetFSPathUNICODE() (which returns a -UCS-2/wide-char string), or directly through the WinRT class, -Windows.Storage.ApplicationData. - - - -Setup, High-Level Steps ------------------------ - -The steps for setting up a project for an SDL/WinRT app looks like the -following, at a high-level: - -1. create a new Visual C++ project using Microsoft's template for a, - "Direct3D App". -2. remove most of the files from the project. -3. make your app's project directly reference SDL/WinRT's own Visual C++ - project file, via use of Visual C++'s "References" dialog. This will setup - the linker, and will copy SDL's .dll files to your app's final output. -4. adjust your app's build settings, at minimum, telling it where to find SDL's - header files. -5. add a file that contains a WinRT-appropriate main function. -6. add SDL-specific app code. -7. build and run your app. - - -Setup, Detailed Steps ---------------------- - -### 1. Create a new project ### - -Create a new project using one of Visual C++'s templates for a plain, non-XAML, -"Direct3D App" (XAML support for SDL/WinRT is not yet ready for use). If you -don't see one of these templates, in Visual C++'s 'New Project' dialog, try -using the textbox titled, 'Search Installed Templates' to look for one. - - -### 2. Remove unneeded files from the project ### - -In the new project, delete any file that has one of the following extensions: - -- .cpp -- .h -- .hlsl - -When you are done, you should be left with a few files, each of which will be a -necessary part of your app's project. These files will consist of: - -- an .appxmanifest file, which contains metadata on your WinRT app. This is - similar to an Info.plist file on iOS, or an AndroidManifest.xml on Android. -- a few .png files, one of which is a splash screen (displayed when your app - launches), others are app icons. -- a .pfx file, used for code signing purposes. - - -### 3. Add references to SDL's project files ### - -SDL/WinRT can be built in multiple variations, spanning across three different -CPU architectures (x86, x64, and ARM) and two different configurations -(Debug and Release). WinRT and Visual C++ do not currently provide a means -for combining multiple variations of one library into a single file. -Furthermore, it does not provide an easy means for copying pre-built .dll files -into your app's final output (via Post-Build steps, for example). It does, -however, provide a system whereby an app can reference the MSVC projects of -libraries such that, when the app is built: - -1. each library gets built for the appropriate CPU architecture(s) and WinRT - platform(s). -2. each library's output, such as .dll files, get copied to the app's build - output. - -To set this up for SDL/WinRT, you'll need to run through the following steps: - -1. open up the Solution Explorer inside Visual C++ (under the "View" menu, then - "Solution Explorer") -2. right click on your app's solution. -3. navigate to "Add", then to "Existing Project..." -4. find SDL/WinRT's Visual C++ project file and open it. Different project - files exist for different WinRT platforms. All of them are in SDL's - source distribution, in the following directories: - * `VisualC-WinRT/UWP_VS2015/` - for Windows 10 / UWP apps - * `VisualC-WinRT/WinPhone81_VS2013/` - for Windows Phone 8.1 apps - * `VisualC-WinRT/WinRT80_VS2012/` - for Windows 8.0 apps - * `VisualC-WinRT/WinRT81_VS2013/` - for Windows 8.1 apps -5. once the project has been added, right-click on your app's project and - select, "References..." -6. click on the button titled, "Add New Reference..." -7. check the box next to SDL -8. click OK to close the dialog -9. SDL will now show up in the list of references. Click OK to close that - dialog. - -Your project is now linked to SDL's project, insofar that when the app is -built, SDL will be built as well, with its build output getting included with -your app. - - -### 4. Adjust Your App's Build Settings ### - -Some build settings need to be changed in your app's project. This guide will -outline the following: - -- making sure that the compiler knows where to find SDL's header files -- **Optional for C++, but NECESSARY for compiling C code:** telling the - compiler not to use Microsoft's C++ extensions for WinRT development. -- **Optional:** telling the compiler not generate errors due to missing - precompiled header files. - -To change these settings: - -1. right-click on the project -2. choose "Properties" -3. in the drop-down box next to "Configuration", choose, "All Configurations" -4. in the drop-down box next to "Platform", choose, "All Platforms" -5. in the left-hand list, expand the "C/C++" section -6. select "General" -7. edit the "Additional Include Directories" setting, and add a path to SDL's - "include" directory -8. **Optional: to enable compilation of C code:** change the setting for - "Consume Windows Runtime Extension" from "Yes (/ZW)" to "No". If you're - working with a completely C++ based project, this step can usually be - omitted. -9. **Optional: to disable precompiled headers (which can produce - 'stdafx.h'-related build errors, if setup incorrectly:** in the left-hand - list, select "Precompiled Headers", then change the setting for "Precompiled - Header" from "Use (/Yu)" to "Not Using Precompiled Headers". -10. close the dialog, saving settings, by clicking the "OK" button - - -### 5. Add a WinRT-appropriate main function to the app. ### - -C/C++-based WinRT apps do contain a `main` function that the OS will invoke when -the app starts launching. The parameters of WinRT main functions are different -than those found on other platforms, Win32 included. SDL/WinRT provides a -platform-appropriate main function that will perform these actions, setup key -portions of the app, then invoke a classic, C/C++-style main function (that take -in "argc" and "argv" parameters). The code for this file is contained inside -SDL's source distribution, under `src/main/winrt/SDL_winrt_main_NonXAML.cpp`. -You'll need to add this file, or a copy of it, to your app's project, and make -sure it gets compiled using a Microsoft-specific set of C++ extensions called -C++/CX. - -**NOTE: C++/CX compilation is currently required in at least one file of your -app's project. This is to make sure that Visual C++'s linker builds a 'Windows -Metadata' file (.winmd) for your app. Not doing so can lead to build errors.** - -To include `SDL_winrt_main_NonXAML.cpp`: - -1. right-click on your project (again, in Visual C++'s Solution Explorer), - navigate to "Add", then choose "Existing Item...". -2. open `SDL_winrt_main_NonXAML.cpp`, which is found inside SDL's source - distribution, under `src/main/winrt/`. Make sure that the open-file dialog - closes, either by double-clicking on the file, or single-clicking on it and - then clicking Add. -3. right-click on the file (as listed in your project), then click on - "Properties...". -4. in the drop-down box next to "Configuration", choose, "All Configurations" -5. in the drop-down box next to "Platform", choose, "All Platforms" -6. in the left-hand list, click on "C/C++" -7. change the setting for "Consume Windows Runtime Extension" to "Yes (/ZW)". -8. click the OK button. This will close the dialog. - - -### 6. Add app code and assets ### - -At this point, you can add in SDL-specific source code. Be sure to include a -C-style main function (ie: `int main(int argc, char *argv[])`). From there you -should be able to create a single `SDL_Window` (WinRT apps can only have one -window, at present), as well as an `SDL_Renderer`. Direct3D will be used to -draw content. Events are received via SDL's usual event functions -(`SDL_PollEvent`, etc.) If you have a set of existing source files and assets, -you can start adding them to the project now. If not, or if you would like to -make sure that you're setup correctly, some short and simple sample code is -provided below. - - -#### 6.A. ... when creating a new app #### - -If you are creating a new app (rather than porting an existing SDL-based app), -or if you would just like a simple app to test SDL/WinRT with before trying to -get existing code working, some working SDL/WinRT code is provided below. To -set this up: - -1. right click on your app's project -2. select Add, then New Item. An "Add New Item" dialog will show up. -3. from the left-hand list, choose "Visual C++" -4. from the middle/main list, choose "C++ File (.cpp)" -5. near the bottom of the dialog, next to "Name:", type in a name for your -source file, such as, "main.cpp". -6. click on the Add button. This will close the dialog, add the new file to -your project, and open the file in Visual C++'s text editor. -7. Copy and paste the following code into the new file, then save it. - - - #include - - int main(int argc, char **argv) - { - SDL_DisplayMode mode; - SDL_Window * window = NULL; - SDL_Renderer * renderer = NULL; - SDL_Event evt; - - if (SDL_Init(SDL_INIT_VIDEO) != 0) { - return 1; - } - - if (SDL_GetCurrentDisplayMode(0, &mode) != 0) { - return 1; - } - - if (SDL_CreateWindowAndRenderer(mode.w, mode.h, SDL_WINDOW_FULLSCREEN, &window, &renderer) != 0) { - return 1; - } - - while (1) { - while (SDL_PollEvent(&evt)) { - } - - SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255); - SDL_RenderClear(renderer); - SDL_RenderPresent(renderer); - } - } - - -#### 6.B. Adding code and assets #### - -If you have existing code and assets that you'd like to add, you should be able -to add them now. The process for adding a set of files is as such. - -1. right click on the app's project -2. select Add, then click on "New Item..." -3. open any source, header, or asset files as appropriate. Support for C and -C++ is available. - -Do note that WinRT only supports a subset of the APIs that are available to -Win32-based apps. Many portions of the Win32 API and the C runtime are not -available. - -A list of unsupported C APIs can be found at - - -General information on using the C runtime in WinRT can be found at - - -A list of supported Win32 APIs for WinRT apps can be found at -. To note, -the list of supported Win32 APIs for Windows Phone 8.0 is different. -That list can be found at - - - -### 7. Build and run your app ### - -Your app project should now be setup, and you should be ready to build your app. -To run it on the local machine, open the Debug menu and choose "Start -Debugging". This will build your app, then run your app full-screen. To switch -out of your app, press the Windows key. Alternatively, you can choose to run -your app in a window. To do this, before building and running your app, find -the drop-down menu in Visual C++'s toolbar that says, "Local Machine". Expand -this by clicking on the arrow on the right side of the list, then click on -Simulator. Once you do that, any time you build and run the app, the app will -launch in window, rather than full-screen. - - -#### 7.A. Running apps on older, ARM-based, "Windows RT" devices #### - -**These instructions do not include Windows Phone, despite Windows Phone -typically running on ARM processors.** They are specifically for devices -that use the "Windows RT" operating system, which was a modified version of -Windows 8.x that ran primarily on ARM-based tablet computers. - -To build and run the app on ARM-based, "Windows RT" devices, you'll need to: - -- install Microsoft's "Remote Debugger" on the device. Visual C++ installs and - debugs ARM-based apps via IP networks. -- change a few options on the development machine, both to make sure it builds - for ARM (rather than x86 or x64), and to make sure it knows how to find the - Windows RT device (on the network). - -Microsoft's Remote Debugger can be found at -. Please note -that separate versions of this debugger exist for different versions of Visual -C++, one each for MSVC 2015, 2013, and 2012. - -To setup Visual C++ to launch your app on an ARM device: - -1. make sure the Remote Debugger is running on your ARM device, and that it's on - the same IP network as your development machine. -2. from Visual C++'s toolbar, find a drop-down menu that says, "Win32". Click - it, then change the value to "ARM". -3. make sure Visual C++ knows the hostname or IP address of the ARM device. To - do this: - 1. open the app project's properties - 2. select "Debugging" - 3. next to "Machine Name", enter the hostname or IP address of the ARM - device - 4. if, and only if, you've turned off authentication in the Remote Debugger, - then change the setting for "Require Authentication" to No - 5. click "OK" -4. build and run the app (from Visual C++). The first time you do this, a - prompt will show up on the ARM device, asking for a Microsoft Account. You - do, unfortunately, need to log in here, and will need to follow the - subsequent registration steps in order to launch the app. After you do so, - if the app didn't already launch, try relaunching it again from within Visual - C++. - - -Troubleshooting ---------------- - -#### Build fails with message, "error LNK2038: mismatch detected for 'vccorlib_lib_should_be_specified_before_msvcrt_lib_to_linker'" - -Try adding the following to your linker flags. In MSVC, this can be done by -right-clicking on the app project, navigating to Configuration Properties -> -Linker -> Command Line, then adding them to the Additional Options -section. - -* For Release builds / MSVC-Configurations, add: - - /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib - -* For Debug builds / MSVC-Configurations, add: - - /nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib - diff --git a/#ThirdParty/libSDL/docs/README.md b/#ThirdParty/libSDL/docs/README.md deleted file mode 100644 index 4e31069..0000000 --- a/#ThirdParty/libSDL/docs/README.md +++ /dev/null @@ -1,63 +0,0 @@ -Simple DirectMedia Layer {#mainpage} -======================== - - (SDL) - - Version 2.0 - ---- -http://www.libsdl.org/ - -Simple DirectMedia Layer is a cross-platform development library designed -to provide low level access to audio, keyboard, mouse, joystick, and graphics -hardware via OpenGL and Direct3D. It is used by video playback software, -emulators, and popular games including Valve's award winning catalog -and many Humble Bundle games. - -SDL officially supports Windows, Mac OS X, Linux, iOS, and Android. -Support for other platforms may be found in the source code. - -SDL is written in C, works natively with C++, and there are bindings -available for several other languages, including C# and Python. - -This library is distributed under the zlib license, which can be found -in the file "COPYING.txt". - -The best way to learn how to use SDL is to check out the header files in -the "include" subdirectory and the programs in the "test" subdirectory. -The header files and test programs are well commented and always up to date. - -More documentation and FAQs are available online at [the wiki](http://wiki.libsdl.org/) - -- [Android](README-android.md) -- [CMake](README-cmake.md) -- [DirectFB](README-directfb.md) -- [DynAPI](README-dynapi.md) -- [Emscripten](README-emscripten.md) -- [Gesture](README-gesture.md) -- [Mercurial](README-hg.md) -- [iOS](README-ios.md) -- [Linux](README-linux.md) -- [OS X](README-macosx.md) -- [Native Client](README-nacl.md) -- [Pandora](README-pandora.md) -- [Supported Platforms](README-platforms.md) -- [Porting information](README-porting.md) -- [PSP](README-psp.md) -- [Raspberry Pi](README-raspberrypi.md) -- [Touch](README-touch.md) -- [WinCE](README-wince.md) -- [Windows](README-windows.md) -- [WinRT](README-winrt.md) - -If you need help with the library, or just want to discuss SDL related -issues, you can join the [developers mailing list](http://www.libsdl.org/mailing-list.php) - -If you want to report bugs or contribute patches, please submit them to -[bugzilla](http://bugzilla.libsdl.org/) - -Enjoy! - - -Sam Lantinga - diff --git a/#ThirdParty/libSDL/docs/doxyfile b/#ThirdParty/libSDL/docs/doxyfile deleted file mode 100644 index baf1c98..0000000 --- a/#ThirdParty/libSDL/docs/doxyfile +++ /dev/null @@ -1,1560 +0,0 @@ -# Doxyfile 1.5.9 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all -# text before the first occurrence of this tag. Doxygen uses libiconv (or the -# iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = SDL - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = 2.0 - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = ./output - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = YES - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, -# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English -# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, -# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, -# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = "The $name class" \ - "The $name widget" \ - "The $name file" \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = YES - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = YES - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) - -JAVADOC_AUTOBRIEF = NO - -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 8 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = "defined=\"\def\"" \ - "discussion=\"\par Discussion:\n\"" - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for -# Java. For instance, namespaces will be presented as packages, qualified -# scopes will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources only. Doxygen will then generate output that is more tailored for -# Fortran. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for -# VHDL. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it parses. -# With this tag you can assign which parser to use for a given extension. -# Doxygen has a built-in mapping, but you can override or extend it using this tag. -# The format is ext=language, where ext is a file extension, and language is one of -# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, -# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat -# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), -# use: inc=Fortran f=C. Note that for custom extensions you also need to set -# FILE_PATTERNS otherwise the files are not read by doxygen. - -EXTENSION_MAPPING = - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = YES - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. -# Doxygen will parse them like normal C++ but will assume all classes use public -# instead of private inheritance when no explicit protection keyword is present. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate getter -# and setter methods for a property. Setting this option to YES (the default) -# will make doxygen to replace the get and set methods by a property in the -# documentation. This will only work if the methods are indeed getting or -# setting a simple type. If this is not the case, or you want to show the -# methods anyway, you should set this option to NO. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum -# is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically -# be useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. - -TYPEDEF_HIDES_STRUCT = YES - -# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to -# determine which symbols to keep in memory and which to flush to disk. -# When the cache is full, less often used symbols will be written to disk. -# For small to medium size projects (<1000 input files) the default value is -# probably good enough. For larger projects a too small cache size can cause -# doxygen to be busy swapping symbols to and from disk most of the time -# causing a significant performance penality. -# If the system has enough physical memory increasing the cache will improve the -# performance by keeping more symbols in memory. Note that the value works on -# a logarithmic scale so increasing the size by one will rougly double the -# memory usage. The cache size is given by this formula: -# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols - -SYMBOL_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = YES - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = YES - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = YES - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base -# name of the file that contains the anonymous namespace. By default -# anonymous namespace are hidden. - -EXTRACT_ANON_NSPACES = YES - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = YES - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = NO - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the -# hierarchy of group names into alphabetical order. If set to NO (the default) -# the group names will appear in their defined order. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy -# in the documentation. The default is NO. - -SHOW_DIRECTORIES = YES - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. -# This will remove the Files entry from the Quick Index and from the -# Folder Tree View (if specified). The default is YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the -# Namespaces page. This will remove the Namespaces entry from the Quick Index -# and from the Folder Tree View (if specified). The default is YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by -# doxygen. The layout file controls the global structure of the generated output files -# in an output format independent way. The create the layout file that represents -# doxygen's defaults, run doxygen with the -l option. You can optionally specify a -# file name after the option, if omitted DoxygenLayout.xml will be used as the name -# of the layout file. - -LAYOUT_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be abled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = YES - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = ./doxygen_warn.txt - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = . ../include - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is -# also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for -# the list of possible encodings. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx -# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 - -FILE_PATTERNS = *.c \ - *.cc \ - *.cxx \ - *.cpp \ - *.c++ \ - *.d \ - *.java \ - *.ii \ - *.ixx \ - *.ipp \ - *.i++ \ - *.inl \ - *.h \ - *.hh \ - *.hxx \ - *.hpp \ - *.h++ \ - *.idl \ - *.odl \ - *.cs \ - *.php \ - *.php3 \ - *.inc \ - *.m \ - *.mm \ - *.dox \ - *.py \ - *.f90 \ - *.f \ - *.vhd \ - *.vhdl \ - *.h.in \ - *.h.default \ - *.md - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = ../include/SDL_opengles2_gl2ext.h \ - ../include/SDL_opengles2_gl2platform.h \ - ../include/SDL_opengles2_khrplatform.h \ - ../include/SDL_opengl_glext.h \ - ../include/SDL_opengles2_gl2.h \ - ../include/SDL_opengles2.h \ - ../include/SDL_opengles.h \ - ../include/SDL_opengl.h \ - ../include/SDL_egl.h \ - - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix filesystem feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = * - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = YES - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER -# is applied to all files. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = YES - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = YES - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = NO - -# If the REFERENCED_BY_RELATION tag is set to YES -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = YES - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. Otherwise they will link to the documentation. - -REFERENCES_LINK_SOURCE = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = YES - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = SDL_ \ - SDL - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. For this to work a browser that supports -# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox -# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). - -HTML_DYNAMIC_SECTIONS = YES - -# If the GENERATE_DOCSET tag is set to YES, additional index files -# will be generated that can be used as input for Apple's Xcode 3 -# integrated development environment, introduced with OSX 10.5 (Leopard). -# To create a documentation set, doxygen will generate a Makefile in the -# HTML output directory. Running make will produce the docset in that -# directory and running "make install" will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find -# it at startup. -# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. - -GENERATE_DOCSET = NO - -# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the -# feed. A documentation feed provides an umbrella under which multiple -# documentation sets from a single provider (such as a company or product suite) -# can be grouped. - -DOCSET_FEEDNAME = "SDL 2.0 Doxygen" - -# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that -# should uniquely identify the documentation set bundle. This should be a -# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen -# will append .docset to the name. - -DOCSET_BUNDLE_ID = org.libsdl.sdl20 - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = ./sdl20.chm - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING -# is used to encode HtmlHelp index (hhk), content (hhc) and project file -# content. - -CHM_INDEX_ENCODING = - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = YES - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER -# are set, an additional index file will be generated that can be used as input for -# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated -# HTML documentation. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can -# be used to specify the file name of the resulting .qch file. -# The path specified is relative to the HTML output folder. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#namespace - -QHP_NAMESPACE = - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#virtual-folders - -QHP_VIRTUAL_FOLDER = doc - -# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. -# For more information please see -# http://doc.trolltech.com/qthelpproject.html#custom-filters - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see -# Qt Help Project / Custom Filters. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's -# filter section matches. -# Qt Help Project / Filter Attributes. - -QHP_SECT_FILTER_ATTRS = - -# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can -# be used to specify the location of Qt's qhelpgenerator. -# If non-empty doxygen will try to run qhelpgenerator on the generated -# .qhp file. - -QHG_LOCATION = - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - -ENUM_VALUES_PER_LINE = 1 - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. -# If the tag value is set to FRAME, a side panel will be generated -# containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, -# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are -# probably better off using the HTML help feature. Other possible values -# for this tag are: HIERARCHIES, which will generate the Groups, Directories, -# and Class Hierarchy pages using a tree view instead of an ordered list; -# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which -# disables this behavior completely. For backwards compatibility with previous -# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE -# respectively. - -GENERATE_TREEVIEW = ALL - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -# Use this tag to change the font size of Latex formulas included -# as images in the HTML documentation. The default is 10. Note that -# when you change the font size after a successful doxygen run you need -# to manually remove any form_*.png images from the HTML output directory -# to force them to be regenerated. - -FORMULA_FONTSIZE = 10 - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = YES - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = YES - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -# If LATEX_SOURCE_CODE is set to YES then doxygen will include -# source code with syntax highlighting in the LaTeX output. -# Note that which sources are shown also depends on other settings -# such as SOURCE_BROWSER. - -LATEX_SOURCE_CODE = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = YES - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = YES - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = DOXYGEN_SHOULD_IGNORE_THIS=1 \ - DECLSPEC= \ - SDLCALL= \ - _WIN32=1 - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse -# the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = ./SDL.tag - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = c:\Perl\bin\perl.exe - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option is superseded by the HAVE_DOT option below. This is only a -# fallback. It is recommended to install and use dot, since it yields more -# powerful graphs. - -CLASS_DIAGRAMS = YES - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see -# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = YES - -# By default doxygen will write a font called FreeSans.ttf to the output -# directory and reference it in all dot files that doxygen generates. This -# font does not include all possible unicode characters however, so when you need -# these (or just want a differently looking font) you can specify the font name -# using DOT_FONTNAME. You need need to make sure dot is able to find the font, -# which can be done by putting it in a standard location or by setting the -# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory -# containing the font. - -DOT_FONTNAME = FreeSans - -# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. -# The default size is 10pt. - -DOT_FONTSIZE = 10 - -# By default doxygen will tell dot to use the output directory to look for the -# FreeSans.ttf font (which doxygen will put there itself). If you specify a -# different font using DOT_FONTNAME you can set the path where dot -# can find it using this tag. - -DOT_FONTPATH = - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT options are set to YES then -# doxygen will generate a call dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable call graphs -# for selected functions only using the \callgraph command. - -CALL_GRAPH = NO - -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then -# doxygen will generate a caller dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable caller -# graphs for selected functions only using the \callergraph command. - -CALLER_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif -# If left blank png will be used. - -DOT_IMAGE_FORMAT = png - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of -# nodes that will be shown in the graph. If the number of nodes in a graph -# becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen if the -# number of direct children of the root node in a graph is already larger than -# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note -# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. - -DOT_GRAPH_MAX_NODES = 60 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that the size of a graph can be further restricted by -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. - -MAX_DOT_GRAPH_DEPTH = 2 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not -# seem to support this out of the box. Warning: Depending on the platform used, -# enabling this option may lead to badly anti-aliased labels on the edges of -# a graph (i.e. they become hard to read). - -DOT_TRANSPARENT = NO - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = YES - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES - -#--------------------------------------------------------------------------- -# Options related to the search engine -#--------------------------------------------------------------------------- - -# The SEARCHENGINE tag specifies whether or not a search engine should be -# used. If set to NO the values of all tags below this one will be ignored. - -SEARCHENGINE = NO diff --git a/#ThirdParty/libSDL/include/SDL_revision.h b/#ThirdParty/libSDL/include/SDL_revision.h deleted file mode 100644 index 6d7163d..0000000 --- a/#ThirdParty/libSDL/include/SDL_revision.h +++ /dev/null @@ -1,2 +0,0 @@ -#define SDL_REVISION "hg-10001:e12c38730512" -#define SDL_REVISION_NUMBER 10001 diff --git a/#ThirdParty/libSDL/lib/x64/SDL2.dll b/#ThirdParty/libSDL/lib/x64/SDL2.dll deleted file mode 100644 index 0f653f5..0000000 Binary files a/#ThirdParty/libSDL/lib/x64/SDL2.dll and /dev/null differ diff --git a/#ThirdParty/libSDL/lib/x64/SDL2.lib b/#ThirdParty/libSDL/lib/x64/SDL2.lib deleted file mode 100644 index fd67b32..0000000 Binary files a/#ThirdParty/libSDL/lib/x64/SDL2.lib and /dev/null differ diff --git a/#ThirdParty/libSDL/lib/x64/SDL2main.lib b/#ThirdParty/libSDL/lib/x64/SDL2main.lib deleted file mode 100644 index a001767..0000000 Binary files a/#ThirdParty/libSDL/lib/x64/SDL2main.lib and /dev/null differ diff --git a/#ThirdParty/libSDL/lib/x64/SDL2test.lib b/#ThirdParty/libSDL/lib/x64/SDL2test.lib deleted file mode 100644 index ef4eaad..0000000 Binary files a/#ThirdParty/libSDL/lib/x64/SDL2test.lib and /dev/null differ diff --git a/#ThirdParty/libSDL/lib/x86/SDL2.dll b/#ThirdParty/libSDL/lib/x86/SDL2.dll deleted file mode 100644 index 15ad52e..0000000 Binary files a/#ThirdParty/libSDL/lib/x86/SDL2.dll and /dev/null differ diff --git a/#ThirdParty/libSDL/lib/x86/SDL2.lib b/#ThirdParty/libSDL/lib/x86/SDL2.lib deleted file mode 100644 index d24f272..0000000 Binary files a/#ThirdParty/libSDL/lib/x86/SDL2.lib and /dev/null differ diff --git a/#ThirdParty/libSDL/lib/x86/SDL2main.lib b/#ThirdParty/libSDL/lib/x86/SDL2main.lib deleted file mode 100644 index 5993374..0000000 Binary files a/#ThirdParty/libSDL/lib/x86/SDL2main.lib and /dev/null differ diff --git a/#ThirdParty/libSDL/lib/x86/SDL2test.lib b/#ThirdParty/libSDL/lib/x86/SDL2test.lib deleted file mode 100644 index d9f3614..0000000 Binary files a/#ThirdParty/libSDL/lib/x86/SDL2test.lib and /dev/null differ diff --git a/#ThirdParty/ddraw.lib b/third-party/ddraw.lib similarity index 100% rename from #ThirdParty/ddraw.lib rename to third-party/ddraw.lib diff --git a/#ThirdParty/dsound.lib b/third-party/dsound.lib similarity index 100% rename from #ThirdParty/dsound.lib rename to third-party/dsound.lib diff --git a/#ThirdParty/dxguid.lib b/third-party/dxguid.lib similarity index 100% rename from #ThirdParty/dxguid.lib rename to third-party/dxguid.lib diff --git a/#ThirdParty/fmodapi375win/api/fmod.dll b/third-party/fmod/api/fmod.dll similarity index 100% rename from #ThirdParty/fmodapi375win/api/fmod.dll rename to third-party/fmod/api/fmod.dll diff --git a/#ThirdParty/fmodapi375win/api/fmod64.dll b/third-party/fmod/api/fmod64.dll similarity index 100% rename from #ThirdParty/fmodapi375win/api/fmod64.dll rename to third-party/fmod/api/fmod64.dll diff --git a/#ThirdParty/fmodapi375win/api/inc/fmod.h b/third-party/fmod/api/inc/fmod.h similarity index 98% rename from #ThirdParty/fmodapi375win/api/inc/fmod.h rename to third-party/fmod/api/inc/fmod.h index 54d3562..b965593 100644 --- a/#ThirdParty/fmodapi375win/api/inc/fmod.h +++ b/third-party/fmod/api/inc/fmod.h @@ -1,1224 +1,1224 @@ -/* ========================================================================================== */ -/* FMOD Main header file. Copyright (c), Firelight Technologies Pty, Ltd. 1999-2004. */ -/* ========================================================================================== */ - -#ifndef _FMOD_H_ -#define _FMOD_H_ - -/* ========================================================================================== */ -/* DEFINITIONS */ -/* ========================================================================================== */ - -#if (!defined(WIN32) && !defined(_WIN32) && !defined(__WIN32__) && !defined(_WIN64) && !defined(_WIN32_WCE) && !defined(_XBOX)) || (defined(__GNUC__) && defined(WIN32)) - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __stdcall - #define __stdcall - #endif -#endif - -#if defined(_WIN32_WCE) - #define F_API _cdecl - #define F_CALLBACKAPI _cdecl -#else - #define F_API __stdcall - #define F_CALLBACKAPI __stdcall -#endif - -#ifdef DLL_EXPORTS - #define DLL_API __declspec(dllexport) -#else - #if defined(__LCC__) || defined(__MINGW32__) || defined(__CYGWIN32__) - #define DLL_API F_API - #else - #define DLL_API - #endif /* __LCC__ || __MINGW32__ || __CYGWIN32__ */ -#endif /* DLL_EXPORTS */ - -#define FMOD_VERSION 3.75f - -/* - FMOD defined types -*/ -typedef struct FSOUND_SAMPLE FSOUND_SAMPLE; -typedef struct FSOUND_STREAM FSOUND_STREAM; -typedef struct FSOUND_DSPUNIT FSOUND_DSPUNIT; -typedef struct FSOUND_SYNCPOINT FSOUND_SYNCPOINT; -typedef struct FMUSIC_MODULE FMUSIC_MODULE; - -/* - Callback types -*/ -typedef void * (F_CALLBACKAPI *FSOUND_OPENCALLBACK) (const char *name); -typedef void (F_CALLBACKAPI *FSOUND_CLOSECALLBACK) (void *handle); -typedef int (F_CALLBACKAPI *FSOUND_READCALLBACK) (void *buffer, int size, void *handle); -typedef int (F_CALLBACKAPI *FSOUND_SEEKCALLBACK) (void *handle, int pos, signed char mode); -typedef int (F_CALLBACKAPI *FSOUND_TELLCALLBACK) (void *handle); - -typedef void * (F_CALLBACKAPI *FSOUND_ALLOCCALLBACK) (unsigned int size); -typedef void * (F_CALLBACKAPI *FSOUND_REALLOCCALLBACK) (void *ptr, unsigned int size); -typedef void (F_CALLBACKAPI *FSOUND_FREECALLBACK) (void *ptr); - -typedef void * (F_CALLBACKAPI *FSOUND_DSPCALLBACK) (void *originalbuffer, void *newbuffer, int length, void *userdata); -typedef signed char (F_CALLBACKAPI *FSOUND_STREAMCALLBACK) (FSOUND_STREAM *stream, void *buff, int len, void *userdata); -typedef signed char (F_CALLBACKAPI *FSOUND_METADATACALLBACK)(char *name, char *value, void *userdata); -typedef void (F_CALLBACKAPI *FMUSIC_CALLBACK) (FMUSIC_MODULE *mod, unsigned char param); - - -/* -[ENUM] -[ - [DESCRIPTION] - On failure of commands in FMOD, use FSOUND_GetError to attain what happened. - - [SEE_ALSO] - FSOUND_GetError -] -*/ -enum FMOD_ERRORS -{ - FMOD_ERR_NONE, /* No errors */ - FMOD_ERR_BUSY, /* Cannot call this command after FSOUND_Init. Call FSOUND_Close first. */ - FMOD_ERR_UNINITIALIZED, /* This command failed because FSOUND_Init or FSOUND_SetOutput was not called */ - FMOD_ERR_INIT, /* Error initializing output device. */ - FMOD_ERR_ALLOCATED, /* Error initializing output device, but more specifically, the output device is already in use and cannot be reused. */ - FMOD_ERR_PLAY, /* Playing the sound failed. */ - FMOD_ERR_OUTPUT_FORMAT, /* Soundcard does not support the features needed for this soundsystem (16bit stereo output) */ - FMOD_ERR_COOPERATIVELEVEL, /* Error setting cooperative level for hardware. */ - FMOD_ERR_CREATEBUFFER, /* Error creating hardware sound buffer. */ - FMOD_ERR_FILE_NOTFOUND, /* File not found */ - FMOD_ERR_FILE_FORMAT, /* Unknown file format */ - FMOD_ERR_FILE_BAD, /* Error loading file */ - FMOD_ERR_MEMORY, /* Not enough memory or resources */ - FMOD_ERR_VERSION, /* The version number of this file format is not supported */ - FMOD_ERR_INVALID_PARAM, /* An invalid parameter was passed to this function */ - FMOD_ERR_NO_EAX, /* Tried to use an EAX command on a non EAX enabled channel or output. */ - FMOD_ERR_CHANNEL_ALLOC, /* Failed to allocate a new channel */ - FMOD_ERR_RECORD, /* Recording is not supported on this machine */ - FMOD_ERR_MEDIAPLAYER, /* Windows Media Player not installed so cannot play wma or use internet streaming. */ - FMOD_ERR_CDDEVICE /* An error occured trying to open the specified CD device */ -}; - - -/* -[ENUM] -[ - [DESCRIPTION] - These output types are used with FSOUND_SetOutput, to choose which output driver to use. - - FSOUND_OUTPUT_DSOUND will not support hardware 3d acceleration if the sound card driver - does not support DirectX 6 Voice Manager Extensions. - - FSOUND_OUTPUT_WINMM is recommended for NT and CE. - - [SEE_ALSO] - FSOUND_SetOutput - FSOUND_GetOutput -] -*/ -enum FSOUND_OUTPUTTYPES -{ - FSOUND_OUTPUT_NOSOUND, /* NoSound driver, all calls to this succeed but do nothing. */ - FSOUND_OUTPUT_WINMM, /* Windows Multimedia driver. */ - FSOUND_OUTPUT_DSOUND, /* DirectSound driver. You need this to get EAX2 or EAX3 support, or FX api support. */ - FSOUND_OUTPUT_A3D, /* A3D driver. */ - - FSOUND_OUTPUT_OSS, /* Linux/Unix OSS (Open Sound System) driver, i.e. the kernel sound drivers. */ - FSOUND_OUTPUT_ESD, /* Linux/Unix ESD (Enlightment Sound Daemon) driver. */ - FSOUND_OUTPUT_ALSA, /* Linux Alsa driver. */ - - FSOUND_OUTPUT_ASIO, /* Low latency ASIO driver */ - FSOUND_OUTPUT_XBOX, /* Xbox driver */ - FSOUND_OUTPUT_PS2, /* PlayStation 2 driver */ - FSOUND_OUTPUT_MAC, /* Mac SoundManager driver */ - FSOUND_OUTPUT_GC, /* Gamecube driver */ - FSOUND_OUTPUT_PSP, /* PlayStation Portable driver */ - - FSOUND_OUTPUT_NOSOUND_NONREALTIME /* This is the same as nosound, but the sound generation is driven by FSOUND_Update */ -}; - - -/* -[ENUM] -[ - [DESCRIPTION] - These mixer types are used with FSOUND_SetMixer, to choose which mixer to use, or to act - upon for other reasons using FSOUND_GetMixer. - It is not nescessary to set the mixer. FMOD will autodetect the best mixer for you. - - [SEE_ALSO] - FSOUND_SetMixer - FSOUND_GetMixer -] -*/ -enum FSOUND_MIXERTYPES -{ - FSOUND_MIXER_AUTODETECT, /* CE/PS2/GC Only - Non interpolating/low quality mixer. */ - FSOUND_MIXER_BLENDMODE, /* Removed / obsolete. */ - FSOUND_MIXER_MMXP5, /* Removed / obsolete. */ - FSOUND_MIXER_MMXP6, /* Removed / obsolete. */ - - FSOUND_MIXER_QUALITY_AUTODETECT,/* All platforms - Autodetect the fastest quality mixer based on your cpu. */ - FSOUND_MIXER_QUALITY_FPU, /* Win32/Linux only - Interpolating/volume ramping FPU mixer. */ - FSOUND_MIXER_QUALITY_MMXP5, /* Win32/Linux only - Interpolating/volume ramping P5 MMX mixer. */ - FSOUND_MIXER_QUALITY_MMXP6, /* Win32/Linux only - Interpolating/volume ramping ppro+ MMX mixer. */ - - FSOUND_MIXER_MONO, /* CE/PS2/GC only - MONO non interpolating/low quality mixer. For speed*/ - FSOUND_MIXER_QUALITY_MONO, /* CE/PS2/GC only - MONO Interpolating mixer. For speed */ - - FSOUND_MIXER_MAX -}; - - -/* -[ENUM] -[ - [DESCRIPTION] - These definitions describe the type of song being played. - - [SEE_ALSO] - FMUSIC_GetType -] -*/ -enum FMUSIC_TYPES -{ - FMUSIC_TYPE_NONE, - FMUSIC_TYPE_MOD, /* Protracker / Fasttracker */ - FMUSIC_TYPE_S3M, /* ScreamTracker 3 */ - FMUSIC_TYPE_XM, /* FastTracker 2 */ - FMUSIC_TYPE_IT, /* Impulse Tracker. */ - FMUSIC_TYPE_MIDI, /* MIDI file */ - FMUSIC_TYPE_FSB /* FMOD Sample Bank file */ -}; - - -/* -[DEFINE_START] -[ - [NAME] - FSOUND_DSP_PRIORITIES - - [DESCRIPTION] - These default priorities are used by FMOD internal system DSP units. They describe the - position of the DSP chain, and the order of how audio processing is executed. - You can actually through the use of FSOUND_DSP_GetxxxUnit (where xxx is the name of the DSP - unit), disable or even change the priority of a DSP unit. - - [SEE_ALSO] - FSOUND_DSP_Create - FSOUND_DSP_SetPriority - FSOUND_DSP_GetSpectrum -] -*/ -#define FSOUND_DSP_DEFAULTPRIORITY_CLEARUNIT 0 /* DSP CLEAR unit - done first */ -#define FSOUND_DSP_DEFAULTPRIORITY_SFXUNIT 100 /* DSP SFX unit - done second */ -#define FSOUND_DSP_DEFAULTPRIORITY_MUSICUNIT 200 /* DSP MUSIC unit - done third */ -#define FSOUND_DSP_DEFAULTPRIORITY_USER 300 /* User priority, use this as reference for your own DSP units */ -#define FSOUND_DSP_DEFAULTPRIORITY_FFTUNIT 900 /* This reads data for FSOUND_DSP_GetSpectrum, so it comes after user units */ -#define FSOUND_DSP_DEFAULTPRIORITY_CLIPANDCOPYUNIT 1000 /* DSP CLIP AND COPY unit - last */ -/* [DEFINE_END] */ - - -/* -[DEFINE_START] -[ - [NAME] - FSOUND_CAPS - - [DESCRIPTION] - Driver description bitfields. Use FSOUND_Driver_GetCaps to determine if a driver enumerated - has the settings you are after. The enumerated driver depends on the output mode, see - FSOUND_OUTPUTTYPES - - [SEE_ALSO] - FSOUND_GetDriverCaps - FSOUND_OUTPUTTYPES -] -*/ -#define FSOUND_CAPS_HARDWARE 0x1 /* This driver supports hardware accelerated 3d sound. */ -#define FSOUND_CAPS_EAX2 0x2 /* This driver supports EAX 2 reverb */ -#define FSOUND_CAPS_EAX3 0x10 /* This driver supports EAX 3 reverb */ -/* [DEFINE_END] */ - - -/* -[DEFINE_START] -[ - [NAME] - FSOUND_MODES - - [DESCRIPTION] - Sample description bitfields, OR them together for loading and describing samples. - NOTE. If the file format being loaded already has a defined format, such as WAV or MP3, then - trying to override the pre-defined format with a new set of format flags will not work. For - example, an 8 bit WAV file will not load as 16bit if you specify FSOUND_16BITS. It will just - ignore the flag and go ahead loading it as 8bits. For these type of formats the only flags - you can specify that will really alter the behaviour of how it is loaded, are the following. - --------- - Looping behaviour - FSOUND_LOOP_OFF, FSOUND_LOOP_NORMAL, FSOUND_LOOP_BIDI - Load destination - FSOUND_HW3D, FSOUND_HW2D, FSOUND_2D - Loading behaviour - FSOUND_NONBLOCKING, FSOUND_LOADMEMORY, FSOUND_LOADRAW, FSOUND_MPEGACCURATE, FSOUND_MPEGHALFRATE, FSOUND_FORCEMONO - Playback behaviour - FSOUND_STREAMABLE, FSOUND_ENABLEFX - PlayStation 2 only - FSOUND_USECORE0, FSOUND_USECORE1, FSOUND_LOADMEMORYIOP - --------- - See flag descriptions for what these do. -] -*/ -#define FSOUND_LOOP_OFF 0x00000001 /* For non looping samples. */ -#define FSOUND_LOOP_NORMAL 0x00000002 /* For forward looping samples. */ -#define FSOUND_LOOP_BIDI 0x00000004 /* For bidirectional looping samples. (no effect if in hardware). */ -#define FSOUND_8BITS 0x00000008 /* For 8 bit samples. */ -#define FSOUND_16BITS 0x00000010 /* For 16 bit samples. */ -#define FSOUND_MONO 0x00000020 /* For mono samples. */ -#define FSOUND_STEREO 0x00000040 /* For stereo samples. */ -#define FSOUND_UNSIGNED 0x00000080 /* For user created source data containing unsigned samples. */ -#define FSOUND_SIGNED 0x00000100 /* For user created source data containing signed data. */ -#define FSOUND_DELTA 0x00000200 /* For user created source data stored as delta values. */ -#define FSOUND_IT214 0x00000400 /* For user created source data stored using IT214 compression. */ -#define FSOUND_IT215 0x00000800 /* For user created source data stored using IT215 compression. */ -#define FSOUND_HW3D 0x00001000 /* Attempts to make samples use 3d hardware acceleration. (if the card supports it) */ -#define FSOUND_2D 0x00002000 /* Tells software (not hardware) based sample not to be included in 3d processing. */ -#define FSOUND_STREAMABLE 0x00004000 /* For a streamimg sound where you feed the data to it. */ -#define FSOUND_LOADMEMORY 0x00008000 /* "name" will be interpreted as a pointer to data for streaming and samples. */ -#define FSOUND_LOADRAW 0x00010000 /* Will ignore file format and treat as raw pcm. */ -#define FSOUND_MPEGACCURATE 0x00020000 /* For FSOUND_Stream_Open - for accurate FSOUND_Stream_GetLengthMs/FSOUND_Stream_SetTime. WARNING, see FSOUND_Stream_Open for inital opening time performance issues. */ -#define FSOUND_FORCEMONO 0x00040000 /* For forcing stereo streams and samples to be mono - needed if using FSOUND_HW3D and stereo data - incurs a small speed hit for streams */ -#define FSOUND_HW2D 0x00080000 /* 2D hardware sounds. allows hardware specific effects */ -#define FSOUND_ENABLEFX 0x00100000 /* Allows DX8 FX to be played back on a sound. Requires DirectX 8 - Note these sounds cannot be played more than once, be 8 bit, be less than a certain size, or have a changing frequency */ -#define FSOUND_MPEGHALFRATE 0x00200000 /* For FMODCE only - decodes mpeg streams using a lower quality decode, but faster execution */ -#define FSOUND_IMAADPCM 0x00400000 /* Contents are stored compressed as IMA ADPCM */ -#define FSOUND_VAG 0x00800000 /* For PS2 only - Contents are compressed as Sony VAG format */ -#define FSOUND_NONBLOCKING 0x01000000 /* For FSOUND_Stream_Open/FMUSIC_LoadSong - Causes stream or music to open in the background and not block the foreground app. See FSOUND_Stream_GetOpenState or FMUSIC_GetOpenState to determine when it IS ready. */ -#define FSOUND_GCADPCM 0x02000000 /* For Gamecube only - Contents are compressed as Gamecube DSP-ADPCM format */ -#define FSOUND_MULTICHANNEL 0x04000000 /* For PS2 and Gamecube only - Contents are interleaved into a multi-channel (more than stereo) format */ -#define FSOUND_USECORE0 0x08000000 /* For PS2 only - Sample/Stream is forced to use hardware voices 00-23 */ -#define FSOUND_USECORE1 0x10000000 /* For PS2 only - Sample/Stream is forced to use hardware voices 24-47 */ -#define FSOUND_LOADMEMORYIOP 0x20000000 /* For PS2 only - "name" will be interpreted as a pointer to data for streaming and samples. The address provided will be an IOP address */ -#define FSOUND_IGNORETAGS 0x40000000 /* Skips id3v2 etc tag checks when opening a stream, to reduce seek/read overhead when opening files (helps with CD performance) */ -#define FSOUND_STREAM_NET 0x80000000 /* Specifies an internet stream */ - -#define FSOUND_NORMAL (FSOUND_16BITS | FSOUND_SIGNED | FSOUND_MONO) -/* [DEFINE_END] */ - - - -/* -[DEFINE_START] -[ - [NAME] - FSOUND_CDPLAYMODES - - [DESCRIPTION] - Playback method for a CD Audio track, with FSOUND_CD_SetPlayMode - - [SEE_ALSO] - FSOUND_CD_SetPlayMode - FSOUND_CD_Play -] -*/ -#define FSOUND_CD_PLAYCONTINUOUS 0 /* Starts from the current track and plays to end of CD. */ -#define FSOUND_CD_PLAYONCE 1 /* Plays the specified track then stops. */ -#define FSOUND_CD_PLAYLOOPED 2 /* Plays the specified track looped, forever until stopped manually. */ -#define FSOUND_CD_PLAYRANDOM 3 /* Plays tracks in random order */ -/* [DEFINE_END] */ - - -/* -[DEFINE_START] -[ - [NAME] - FSOUND_MISC_VALUES - - [DESCRIPTION] - Miscellaneous values for FMOD functions. - - [SEE_ALSO] - FSOUND_PlaySound - FSOUND_PlaySoundEx - FSOUND_Sample_Alloc - FSOUND_Sample_Load - FSOUND_SetPan -] -*/ -#define FSOUND_FREE -1 /* value to play on any free channel, or to allocate a sample in a free sample slot. */ -#define FSOUND_UNMANAGED -2 /* value to allocate a sample that is NOT managed by FSOUND or placed in a sample slot. */ -#define FSOUND_ALL -3 /* for a channel index , this flag will affect ALL channels available! Not supported by every function. */ -#define FSOUND_STEREOPAN -1 /* value for FSOUND_SetPan so that stereo sounds are not played at half volume. See FSOUND_SetPan for more on this. */ -#define FSOUND_SYSTEMCHANNEL -1000 /* special 'channel' ID for all channel based functions that want to alter the global FSOUND software mixing output channel */ -#define FSOUND_SYSTEMSAMPLE -1000 /* special 'sample' ID for all sample based functions that want to alter the global FSOUND software mixing output sample */ - -/* [DEFINE_END] */ - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Structure defining a reverb environment. - For more indepth descriptions of the reverb properties under win32, please see the EAX2 and EAX3 - documentation at http://developer.creative.com/ under the 'downloads' section. - If they do not have the EAX3 documentation, then most information can be attained from - the EAX2 documentation, as EAX3 only adds some more parameters and functionality on top of EAX2. - Note the default reverb properties are the same as the FSOUND_PRESET_GENERIC preset. - Note that integer values that typically range from -10,000 to 1000 are represented in decibels, and are of a logarithmic scale, not linear, wheras float values are typically linear. - PORTABILITY: Each member has the platform it supports in braces ie (win32/xbox). - Some reverb parameters are only supported in win32 and some only on xbox. If all parameters are set then the reverb should product a similar effect on either platform. - - The numerical values listed below are the maximum, minimum and default values for each variable respectively. - - [SEE_ALSO] - FSOUND_Reverb_SetProperties - FSOUND_Reverb_GetProperties - FSOUND_REVERB_PRESETS - FSOUND_REVERB_FLAGS -] -*/ -typedef struct _FSOUND_REVERB_PROPERTIES /* MIN MAX DEFAULT DESCRIPTION */ -{ - unsigned int Environment; /* 0 , 25 , 0 , sets all listener properties (WIN32/PS2 only) */ - float EnvSize; /* 1.0 , 100.0 , 7.5 , environment size in meters (WIN32 only) */ - float EnvDiffusion; /* 0.0 , 1.0 , 1.0 , environment diffusion (WIN32/XBOX) */ - int Room; /* -10000, 0 , -1000 , room effect level (at mid frequencies) (WIN32/XBOX/PS2) */ - int RoomHF; /* -10000, 0 , -100 , relative room effect level at high frequencies (WIN32/XBOX) */ - int RoomLF; /* -10000, 0 , 0 , relative room effect level at low frequencies (WIN32 only) */ - float DecayTime; /* 0.1 , 20.0 , 1.49 , reverberation decay time at mid frequencies (WIN32/XBOX) */ - float DecayHFRatio; /* 0.1 , 2.0 , 0.83 , high-frequency to mid-frequency decay time ratio (WIN32/XBOX) */ - float DecayLFRatio; /* 0.1 , 2.0 , 1.0 , low-frequency to mid-frequency decay time ratio (WIN32 only) */ - int Reflections; /* -10000, 1000 , -2602 , early reflections level relative to room effect (WIN32/XBOX) */ - float ReflectionsDelay; /* 0.0 , 0.3 , 0.007 , initial reflection delay time (WIN32/XBOX) */ - float ReflectionsPan[3]; /* , , [0,0,0], early reflections panning vector (WIN32 only) */ - int Reverb; /* -10000, 2000 , 200 , late reverberation level relative to room effect (WIN32/XBOX) */ - float ReverbDelay; /* 0.0 , 0.1 , 0.011 , late reverberation delay time relative to initial reflection (WIN32/XBOX) */ - float ReverbPan[3]; /* , , [0,0,0], late reverberation panning vector (WIN32 only) */ - float EchoTime; /* .075 , 0.25 , 0.25 , echo time (WIN32/PS2 only. PS2 = Delay time for ECHO/DELAY modes only) */ - float EchoDepth; /* 0.0 , 1.0 , 0.0 , echo depth (WIN32/PS2 only. PS2 = Feedback level for ECHO mode only) */ - float ModulationTime; /* 0.04 , 4.0 , 0.25 , modulation time (WIN32 only) */ - float ModulationDepth; /* 0.0 , 1.0 , 0.0 , modulation depth (WIN32 only) */ - float AirAbsorptionHF; /* -100 , 0.0 , -5.0 , change in level per meter at high frequencies (WIN32 only) */ - float HFReference; /* 1000.0, 20000 , 5000.0 , reference high frequency (hz) (WIN32/XBOX) */ - float LFReference; /* 20.0 , 1000.0, 250.0 , reference low frequency (hz) (WIN32 only) */ - float RoomRolloffFactor; /* 0.0 , 10.0 , 0.0 , like FSOUND_3D_SetRolloffFactor but for room effect (WIN32/XBOX) */ - float Diffusion; /* 0.0 , 100.0 , 100.0 , Value that controls the echo density in the late reverberation decay. (XBOX only) */ - float Density; /* 0.0 , 100.0 , 100.0 , Value that controls the modal density in the late reverberation decay (XBOX only) */ - unsigned int Flags; /* FSOUND_REVERB_FLAGS - modifies the behavior of above properties (WIN32/PS2 only) */ -} FSOUND_REVERB_PROPERTIES; - - -/* -[DEFINE_START] -[ - [NAME] - FSOUND_REVERB_FLAGS - - [DESCRIPTION] - Values for the Flags member of the FSOUND_REVERB_PROPERTIES structure. - - [SEE_ALSO] - FSOUND_REVERB_PROPERTIES -] -*/ -#define FSOUND_REVERB_FLAGS_DECAYTIMESCALE 0x00000001 /* 'EnvSize' affects reverberation decay time */ -#define FSOUND_REVERB_FLAGS_REFLECTIONSSCALE 0x00000002 /* 'EnvSize' affects reflection level */ -#define FSOUND_REVERB_FLAGS_REFLECTIONSDELAYSCALE 0x00000004 /* 'EnvSize' affects initial reflection delay time */ -#define FSOUND_REVERB_FLAGS_REVERBSCALE 0x00000008 /* 'EnvSize' affects reflections level */ -#define FSOUND_REVERB_FLAGS_REVERBDELAYSCALE 0x00000010 /* 'EnvSize' affects late reverberation delay time */ -#define FSOUND_REVERB_FLAGS_DECAYHFLIMIT 0x00000020 /* AirAbsorptionHF affects DecayHFRatio */ -#define FSOUND_REVERB_FLAGS_ECHOTIMESCALE 0x00000040 /* 'EnvSize' affects echo time */ -#define FSOUND_REVERB_FLAGS_MODULATIONTIMESCALE 0x00000080 /* 'EnvSize' affects modulation time */ -#define FSOUND_REVERB_FLAGS_CORE0 0x00000100 /* PS2 Only - Reverb is applied to CORE0 (hw voices 0-23) */ -#define FSOUND_REVERB_FLAGS_CORE1 0x00000200 /* PS2 Only - Reverb is applied to CORE1 (hw voices 24-47) */ -#define FSOUND_REVERB_FLAGS_DEFAULT (FSOUND_REVERB_FLAGS_DECAYTIMESCALE | \ - FSOUND_REVERB_FLAGS_REFLECTIONSSCALE | \ - FSOUND_REVERB_FLAGS_REFLECTIONSDELAYSCALE | \ - FSOUND_REVERB_FLAGS_REVERBSCALE | \ - FSOUND_REVERB_FLAGS_REVERBDELAYSCALE | \ - FSOUND_REVERB_FLAGS_DECAYHFLIMIT | \ - FSOUND_REVERB_FLAGS_CORE0 | \ - FSOUND_REVERB_FLAGS_CORE1 ) -/* [DEFINE_END] */ - - - - -/* -[DEFINE_START] -[ - [NAME] - FSOUND_REVERB_PRESETS - - [DESCRIPTION] - A set of predefined environment PARAMETERS, created by Creative Labs - These are used to initialize an FSOUND_REVERB_PROPERTIES structure statically. - ie - FSOUND_REVERB_PROPERTIES prop = FSOUND_PRESET_GENERIC; - - [SEE_ALSO] - FSOUND_Reverb_SetProperties -] -*/ -/* Env Size Diffus Room RoomHF RmLF DecTm DecHF DecLF Refl RefDel RefPan Revb RevDel ReverbPan EchoTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff Diffus Densty FLAGS */ -#define FSOUND_PRESET_OFF {0, 7.5f, 1.00f, -10000, -10000, 0, 1.00f, 1.00f, 1.0f, -2602, 0.007f, { 0.0f,0.0f,0.0f }, 200, 0.011f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 0.0f, 0.0f, 0x33f } -#define FSOUND_PRESET_GENERIC {0, 7.5f, 1.00f, -1000, -100, 0, 1.49f, 0.83f, 1.0f, -2602, 0.007f, { 0.0f,0.0f,0.0f }, 200, 0.011f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_PADDEDCELL {1, 1.4f, 1.00f, -1000, -6000, 0, 0.17f, 0.10f, 1.0f, -1204, 0.001f, { 0.0f,0.0f,0.0f }, 207, 0.002f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_ROOM {2, 1.9f, 1.00f, -1000, -454, 0, 0.40f, 0.83f, 1.0f, -1646, 0.002f, { 0.0f,0.0f,0.0f }, 53, 0.003f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_BATHROOM {3, 1.4f, 1.00f, -1000, -1200, 0, 1.49f, 0.54f, 1.0f, -370, 0.007f, { 0.0f,0.0f,0.0f }, 1030, 0.011f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 60.0f, 0x3f } -#define FSOUND_PRESET_LIVINGROOM {4, 2.5f, 1.00f, -1000, -6000, 0, 0.50f, 0.10f, 1.0f, -1376, 0.003f, { 0.0f,0.0f,0.0f }, -1104, 0.004f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_STONEROOM {5, 11.6f, 1.00f, -1000, -300, 0, 2.31f, 0.64f, 1.0f, -711, 0.012f, { 0.0f,0.0f,0.0f }, 83, 0.017f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_AUDITORIUM {6, 21.6f, 1.00f, -1000, -476, 0, 4.32f, 0.59f, 1.0f, -789, 0.020f, { 0.0f,0.0f,0.0f }, -289, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_CONCERTHALL {7, 19.6f, 1.00f, -1000, -500, 0, 3.92f, 0.70f, 1.0f, -1230, 0.020f, { 0.0f,0.0f,0.0f }, -2, 0.029f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_CAVE {8, 14.6f, 1.00f, -1000, 0, 0, 2.91f, 1.30f, 1.0f, -602, 0.015f, { 0.0f,0.0f,0.0f }, -302, 0.022f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x1f } -#define FSOUND_PRESET_ARENA {9, 36.2f, 1.00f, -1000, -698, 0, 7.24f, 0.33f, 1.0f, -1166, 0.020f, { 0.0f,0.0f,0.0f }, 16, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_HANGAR {10, 50.3f, 1.00f, -1000, -1000, 0, 10.05f, 0.23f, 1.0f, -602, 0.020f, { 0.0f,0.0f,0.0f }, 198, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_CARPETTEDHALLWAY {11, 1.9f, 1.00f, -1000, -4000, 0, 0.30f, 0.10f, 1.0f, -1831, 0.002f, { 0.0f,0.0f,0.0f }, -1630, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_HALLWAY {12, 1.8f, 1.00f, -1000, -300, 0, 1.49f, 0.59f, 1.0f, -1219, 0.007f, { 0.0f,0.0f,0.0f }, 441, 0.011f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_STONECORRIDOR {13, 13.5f, 1.00f, -1000, -237, 0, 2.70f, 0.79f, 1.0f, -1214, 0.013f, { 0.0f,0.0f,0.0f }, 395, 0.020f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_ALLEY {14, 7.5f, 0.30f, -1000, -270, 0, 1.49f, 0.86f, 1.0f, -1204, 0.007f, { 0.0f,0.0f,0.0f }, -4, 0.011f, { 0.0f,0.0f,0.0f }, 0.125f, 0.95f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_FOREST {15, 38.0f, 0.30f, -1000, -3300, 0, 1.49f, 0.54f, 1.0f, -2560, 0.162f, { 0.0f,0.0f,0.0f }, -229, 0.088f, { 0.0f,0.0f,0.0f }, 0.125f, 1.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 79.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_CITY {16, 7.5f, 0.50f, -1000, -800, 0, 1.49f, 0.67f, 1.0f, -2273, 0.007f, { 0.0f,0.0f,0.0f }, -1691, 0.011f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 50.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_MOUNTAINS {17, 100.0f, 0.27f, -1000, -2500, 0, 1.49f, 0.21f, 1.0f, -2780, 0.300f, { 0.0f,0.0f,0.0f }, -1434, 0.100f, { 0.0f,0.0f,0.0f }, 0.250f, 1.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 27.0f, 100.0f, 0x1f } -#define FSOUND_PRESET_QUARRY {18, 17.5f, 1.00f, -1000, -1000, 0, 1.49f, 0.83f, 1.0f, -10000, 0.061f, { 0.0f,0.0f,0.0f }, 500, 0.025f, { 0.0f,0.0f,0.0f }, 0.125f, 0.70f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_PLAIN {19, 42.5f, 0.21f, -1000, -2000, 0, 1.49f, 0.50f, 1.0f, -2466, 0.179f, { 0.0f,0.0f,0.0f }, -1926, 0.100f, { 0.0f,0.0f,0.0f }, 0.250f, 1.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 21.0f, 100.0f, 0x3f } -#define FSOUND_PRESET_PARKINGLOT {20, 8.3f, 1.00f, -1000, 0, 0, 1.65f, 1.50f, 1.0f, -1363, 0.008f, { 0.0f,0.0f,0.0f }, -1153, 0.012f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x1f } -#define FSOUND_PRESET_SEWERPIPE {21, 1.7f, 0.80f, -1000, -1000, 0, 2.81f, 0.14f, 1.0f, 429, 0.014f, { 0.0f,0.0f,0.0f }, 1023, 0.021f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 80.0f, 60.0f, 0x3f } -#define FSOUND_PRESET_UNDERWATER {22, 1.8f, 1.00f, -1000, -4000, 0, 1.49f, 0.10f, 1.0f, -449, 0.007f, { 0.0f,0.0f,0.0f }, 1700, 0.011f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 1.18f, 0.348f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } - -/* Non I3DL2 presets */ - -#define FSOUND_PRESET_DRUGGED {23, 1.9f, 0.50f, -1000, 0, 0, 8.39f, 1.39f, 1.0f, -115, 0.002f, { 0.0f,0.0f,0.0f }, 985, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 1.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x1f } -#define FSOUND_PRESET_DIZZY {24, 1.8f, 0.60f, -1000, -400, 0, 17.23f, 0.56f, 1.0f, -1713, 0.020f, { 0.0f,0.0f,0.0f }, -613, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 1.00f, 0.81f, 0.310f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x1f } -#define FSOUND_PRESET_PSYCHOTIC {25, 1.0f, 0.50f, -1000, -151, 0, 7.56f, 0.91f, 1.0f, -626, 0.020f, { 0.0f,0.0f,0.0f }, 774, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 4.00f, 1.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x1f } - -/* PlayStation 2 and PlayStation Portable only presets */ - -#define FSOUND_PRESET_PS2_ROOM {1, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FSOUND_PRESET_PS2_STUDIO_A {2, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FSOUND_PRESET_PS2_STUDIO_B {3, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FSOUND_PRESET_PS2_STUDIO_C {4, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FSOUND_PRESET_PS2_HALL {5, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FSOUND_PRESET_PS2_SPACE {6, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FSOUND_PRESET_PS2_ECHO {7, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FSOUND_PRESET_PS2_DELAY {8, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } -#define FSOUND_PRESET_PS2_PIPE {9, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } - -/* [DEFINE_END] */ - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Structure defining the properties for a reverb source, related to a FSOUND channel. - For more indepth descriptions of the reverb properties under win32, please see the EAX3 - documentation at http://developer.creative.com/ under the 'downloads' section. - If they do not have the EAX3 documentation, then most information can be attained from - the EAX2 documentation, as EAX3 only adds some more parameters and functionality on top of - EAX2. - - Note the default reverb properties are the same as the FSOUND_PRESET_GENERIC preset. - Note that integer values that typically range from -10,000 to 1000 are represented in - decibels, and are of a logarithmic scale, not linear, wheras float values are typically linear. - PORTABILITY: Each member has the platform it supports in braces ie (win32/xbox). - Some reverb parameters are only supported in win32 and some only on xbox. If all parameters are set then - the reverb should product a similar effect on either platform. - Linux and FMODCE do not support the reverb api. - - The numerical values listed below are the maximum, minimum and default values for each variable respectively. - - [SEE_ALSO] - FSOUND_Reverb_SetChannelProperties - FSOUND_Reverb_GetChannelProperties - FSOUND_REVERB_CHANNELFLAGS -] -*/ -typedef struct _FSOUND_REVERB_CHANNELPROPERTIES /* MIN MAX DEFAULT */ -{ - int Direct; /* -10000, 1000, 0, direct path level (at low and mid frequencies) (WIN32/XBOX) */ - int DirectHF; /* -10000, 0, 0, relative direct path level at high frequencies (WIN32/XBOX) */ - int Room; /* -10000, 1000, 0, room effect level (at low and mid frequencies) (WIN32/XBOX/PS2) */ - int RoomHF; /* -10000, 0, 0, relative room effect level at high frequencies (WIN32/XBOX) */ - int Obstruction; /* -10000, 0, 0, main obstruction control (attenuation at high frequencies) (WIN32/XBOX) */ - float ObstructionLFRatio; /* 0.0, 1.0, 0.0, obstruction low-frequency level re. main control (WIN32/XBOX) */ - int Occlusion; /* -10000, 0, 0, main occlusion control (attenuation at high frequencies) (WIN32/XBOX) */ - float OcclusionLFRatio; /* 0.0, 1.0, 0.25, occlusion low-frequency level re. main control (WIN32/XBOX) */ - float OcclusionRoomRatio; /* 0.0, 10.0, 1.5, relative occlusion control for room effect (WIN32) */ - float OcclusionDirectRatio; /* 0.0, 10.0, 1.0, relative occlusion control for direct path (WIN32) */ - int Exclusion; /* -10000, 0, 0, main exlusion control (attenuation at high frequencies) (WIN32) */ - float ExclusionLFRatio; /* 0.0, 1.0, 1.0, exclusion low-frequency level re. main control (WIN32) */ - int OutsideVolumeHF; /* -10000, 0, 0, outside sound cone level at high frequencies (WIN32) */ - float DopplerFactor; /* 0.0, 10.0, 0.0, like DS3D flDopplerFactor but per source (WIN32) */ - float RolloffFactor; /* 0.0, 10.0, 0.0, like DS3D flRolloffFactor but per source (WIN32) */ - float RoomRolloffFactor; /* 0.0, 10.0, 0.0, like DS3D flRolloffFactor but for room effect (WIN32/XBOX) */ - float AirAbsorptionFactor; /* 0.0, 10.0, 1.0, multiplies AirAbsorptionHF member of FSOUND_REVERB_PROPERTIES (WIN32) */ - int Flags; /* FSOUND_REVERB_CHANNELFLAGS - modifies the behavior of properties (WIN32) */ -} FSOUND_REVERB_CHANNELPROPERTIES; - - -/* -[DEFINE_START] -[ - [NAME] - FSOUND_REVERB_CHANNELFLAGS - - [DESCRIPTION] - Values for the Flags member of the FSOUND_REVERB_CHANNELPROPERTIES structure. - - [SEE_ALSO] - FSOUND_REVERB_CHANNELPROPERTIES -] -*/ -#define FSOUND_REVERB_CHANNELFLAGS_DIRECTHFAUTO 0x00000001 /* Automatic setting of 'Direct' due to distance from listener */ -#define FSOUND_REVERB_CHANNELFLAGS_ROOMAUTO 0x00000002 /* Automatic setting of 'Room' due to distance from listener */ -#define FSOUND_REVERB_CHANNELFLAGS_ROOMHFAUTO 0x00000004 /* Automatic setting of 'RoomHF' due to distance from listener */ -#define FSOUND_REVERB_CHANNELFLAGS_DEFAULT (FSOUND_REVERB_CHANNELFLAGS_DIRECTHFAUTO | \ - FSOUND_REVERB_CHANNELFLAGS_ROOMAUTO| \ - FSOUND_REVERB_CHANNELFLAGS_ROOMHFAUTO) -/* [DEFINE_END] */ - - -/* -[ENUM] -[ - [DESCRIPTION] - These values are used with FSOUND_FX_Enable to enable DirectX 8 FX for a channel. - - [SEE_ALSO] - FSOUND_FX_Enable - FSOUND_FX_Disable - FSOUND_FX_SetChorus - FSOUND_FX_SetCompressor - FSOUND_FX_SetDistortion - FSOUND_FX_SetEcho - FSOUND_FX_SetFlanger - FSOUND_FX_SetGargle - FSOUND_FX_SetI3DL2Reverb - FSOUND_FX_SetParamEQ - FSOUND_FX_SetWavesReverb -] -*/ -enum FSOUND_FX_MODES -{ - FSOUND_FX_CHORUS, - FSOUND_FX_COMPRESSOR, - FSOUND_FX_DISTORTION, - FSOUND_FX_ECHO, - FSOUND_FX_FLANGER, - FSOUND_FX_GARGLE, - FSOUND_FX_I3DL2REVERB, - FSOUND_FX_PARAMEQ, - FSOUND_FX_WAVES_REVERB, - - FSOUND_FX_MAX -}; - -/* -[ENUM] -[ - [DESCRIPTION] - These are speaker types defined for use with the FSOUND_SetSpeakerMode command. - Note - Only reliably works with FSOUND_OUTPUT_DSOUND or FSOUND_OUTPUT_XBOX output modes. Other output modes will only - interpret FSOUND_SPEAKERMODE_MONO and set everything else to be stereo. - - Using either DolbyDigital or DTS will use whatever 5.1 digital mode is available if destination hardware is unsure. - - [SEE_ALSO] - FSOUND_SetSpeakerMode - -] -*/ -enum FSOUND_SPEAKERMODES -{ - FSOUND_SPEAKERMODE_DOLBYDIGITAL, /* Dolby Digital Output (XBOX or PC only). */ - FSOUND_SPEAKERMODE_HEADPHONES, /* The speakers are headphones. */ - FSOUND_SPEAKERMODE_MONO, /* The speakers are monaural. */ - FSOUND_SPEAKERMODE_QUAD, /* The speakers are quadraphonic. */ - FSOUND_SPEAKERMODE_STEREO, /* The speakers are stereo (default value). */ - FSOUND_SPEAKERMODE_SURROUND, /* The speakers are surround sound. */ - FSOUND_SPEAKERMODE_DTS, /* DTS output (XBOX only). */ - FSOUND_SPEAKERMODE_PROLOGIC2, /* Dolby Prologic 2. Playstation 2 and Gamecube only. PlayStation 2 doesnt support interior panning, but supports 48 voices simultaneously. */ - FSOUND_SPEAKERMODE_PROLOGIC2_INTERIOR /* Dolby Prologic 2. Playstation 2 and Gamecube only. PlayStation 2 does support interior panning, but only supports 24 voices simultaneously. */ -}; - - -/* -[DEFINE_START] -[ - [NAME] - FSOUND_INIT_FLAGS - - [DESCRIPTION] - Initialization flags. Use them with FSOUND_Init in the flags parameter to change various behaviour. - - FSOUND_INIT_ENABLESYSTEMCHANNELFX Is an init mode which enables the FSOUND mixer buffer to be affected by DirectX 8 effects. - Note that due to limitations of DirectSound, FSOUND_Init may fail if this is enabled because the buffersize is too small. - This can be fixed with FSOUND_SetBufferSize. Increase the BufferSize until it works. - When it is enabled you can use the FSOUND_FX api, and use FSOUND_SYSTEMCHANNEL as the channel id when setting parameters. - - [SEE_ALSO] - FSOUND_Init -] -*/ -#define FSOUND_INIT_USEDEFAULTMIDISYNTH 0x0001 /* Win32 only - Causes MIDI playback to force software decoding. */ -#define FSOUND_INIT_GLOBALFOCUS 0x0002 /* Win32 only - For DirectSound output - sound is not muted when window is out of focus. */ -#define FSOUND_INIT_ENABLESYSTEMCHANNELFX 0x0004 /* Win32 only - For DirectSound output - Allows FSOUND_FX api to be used on global software mixer output! (use FSOUND_SYSTEMCHANNEL as channel id) */ -#define FSOUND_INIT_ACCURATEVULEVELS 0x0008 /* This latency adjusts FSOUND_GetCurrentLevels, but incurs a small cpu and memory hit */ -#define FSOUND_INIT_PS2_DISABLECORE0REVERB 0x0010 /* PS2 only - Disable reverb on CORE 0 (SPU2 voices 00-23) to regain SRAM */ -#define FSOUND_INIT_PS2_DISABLECORE1REVERB 0x0020 /* PS2 only - Disable reverb on CORE 1 (SPU2 voices 24-47) to regain SRAM */ -#define FSOUND_INIT_PS2_SWAPDMACORES 0x0040 /* PS2 only - By default FMOD uses DMA CH0 for mixing, CH1 for uploads, this flag swaps them around */ -#define FSOUND_INIT_DONTLATENCYADJUST 0x0080 /* Callbacks are not latency adjusted, and are called at mix time. Also information functions are immediate */ -#define FSOUND_INIT_GC_INITLIBS 0x0100 /* GC only - Initializes GC audio libraries */ -#define FSOUND_INIT_STREAM_FROM_MAIN_THREAD 0x0200 /* Turns off fmod streamer thread, and makes streaming update from FSOUND_Update called by the user */ -#define FSOUND_INIT_PS2_USEVOLUMERAMPING 0x0400 /* PS2 only - Turns on volume ramping system to remove hardware clicks. */ -#define FSOUND_INIT_DSOUND_DEFERRED 0x0800 /* Win32 only - For DirectSound output. 3D commands are batched together and executed at FSOUND_Update. */ -#define FSOUND_INIT_DSOUND_HRTF_LIGHT 0x1000 /* Win32 only - For DirectSound output. FSOUND_HW3D buffers use a slightly higher quality algorithm when 3d hardware acceleration is not present. */ -#define FSOUND_INIT_DSOUND_HRTF_FULL 0x2000 /* Win32 only - For DirectSound output. FSOUND_HW3D buffers use full quality 3d playback when 3d hardware acceleration is not present. */ -#define FSOUND_INIT_XBOX_REMOVEHEADROOM 0x4000 /* XBox only - By default directsound attenuates all sound by 6db to avoid clipping/distortion. CAUTION. If you use this flag you are responsible for the final mix to make sure clipping / distortion doesn't happen. */ -#define FSOUND_INIT_PSP_SILENCEONUNDERRUN 0x8000 /* PSP only - If streams skip / stutter when device is powered on, either increase stream buffersize, or use this flag instead to play silence while the UMD is recovering. */ -/* [DEFINE_END] */ - - -/* -[ENUM] -[ - [DESCRIPTION] - Status values for internet streams. Use FSOUND_Stream_Net_GetStatus to get the current status of an internet stream. - - [SEE_ALSO] - FSOUND_Stream_Net_GetStatus -] -*/ -enum FSOUND_STREAM_NET_STATUS -{ - FSOUND_STREAM_NET_NOTCONNECTED = 0, /* Stream hasn't connected yet */ - FSOUND_STREAM_NET_CONNECTING, /* Stream is connecting to remote host */ - FSOUND_STREAM_NET_BUFFERING, /* Stream is buffering data */ - FSOUND_STREAM_NET_READY, /* Stream is ready to play */ - FSOUND_STREAM_NET_ERROR /* Stream has suffered a fatal error */ -}; - - -/* -[ENUM] -[ - [DESCRIPTION] - Describes the type of a particular tag field. - - [SEE_ALSO] - FSOUND_Stream_GetNumTagFields - FSOUND_Stream_GetTagField - FSOUND_Stream_FindTagField -] -*/ -enum FSOUND_TAGFIELD_TYPE -{ - FSOUND_TAGFIELD_VORBISCOMMENT = 0, /* A vorbis comment */ - FSOUND_TAGFIELD_ID3V1, /* Part of an ID3v1 tag */ - FSOUND_TAGFIELD_ID3V2, /* An ID3v2 frame */ - FSOUND_TAGFIELD_SHOUTCAST, /* A SHOUTcast header line */ - FSOUND_TAGFIELD_ICECAST, /* An Icecast header line */ - FSOUND_TAGFIELD_ASF /* An Advanced Streaming Format header line */ -}; - - -/* -[DEFINE_START] -[ - [NAME] - FSOUND_STATUS_FLAGS - - [DESCRIPTION] - These values describe the protocol and format of an internet stream. Use FSOUND_Stream_Net_GetStatus to retrieve this information for an open internet stream. - - [SEE_ALSO] - FSOUND_Stream_Net_GetStatus -] -*/ -#define FSOUND_PROTOCOL_SHOUTCAST 0x00000001 -#define FSOUND_PROTOCOL_ICECAST 0x00000002 -#define FSOUND_PROTOCOL_HTTP 0x00000004 -#define FSOUND_FORMAT_MPEG 0x00010000 -#define FSOUND_FORMAT_OGGVORBIS 0x00020000 -/* [DEFINE_END] */ - - -/* -[STRUCTURE] -[ - [DESCRIPTION] - Structure defining a CD table of contents. This structure is returned as a tag from FSOUND_Stream_FindTagField when the tag name "CD_TOC" is specified. - Note: All tracks on the CD - including data tracks- will be represented in this structure so it's use for anything other than generating disc id information is not recommended. - See the cdda example program for info on retrieving and using this structure. - - [SEE_ALSO] - FSOUND_Stream_Open - FSOUND_Stream_FindTagField -] -*/ -typedef struct _FSOUND_TOC_TAG -{ - char name[4]; /* The string "TOC", just in case this structure is accidentally treated as a string */ - int numtracks; /* The number of tracks on the CD */ - int min[100]; /* The start offset of each track in minutes */ - int sec[100]; /* The start offset of each track in seconds */ - int frame[100]; /* The start offset of each track in frames */ - -} FSOUND_TOC_TAG; - - -/* ========================================================================================== */ -/* FUNCTION PROTOTYPES */ -/* ========================================================================================== */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* ================================== */ -/* Initialization / Global functions. */ -/* ================================== */ - -/* - PRE - FSOUND_Init functions. These can't be called after FSOUND_Init is - called (they will fail). They set up FMOD system functionality. -*/ - -DLL_API signed char F_API FSOUND_SetOutput(int outputtype); -DLL_API signed char F_API FSOUND_SetDriver(int driver); -DLL_API signed char F_API FSOUND_SetMixer(int mixer); -DLL_API signed char F_API FSOUND_SetBufferSize(int len_ms); -DLL_API signed char F_API FSOUND_SetHWND(void *hwnd); -DLL_API signed char F_API FSOUND_SetMinHardwareChannels(int min); -DLL_API signed char F_API FSOUND_SetMaxHardwareChannels(int max); -DLL_API signed char F_API FSOUND_SetMemorySystem(void *pool, - int poollen, - FSOUND_ALLOCCALLBACK useralloc, - FSOUND_REALLOCCALLBACK userrealloc, - FSOUND_FREECALLBACK userfree); -/* - Main initialization / closedown functions. - Note : Use FSOUND_INIT_USEDEFAULTMIDISYNTH with FSOUND_Init for software override - with MIDI playback. - : Use FSOUND_INIT_GLOBALFOCUS with FSOUND_Init to make sound audible no matter - which window is in focus. (FSOUND_OUTPUT_DSOUND only) -*/ - -DLL_API signed char F_API FSOUND_Init(int mixrate, int maxsoftwarechannels, unsigned int flags); -DLL_API void F_API FSOUND_Close(); - -/* - Runtime system level functions -*/ - -DLL_API void F_API FSOUND_Update(); /* This is called to update 3d sound / non-realtime output */ - -DLL_API void F_API FSOUND_SetSpeakerMode(unsigned int speakermode); -DLL_API void F_API FSOUND_SetSFXMasterVolume(int volume); -DLL_API void F_API FSOUND_SetPanSeperation(float pansep); -DLL_API void F_API FSOUND_File_SetCallbacks(FSOUND_OPENCALLBACK useropen, - FSOUND_CLOSECALLBACK userclose, - FSOUND_READCALLBACK userread, - FSOUND_SEEKCALLBACK userseek, - FSOUND_TELLCALLBACK usertell); - -/* - System information functions. -*/ - -DLL_API int F_API FSOUND_GetError(); -DLL_API float F_API FSOUND_GetVersion(); -DLL_API int F_API FSOUND_GetOutput(); -DLL_API void * F_API FSOUND_GetOutputHandle(); -DLL_API int F_API FSOUND_GetDriver(); -DLL_API int F_API FSOUND_GetMixer(); -DLL_API int F_API FSOUND_GetNumDrivers(); -DLL_API const char * F_API FSOUND_GetDriverName(int id); -DLL_API signed char F_API FSOUND_GetDriverCaps(int id, unsigned int *caps); -DLL_API int F_API FSOUND_GetOutputRate(); -DLL_API int F_API FSOUND_GetMaxChannels(); -DLL_API int F_API FSOUND_GetMaxSamples(); -DLL_API unsigned int F_API FSOUND_GetSpeakerMode(); -DLL_API int F_API FSOUND_GetSFXMasterVolume(); -DLL_API signed char F_API FSOUND_GetNumHWChannels(int *num2d, int *num3d, int *total); -DLL_API int F_API FSOUND_GetChannelsPlaying(); -DLL_API float F_API FSOUND_GetCPUUsage(); -DLL_API void F_API FSOUND_GetMemoryStats(unsigned int *currentalloced, unsigned int *maxalloced); - -/* =================================== */ -/* Sample management / load functions. */ -/* =================================== */ - -/* - Sample creation and management functions - Note : Use FSOUND_LOADMEMORY flag with FSOUND_Sample_Load to load from memory. - Use FSOUND_LOADRAW flag with FSOUND_Sample_Load to treat as as raw pcm data. -*/ - -DLL_API FSOUND_SAMPLE * F_API FSOUND_Sample_Load(int index, const char *name_or_data, unsigned int mode, int offset, int length); -DLL_API FSOUND_SAMPLE * F_API FSOUND_Sample_Alloc(int index, int length, unsigned int mode, int deffreq, int defvol, int defpan, int defpri); -DLL_API void F_API FSOUND_Sample_Free(FSOUND_SAMPLE *sptr); -DLL_API signed char F_API FSOUND_Sample_Upload(FSOUND_SAMPLE *sptr, void *srcdata, unsigned int mode); -DLL_API signed char F_API FSOUND_Sample_Lock(FSOUND_SAMPLE *sptr, int offset, int length, void **ptr1, void **ptr2, unsigned int *len1, unsigned int *len2); -DLL_API signed char F_API FSOUND_Sample_Unlock(FSOUND_SAMPLE *sptr, void *ptr1, void *ptr2, unsigned int len1, unsigned int len2); - -/* - Sample control functions -*/ - -DLL_API signed char F_API FSOUND_Sample_SetMode(FSOUND_SAMPLE *sptr, unsigned int mode); -DLL_API signed char F_API FSOUND_Sample_SetLoopPoints(FSOUND_SAMPLE *sptr, int loopstart, int loopend); -DLL_API signed char F_API FSOUND_Sample_SetDefaults(FSOUND_SAMPLE *sptr, int deffreq, int defvol, int defpan, int defpri); -DLL_API signed char F_API FSOUND_Sample_SetDefaultsEx(FSOUND_SAMPLE *sptr, int deffreq, int defvol, int defpan, int defpri, int varfreq, int varvol, int varpan); -DLL_API signed char F_API FSOUND_Sample_SetMinMaxDistance(FSOUND_SAMPLE *sptr, float min, float max); -DLL_API signed char F_API FSOUND_Sample_SetMaxPlaybacks(FSOUND_SAMPLE *sptr, int max); - -/* - Sample information functions -*/ - -DLL_API FSOUND_SAMPLE * F_API FSOUND_Sample_Get(int sampno); -DLL_API const char * F_API FSOUND_Sample_GetName(FSOUND_SAMPLE *sptr); -DLL_API unsigned int F_API FSOUND_Sample_GetLength(FSOUND_SAMPLE *sptr); -DLL_API signed char F_API FSOUND_Sample_GetLoopPoints(FSOUND_SAMPLE *sptr, int *loopstart, int *loopend); -DLL_API signed char F_API FSOUND_Sample_GetDefaults(FSOUND_SAMPLE *sptr, int *deffreq, int *defvol, int *defpan, int *defpri); -DLL_API signed char F_API FSOUND_Sample_GetDefaultsEx(FSOUND_SAMPLE *sptr, int *deffreq, int *defvol, int *defpan, int *defpri, int *varfreq, int *varvol, int *varpan); -DLL_API unsigned int F_API FSOUND_Sample_GetMode(FSOUND_SAMPLE *sptr); -DLL_API signed char F_API FSOUND_Sample_GetMinMaxDistance(FSOUND_SAMPLE *sptr, float *min, float *max); - -/* ============================ */ -/* Channel control functions. */ -/* ============================ */ - -/* - Playing and stopping sounds. - Note : Use FSOUND_FREE as the 'channel' variable, to let FMOD pick a free channel for you. - Use FSOUND_ALL as the 'channel' variable to control ALL channels with one function call! -*/ - -DLL_API int F_API FSOUND_PlaySound(int channel, FSOUND_SAMPLE *sptr); -DLL_API int F_API FSOUND_PlaySoundEx(int channel, FSOUND_SAMPLE *sptr, FSOUND_DSPUNIT *dsp, signed char startpaused); -DLL_API signed char F_API FSOUND_StopSound(int channel); - -/* - Functions to control playback of a channel. - Note : FSOUND_ALL can be used on most of these functions as a channel value. -*/ - -DLL_API signed char F_API FSOUND_SetFrequency(int channel, int freq); -DLL_API signed char F_API FSOUND_SetVolume(int channel, int vol); -DLL_API signed char F_API FSOUND_SetVolumeAbsolute(int channel, int vol); -DLL_API signed char F_API FSOUND_SetPan(int channel, int pan); -DLL_API signed char F_API FSOUND_SetSurround(int channel, signed char surround); -DLL_API signed char F_API FSOUND_SetMute(int channel, signed char mute); -DLL_API signed char F_API FSOUND_SetPriority(int channel, int priority); -DLL_API signed char F_API FSOUND_SetReserved(int channel, signed char reserved); -DLL_API signed char F_API FSOUND_SetPaused(int channel, signed char paused); -DLL_API signed char F_API FSOUND_SetLoopMode(int channel, unsigned int loopmode); -DLL_API signed char F_API FSOUND_SetCurrentPosition(int channel, unsigned int offset); -DLL_API signed char F_API FSOUND_3D_SetAttributes(int channel, const float *pos, const float *vel); -DLL_API signed char F_API FSOUND_3D_SetMinMaxDistance(int channel, float min, float max); - -/* - Channel information functions. -*/ - -DLL_API signed char F_API FSOUND_IsPlaying(int channel); -DLL_API int F_API FSOUND_GetFrequency(int channel); -DLL_API int F_API FSOUND_GetVolume(int channel); -DLL_API int F_API FSOUND_GetAmplitude(int channel); -DLL_API int F_API FSOUND_GetPan(int channel); -DLL_API signed char F_API FSOUND_GetSurround(int channel); -DLL_API signed char F_API FSOUND_GetMute(int channel); -DLL_API int F_API FSOUND_GetPriority(int channel); -DLL_API signed char F_API FSOUND_GetReserved(int channel); -DLL_API signed char F_API FSOUND_GetPaused(int channel); -DLL_API unsigned int F_API FSOUND_GetLoopMode(int channel); -DLL_API unsigned int F_API FSOUND_GetCurrentPosition(int channel); -DLL_API FSOUND_SAMPLE * F_API FSOUND_GetCurrentSample(int channel); -DLL_API signed char F_API FSOUND_GetCurrentLevels(int channel, float *l, float *r); -DLL_API int F_API FSOUND_GetNumSubChannels(int channel); -DLL_API int F_API FSOUND_GetSubChannel(int channel, int subchannel); -DLL_API signed char F_API FSOUND_3D_GetAttributes(int channel, float *pos, float *vel); -DLL_API signed char F_API FSOUND_3D_GetMinMaxDistance(int channel, float *min, float *max); - -/* ========================== */ -/* Global 3D sound functions. */ -/* ========================== */ - -/* - See also 3d sample and channel based functions above. - Call FSOUND_Update once a frame to process 3d information. -*/ - -DLL_API void F_API FSOUND_3D_Listener_SetAttributes(const float *pos, const float *vel, float fx, float fy, float fz, float tx, float ty, float tz); -DLL_API void F_API FSOUND_3D_Listener_GetAttributes(float *pos, float *vel, float *fx, float *fy, float *fz, float *tx, float *ty, float *tz); -DLL_API void F_API FSOUND_3D_Listener_SetCurrent(int current, int numlisteners); /* use this if you use multiple listeners / splitscreen */ -DLL_API void F_API FSOUND_3D_SetDopplerFactor(float scale); -DLL_API void F_API FSOUND_3D_SetDistanceFactor(float scale); -DLL_API void F_API FSOUND_3D_SetRolloffFactor(float scale); - -/* =================== */ -/* FX functions. */ -/* =================== */ - -/* - Functions to control DX8 only effects processing. - - - FX enabled samples can only be played once at a time, not multiple times at once. - - Sounds have to be created with FSOUND_HW2D or FSOUND_HW3D for this to work. - - FSOUND_INIT_ENABLESYSTEMCHANNELFX can be used to apply hardware effect processing to the - global mixed output of FMOD's software channels. - - FSOUND_FX_Enable returns an FX handle that you can use to alter fx parameters. - - FSOUND_FX_Enable can be called multiple times in a row, even on the same FX type, - it will return a unique handle for each FX. - - FSOUND_FX_Enable cannot be called if the sound is playing or locked. - - FSOUND_FX_Disable must be called to reset/clear the FX from a channel. -*/ - -DLL_API int F_API FSOUND_FX_Enable(int channel, unsigned int fxtype); /* See FSOUND_FX_MODES */ -DLL_API signed char F_API FSOUND_FX_Disable(int channel); /* Disables all effects */ - -DLL_API signed char F_API FSOUND_FX_SetChorus(int fxid, float WetDryMix, float Depth, float Feedback, float Frequency, int Waveform, float Delay, int Phase); -DLL_API signed char F_API FSOUND_FX_SetCompressor(int fxid, float Gain, float Attack, float Release, float Threshold, float Ratio, float Predelay); -DLL_API signed char F_API FSOUND_FX_SetDistortion(int fxid, float Gain, float Edge, float PostEQCenterFrequency, float PostEQBandwidth, float PreLowpassCutoff); -DLL_API signed char F_API FSOUND_FX_SetEcho(int fxid, float WetDryMix, float Feedback, float LeftDelay, float RightDelay, int PanDelay); -DLL_API signed char F_API FSOUND_FX_SetFlanger(int fxid, float WetDryMix, float Depth, float Feedback, float Frequency, int Waveform, float Delay, int Phase); -DLL_API signed char F_API FSOUND_FX_SetGargle(int fxid, int RateHz, int WaveShape); -DLL_API signed char F_API FSOUND_FX_SetI3DL2Reverb(int fxid, int Room, int RoomHF, float RoomRolloffFactor, float DecayTime, float DecayHFRatio, int Reflections, float ReflectionsDelay, int Reverb, float ReverbDelay, float Diffusion, float Density, float HFReference); -DLL_API signed char F_API FSOUND_FX_SetParamEQ(int fxid, float Center, float Bandwidth, float Gain); -DLL_API signed char F_API FSOUND_FX_SetWavesReverb(int fxid, float InGain, float ReverbMix, float ReverbTime, float HighFreqRTRatio); - -/* ========================= */ -/* File Streaming functions. */ -/* ========================= */ - -/* - Note : Use FSOUND_LOADMEMORY flag with FSOUND_Stream_Open to stream from memory. - Use FSOUND_LOADRAW flag with FSOUND_Stream_Open to treat stream as raw pcm data. - Use FSOUND_MPEGACCURATE flag with FSOUND_Stream_Open to open mpegs in 'accurate mode' for settime/gettime/getlengthms. - Use FSOUND_FREE as the 'channel' variable, to let FMOD pick a free channel for you. -*/ - -DLL_API signed char F_API FSOUND_Stream_SetBufferSize(int ms); /* call this before opening streams, not after */ - -DLL_API FSOUND_STREAM * F_API FSOUND_Stream_Open(const char *name_or_data, unsigned int mode, int offset, int length); -DLL_API FSOUND_STREAM * F_API FSOUND_Stream_Create(FSOUND_STREAMCALLBACK callback, int length, unsigned int mode, int samplerate, void *userdata); -DLL_API signed char F_API FSOUND_Stream_Close(FSOUND_STREAM *stream); - -DLL_API int F_API FSOUND_Stream_Play(int channel, FSOUND_STREAM *stream); -DLL_API int F_API FSOUND_Stream_PlayEx(int channel, FSOUND_STREAM *stream, FSOUND_DSPUNIT *dsp, signed char startpaused); -DLL_API signed char F_API FSOUND_Stream_Stop(FSOUND_STREAM *stream); - -DLL_API signed char F_API FSOUND_Stream_SetPosition(FSOUND_STREAM *stream, unsigned int position); -DLL_API unsigned int F_API FSOUND_Stream_GetPosition(FSOUND_STREAM *stream); -DLL_API signed char F_API FSOUND_Stream_SetTime(FSOUND_STREAM *stream, int ms); -DLL_API int F_API FSOUND_Stream_GetTime(FSOUND_STREAM *stream); -DLL_API int F_API FSOUND_Stream_GetLength(FSOUND_STREAM *stream); -DLL_API int F_API FSOUND_Stream_GetLengthMs(FSOUND_STREAM *stream); - -DLL_API signed char F_API FSOUND_Stream_SetMode(FSOUND_STREAM *stream, unsigned int mode); -DLL_API unsigned int F_API FSOUND_Stream_GetMode(FSOUND_STREAM *stream); -DLL_API signed char F_API FSOUND_Stream_SetLoopPoints(FSOUND_STREAM *stream, unsigned int loopstartpcm, unsigned int loopendpcm); -DLL_API signed char F_API FSOUND_Stream_SetLoopCount(FSOUND_STREAM *stream, int count); -DLL_API int F_API FSOUND_Stream_GetOpenState(FSOUND_STREAM *stream); /* use with FSOUND_NONBLOCKING opened streams */ -DLL_API FSOUND_SAMPLE * F_API FSOUND_Stream_GetSample(FSOUND_STREAM *stream); -DLL_API FSOUND_DSPUNIT * F_API FSOUND_Stream_CreateDSP(FSOUND_STREAM *stream, FSOUND_DSPCALLBACK callback, int priority, void *userdata); - -DLL_API signed char F_API FSOUND_Stream_SetEndCallback(FSOUND_STREAM *stream, FSOUND_STREAMCALLBACK callback, void *userdata); -DLL_API signed char F_API FSOUND_Stream_SetSyncCallback(FSOUND_STREAM *stream, FSOUND_STREAMCALLBACK callback, void *userdata); - -DLL_API FSOUND_SYNCPOINT * F_API FSOUND_Stream_AddSyncPoint(FSOUND_STREAM *stream, unsigned int pcmoffset, const char *name); -DLL_API signed char F_API FSOUND_Stream_DeleteSyncPoint(FSOUND_SYNCPOINT *point); -DLL_API int F_API FSOUND_Stream_GetNumSyncPoints(FSOUND_STREAM *stream); -DLL_API FSOUND_SYNCPOINT * F_API FSOUND_Stream_GetSyncPoint(FSOUND_STREAM *stream, int index); -DLL_API char * F_API FSOUND_Stream_GetSyncPointInfo(FSOUND_SYNCPOINT *point, unsigned int *pcmoffset); - -DLL_API signed char F_API FSOUND_Stream_SetSubStream(FSOUND_STREAM *stream, int index); /* For FMOD .FSB bank files. */ -DLL_API int F_API FSOUND_Stream_GetNumSubStreams(FSOUND_STREAM *stream); /* For FMOD .FSB bank files. */ -DLL_API signed char F_API FSOUND_Stream_SetSubStreamSentence(FSOUND_STREAM *stream, const int *sentencelist, int numitems); - -DLL_API signed char F_API FSOUND_Stream_GetNumTagFields(FSOUND_STREAM *stream, int *num); -DLL_API signed char F_API FSOUND_Stream_GetTagField(FSOUND_STREAM *stream, int num, int *type, char **name, void **value, int *length); -DLL_API signed char F_API FSOUND_Stream_FindTagField(FSOUND_STREAM *stream, int type, const char *name, void **value, int *length); - -/* - Internet streaming functions -*/ - -DLL_API signed char F_API FSOUND_Stream_Net_SetProxy(const char *proxy); -DLL_API signed char F_API FSOUND_Stream_Net_SetTimeout(int timeout); -DLL_API char * F_API FSOUND_Stream_Net_GetLastServerStatus(); -DLL_API signed char F_API FSOUND_Stream_Net_SetBufferProperties(int buffersize, int prebuffer_percent, int rebuffer_percent); -DLL_API signed char F_API FSOUND_Stream_Net_GetBufferProperties(int *buffersize, int *prebuffer_percent, int *rebuffer_percent); -DLL_API signed char F_API FSOUND_Stream_Net_SetMetadataCallback(FSOUND_STREAM *stream, FSOUND_METADATACALLBACK callback, void *userdata); -DLL_API signed char F_API FSOUND_Stream_Net_GetStatus(FSOUND_STREAM *stream, int *status, int *bufferpercentused, int *bitrate, unsigned int *flags); - -/* =================== */ -/* CD audio functions. */ -/* =================== */ - -/* - Note : 0 = default cdrom. Otherwise specify the drive letter, for example. 'D'. -*/ - -DLL_API signed char F_API FSOUND_CD_Play(char drive, int track); -DLL_API void F_API FSOUND_CD_SetPlayMode(char drive, signed char mode); -DLL_API signed char F_API FSOUND_CD_Stop(char drive); -DLL_API signed char F_API FSOUND_CD_SetPaused(char drive, signed char paused); -DLL_API signed char F_API FSOUND_CD_SetVolume(char drive, int volume); -DLL_API signed char F_API FSOUND_CD_SetTrackTime(char drive, unsigned int ms); -DLL_API signed char F_API FSOUND_CD_OpenTray(char drive, signed char open); - -DLL_API signed char F_API FSOUND_CD_GetPaused(char drive); -DLL_API int F_API FSOUND_CD_GetTrack(char drive); -DLL_API int F_API FSOUND_CD_GetNumTracks(char drive); -DLL_API int F_API FSOUND_CD_GetVolume(char drive); -DLL_API int F_API FSOUND_CD_GetTrackLength(char drive, int track); -DLL_API int F_API FSOUND_CD_GetTrackTime(char drive); - -/* ============== */ -/* DSP functions. */ -/* ============== */ - -/* - DSP Unit control and information functions. - These functions allow you access to the mixed stream that FMOD uses to play back sound on. -*/ - -DLL_API FSOUND_DSPUNIT *F_API FSOUND_DSP_Create(FSOUND_DSPCALLBACK callback, int priority, void *userdata); -DLL_API void F_API FSOUND_DSP_Free(FSOUND_DSPUNIT *unit); -DLL_API void F_API FSOUND_DSP_SetPriority(FSOUND_DSPUNIT *unit, int priority); -DLL_API int F_API FSOUND_DSP_GetPriority(FSOUND_DSPUNIT *unit); -DLL_API void F_API FSOUND_DSP_SetActive(FSOUND_DSPUNIT *unit, signed char active); -DLL_API signed char F_API FSOUND_DSP_GetActive(FSOUND_DSPUNIT *unit); - -/* - Functions to get hold of FSOUND 'system DSP unit' handles. -*/ - -DLL_API FSOUND_DSPUNIT *F_API FSOUND_DSP_GetClearUnit(); -DLL_API FSOUND_DSPUNIT *F_API FSOUND_DSP_GetSFXUnit(); -DLL_API FSOUND_DSPUNIT *F_API FSOUND_DSP_GetMusicUnit(); -DLL_API FSOUND_DSPUNIT *F_API FSOUND_DSP_GetFFTUnit(); -DLL_API FSOUND_DSPUNIT *F_API FSOUND_DSP_GetClipAndCopyUnit(); - -/* - Miscellaneous DSP functions - Note for the spectrum analysis function to work, you have to enable the FFT DSP unit with - the following code FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(), TRUE); - It is off by default to save cpu usage. -*/ - -DLL_API signed char F_API FSOUND_DSP_MixBuffers(void *destbuffer, void *srcbuffer, int len, int freq, int vol, int pan, unsigned int mode); -DLL_API void F_API FSOUND_DSP_ClearMixBuffer(); -DLL_API int F_API FSOUND_DSP_GetBufferLength(); /* Length of each DSP update */ -DLL_API int F_API FSOUND_DSP_GetBufferLengthTotal(); /* Total buffer length due to FSOUND_SetBufferSize */ -DLL_API float * F_API FSOUND_DSP_GetSpectrum(); /* Array of 512 floats - call FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(), TRUE)) for this to work. */ - -/* =================================================================================== */ -/* Reverb functions. (eax2/eax3 reverb) (ONLY SUPPORTED ON WIN32 W/ FSOUND_HW3D FLAG) */ -/* =================================================================================== */ - -/* - See top of file for definitions and information on the reverb parameters. -*/ - -DLL_API signed char F_API FSOUND_Reverb_SetProperties(const FSOUND_REVERB_PROPERTIES *prop); -DLL_API signed char F_API FSOUND_Reverb_GetProperties(FSOUND_REVERB_PROPERTIES *prop); -DLL_API signed char F_API FSOUND_Reverb_SetChannelProperties(int channel, const FSOUND_REVERB_CHANNELPROPERTIES *prop); -DLL_API signed char F_API FSOUND_Reverb_GetChannelProperties(int channel, FSOUND_REVERB_CHANNELPROPERTIES *prop); - -/* ===================================================== */ -/* Recording functions (ONLY SUPPORTED IN WIN32, WINCE) */ -/* ===================================================== */ - -/* - Recording initialization functions -*/ - -DLL_API signed char F_API FSOUND_Record_SetDriver(int outputtype); -DLL_API int F_API FSOUND_Record_GetNumDrivers(); -DLL_API const char * F_API FSOUND_Record_GetDriverName(int id); -DLL_API int F_API FSOUND_Record_GetDriver(); - -/* - Recording functionality. Only one recording session will work at a time. -*/ - -DLL_API signed char F_API FSOUND_Record_StartSample(FSOUND_SAMPLE *sptr, signed char loop); -DLL_API signed char F_API FSOUND_Record_Stop(); -DLL_API int F_API FSOUND_Record_GetPosition(); - -/* ========================================================================================== */ -/* FMUSIC API (MOD,S3M,XM,IT,MIDI PLAYBACK) */ -/* ========================================================================================== */ - -/* - Song management / playback functions. -*/ - -DLL_API FMUSIC_MODULE * F_API FMUSIC_LoadSong(const char *name); -DLL_API FMUSIC_MODULE * F_API FMUSIC_LoadSongEx(const char *name_or_data, int offset, int length, unsigned int mode, const int *samplelist, int samplelistnum); -DLL_API int F_API FMUSIC_GetOpenState(FMUSIC_MODULE *mod); -DLL_API signed char F_API FMUSIC_FreeSong(FMUSIC_MODULE *mod); -DLL_API signed char F_API FMUSIC_PlaySong(FMUSIC_MODULE *mod); -DLL_API signed char F_API FMUSIC_StopSong(FMUSIC_MODULE *mod); -DLL_API void F_API FMUSIC_StopAllSongs(); - -DLL_API signed char F_API FMUSIC_SetZxxCallback(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback); -DLL_API signed char F_API FMUSIC_SetRowCallback(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int rowstep); -DLL_API signed char F_API FMUSIC_SetOrderCallback(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int orderstep); -DLL_API signed char F_API FMUSIC_SetInstCallback(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int instrument); - -DLL_API signed char F_API FMUSIC_SetSample(FMUSIC_MODULE *mod, int sampno, FSOUND_SAMPLE *sptr); -DLL_API signed char F_API FMUSIC_SetUserData(FMUSIC_MODULE *mod, void *userdata); -DLL_API signed char F_API FMUSIC_OptimizeChannels(FMUSIC_MODULE *mod, int maxchannels, int minvolume); - -/* - Runtime song functions. -*/ - -DLL_API signed char F_API FMUSIC_SetReverb(signed char reverb); /* MIDI only */ -DLL_API signed char F_API FMUSIC_SetLooping(FMUSIC_MODULE *mod, signed char looping); -DLL_API signed char F_API FMUSIC_SetOrder(FMUSIC_MODULE *mod, int order); -DLL_API signed char F_API FMUSIC_SetPaused(FMUSIC_MODULE *mod, signed char pause); -DLL_API signed char F_API FMUSIC_SetMasterVolume(FMUSIC_MODULE *mod, int volume); -DLL_API signed char F_API FMUSIC_SetMasterSpeed(FMUSIC_MODULE *mode, float speed); -DLL_API signed char F_API FMUSIC_SetPanSeperation(FMUSIC_MODULE *mod, float pansep); - -/* - Static song information functions. -*/ - -DLL_API const char * F_API FMUSIC_GetName(FMUSIC_MODULE *mod); -DLL_API int F_API FMUSIC_GetType(FMUSIC_MODULE *mod); -DLL_API int F_API FMUSIC_GetNumOrders(FMUSIC_MODULE *mod); -DLL_API int F_API FMUSIC_GetNumPatterns(FMUSIC_MODULE *mod); -DLL_API int F_API FMUSIC_GetNumInstruments(FMUSIC_MODULE *mod); -DLL_API int F_API FMUSIC_GetNumSamples(FMUSIC_MODULE *mod); -DLL_API int F_API FMUSIC_GetNumChannels(FMUSIC_MODULE *mod); -DLL_API FSOUND_SAMPLE * F_API FMUSIC_GetSample(FMUSIC_MODULE *mod, int sampno); -DLL_API int F_API FMUSIC_GetPatternLength(FMUSIC_MODULE *mod, int orderno); - -/* - Runtime song information. -*/ - -DLL_API signed char F_API FMUSIC_IsFinished(FMUSIC_MODULE *mod); -DLL_API signed char F_API FMUSIC_IsPlaying(FMUSIC_MODULE *mod); -DLL_API int F_API FMUSIC_GetMasterVolume(FMUSIC_MODULE *mod); -DLL_API int F_API FMUSIC_GetGlobalVolume(FMUSIC_MODULE *mod); -DLL_API int F_API FMUSIC_GetOrder(FMUSIC_MODULE *mod); -DLL_API int F_API FMUSIC_GetPattern(FMUSIC_MODULE *mod); -DLL_API int F_API FMUSIC_GetSpeed(FMUSIC_MODULE *mod); -DLL_API int F_API FMUSIC_GetBPM(FMUSIC_MODULE *mod); -DLL_API int F_API FMUSIC_GetRow(FMUSIC_MODULE *mod); -DLL_API signed char F_API FMUSIC_GetPaused(FMUSIC_MODULE *mod); -DLL_API int F_API FMUSIC_GetTime(FMUSIC_MODULE *mod); -DLL_API int F_API FMUSIC_GetRealChannel(FMUSIC_MODULE *mod, int modchannel); -DLL_API void * F_API FMUSIC_GetUserData(FMUSIC_MODULE *mod); - -#ifdef __cplusplus -} -#endif - -#endif +/* ========================================================================================== */ +/* FMOD Main header file. Copyright (c), Firelight Technologies Pty, Ltd. 1999-2004. */ +/* ========================================================================================== */ + +#ifndef _FMOD_H_ +#define _FMOD_H_ + +/* ========================================================================================== */ +/* DEFINITIONS */ +/* ========================================================================================== */ + +#if (!defined(WIN32) && !defined(_WIN32) && !defined(__WIN32__) && !defined(_WIN64) && !defined(_WIN32_WCE) && !defined(_XBOX)) || (defined(__GNUC__) && defined(WIN32)) + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __stdcall + #define __stdcall + #endif +#endif + +#if defined(_WIN32_WCE) + #define F_API _cdecl + #define F_CALLBACKAPI _cdecl +#else + #define F_API __stdcall + #define F_CALLBACKAPI __stdcall +#endif + +#ifdef DLL_EXPORTS + #define DLL_API __declspec(dllexport) +#else + #if defined(__LCC__) || defined(__MINGW32__) || defined(__CYGWIN32__) + #define DLL_API F_API + #else + #define DLL_API + #endif /* __LCC__ || __MINGW32__ || __CYGWIN32__ */ +#endif /* DLL_EXPORTS */ + +#define FMOD_VERSION 3.75f + +/* + FMOD defined types +*/ +typedef struct FSOUND_SAMPLE FSOUND_SAMPLE; +typedef struct FSOUND_STREAM FSOUND_STREAM; +typedef struct FSOUND_DSPUNIT FSOUND_DSPUNIT; +typedef struct FSOUND_SYNCPOINT FSOUND_SYNCPOINT; +typedef struct FMUSIC_MODULE FMUSIC_MODULE; + +/* + Callback types +*/ +typedef void * (F_CALLBACKAPI *FSOUND_OPENCALLBACK) (const char *name); +typedef void (F_CALLBACKAPI *FSOUND_CLOSECALLBACK) (void *handle); +typedef int (F_CALLBACKAPI *FSOUND_READCALLBACK) (void *buffer, int size, void *handle); +typedef int (F_CALLBACKAPI *FSOUND_SEEKCALLBACK) (void *handle, int pos, signed char mode); +typedef int (F_CALLBACKAPI *FSOUND_TELLCALLBACK) (void *handle); + +typedef void * (F_CALLBACKAPI *FSOUND_ALLOCCALLBACK) (unsigned int size); +typedef void * (F_CALLBACKAPI *FSOUND_REALLOCCALLBACK) (void *ptr, unsigned int size); +typedef void (F_CALLBACKAPI *FSOUND_FREECALLBACK) (void *ptr); + +typedef void * (F_CALLBACKAPI *FSOUND_DSPCALLBACK) (void *originalbuffer, void *newbuffer, int length, void *userdata); +typedef signed char (F_CALLBACKAPI *FSOUND_STREAMCALLBACK) (FSOUND_STREAM *stream, void *buff, int len, void *userdata); +typedef signed char (F_CALLBACKAPI *FSOUND_METADATACALLBACK)(char *name, char *value, void *userdata); +typedef void (F_CALLBACKAPI *FMUSIC_CALLBACK) (FMUSIC_MODULE *mod, unsigned char param); + + +/* +[ENUM] +[ + [DESCRIPTION] + On failure of commands in FMOD, use FSOUND_GetError to attain what happened. + + [SEE_ALSO] + FSOUND_GetError +] +*/ +enum FMOD_ERRORS +{ + FMOD_ERR_NONE, /* No errors */ + FMOD_ERR_BUSY, /* Cannot call this command after FSOUND_Init. Call FSOUND_Close first. */ + FMOD_ERR_UNINITIALIZED, /* This command failed because FSOUND_Init or FSOUND_SetOutput was not called */ + FMOD_ERR_INIT, /* Error initializing output device. */ + FMOD_ERR_ALLOCATED, /* Error initializing output device, but more specifically, the output device is already in use and cannot be reused. */ + FMOD_ERR_PLAY, /* Playing the sound failed. */ + FMOD_ERR_OUTPUT_FORMAT, /* Soundcard does not support the features needed for this soundsystem (16bit stereo output) */ + FMOD_ERR_COOPERATIVELEVEL, /* Error setting cooperative level for hardware. */ + FMOD_ERR_CREATEBUFFER, /* Error creating hardware sound buffer. */ + FMOD_ERR_FILE_NOTFOUND, /* File not found */ + FMOD_ERR_FILE_FORMAT, /* Unknown file format */ + FMOD_ERR_FILE_BAD, /* Error loading file */ + FMOD_ERR_MEMORY, /* Not enough memory or resources */ + FMOD_ERR_VERSION, /* The version number of this file format is not supported */ + FMOD_ERR_INVALID_PARAM, /* An invalid parameter was passed to this function */ + FMOD_ERR_NO_EAX, /* Tried to use an EAX command on a non EAX enabled channel or output. */ + FMOD_ERR_CHANNEL_ALLOC, /* Failed to allocate a new channel */ + FMOD_ERR_RECORD, /* Recording is not supported on this machine */ + FMOD_ERR_MEDIAPLAYER, /* Windows Media Player not installed so cannot play wma or use internet streaming. */ + FMOD_ERR_CDDEVICE /* An error occured trying to open the specified CD device */ +}; + + +/* +[ENUM] +[ + [DESCRIPTION] + These output types are used with FSOUND_SetOutput, to choose which output driver to use. + + FSOUND_OUTPUT_DSOUND will not support hardware 3d acceleration if the sound card driver + does not support DirectX 6 Voice Manager Extensions. + + FSOUND_OUTPUT_WINMM is recommended for NT and CE. + + [SEE_ALSO] + FSOUND_SetOutput + FSOUND_GetOutput +] +*/ +enum FSOUND_OUTPUTTYPES +{ + FSOUND_OUTPUT_NOSOUND, /* NoSound driver, all calls to this succeed but do nothing. */ + FSOUND_OUTPUT_WINMM, /* Windows Multimedia driver. */ + FSOUND_OUTPUT_DSOUND, /* DirectSound driver. You need this to get EAX2 or EAX3 support, or FX api support. */ + FSOUND_OUTPUT_A3D, /* A3D driver. */ + + FSOUND_OUTPUT_OSS, /* Linux/Unix OSS (Open Sound System) driver, i.e. the kernel sound drivers. */ + FSOUND_OUTPUT_ESD, /* Linux/Unix ESD (Enlightment Sound Daemon) driver. */ + FSOUND_OUTPUT_ALSA, /* Linux Alsa driver. */ + + FSOUND_OUTPUT_ASIO, /* Low latency ASIO driver */ + FSOUND_OUTPUT_XBOX, /* Xbox driver */ + FSOUND_OUTPUT_PS2, /* PlayStation 2 driver */ + FSOUND_OUTPUT_MAC, /* Mac SoundManager driver */ + FSOUND_OUTPUT_GC, /* Gamecube driver */ + FSOUND_OUTPUT_PSP, /* PlayStation Portable driver */ + + FSOUND_OUTPUT_NOSOUND_NONREALTIME /* This is the same as nosound, but the sound generation is driven by FSOUND_Update */ +}; + + +/* +[ENUM] +[ + [DESCRIPTION] + These mixer types are used with FSOUND_SetMixer, to choose which mixer to use, or to act + upon for other reasons using FSOUND_GetMixer. + It is not nescessary to set the mixer. FMOD will autodetect the best mixer for you. + + [SEE_ALSO] + FSOUND_SetMixer + FSOUND_GetMixer +] +*/ +enum FSOUND_MIXERTYPES +{ + FSOUND_MIXER_AUTODETECT, /* CE/PS2/GC Only - Non interpolating/low quality mixer. */ + FSOUND_MIXER_BLENDMODE, /* Removed / obsolete. */ + FSOUND_MIXER_MMXP5, /* Removed / obsolete. */ + FSOUND_MIXER_MMXP6, /* Removed / obsolete. */ + + FSOUND_MIXER_QUALITY_AUTODETECT,/* All platforms - Autodetect the fastest quality mixer based on your cpu. */ + FSOUND_MIXER_QUALITY_FPU, /* Win32/Linux only - Interpolating/volume ramping FPU mixer. */ + FSOUND_MIXER_QUALITY_MMXP5, /* Win32/Linux only - Interpolating/volume ramping P5 MMX mixer. */ + FSOUND_MIXER_QUALITY_MMXP6, /* Win32/Linux only - Interpolating/volume ramping ppro+ MMX mixer. */ + + FSOUND_MIXER_MONO, /* CE/PS2/GC only - MONO non interpolating/low quality mixer. For speed*/ + FSOUND_MIXER_QUALITY_MONO, /* CE/PS2/GC only - MONO Interpolating mixer. For speed */ + + FSOUND_MIXER_MAX +}; + + +/* +[ENUM] +[ + [DESCRIPTION] + These definitions describe the type of song being played. + + [SEE_ALSO] + FMUSIC_GetType +] +*/ +enum FMUSIC_TYPES +{ + FMUSIC_TYPE_NONE, + FMUSIC_TYPE_MOD, /* Protracker / Fasttracker */ + FMUSIC_TYPE_S3M, /* ScreamTracker 3 */ + FMUSIC_TYPE_XM, /* FastTracker 2 */ + FMUSIC_TYPE_IT, /* Impulse Tracker. */ + FMUSIC_TYPE_MIDI, /* MIDI file */ + FMUSIC_TYPE_FSB /* FMOD Sample Bank file */ +}; + + +/* +[DEFINE_START] +[ + [NAME] + FSOUND_DSP_PRIORITIES + + [DESCRIPTION] + These default priorities are used by FMOD internal system DSP units. They describe the + position of the DSP chain, and the order of how audio processing is executed. + You can actually through the use of FSOUND_DSP_GetxxxUnit (where xxx is the name of the DSP + unit), disable or even change the priority of a DSP unit. + + [SEE_ALSO] + FSOUND_DSP_Create + FSOUND_DSP_SetPriority + FSOUND_DSP_GetSpectrum +] +*/ +#define FSOUND_DSP_DEFAULTPRIORITY_CLEARUNIT 0 /* DSP CLEAR unit - done first */ +#define FSOUND_DSP_DEFAULTPRIORITY_SFXUNIT 100 /* DSP SFX unit - done second */ +#define FSOUND_DSP_DEFAULTPRIORITY_MUSICUNIT 200 /* DSP MUSIC unit - done third */ +#define FSOUND_DSP_DEFAULTPRIORITY_USER 300 /* User priority, use this as reference for your own DSP units */ +#define FSOUND_DSP_DEFAULTPRIORITY_FFTUNIT 900 /* This reads data for FSOUND_DSP_GetSpectrum, so it comes after user units */ +#define FSOUND_DSP_DEFAULTPRIORITY_CLIPANDCOPYUNIT 1000 /* DSP CLIP AND COPY unit - last */ +/* [DEFINE_END] */ + + +/* +[DEFINE_START] +[ + [NAME] + FSOUND_CAPS + + [DESCRIPTION] + Driver description bitfields. Use FSOUND_Driver_GetCaps to determine if a driver enumerated + has the settings you are after. The enumerated driver depends on the output mode, see + FSOUND_OUTPUTTYPES + + [SEE_ALSO] + FSOUND_GetDriverCaps + FSOUND_OUTPUTTYPES +] +*/ +#define FSOUND_CAPS_HARDWARE 0x1 /* This driver supports hardware accelerated 3d sound. */ +#define FSOUND_CAPS_EAX2 0x2 /* This driver supports EAX 2 reverb */ +#define FSOUND_CAPS_EAX3 0x10 /* This driver supports EAX 3 reverb */ +/* [DEFINE_END] */ + + +/* +[DEFINE_START] +[ + [NAME] + FSOUND_MODES + + [DESCRIPTION] + Sample description bitfields, OR them together for loading and describing samples. + NOTE. If the file format being loaded already has a defined format, such as WAV or MP3, then + trying to override the pre-defined format with a new set of format flags will not work. For + example, an 8 bit WAV file will not load as 16bit if you specify FSOUND_16BITS. It will just + ignore the flag and go ahead loading it as 8bits. For these type of formats the only flags + you can specify that will really alter the behaviour of how it is loaded, are the following. + --------- + Looping behaviour - FSOUND_LOOP_OFF, FSOUND_LOOP_NORMAL, FSOUND_LOOP_BIDI + Load destination - FSOUND_HW3D, FSOUND_HW2D, FSOUND_2D + Loading behaviour - FSOUND_NONBLOCKING, FSOUND_LOADMEMORY, FSOUND_LOADRAW, FSOUND_MPEGACCURATE, FSOUND_MPEGHALFRATE, FSOUND_FORCEMONO + Playback behaviour - FSOUND_STREAMABLE, FSOUND_ENABLEFX + PlayStation 2 only - FSOUND_USECORE0, FSOUND_USECORE1, FSOUND_LOADMEMORYIOP + --------- + See flag descriptions for what these do. +] +*/ +#define FSOUND_LOOP_OFF 0x00000001 /* For non looping samples. */ +#define FSOUND_LOOP_NORMAL 0x00000002 /* For forward looping samples. */ +#define FSOUND_LOOP_BIDI 0x00000004 /* For bidirectional looping samples. (no effect if in hardware). */ +#define FSOUND_8BITS 0x00000008 /* For 8 bit samples. */ +#define FSOUND_16BITS 0x00000010 /* For 16 bit samples. */ +#define FSOUND_MONO 0x00000020 /* For mono samples. */ +#define FSOUND_STEREO 0x00000040 /* For stereo samples. */ +#define FSOUND_UNSIGNED 0x00000080 /* For user created source data containing unsigned samples. */ +#define FSOUND_SIGNED 0x00000100 /* For user created source data containing signed data. */ +#define FSOUND_DELTA 0x00000200 /* For user created source data stored as delta values. */ +#define FSOUND_IT214 0x00000400 /* For user created source data stored using IT214 compression. */ +#define FSOUND_IT215 0x00000800 /* For user created source data stored using IT215 compression. */ +#define FSOUND_HW3D 0x00001000 /* Attempts to make samples use 3d hardware acceleration. (if the card supports it) */ +#define FSOUND_2D 0x00002000 /* Tells software (not hardware) based sample not to be included in 3d processing. */ +#define FSOUND_STREAMABLE 0x00004000 /* For a streamimg sound where you feed the data to it. */ +#define FSOUND_LOADMEMORY 0x00008000 /* "name" will be interpreted as a pointer to data for streaming and samples. */ +#define FSOUND_LOADRAW 0x00010000 /* Will ignore file format and treat as raw pcm. */ +#define FSOUND_MPEGACCURATE 0x00020000 /* For FSOUND_Stream_Open - for accurate FSOUND_Stream_GetLengthMs/FSOUND_Stream_SetTime. WARNING, see FSOUND_Stream_Open for inital opening time performance issues. */ +#define FSOUND_FORCEMONO 0x00040000 /* For forcing stereo streams and samples to be mono - needed if using FSOUND_HW3D and stereo data - incurs a small speed hit for streams */ +#define FSOUND_HW2D 0x00080000 /* 2D hardware sounds. allows hardware specific effects */ +#define FSOUND_ENABLEFX 0x00100000 /* Allows DX8 FX to be played back on a sound. Requires DirectX 8 - Note these sounds cannot be played more than once, be 8 bit, be less than a certain size, or have a changing frequency */ +#define FSOUND_MPEGHALFRATE 0x00200000 /* For FMODCE only - decodes mpeg streams using a lower quality decode, but faster execution */ +#define FSOUND_IMAADPCM 0x00400000 /* Contents are stored compressed as IMA ADPCM */ +#define FSOUND_VAG 0x00800000 /* For PS2 only - Contents are compressed as Sony VAG format */ +#define FSOUND_NONBLOCKING 0x01000000 /* For FSOUND_Stream_Open/FMUSIC_LoadSong - Causes stream or music to open in the background and not block the foreground app. See FSOUND_Stream_GetOpenState or FMUSIC_GetOpenState to determine when it IS ready. */ +#define FSOUND_GCADPCM 0x02000000 /* For Gamecube only - Contents are compressed as Gamecube DSP-ADPCM format */ +#define FSOUND_MULTICHANNEL 0x04000000 /* For PS2 and Gamecube only - Contents are interleaved into a multi-channel (more than stereo) format */ +#define FSOUND_USECORE0 0x08000000 /* For PS2 only - Sample/Stream is forced to use hardware voices 00-23 */ +#define FSOUND_USECORE1 0x10000000 /* For PS2 only - Sample/Stream is forced to use hardware voices 24-47 */ +#define FSOUND_LOADMEMORYIOP 0x20000000 /* For PS2 only - "name" will be interpreted as a pointer to data for streaming and samples. The address provided will be an IOP address */ +#define FSOUND_IGNORETAGS 0x40000000 /* Skips id3v2 etc tag checks when opening a stream, to reduce seek/read overhead when opening files (helps with CD performance) */ +#define FSOUND_STREAM_NET 0x80000000 /* Specifies an internet stream */ + +#define FSOUND_NORMAL (FSOUND_16BITS | FSOUND_SIGNED | FSOUND_MONO) +/* [DEFINE_END] */ + + + +/* +[DEFINE_START] +[ + [NAME] + FSOUND_CDPLAYMODES + + [DESCRIPTION] + Playback method for a CD Audio track, with FSOUND_CD_SetPlayMode + + [SEE_ALSO] + FSOUND_CD_SetPlayMode + FSOUND_CD_Play +] +*/ +#define FSOUND_CD_PLAYCONTINUOUS 0 /* Starts from the current track and plays to end of CD. */ +#define FSOUND_CD_PLAYONCE 1 /* Plays the specified track then stops. */ +#define FSOUND_CD_PLAYLOOPED 2 /* Plays the specified track looped, forever until stopped manually. */ +#define FSOUND_CD_PLAYRANDOM 3 /* Plays tracks in random order */ +/* [DEFINE_END] */ + + +/* +[DEFINE_START] +[ + [NAME] + FSOUND_MISC_VALUES + + [DESCRIPTION] + Miscellaneous values for FMOD functions. + + [SEE_ALSO] + FSOUND_PlaySound + FSOUND_PlaySoundEx + FSOUND_Sample_Alloc + FSOUND_Sample_Load + FSOUND_SetPan +] +*/ +#define FSOUND_FREE -1 /* value to play on any free channel, or to allocate a sample in a free sample slot. */ +#define FSOUND_UNMANAGED -2 /* value to allocate a sample that is NOT managed by FSOUND or placed in a sample slot. */ +#define FSOUND_ALL -3 /* for a channel index , this flag will affect ALL channels available! Not supported by every function. */ +#define FSOUND_STEREOPAN -1 /* value for FSOUND_SetPan so that stereo sounds are not played at half volume. See FSOUND_SetPan for more on this. */ +#define FSOUND_SYSTEMCHANNEL -1000 /* special 'channel' ID for all channel based functions that want to alter the global FSOUND software mixing output channel */ +#define FSOUND_SYSTEMSAMPLE -1000 /* special 'sample' ID for all sample based functions that want to alter the global FSOUND software mixing output sample */ + +/* [DEFINE_END] */ + + +/* +[STRUCTURE] +[ + [DESCRIPTION] + Structure defining a reverb environment. + For more indepth descriptions of the reverb properties under win32, please see the EAX2 and EAX3 + documentation at http://developer.creative.com/ under the 'downloads' section. + If they do not have the EAX3 documentation, then most information can be attained from + the EAX2 documentation, as EAX3 only adds some more parameters and functionality on top of EAX2. + Note the default reverb properties are the same as the FSOUND_PRESET_GENERIC preset. + Note that integer values that typically range from -10,000 to 1000 are represented in decibels, and are of a logarithmic scale, not linear, wheras float values are typically linear. + PORTABILITY: Each member has the platform it supports in braces ie (win32/xbox). + Some reverb parameters are only supported in win32 and some only on xbox. If all parameters are set then the reverb should product a similar effect on either platform. + + The numerical values listed below are the maximum, minimum and default values for each variable respectively. + + [SEE_ALSO] + FSOUND_Reverb_SetProperties + FSOUND_Reverb_GetProperties + FSOUND_REVERB_PRESETS + FSOUND_REVERB_FLAGS +] +*/ +typedef struct _FSOUND_REVERB_PROPERTIES /* MIN MAX DEFAULT DESCRIPTION */ +{ + unsigned int Environment; /* 0 , 25 , 0 , sets all listener properties (WIN32/PS2 only) */ + float EnvSize; /* 1.0 , 100.0 , 7.5 , environment size in meters (WIN32 only) */ + float EnvDiffusion; /* 0.0 , 1.0 , 1.0 , environment diffusion (WIN32/XBOX) */ + int Room; /* -10000, 0 , -1000 , room effect level (at mid frequencies) (WIN32/XBOX/PS2) */ + int RoomHF; /* -10000, 0 , -100 , relative room effect level at high frequencies (WIN32/XBOX) */ + int RoomLF; /* -10000, 0 , 0 , relative room effect level at low frequencies (WIN32 only) */ + float DecayTime; /* 0.1 , 20.0 , 1.49 , reverberation decay time at mid frequencies (WIN32/XBOX) */ + float DecayHFRatio; /* 0.1 , 2.0 , 0.83 , high-frequency to mid-frequency decay time ratio (WIN32/XBOX) */ + float DecayLFRatio; /* 0.1 , 2.0 , 1.0 , low-frequency to mid-frequency decay time ratio (WIN32 only) */ + int Reflections; /* -10000, 1000 , -2602 , early reflections level relative to room effect (WIN32/XBOX) */ + float ReflectionsDelay; /* 0.0 , 0.3 , 0.007 , initial reflection delay time (WIN32/XBOX) */ + float ReflectionsPan[3]; /* , , [0,0,0], early reflections panning vector (WIN32 only) */ + int Reverb; /* -10000, 2000 , 200 , late reverberation level relative to room effect (WIN32/XBOX) */ + float ReverbDelay; /* 0.0 , 0.1 , 0.011 , late reverberation delay time relative to initial reflection (WIN32/XBOX) */ + float ReverbPan[3]; /* , , [0,0,0], late reverberation panning vector (WIN32 only) */ + float EchoTime; /* .075 , 0.25 , 0.25 , echo time (WIN32/PS2 only. PS2 = Delay time for ECHO/DELAY modes only) */ + float EchoDepth; /* 0.0 , 1.0 , 0.0 , echo depth (WIN32/PS2 only. PS2 = Feedback level for ECHO mode only) */ + float ModulationTime; /* 0.04 , 4.0 , 0.25 , modulation time (WIN32 only) */ + float ModulationDepth; /* 0.0 , 1.0 , 0.0 , modulation depth (WIN32 only) */ + float AirAbsorptionHF; /* -100 , 0.0 , -5.0 , change in level per meter at high frequencies (WIN32 only) */ + float HFReference; /* 1000.0, 20000 , 5000.0 , reference high frequency (hz) (WIN32/XBOX) */ + float LFReference; /* 20.0 , 1000.0, 250.0 , reference low frequency (hz) (WIN32 only) */ + float RoomRolloffFactor; /* 0.0 , 10.0 , 0.0 , like FSOUND_3D_SetRolloffFactor but for room effect (WIN32/XBOX) */ + float Diffusion; /* 0.0 , 100.0 , 100.0 , Value that controls the echo density in the late reverberation decay. (XBOX only) */ + float Density; /* 0.0 , 100.0 , 100.0 , Value that controls the modal density in the late reverberation decay (XBOX only) */ + unsigned int Flags; /* FSOUND_REVERB_FLAGS - modifies the behavior of above properties (WIN32/PS2 only) */ +} FSOUND_REVERB_PROPERTIES; + + +/* +[DEFINE_START] +[ + [NAME] + FSOUND_REVERB_FLAGS + + [DESCRIPTION] + Values for the Flags member of the FSOUND_REVERB_PROPERTIES structure. + + [SEE_ALSO] + FSOUND_REVERB_PROPERTIES +] +*/ +#define FSOUND_REVERB_FLAGS_DECAYTIMESCALE 0x00000001 /* 'EnvSize' affects reverberation decay time */ +#define FSOUND_REVERB_FLAGS_REFLECTIONSSCALE 0x00000002 /* 'EnvSize' affects reflection level */ +#define FSOUND_REVERB_FLAGS_REFLECTIONSDELAYSCALE 0x00000004 /* 'EnvSize' affects initial reflection delay time */ +#define FSOUND_REVERB_FLAGS_REVERBSCALE 0x00000008 /* 'EnvSize' affects reflections level */ +#define FSOUND_REVERB_FLAGS_REVERBDELAYSCALE 0x00000010 /* 'EnvSize' affects late reverberation delay time */ +#define FSOUND_REVERB_FLAGS_DECAYHFLIMIT 0x00000020 /* AirAbsorptionHF affects DecayHFRatio */ +#define FSOUND_REVERB_FLAGS_ECHOTIMESCALE 0x00000040 /* 'EnvSize' affects echo time */ +#define FSOUND_REVERB_FLAGS_MODULATIONTIMESCALE 0x00000080 /* 'EnvSize' affects modulation time */ +#define FSOUND_REVERB_FLAGS_CORE0 0x00000100 /* PS2 Only - Reverb is applied to CORE0 (hw voices 0-23) */ +#define FSOUND_REVERB_FLAGS_CORE1 0x00000200 /* PS2 Only - Reverb is applied to CORE1 (hw voices 24-47) */ +#define FSOUND_REVERB_FLAGS_DEFAULT (FSOUND_REVERB_FLAGS_DECAYTIMESCALE | \ + FSOUND_REVERB_FLAGS_REFLECTIONSSCALE | \ + FSOUND_REVERB_FLAGS_REFLECTIONSDELAYSCALE | \ + FSOUND_REVERB_FLAGS_REVERBSCALE | \ + FSOUND_REVERB_FLAGS_REVERBDELAYSCALE | \ + FSOUND_REVERB_FLAGS_DECAYHFLIMIT | \ + FSOUND_REVERB_FLAGS_CORE0 | \ + FSOUND_REVERB_FLAGS_CORE1 ) +/* [DEFINE_END] */ + + + + +/* +[DEFINE_START] +[ + [NAME] + FSOUND_REVERB_PRESETS + + [DESCRIPTION] + A set of predefined environment PARAMETERS, created by Creative Labs + These are used to initialize an FSOUND_REVERB_PROPERTIES structure statically. + ie + FSOUND_REVERB_PROPERTIES prop = FSOUND_PRESET_GENERIC; + + [SEE_ALSO] + FSOUND_Reverb_SetProperties +] +*/ +/* Env Size Diffus Room RoomHF RmLF DecTm DecHF DecLF Refl RefDel RefPan Revb RevDel ReverbPan EchoTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff Diffus Densty FLAGS */ +#define FSOUND_PRESET_OFF {0, 7.5f, 1.00f, -10000, -10000, 0, 1.00f, 1.00f, 1.0f, -2602, 0.007f, { 0.0f,0.0f,0.0f }, 200, 0.011f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 0.0f, 0.0f, 0x33f } +#define FSOUND_PRESET_GENERIC {0, 7.5f, 1.00f, -1000, -100, 0, 1.49f, 0.83f, 1.0f, -2602, 0.007f, { 0.0f,0.0f,0.0f }, 200, 0.011f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_PADDEDCELL {1, 1.4f, 1.00f, -1000, -6000, 0, 0.17f, 0.10f, 1.0f, -1204, 0.001f, { 0.0f,0.0f,0.0f }, 207, 0.002f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_ROOM {2, 1.9f, 1.00f, -1000, -454, 0, 0.40f, 0.83f, 1.0f, -1646, 0.002f, { 0.0f,0.0f,0.0f }, 53, 0.003f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_BATHROOM {3, 1.4f, 1.00f, -1000, -1200, 0, 1.49f, 0.54f, 1.0f, -370, 0.007f, { 0.0f,0.0f,0.0f }, 1030, 0.011f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 60.0f, 0x3f } +#define FSOUND_PRESET_LIVINGROOM {4, 2.5f, 1.00f, -1000, -6000, 0, 0.50f, 0.10f, 1.0f, -1376, 0.003f, { 0.0f,0.0f,0.0f }, -1104, 0.004f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_STONEROOM {5, 11.6f, 1.00f, -1000, -300, 0, 2.31f, 0.64f, 1.0f, -711, 0.012f, { 0.0f,0.0f,0.0f }, 83, 0.017f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_AUDITORIUM {6, 21.6f, 1.00f, -1000, -476, 0, 4.32f, 0.59f, 1.0f, -789, 0.020f, { 0.0f,0.0f,0.0f }, -289, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_CONCERTHALL {7, 19.6f, 1.00f, -1000, -500, 0, 3.92f, 0.70f, 1.0f, -1230, 0.020f, { 0.0f,0.0f,0.0f }, -2, 0.029f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_CAVE {8, 14.6f, 1.00f, -1000, 0, 0, 2.91f, 1.30f, 1.0f, -602, 0.015f, { 0.0f,0.0f,0.0f }, -302, 0.022f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x1f } +#define FSOUND_PRESET_ARENA {9, 36.2f, 1.00f, -1000, -698, 0, 7.24f, 0.33f, 1.0f, -1166, 0.020f, { 0.0f,0.0f,0.0f }, 16, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_HANGAR {10, 50.3f, 1.00f, -1000, -1000, 0, 10.05f, 0.23f, 1.0f, -602, 0.020f, { 0.0f,0.0f,0.0f }, 198, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_CARPETTEDHALLWAY {11, 1.9f, 1.00f, -1000, -4000, 0, 0.30f, 0.10f, 1.0f, -1831, 0.002f, { 0.0f,0.0f,0.0f }, -1630, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_HALLWAY {12, 1.8f, 1.00f, -1000, -300, 0, 1.49f, 0.59f, 1.0f, -1219, 0.007f, { 0.0f,0.0f,0.0f }, 441, 0.011f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_STONECORRIDOR {13, 13.5f, 1.00f, -1000, -237, 0, 2.70f, 0.79f, 1.0f, -1214, 0.013f, { 0.0f,0.0f,0.0f }, 395, 0.020f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_ALLEY {14, 7.5f, 0.30f, -1000, -270, 0, 1.49f, 0.86f, 1.0f, -1204, 0.007f, { 0.0f,0.0f,0.0f }, -4, 0.011f, { 0.0f,0.0f,0.0f }, 0.125f, 0.95f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_FOREST {15, 38.0f, 0.30f, -1000, -3300, 0, 1.49f, 0.54f, 1.0f, -2560, 0.162f, { 0.0f,0.0f,0.0f }, -229, 0.088f, { 0.0f,0.0f,0.0f }, 0.125f, 1.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 79.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_CITY {16, 7.5f, 0.50f, -1000, -800, 0, 1.49f, 0.67f, 1.0f, -2273, 0.007f, { 0.0f,0.0f,0.0f }, -1691, 0.011f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 50.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_MOUNTAINS {17, 100.0f, 0.27f, -1000, -2500, 0, 1.49f, 0.21f, 1.0f, -2780, 0.300f, { 0.0f,0.0f,0.0f }, -1434, 0.100f, { 0.0f,0.0f,0.0f }, 0.250f, 1.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 27.0f, 100.0f, 0x1f } +#define FSOUND_PRESET_QUARRY {18, 17.5f, 1.00f, -1000, -1000, 0, 1.49f, 0.83f, 1.0f, -10000, 0.061f, { 0.0f,0.0f,0.0f }, 500, 0.025f, { 0.0f,0.0f,0.0f }, 0.125f, 0.70f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_PLAIN {19, 42.5f, 0.21f, -1000, -2000, 0, 1.49f, 0.50f, 1.0f, -2466, 0.179f, { 0.0f,0.0f,0.0f }, -1926, 0.100f, { 0.0f,0.0f,0.0f }, 0.250f, 1.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 21.0f, 100.0f, 0x3f } +#define FSOUND_PRESET_PARKINGLOT {20, 8.3f, 1.00f, -1000, 0, 0, 1.65f, 1.50f, 1.0f, -1363, 0.008f, { 0.0f,0.0f,0.0f }, -1153, 0.012f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x1f } +#define FSOUND_PRESET_SEWERPIPE {21, 1.7f, 0.80f, -1000, -1000, 0, 2.81f, 0.14f, 1.0f, 429, 0.014f, { 0.0f,0.0f,0.0f }, 1023, 0.021f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 0.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 80.0f, 60.0f, 0x3f } +#define FSOUND_PRESET_UNDERWATER {22, 1.8f, 1.00f, -1000, -4000, 0, 1.49f, 0.10f, 1.0f, -449, 0.007f, { 0.0f,0.0f,0.0f }, 1700, 0.011f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 1.18f, 0.348f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x3f } + +/* Non I3DL2 presets */ + +#define FSOUND_PRESET_DRUGGED {23, 1.9f, 0.50f, -1000, 0, 0, 8.39f, 1.39f, 1.0f, -115, 0.002f, { 0.0f,0.0f,0.0f }, 985, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 0.25f, 1.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x1f } +#define FSOUND_PRESET_DIZZY {24, 1.8f, 0.60f, -1000, -400, 0, 17.23f, 0.56f, 1.0f, -1713, 0.020f, { 0.0f,0.0f,0.0f }, -613, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 1.00f, 0.81f, 0.310f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x1f } +#define FSOUND_PRESET_PSYCHOTIC {25, 1.0f, 0.50f, -1000, -151, 0, 7.56f, 0.91f, 1.0f, -626, 0.020f, { 0.0f,0.0f,0.0f }, 774, 0.030f, { 0.0f,0.0f,0.0f }, 0.250f, 0.00f, 4.00f, 1.000f, -5.0f, 5000.0f, 250.0f, 0.0f, 100.0f, 100.0f, 0x1f } + +/* PlayStation 2 and PlayStation Portable only presets */ + +#define FSOUND_PRESET_PS2_ROOM {1, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } +#define FSOUND_PRESET_PS2_STUDIO_A {2, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } +#define FSOUND_PRESET_PS2_STUDIO_B {3, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } +#define FSOUND_PRESET_PS2_STUDIO_C {4, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } +#define FSOUND_PRESET_PS2_HALL {5, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } +#define FSOUND_PRESET_PS2_SPACE {6, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } +#define FSOUND_PRESET_PS2_ECHO {7, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } +#define FSOUND_PRESET_PS2_DELAY {8, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } +#define FSOUND_PRESET_PS2_PIPE {9, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0, 0.000f, { 0.0f,0.0f,0.0f }, 0.000f, 0.00f, 0.00f, 0.000f, 0.0f, 0000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0x31f } + +/* [DEFINE_END] */ + + +/* +[STRUCTURE] +[ + [DESCRIPTION] + Structure defining the properties for a reverb source, related to a FSOUND channel. + For more indepth descriptions of the reverb properties under win32, please see the EAX3 + documentation at http://developer.creative.com/ under the 'downloads' section. + If they do not have the EAX3 documentation, then most information can be attained from + the EAX2 documentation, as EAX3 only adds some more parameters and functionality on top of + EAX2. + + Note the default reverb properties are the same as the FSOUND_PRESET_GENERIC preset. + Note that integer values that typically range from -10,000 to 1000 are represented in + decibels, and are of a logarithmic scale, not linear, wheras float values are typically linear. + PORTABILITY: Each member has the platform it supports in braces ie (win32/xbox). + Some reverb parameters are only supported in win32 and some only on xbox. If all parameters are set then + the reverb should product a similar effect on either platform. + Linux and FMODCE do not support the reverb api. + + The numerical values listed below are the maximum, minimum and default values for each variable respectively. + + [SEE_ALSO] + FSOUND_Reverb_SetChannelProperties + FSOUND_Reverb_GetChannelProperties + FSOUND_REVERB_CHANNELFLAGS +] +*/ +typedef struct _FSOUND_REVERB_CHANNELPROPERTIES /* MIN MAX DEFAULT */ +{ + int Direct; /* -10000, 1000, 0, direct path level (at low and mid frequencies) (WIN32/XBOX) */ + int DirectHF; /* -10000, 0, 0, relative direct path level at high frequencies (WIN32/XBOX) */ + int Room; /* -10000, 1000, 0, room effect level (at low and mid frequencies) (WIN32/XBOX/PS2) */ + int RoomHF; /* -10000, 0, 0, relative room effect level at high frequencies (WIN32/XBOX) */ + int Obstruction; /* -10000, 0, 0, main obstruction control (attenuation at high frequencies) (WIN32/XBOX) */ + float ObstructionLFRatio; /* 0.0, 1.0, 0.0, obstruction low-frequency level re. main control (WIN32/XBOX) */ + int Occlusion; /* -10000, 0, 0, main occlusion control (attenuation at high frequencies) (WIN32/XBOX) */ + float OcclusionLFRatio; /* 0.0, 1.0, 0.25, occlusion low-frequency level re. main control (WIN32/XBOX) */ + float OcclusionRoomRatio; /* 0.0, 10.0, 1.5, relative occlusion control for room effect (WIN32) */ + float OcclusionDirectRatio; /* 0.0, 10.0, 1.0, relative occlusion control for direct path (WIN32) */ + int Exclusion; /* -10000, 0, 0, main exlusion control (attenuation at high frequencies) (WIN32) */ + float ExclusionLFRatio; /* 0.0, 1.0, 1.0, exclusion low-frequency level re. main control (WIN32) */ + int OutsideVolumeHF; /* -10000, 0, 0, outside sound cone level at high frequencies (WIN32) */ + float DopplerFactor; /* 0.0, 10.0, 0.0, like DS3D flDopplerFactor but per source (WIN32) */ + float RolloffFactor; /* 0.0, 10.0, 0.0, like DS3D flRolloffFactor but per source (WIN32) */ + float RoomRolloffFactor; /* 0.0, 10.0, 0.0, like DS3D flRolloffFactor but for room effect (WIN32/XBOX) */ + float AirAbsorptionFactor; /* 0.0, 10.0, 1.0, multiplies AirAbsorptionHF member of FSOUND_REVERB_PROPERTIES (WIN32) */ + int Flags; /* FSOUND_REVERB_CHANNELFLAGS - modifies the behavior of properties (WIN32) */ +} FSOUND_REVERB_CHANNELPROPERTIES; + + +/* +[DEFINE_START] +[ + [NAME] + FSOUND_REVERB_CHANNELFLAGS + + [DESCRIPTION] + Values for the Flags member of the FSOUND_REVERB_CHANNELPROPERTIES structure. + + [SEE_ALSO] + FSOUND_REVERB_CHANNELPROPERTIES +] +*/ +#define FSOUND_REVERB_CHANNELFLAGS_DIRECTHFAUTO 0x00000001 /* Automatic setting of 'Direct' due to distance from listener */ +#define FSOUND_REVERB_CHANNELFLAGS_ROOMAUTO 0x00000002 /* Automatic setting of 'Room' due to distance from listener */ +#define FSOUND_REVERB_CHANNELFLAGS_ROOMHFAUTO 0x00000004 /* Automatic setting of 'RoomHF' due to distance from listener */ +#define FSOUND_REVERB_CHANNELFLAGS_DEFAULT (FSOUND_REVERB_CHANNELFLAGS_DIRECTHFAUTO | \ + FSOUND_REVERB_CHANNELFLAGS_ROOMAUTO| \ + FSOUND_REVERB_CHANNELFLAGS_ROOMHFAUTO) +/* [DEFINE_END] */ + + +/* +[ENUM] +[ + [DESCRIPTION] + These values are used with FSOUND_FX_Enable to enable DirectX 8 FX for a channel. + + [SEE_ALSO] + FSOUND_FX_Enable + FSOUND_FX_Disable + FSOUND_FX_SetChorus + FSOUND_FX_SetCompressor + FSOUND_FX_SetDistortion + FSOUND_FX_SetEcho + FSOUND_FX_SetFlanger + FSOUND_FX_SetGargle + FSOUND_FX_SetI3DL2Reverb + FSOUND_FX_SetParamEQ + FSOUND_FX_SetWavesReverb +] +*/ +enum FSOUND_FX_MODES +{ + FSOUND_FX_CHORUS, + FSOUND_FX_COMPRESSOR, + FSOUND_FX_DISTORTION, + FSOUND_FX_ECHO, + FSOUND_FX_FLANGER, + FSOUND_FX_GARGLE, + FSOUND_FX_I3DL2REVERB, + FSOUND_FX_PARAMEQ, + FSOUND_FX_WAVES_REVERB, + + FSOUND_FX_MAX +}; + +/* +[ENUM] +[ + [DESCRIPTION] + These are speaker types defined for use with the FSOUND_SetSpeakerMode command. + Note - Only reliably works with FSOUND_OUTPUT_DSOUND or FSOUND_OUTPUT_XBOX output modes. Other output modes will only + interpret FSOUND_SPEAKERMODE_MONO and set everything else to be stereo. + + Using either DolbyDigital or DTS will use whatever 5.1 digital mode is available if destination hardware is unsure. + + [SEE_ALSO] + FSOUND_SetSpeakerMode + +] +*/ +enum FSOUND_SPEAKERMODES +{ + FSOUND_SPEAKERMODE_DOLBYDIGITAL, /* Dolby Digital Output (XBOX or PC only). */ + FSOUND_SPEAKERMODE_HEADPHONES, /* The speakers are headphones. */ + FSOUND_SPEAKERMODE_MONO, /* The speakers are monaural. */ + FSOUND_SPEAKERMODE_QUAD, /* The speakers are quadraphonic. */ + FSOUND_SPEAKERMODE_STEREO, /* The speakers are stereo (default value). */ + FSOUND_SPEAKERMODE_SURROUND, /* The speakers are surround sound. */ + FSOUND_SPEAKERMODE_DTS, /* DTS output (XBOX only). */ + FSOUND_SPEAKERMODE_PROLOGIC2, /* Dolby Prologic 2. Playstation 2 and Gamecube only. PlayStation 2 doesnt support interior panning, but supports 48 voices simultaneously. */ + FSOUND_SPEAKERMODE_PROLOGIC2_INTERIOR /* Dolby Prologic 2. Playstation 2 and Gamecube only. PlayStation 2 does support interior panning, but only supports 24 voices simultaneously. */ +}; + + +/* +[DEFINE_START] +[ + [NAME] + FSOUND_INIT_FLAGS + + [DESCRIPTION] + Initialization flags. Use them with FSOUND_Init in the flags parameter to change various behaviour. + + FSOUND_INIT_ENABLESYSTEMCHANNELFX Is an init mode which enables the FSOUND mixer buffer to be affected by DirectX 8 effects. + Note that due to limitations of DirectSound, FSOUND_Init may fail if this is enabled because the buffersize is too small. + This can be fixed with FSOUND_SetBufferSize. Increase the BufferSize until it works. + When it is enabled you can use the FSOUND_FX api, and use FSOUND_SYSTEMCHANNEL as the channel id when setting parameters. + + [SEE_ALSO] + FSOUND_Init +] +*/ +#define FSOUND_INIT_USEDEFAULTMIDISYNTH 0x0001 /* Win32 only - Causes MIDI playback to force software decoding. */ +#define FSOUND_INIT_GLOBALFOCUS 0x0002 /* Win32 only - For DirectSound output - sound is not muted when window is out of focus. */ +#define FSOUND_INIT_ENABLESYSTEMCHANNELFX 0x0004 /* Win32 only - For DirectSound output - Allows FSOUND_FX api to be used on global software mixer output! (use FSOUND_SYSTEMCHANNEL as channel id) */ +#define FSOUND_INIT_ACCURATEVULEVELS 0x0008 /* This latency adjusts FSOUND_GetCurrentLevels, but incurs a small cpu and memory hit */ +#define FSOUND_INIT_PS2_DISABLECORE0REVERB 0x0010 /* PS2 only - Disable reverb on CORE 0 (SPU2 voices 00-23) to regain SRAM */ +#define FSOUND_INIT_PS2_DISABLECORE1REVERB 0x0020 /* PS2 only - Disable reverb on CORE 1 (SPU2 voices 24-47) to regain SRAM */ +#define FSOUND_INIT_PS2_SWAPDMACORES 0x0040 /* PS2 only - By default FMOD uses DMA CH0 for mixing, CH1 for uploads, this flag swaps them around */ +#define FSOUND_INIT_DONTLATENCYADJUST 0x0080 /* Callbacks are not latency adjusted, and are called at mix time. Also information functions are immediate */ +#define FSOUND_INIT_GC_INITLIBS 0x0100 /* GC only - Initializes GC audio libraries */ +#define FSOUND_INIT_STREAM_FROM_MAIN_THREAD 0x0200 /* Turns off fmod streamer thread, and makes streaming update from FSOUND_Update called by the user */ +#define FSOUND_INIT_PS2_USEVOLUMERAMPING 0x0400 /* PS2 only - Turns on volume ramping system to remove hardware clicks. */ +#define FSOUND_INIT_DSOUND_DEFERRED 0x0800 /* Win32 only - For DirectSound output. 3D commands are batched together and executed at FSOUND_Update. */ +#define FSOUND_INIT_DSOUND_HRTF_LIGHT 0x1000 /* Win32 only - For DirectSound output. FSOUND_HW3D buffers use a slightly higher quality algorithm when 3d hardware acceleration is not present. */ +#define FSOUND_INIT_DSOUND_HRTF_FULL 0x2000 /* Win32 only - For DirectSound output. FSOUND_HW3D buffers use full quality 3d playback when 3d hardware acceleration is not present. */ +#define FSOUND_INIT_XBOX_REMOVEHEADROOM 0x4000 /* XBox only - By default directsound attenuates all sound by 6db to avoid clipping/distortion. CAUTION. If you use this flag you are responsible for the final mix to make sure clipping / distortion doesn't happen. */ +#define FSOUND_INIT_PSP_SILENCEONUNDERRUN 0x8000 /* PSP only - If streams skip / stutter when device is powered on, either increase stream buffersize, or use this flag instead to play silence while the UMD is recovering. */ +/* [DEFINE_END] */ + + +/* +[ENUM] +[ + [DESCRIPTION] + Status values for internet streams. Use FSOUND_Stream_Net_GetStatus to get the current status of an internet stream. + + [SEE_ALSO] + FSOUND_Stream_Net_GetStatus +] +*/ +enum FSOUND_STREAM_NET_STATUS +{ + FSOUND_STREAM_NET_NOTCONNECTED = 0, /* Stream hasn't connected yet */ + FSOUND_STREAM_NET_CONNECTING, /* Stream is connecting to remote host */ + FSOUND_STREAM_NET_BUFFERING, /* Stream is buffering data */ + FSOUND_STREAM_NET_READY, /* Stream is ready to play */ + FSOUND_STREAM_NET_ERROR /* Stream has suffered a fatal error */ +}; + + +/* +[ENUM] +[ + [DESCRIPTION] + Describes the type of a particular tag field. + + [SEE_ALSO] + FSOUND_Stream_GetNumTagFields + FSOUND_Stream_GetTagField + FSOUND_Stream_FindTagField +] +*/ +enum FSOUND_TAGFIELD_TYPE +{ + FSOUND_TAGFIELD_VORBISCOMMENT = 0, /* A vorbis comment */ + FSOUND_TAGFIELD_ID3V1, /* Part of an ID3v1 tag */ + FSOUND_TAGFIELD_ID3V2, /* An ID3v2 frame */ + FSOUND_TAGFIELD_SHOUTCAST, /* A SHOUTcast header line */ + FSOUND_TAGFIELD_ICECAST, /* An Icecast header line */ + FSOUND_TAGFIELD_ASF /* An Advanced Streaming Format header line */ +}; + + +/* +[DEFINE_START] +[ + [NAME] + FSOUND_STATUS_FLAGS + + [DESCRIPTION] + These values describe the protocol and format of an internet stream. Use FSOUND_Stream_Net_GetStatus to retrieve this information for an open internet stream. + + [SEE_ALSO] + FSOUND_Stream_Net_GetStatus +] +*/ +#define FSOUND_PROTOCOL_SHOUTCAST 0x00000001 +#define FSOUND_PROTOCOL_ICECAST 0x00000002 +#define FSOUND_PROTOCOL_HTTP 0x00000004 +#define FSOUND_FORMAT_MPEG 0x00010000 +#define FSOUND_FORMAT_OGGVORBIS 0x00020000 +/* [DEFINE_END] */ + + +/* +[STRUCTURE] +[ + [DESCRIPTION] + Structure defining a CD table of contents. This structure is returned as a tag from FSOUND_Stream_FindTagField when the tag name "CD_TOC" is specified. + Note: All tracks on the CD - including data tracks- will be represented in this structure so it's use for anything other than generating disc id information is not recommended. + See the cdda example program for info on retrieving and using this structure. + + [SEE_ALSO] + FSOUND_Stream_Open + FSOUND_Stream_FindTagField +] +*/ +typedef struct _FSOUND_TOC_TAG +{ + char name[4]; /* The string "TOC", just in case this structure is accidentally treated as a string */ + int numtracks; /* The number of tracks on the CD */ + int min[100]; /* The start offset of each track in minutes */ + int sec[100]; /* The start offset of each track in seconds */ + int frame[100]; /* The start offset of each track in frames */ + +} FSOUND_TOC_TAG; + + +/* ========================================================================================== */ +/* FUNCTION PROTOTYPES */ +/* ========================================================================================== */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* ================================== */ +/* Initialization / Global functions. */ +/* ================================== */ + +/* + PRE - FSOUND_Init functions. These can't be called after FSOUND_Init is + called (they will fail). They set up FMOD system functionality. +*/ + +DLL_API signed char F_API FSOUND_SetOutput(int outputtype); +DLL_API signed char F_API FSOUND_SetDriver(int driver); +DLL_API signed char F_API FSOUND_SetMixer(int mixer); +DLL_API signed char F_API FSOUND_SetBufferSize(int len_ms); +DLL_API signed char F_API FSOUND_SetHWND(void *hwnd); +DLL_API signed char F_API FSOUND_SetMinHardwareChannels(int min); +DLL_API signed char F_API FSOUND_SetMaxHardwareChannels(int max); +DLL_API signed char F_API FSOUND_SetMemorySystem(void *pool, + int poollen, + FSOUND_ALLOCCALLBACK useralloc, + FSOUND_REALLOCCALLBACK userrealloc, + FSOUND_FREECALLBACK userfree); +/* + Main initialization / closedown functions. + Note : Use FSOUND_INIT_USEDEFAULTMIDISYNTH with FSOUND_Init for software override + with MIDI playback. + : Use FSOUND_INIT_GLOBALFOCUS with FSOUND_Init to make sound audible no matter + which window is in focus. (FSOUND_OUTPUT_DSOUND only) +*/ + +DLL_API signed char F_API FSOUND_Init(int mixrate, int maxsoftwarechannels, unsigned int flags); +DLL_API void F_API FSOUND_Close(); + +/* + Runtime system level functions +*/ + +DLL_API void F_API FSOUND_Update(); /* This is called to update 3d sound / non-realtime output */ + +DLL_API void F_API FSOUND_SetSpeakerMode(unsigned int speakermode); +DLL_API void F_API FSOUND_SetSFXMasterVolume(int volume); +DLL_API void F_API FSOUND_SetPanSeperation(float pansep); +DLL_API void F_API FSOUND_File_SetCallbacks(FSOUND_OPENCALLBACK useropen, + FSOUND_CLOSECALLBACK userclose, + FSOUND_READCALLBACK userread, + FSOUND_SEEKCALLBACK userseek, + FSOUND_TELLCALLBACK usertell); + +/* + System information functions. +*/ + +DLL_API int F_API FSOUND_GetError(); +DLL_API float F_API FSOUND_GetVersion(); +DLL_API int F_API FSOUND_GetOutput(); +DLL_API void * F_API FSOUND_GetOutputHandle(); +DLL_API int F_API FSOUND_GetDriver(); +DLL_API int F_API FSOUND_GetMixer(); +DLL_API int F_API FSOUND_GetNumDrivers(); +DLL_API const char * F_API FSOUND_GetDriverName(int id); +DLL_API signed char F_API FSOUND_GetDriverCaps(int id, unsigned int *caps); +DLL_API int F_API FSOUND_GetOutputRate(); +DLL_API int F_API FSOUND_GetMaxChannels(); +DLL_API int F_API FSOUND_GetMaxSamples(); +DLL_API unsigned int F_API FSOUND_GetSpeakerMode(); +DLL_API int F_API FSOUND_GetSFXMasterVolume(); +DLL_API signed char F_API FSOUND_GetNumHWChannels(int *num2d, int *num3d, int *total); +DLL_API int F_API FSOUND_GetChannelsPlaying(); +DLL_API float F_API FSOUND_GetCPUUsage(); +DLL_API void F_API FSOUND_GetMemoryStats(unsigned int *currentalloced, unsigned int *maxalloced); + +/* =================================== */ +/* Sample management / load functions. */ +/* =================================== */ + +/* + Sample creation and management functions + Note : Use FSOUND_LOADMEMORY flag with FSOUND_Sample_Load to load from memory. + Use FSOUND_LOADRAW flag with FSOUND_Sample_Load to treat as as raw pcm data. +*/ + +DLL_API FSOUND_SAMPLE * F_API FSOUND_Sample_Load(int index, const char *name_or_data, unsigned int mode, int offset, int length); +DLL_API FSOUND_SAMPLE * F_API FSOUND_Sample_Alloc(int index, int length, unsigned int mode, int deffreq, int defvol, int defpan, int defpri); +DLL_API void F_API FSOUND_Sample_Free(FSOUND_SAMPLE *sptr); +DLL_API signed char F_API FSOUND_Sample_Upload(FSOUND_SAMPLE *sptr, void *srcdata, unsigned int mode); +DLL_API signed char F_API FSOUND_Sample_Lock(FSOUND_SAMPLE *sptr, int offset, int length, void **ptr1, void **ptr2, unsigned int *len1, unsigned int *len2); +DLL_API signed char F_API FSOUND_Sample_Unlock(FSOUND_SAMPLE *sptr, void *ptr1, void *ptr2, unsigned int len1, unsigned int len2); + +/* + Sample control functions +*/ + +DLL_API signed char F_API FSOUND_Sample_SetMode(FSOUND_SAMPLE *sptr, unsigned int mode); +DLL_API signed char F_API FSOUND_Sample_SetLoopPoints(FSOUND_SAMPLE *sptr, int loopstart, int loopend); +DLL_API signed char F_API FSOUND_Sample_SetDefaults(FSOUND_SAMPLE *sptr, int deffreq, int defvol, int defpan, int defpri); +DLL_API signed char F_API FSOUND_Sample_SetDefaultsEx(FSOUND_SAMPLE *sptr, int deffreq, int defvol, int defpan, int defpri, int varfreq, int varvol, int varpan); +DLL_API signed char F_API FSOUND_Sample_SetMinMaxDistance(FSOUND_SAMPLE *sptr, float min, float max); +DLL_API signed char F_API FSOUND_Sample_SetMaxPlaybacks(FSOUND_SAMPLE *sptr, int max); + +/* + Sample information functions +*/ + +DLL_API FSOUND_SAMPLE * F_API FSOUND_Sample_Get(int sampno); +DLL_API const char * F_API FSOUND_Sample_GetName(FSOUND_SAMPLE *sptr); +DLL_API unsigned int F_API FSOUND_Sample_GetLength(FSOUND_SAMPLE *sptr); +DLL_API signed char F_API FSOUND_Sample_GetLoopPoints(FSOUND_SAMPLE *sptr, int *loopstart, int *loopend); +DLL_API signed char F_API FSOUND_Sample_GetDefaults(FSOUND_SAMPLE *sptr, int *deffreq, int *defvol, int *defpan, int *defpri); +DLL_API signed char F_API FSOUND_Sample_GetDefaultsEx(FSOUND_SAMPLE *sptr, int *deffreq, int *defvol, int *defpan, int *defpri, int *varfreq, int *varvol, int *varpan); +DLL_API unsigned int F_API FSOUND_Sample_GetMode(FSOUND_SAMPLE *sptr); +DLL_API signed char F_API FSOUND_Sample_GetMinMaxDistance(FSOUND_SAMPLE *sptr, float *min, float *max); + +/* ============================ */ +/* Channel control functions. */ +/* ============================ */ + +/* + Playing and stopping sounds. + Note : Use FSOUND_FREE as the 'channel' variable, to let FMOD pick a free channel for you. + Use FSOUND_ALL as the 'channel' variable to control ALL channels with one function call! +*/ + +DLL_API int F_API FSOUND_PlaySound(int channel, FSOUND_SAMPLE *sptr); +DLL_API int F_API FSOUND_PlaySoundEx(int channel, FSOUND_SAMPLE *sptr, FSOUND_DSPUNIT *dsp, signed char startpaused); +DLL_API signed char F_API FSOUND_StopSound(int channel); + +/* + Functions to control playback of a channel. + Note : FSOUND_ALL can be used on most of these functions as a channel value. +*/ + +DLL_API signed char F_API FSOUND_SetFrequency(int channel, int freq); +DLL_API signed char F_API FSOUND_SetVolume(int channel, int vol); +DLL_API signed char F_API FSOUND_SetVolumeAbsolute(int channel, int vol); +DLL_API signed char F_API FSOUND_SetPan(int channel, int pan); +DLL_API signed char F_API FSOUND_SetSurround(int channel, signed char surround); +DLL_API signed char F_API FSOUND_SetMute(int channel, signed char mute); +DLL_API signed char F_API FSOUND_SetPriority(int channel, int priority); +DLL_API signed char F_API FSOUND_SetReserved(int channel, signed char reserved); +DLL_API signed char F_API FSOUND_SetPaused(int channel, signed char paused); +DLL_API signed char F_API FSOUND_SetLoopMode(int channel, unsigned int loopmode); +DLL_API signed char F_API FSOUND_SetCurrentPosition(int channel, unsigned int offset); +DLL_API signed char F_API FSOUND_3D_SetAttributes(int channel, const float *pos, const float *vel); +DLL_API signed char F_API FSOUND_3D_SetMinMaxDistance(int channel, float min, float max); + +/* + Channel information functions. +*/ + +DLL_API signed char F_API FSOUND_IsPlaying(int channel); +DLL_API int F_API FSOUND_GetFrequency(int channel); +DLL_API int F_API FSOUND_GetVolume(int channel); +DLL_API int F_API FSOUND_GetAmplitude(int channel); +DLL_API int F_API FSOUND_GetPan(int channel); +DLL_API signed char F_API FSOUND_GetSurround(int channel); +DLL_API signed char F_API FSOUND_GetMute(int channel); +DLL_API int F_API FSOUND_GetPriority(int channel); +DLL_API signed char F_API FSOUND_GetReserved(int channel); +DLL_API signed char F_API FSOUND_GetPaused(int channel); +DLL_API unsigned int F_API FSOUND_GetLoopMode(int channel); +DLL_API unsigned int F_API FSOUND_GetCurrentPosition(int channel); +DLL_API FSOUND_SAMPLE * F_API FSOUND_GetCurrentSample(int channel); +DLL_API signed char F_API FSOUND_GetCurrentLevels(int channel, float *l, float *r); +DLL_API int F_API FSOUND_GetNumSubChannels(int channel); +DLL_API int F_API FSOUND_GetSubChannel(int channel, int subchannel); +DLL_API signed char F_API FSOUND_3D_GetAttributes(int channel, float *pos, float *vel); +DLL_API signed char F_API FSOUND_3D_GetMinMaxDistance(int channel, float *min, float *max); + +/* ========================== */ +/* Global 3D sound functions. */ +/* ========================== */ + +/* + See also 3d sample and channel based functions above. + Call FSOUND_Update once a frame to process 3d information. +*/ + +DLL_API void F_API FSOUND_3D_Listener_SetAttributes(const float *pos, const float *vel, float fx, float fy, float fz, float tx, float ty, float tz); +DLL_API void F_API FSOUND_3D_Listener_GetAttributes(float *pos, float *vel, float *fx, float *fy, float *fz, float *tx, float *ty, float *tz); +DLL_API void F_API FSOUND_3D_Listener_SetCurrent(int current, int numlisteners); /* use this if you use multiple listeners / splitscreen */ +DLL_API void F_API FSOUND_3D_SetDopplerFactor(float scale); +DLL_API void F_API FSOUND_3D_SetDistanceFactor(float scale); +DLL_API void F_API FSOUND_3D_SetRolloffFactor(float scale); + +/* =================== */ +/* FX functions. */ +/* =================== */ + +/* + Functions to control DX8 only effects processing. + + - FX enabled samples can only be played once at a time, not multiple times at once. + - Sounds have to be created with FSOUND_HW2D or FSOUND_HW3D for this to work. + - FSOUND_INIT_ENABLESYSTEMCHANNELFX can be used to apply hardware effect processing to the + global mixed output of FMOD's software channels. + - FSOUND_FX_Enable returns an FX handle that you can use to alter fx parameters. + - FSOUND_FX_Enable can be called multiple times in a row, even on the same FX type, + it will return a unique handle for each FX. + - FSOUND_FX_Enable cannot be called if the sound is playing or locked. + - FSOUND_FX_Disable must be called to reset/clear the FX from a channel. +*/ + +DLL_API int F_API FSOUND_FX_Enable(int channel, unsigned int fxtype); /* See FSOUND_FX_MODES */ +DLL_API signed char F_API FSOUND_FX_Disable(int channel); /* Disables all effects */ + +DLL_API signed char F_API FSOUND_FX_SetChorus(int fxid, float WetDryMix, float Depth, float Feedback, float Frequency, int Waveform, float Delay, int Phase); +DLL_API signed char F_API FSOUND_FX_SetCompressor(int fxid, float Gain, float Attack, float Release, float Threshold, float Ratio, float Predelay); +DLL_API signed char F_API FSOUND_FX_SetDistortion(int fxid, float Gain, float Edge, float PostEQCenterFrequency, float PostEQBandwidth, float PreLowpassCutoff); +DLL_API signed char F_API FSOUND_FX_SetEcho(int fxid, float WetDryMix, float Feedback, float LeftDelay, float RightDelay, int PanDelay); +DLL_API signed char F_API FSOUND_FX_SetFlanger(int fxid, float WetDryMix, float Depth, float Feedback, float Frequency, int Waveform, float Delay, int Phase); +DLL_API signed char F_API FSOUND_FX_SetGargle(int fxid, int RateHz, int WaveShape); +DLL_API signed char F_API FSOUND_FX_SetI3DL2Reverb(int fxid, int Room, int RoomHF, float RoomRolloffFactor, float DecayTime, float DecayHFRatio, int Reflections, float ReflectionsDelay, int Reverb, float ReverbDelay, float Diffusion, float Density, float HFReference); +DLL_API signed char F_API FSOUND_FX_SetParamEQ(int fxid, float Center, float Bandwidth, float Gain); +DLL_API signed char F_API FSOUND_FX_SetWavesReverb(int fxid, float InGain, float ReverbMix, float ReverbTime, float HighFreqRTRatio); + +/* ========================= */ +/* File Streaming functions. */ +/* ========================= */ + +/* + Note : Use FSOUND_LOADMEMORY flag with FSOUND_Stream_Open to stream from memory. + Use FSOUND_LOADRAW flag with FSOUND_Stream_Open to treat stream as raw pcm data. + Use FSOUND_MPEGACCURATE flag with FSOUND_Stream_Open to open mpegs in 'accurate mode' for settime/gettime/getlengthms. + Use FSOUND_FREE as the 'channel' variable, to let FMOD pick a free channel for you. +*/ + +DLL_API signed char F_API FSOUND_Stream_SetBufferSize(int ms); /* call this before opening streams, not after */ + +DLL_API FSOUND_STREAM * F_API FSOUND_Stream_Open(const char *name_or_data, unsigned int mode, int offset, int length); +DLL_API FSOUND_STREAM * F_API FSOUND_Stream_Create(FSOUND_STREAMCALLBACK callback, int length, unsigned int mode, int samplerate, void *userdata); +DLL_API signed char F_API FSOUND_Stream_Close(FSOUND_STREAM *stream); + +DLL_API int F_API FSOUND_Stream_Play(int channel, FSOUND_STREAM *stream); +DLL_API int F_API FSOUND_Stream_PlayEx(int channel, FSOUND_STREAM *stream, FSOUND_DSPUNIT *dsp, signed char startpaused); +DLL_API signed char F_API FSOUND_Stream_Stop(FSOUND_STREAM *stream); + +DLL_API signed char F_API FSOUND_Stream_SetPosition(FSOUND_STREAM *stream, unsigned int position); +DLL_API unsigned int F_API FSOUND_Stream_GetPosition(FSOUND_STREAM *stream); +DLL_API signed char F_API FSOUND_Stream_SetTime(FSOUND_STREAM *stream, int ms); +DLL_API int F_API FSOUND_Stream_GetTime(FSOUND_STREAM *stream); +DLL_API int F_API FSOUND_Stream_GetLength(FSOUND_STREAM *stream); +DLL_API int F_API FSOUND_Stream_GetLengthMs(FSOUND_STREAM *stream); + +DLL_API signed char F_API FSOUND_Stream_SetMode(FSOUND_STREAM *stream, unsigned int mode); +DLL_API unsigned int F_API FSOUND_Stream_GetMode(FSOUND_STREAM *stream); +DLL_API signed char F_API FSOUND_Stream_SetLoopPoints(FSOUND_STREAM *stream, unsigned int loopstartpcm, unsigned int loopendpcm); +DLL_API signed char F_API FSOUND_Stream_SetLoopCount(FSOUND_STREAM *stream, int count); +DLL_API int F_API FSOUND_Stream_GetOpenState(FSOUND_STREAM *stream); /* use with FSOUND_NONBLOCKING opened streams */ +DLL_API FSOUND_SAMPLE * F_API FSOUND_Stream_GetSample(FSOUND_STREAM *stream); +DLL_API FSOUND_DSPUNIT * F_API FSOUND_Stream_CreateDSP(FSOUND_STREAM *stream, FSOUND_DSPCALLBACK callback, int priority, void *userdata); + +DLL_API signed char F_API FSOUND_Stream_SetEndCallback(FSOUND_STREAM *stream, FSOUND_STREAMCALLBACK callback, void *userdata); +DLL_API signed char F_API FSOUND_Stream_SetSyncCallback(FSOUND_STREAM *stream, FSOUND_STREAMCALLBACK callback, void *userdata); + +DLL_API FSOUND_SYNCPOINT * F_API FSOUND_Stream_AddSyncPoint(FSOUND_STREAM *stream, unsigned int pcmoffset, const char *name); +DLL_API signed char F_API FSOUND_Stream_DeleteSyncPoint(FSOUND_SYNCPOINT *point); +DLL_API int F_API FSOUND_Stream_GetNumSyncPoints(FSOUND_STREAM *stream); +DLL_API FSOUND_SYNCPOINT * F_API FSOUND_Stream_GetSyncPoint(FSOUND_STREAM *stream, int index); +DLL_API char * F_API FSOUND_Stream_GetSyncPointInfo(FSOUND_SYNCPOINT *point, unsigned int *pcmoffset); + +DLL_API signed char F_API FSOUND_Stream_SetSubStream(FSOUND_STREAM *stream, int index); /* For FMOD .FSB bank files. */ +DLL_API int F_API FSOUND_Stream_GetNumSubStreams(FSOUND_STREAM *stream); /* For FMOD .FSB bank files. */ +DLL_API signed char F_API FSOUND_Stream_SetSubStreamSentence(FSOUND_STREAM *stream, const int *sentencelist, int numitems); + +DLL_API signed char F_API FSOUND_Stream_GetNumTagFields(FSOUND_STREAM *stream, int *num); +DLL_API signed char F_API FSOUND_Stream_GetTagField(FSOUND_STREAM *stream, int num, int *type, char **name, void **value, int *length); +DLL_API signed char F_API FSOUND_Stream_FindTagField(FSOUND_STREAM *stream, int type, const char *name, void **value, int *length); + +/* + Internet streaming functions +*/ + +DLL_API signed char F_API FSOUND_Stream_Net_SetProxy(const char *proxy); +DLL_API signed char F_API FSOUND_Stream_Net_SetTimeout(int timeout); +DLL_API char * F_API FSOUND_Stream_Net_GetLastServerStatus(); +DLL_API signed char F_API FSOUND_Stream_Net_SetBufferProperties(int buffersize, int prebuffer_percent, int rebuffer_percent); +DLL_API signed char F_API FSOUND_Stream_Net_GetBufferProperties(int *buffersize, int *prebuffer_percent, int *rebuffer_percent); +DLL_API signed char F_API FSOUND_Stream_Net_SetMetadataCallback(FSOUND_STREAM *stream, FSOUND_METADATACALLBACK callback, void *userdata); +DLL_API signed char F_API FSOUND_Stream_Net_GetStatus(FSOUND_STREAM *stream, int *status, int *bufferpercentused, int *bitrate, unsigned int *flags); + +/* =================== */ +/* CD audio functions. */ +/* =================== */ + +/* + Note : 0 = default cdrom. Otherwise specify the drive letter, for example. 'D'. +*/ + +DLL_API signed char F_API FSOUND_CD_Play(char drive, int track); +DLL_API void F_API FSOUND_CD_SetPlayMode(char drive, signed char mode); +DLL_API signed char F_API FSOUND_CD_Stop(char drive); +DLL_API signed char F_API FSOUND_CD_SetPaused(char drive, signed char paused); +DLL_API signed char F_API FSOUND_CD_SetVolume(char drive, int volume); +DLL_API signed char F_API FSOUND_CD_SetTrackTime(char drive, unsigned int ms); +DLL_API signed char F_API FSOUND_CD_OpenTray(char drive, signed char open); + +DLL_API signed char F_API FSOUND_CD_GetPaused(char drive); +DLL_API int F_API FSOUND_CD_GetTrack(char drive); +DLL_API int F_API FSOUND_CD_GetNumTracks(char drive); +DLL_API int F_API FSOUND_CD_GetVolume(char drive); +DLL_API int F_API FSOUND_CD_GetTrackLength(char drive, int track); +DLL_API int F_API FSOUND_CD_GetTrackTime(char drive); + +/* ============== */ +/* DSP functions. */ +/* ============== */ + +/* + DSP Unit control and information functions. + These functions allow you access to the mixed stream that FMOD uses to play back sound on. +*/ + +DLL_API FSOUND_DSPUNIT *F_API FSOUND_DSP_Create(FSOUND_DSPCALLBACK callback, int priority, void *userdata); +DLL_API void F_API FSOUND_DSP_Free(FSOUND_DSPUNIT *unit); +DLL_API void F_API FSOUND_DSP_SetPriority(FSOUND_DSPUNIT *unit, int priority); +DLL_API int F_API FSOUND_DSP_GetPriority(FSOUND_DSPUNIT *unit); +DLL_API void F_API FSOUND_DSP_SetActive(FSOUND_DSPUNIT *unit, signed char active); +DLL_API signed char F_API FSOUND_DSP_GetActive(FSOUND_DSPUNIT *unit); + +/* + Functions to get hold of FSOUND 'system DSP unit' handles. +*/ + +DLL_API FSOUND_DSPUNIT *F_API FSOUND_DSP_GetClearUnit(); +DLL_API FSOUND_DSPUNIT *F_API FSOUND_DSP_GetSFXUnit(); +DLL_API FSOUND_DSPUNIT *F_API FSOUND_DSP_GetMusicUnit(); +DLL_API FSOUND_DSPUNIT *F_API FSOUND_DSP_GetFFTUnit(); +DLL_API FSOUND_DSPUNIT *F_API FSOUND_DSP_GetClipAndCopyUnit(); + +/* + Miscellaneous DSP functions + Note for the spectrum analysis function to work, you have to enable the FFT DSP unit with + the following code FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(), TRUE); + It is off by default to save cpu usage. +*/ + +DLL_API signed char F_API FSOUND_DSP_MixBuffers(void *destbuffer, void *srcbuffer, int len, int freq, int vol, int pan, unsigned int mode); +DLL_API void F_API FSOUND_DSP_ClearMixBuffer(); +DLL_API int F_API FSOUND_DSP_GetBufferLength(); /* Length of each DSP update */ +DLL_API int F_API FSOUND_DSP_GetBufferLengthTotal(); /* Total buffer length due to FSOUND_SetBufferSize */ +DLL_API float * F_API FSOUND_DSP_GetSpectrum(); /* Array of 512 floats - call FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(), TRUE)) for this to work. */ + +/* =================================================================================== */ +/* Reverb functions. (eax2/eax3 reverb) (ONLY SUPPORTED ON WIN32 W/ FSOUND_HW3D FLAG) */ +/* =================================================================================== */ + +/* + See top of file for definitions and information on the reverb parameters. +*/ + +DLL_API signed char F_API FSOUND_Reverb_SetProperties(const FSOUND_REVERB_PROPERTIES *prop); +DLL_API signed char F_API FSOUND_Reverb_GetProperties(FSOUND_REVERB_PROPERTIES *prop); +DLL_API signed char F_API FSOUND_Reverb_SetChannelProperties(int channel, const FSOUND_REVERB_CHANNELPROPERTIES *prop); +DLL_API signed char F_API FSOUND_Reverb_GetChannelProperties(int channel, FSOUND_REVERB_CHANNELPROPERTIES *prop); + +/* ===================================================== */ +/* Recording functions (ONLY SUPPORTED IN WIN32, WINCE) */ +/* ===================================================== */ + +/* + Recording initialization functions +*/ + +DLL_API signed char F_API FSOUND_Record_SetDriver(int outputtype); +DLL_API int F_API FSOUND_Record_GetNumDrivers(); +DLL_API const char * F_API FSOUND_Record_GetDriverName(int id); +DLL_API int F_API FSOUND_Record_GetDriver(); + +/* + Recording functionality. Only one recording session will work at a time. +*/ + +DLL_API signed char F_API FSOUND_Record_StartSample(FSOUND_SAMPLE *sptr, signed char loop); +DLL_API signed char F_API FSOUND_Record_Stop(); +DLL_API int F_API FSOUND_Record_GetPosition(); + +/* ========================================================================================== */ +/* FMUSIC API (MOD,S3M,XM,IT,MIDI PLAYBACK) */ +/* ========================================================================================== */ + +/* + Song management / playback functions. +*/ + +DLL_API FMUSIC_MODULE * F_API FMUSIC_LoadSong(const char *name); +DLL_API FMUSIC_MODULE * F_API FMUSIC_LoadSongEx(const char *name_or_data, int offset, int length, unsigned int mode, const int *samplelist, int samplelistnum); +DLL_API int F_API FMUSIC_GetOpenState(FMUSIC_MODULE *mod); +DLL_API signed char F_API FMUSIC_FreeSong(FMUSIC_MODULE *mod); +DLL_API signed char F_API FMUSIC_PlaySong(FMUSIC_MODULE *mod); +DLL_API signed char F_API FMUSIC_StopSong(FMUSIC_MODULE *mod); +DLL_API void F_API FMUSIC_StopAllSongs(); + +DLL_API signed char F_API FMUSIC_SetZxxCallback(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback); +DLL_API signed char F_API FMUSIC_SetRowCallback(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int rowstep); +DLL_API signed char F_API FMUSIC_SetOrderCallback(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int orderstep); +DLL_API signed char F_API FMUSIC_SetInstCallback(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int instrument); + +DLL_API signed char F_API FMUSIC_SetSample(FMUSIC_MODULE *mod, int sampno, FSOUND_SAMPLE *sptr); +DLL_API signed char F_API FMUSIC_SetUserData(FMUSIC_MODULE *mod, void *userdata); +DLL_API signed char F_API FMUSIC_OptimizeChannels(FMUSIC_MODULE *mod, int maxchannels, int minvolume); + +/* + Runtime song functions. +*/ + +DLL_API signed char F_API FMUSIC_SetReverb(signed char reverb); /* MIDI only */ +DLL_API signed char F_API FMUSIC_SetLooping(FMUSIC_MODULE *mod, signed char looping); +DLL_API signed char F_API FMUSIC_SetOrder(FMUSIC_MODULE *mod, int order); +DLL_API signed char F_API FMUSIC_SetPaused(FMUSIC_MODULE *mod, signed char pause); +DLL_API signed char F_API FMUSIC_SetMasterVolume(FMUSIC_MODULE *mod, int volume); +DLL_API signed char F_API FMUSIC_SetMasterSpeed(FMUSIC_MODULE *mode, float speed); +DLL_API signed char F_API FMUSIC_SetPanSeperation(FMUSIC_MODULE *mod, float pansep); + +/* + Static song information functions. +*/ + +DLL_API const char * F_API FMUSIC_GetName(FMUSIC_MODULE *mod); +DLL_API int F_API FMUSIC_GetType(FMUSIC_MODULE *mod); +DLL_API int F_API FMUSIC_GetNumOrders(FMUSIC_MODULE *mod); +DLL_API int F_API FMUSIC_GetNumPatterns(FMUSIC_MODULE *mod); +DLL_API int F_API FMUSIC_GetNumInstruments(FMUSIC_MODULE *mod); +DLL_API int F_API FMUSIC_GetNumSamples(FMUSIC_MODULE *mod); +DLL_API int F_API FMUSIC_GetNumChannels(FMUSIC_MODULE *mod); +DLL_API FSOUND_SAMPLE * F_API FMUSIC_GetSample(FMUSIC_MODULE *mod, int sampno); +DLL_API int F_API FMUSIC_GetPatternLength(FMUSIC_MODULE *mod, int orderno); + +/* + Runtime song information. +*/ + +DLL_API signed char F_API FMUSIC_IsFinished(FMUSIC_MODULE *mod); +DLL_API signed char F_API FMUSIC_IsPlaying(FMUSIC_MODULE *mod); +DLL_API int F_API FMUSIC_GetMasterVolume(FMUSIC_MODULE *mod); +DLL_API int F_API FMUSIC_GetGlobalVolume(FMUSIC_MODULE *mod); +DLL_API int F_API FMUSIC_GetOrder(FMUSIC_MODULE *mod); +DLL_API int F_API FMUSIC_GetPattern(FMUSIC_MODULE *mod); +DLL_API int F_API FMUSIC_GetSpeed(FMUSIC_MODULE *mod); +DLL_API int F_API FMUSIC_GetBPM(FMUSIC_MODULE *mod); +DLL_API int F_API FMUSIC_GetRow(FMUSIC_MODULE *mod); +DLL_API signed char F_API FMUSIC_GetPaused(FMUSIC_MODULE *mod); +DLL_API int F_API FMUSIC_GetTime(FMUSIC_MODULE *mod); +DLL_API int F_API FMUSIC_GetRealChannel(FMUSIC_MODULE *mod, int modchannel); +DLL_API void * F_API FMUSIC_GetUserData(FMUSIC_MODULE *mod); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/#ThirdParty/fmodapi375win/api/inc/fmod_errors.h b/third-party/fmod/api/inc/fmod_errors.h similarity index 98% rename from #ThirdParty/fmodapi375win/api/inc/fmod_errors.h rename to third-party/fmod/api/inc/fmod_errors.h index b28b9c4..9004ec1 100644 --- a/#ThirdParty/fmodapi375win/api/inc/fmod_errors.h +++ b/third-party/fmod/api/inc/fmod_errors.h @@ -1,32 +1,32 @@ -#ifndef _FMOD_ERRORS_H -#define _FMOD_ERRORS_H - -static char *FMOD_ErrorString(int errcode) -{ - switch (errcode) - { - case FMOD_ERR_NONE: return "No errors"; - case FMOD_ERR_BUSY: return "Cannot call this command after FSOUND_Init. Call FSOUND_Close first."; - case FMOD_ERR_UNINITIALIZED: return "This command failed because FSOUND_Init was not called"; - case FMOD_ERR_PLAY: return "Playing the sound failed."; - case FMOD_ERR_INIT: return "Error initializing output device."; - case FMOD_ERR_ALLOCATED: return "The output device is already in use and cannot be reused."; - case FMOD_ERR_OUTPUT_FORMAT: return "Soundcard does not support the features needed for this soundsystem (16bit stereo output)"; - case FMOD_ERR_COOPERATIVELEVEL: return "Error setting cooperative level for hardware."; - case FMOD_ERR_CREATEBUFFER: return "Error creating hardware sound buffer."; - case FMOD_ERR_FILE_NOTFOUND: return "File not found"; - case FMOD_ERR_FILE_FORMAT: return "Unknown file format"; - case FMOD_ERR_FILE_BAD: return "Error loading file"; - case FMOD_ERR_MEMORY: return "Not enough memory "; - case FMOD_ERR_VERSION: return "The version number of this file format is not supported"; - case FMOD_ERR_INVALID_PARAM: return "An invalid parameter was passed to this function"; - case FMOD_ERR_NO_EAX: return "Tried to use an EAX command on a non EAX enabled channel or output."; - case FMOD_ERR_CHANNEL_ALLOC: return "Failed to allocate a new channel"; - case FMOD_ERR_RECORD: return "Recording not supported on this device"; - case FMOD_ERR_MEDIAPLAYER: return "Required Mediaplayer codec is not installed"; - - default : return "Unknown error"; - }; -} - -#endif +#ifndef _FMOD_ERRORS_H +#define _FMOD_ERRORS_H + +static char *FMOD_ErrorString(int errcode) +{ + switch (errcode) + { + case FMOD_ERR_NONE: return "No errors"; + case FMOD_ERR_BUSY: return "Cannot call this command after FSOUND_Init. Call FSOUND_Close first."; + case FMOD_ERR_UNINITIALIZED: return "This command failed because FSOUND_Init was not called"; + case FMOD_ERR_PLAY: return "Playing the sound failed."; + case FMOD_ERR_INIT: return "Error initializing output device."; + case FMOD_ERR_ALLOCATED: return "The output device is already in use and cannot be reused."; + case FMOD_ERR_OUTPUT_FORMAT: return "Soundcard does not support the features needed for this soundsystem (16bit stereo output)"; + case FMOD_ERR_COOPERATIVELEVEL: return "Error setting cooperative level for hardware."; + case FMOD_ERR_CREATEBUFFER: return "Error creating hardware sound buffer."; + case FMOD_ERR_FILE_NOTFOUND: return "File not found"; + case FMOD_ERR_FILE_FORMAT: return "Unknown file format"; + case FMOD_ERR_FILE_BAD: return "Error loading file"; + case FMOD_ERR_MEMORY: return "Not enough memory "; + case FMOD_ERR_VERSION: return "The version number of this file format is not supported"; + case FMOD_ERR_INVALID_PARAM: return "An invalid parameter was passed to this function"; + case FMOD_ERR_NO_EAX: return "Tried to use an EAX command on a non EAX enabled channel or output."; + case FMOD_ERR_CHANNEL_ALLOC: return "Failed to allocate a new channel"; + case FMOD_ERR_RECORD: return "Recording not supported on this device"; + case FMOD_ERR_MEDIAPLAYER: return "Required Mediaplayer codec is not installed"; + + default : return "Unknown error"; + }; +} + +#endif diff --git a/#ThirdParty/fmodapi375win/api/inc/fmoddyn.h b/third-party/fmod/api/inc/fmoddyn.h similarity index 98% rename from #ThirdParty/fmodapi375win/api/inc/fmoddyn.h rename to third-party/fmod/api/inc/fmoddyn.h index 4d5e38e..d1e1d42 100644 --- a/#ThirdParty/fmodapi375win/api/inc/fmoddyn.h +++ b/third-party/fmod/api/inc/fmoddyn.h @@ -1,546 +1,546 @@ -/* =========================================================================================== */ -/* FMOD Dynamic DLL loading header. Copyright (c), Firelight Technologies Pty, Ltd. 1999-2004. */ -/* =========================================================================================== */ - -#ifndef _FMODDYN_H_ -#define _FMODDYN_H_ - -#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) - #include -#else - #include - #include -#endif -#include - -#include "fmod.h" - -typedef struct -{ - void *module; - - signed char (F_API *FSOUND_SetOutput)(int outputtype); - signed char (F_API *FSOUND_SetDriver)(int driver); - signed char (F_API *FSOUND_SetMixer)(int mixer); - signed char (F_API *FSOUND_SetBufferSize)(int len_ms); - signed char (F_API *FSOUND_SetHWND)(void *hwnd); - signed char (F_API *FSOUND_SetMinHardwareChannels)(int min); - signed char (F_API *FSOUND_SetMaxHardwareChannels)(int max); - signed char (F_API *FSOUND_SetMemorySystem)(void *pool, int poollen, FSOUND_ALLOCCALLBACK useralloc, FSOUND_REALLOCCALLBACK userrealloc, FSOUND_FREECALLBACK userfree); - signed char (F_API *FSOUND_Init)(int mixrate, int maxsoftwarechannels, unsigned int flags); - void (F_API *FSOUND_Close)(); - void (F_API *FSOUND_Update)(); /* you must call this once a frame */ - void (F_API *FSOUND_SetSpeakerMode)(unsigned int speakermode); - void (F_API *FSOUND_SetSFXMasterVolume)(int volume); - void (F_API *FSOUND_SetPanSeperation)(float pansep); - void (F_API *FSOUND_File_SetCallbacks)(FSOUND_OPENCALLBACK useropen, FSOUND_CLOSECALLBACK userclose, FSOUND_READCALLBACK userread, FSOUND_SEEKCALLBACK userseek, FSOUND_TELLCALLBACK usertell); - int (F_API *FSOUND_GetError)(); - float (F_API *FSOUND_GetVersion)(); - int (F_API *FSOUND_GetOutput)(); - void * (F_API *FSOUND_GetOutputHandle)(); - int (F_API *FSOUND_GetDriver)(); - int (F_API *FSOUND_GetMixer)(); - int (F_API *FSOUND_GetNumDrivers)(); - const char * (F_API *FSOUND_GetDriverName)(int id); - signed char (F_API *FSOUND_GetDriverCaps)(int id, unsigned int *caps); - int (F_API *FSOUND_GetOutputRate)(); - int (F_API *FSOUND_GetMaxChannels)(); - int (F_API *FSOUND_GetMaxSamples)(); - unsigned int (F_API *FSOUND_GetSpeakerMode)(); - int (F_API *FSOUND_GetSFXMasterVolume)(); - signed char (F_API *FSOUND_GetNumHWChannels)(int *num2d, int *num3d, int *total); - int (F_API *FSOUND_GetChannelsPlaying)(); - float (F_API *FSOUND_GetCPUUsage)(); - void (F_API *FSOUND_GetMemoryStats)(unsigned int *currentalloced, unsigned int *maxalloced); - FSOUND_SAMPLE * (F_API *FSOUND_Sample_Load)(int index, const char *name_or_data, unsigned int mode, int offset, int length); - FSOUND_SAMPLE * (F_API *FSOUND_Sample_Alloc)(int index, int length, unsigned int mode, int deffreq, int defvol, int defpan, int defpri); - void (F_API *FSOUND_Sample_Free)(FSOUND_SAMPLE *sptr); - signed char (F_API *FSOUND_Sample_Upload)(FSOUND_SAMPLE *sptr, void *srcdata, unsigned int mode); - signed char (F_API *FSOUND_Sample_Lock)(FSOUND_SAMPLE *sptr, int offset, int length, void **ptr1, void **ptr2, unsigned int *len1, unsigned int *len2); - signed char (F_API *FSOUND_Sample_Unlock)(FSOUND_SAMPLE *sptr, void *ptr1, void *ptr2, unsigned int len1, unsigned int len2); - signed char (F_API *FSOUND_Sample_SetMode)(FSOUND_SAMPLE *sptr, unsigned int mode); - signed char (F_API *FSOUND_Sample_SetLoopPoints)(FSOUND_SAMPLE *sptr, int loopstart, int loopend); - signed char (F_API *FSOUND_Sample_SetDefaults)(FSOUND_SAMPLE *sptr, int deffreq, int defvol, int defpan, int defpri); - signed char (F_API *FSOUND_Sample_SetDefaultsEx)(FSOUND_SAMPLE *sptr, int deffreq, int defvol, int defpan, int defpri, int varfreq, int varvol, int varpan); - signed char (F_API *FSOUND_Sample_SetMinMaxDistance)(FSOUND_SAMPLE *sptr, float min, float max); - signed char (F_API *FSOUND_Sample_SetMaxPlaybacks)(FSOUND_SAMPLE *sptr, int max); - FSOUND_SAMPLE * (F_API *FSOUND_Sample_Get)(int sampno); - const char * (F_API *FSOUND_Sample_GetName)(FSOUND_SAMPLE *sptr); - unsigned int (F_API *FSOUND_Sample_GetLength)(FSOUND_SAMPLE *sptr); - signed char (F_API *FSOUND_Sample_GetLoopPoints)(FSOUND_SAMPLE *sptr, int *loopstart, int *loopend); - signed char (F_API *FSOUND_Sample_GetDefaults)(FSOUND_SAMPLE *sptr, int *deffreq, int *defvol, int *defpan, int *defpri); - signed char (F_API *FSOUND_Sample_GetDefaultsEx)(FSOUND_SAMPLE *sptr, int *deffreq, int *defvol, int *defpan, int *defpri, int *varfreq, int *varvol, int *varpan); - unsigned int (F_API *FSOUND_Sample_GetMode)(FSOUND_SAMPLE *sptr); - signed char (F_API *FSOUND_Sample_GetMinMaxDistance)(FSOUND_SAMPLE *sptr, float *min, float *max); - int (F_API *FSOUND_PlaySound)(int channel, FSOUND_SAMPLE *sptr); - int (F_API *FSOUND_PlaySoundEx)(int channel, FSOUND_SAMPLE *sptr, FSOUND_DSPUNIT *dsp, signed char startpaused); - signed char (F_API *FSOUND_StopSound)(int channel); - signed char (F_API *FSOUND_SetFrequency)(int channel, int freq); - signed char (F_API *FSOUND_SetVolume)(int channel, int vol); - signed char (F_API *FSOUND_SetVolumeAbsolute)(int channel, int vol); - signed char (F_API *FSOUND_SetPan)(int channel, int pan); - signed char (F_API *FSOUND_SetSurround)(int channel, signed char surround); - signed char (F_API *FSOUND_SetMute)(int channel, signed char mute); - signed char (F_API *FSOUND_SetPriority)(int channel, int priority); - signed char (F_API *FSOUND_SetReserved)(int channel, signed char reserved); - signed char (F_API *FSOUND_SetPaused)(int channel, signed char paused); - signed char (F_API *FSOUND_SetLoopMode)(int channel, unsigned int loopmode); - signed char (F_API *FSOUND_SetCurrentPosition)(int channel, unsigned int offset); - signed char (F_API *FSOUND_3D_SetAttributes)(int channel, const float *pos, const float *vel); - signed char (F_API *FSOUND_3D_SetMinMaxDistance)(int channel, float min, float max); - signed char (F_API *FSOUND_IsPlaying)(int channel); - int (F_API *FSOUND_GetFrequency)(int channel); - int (F_API *FSOUND_GetVolume)(int channel); - int (F_API *FSOUND_GetAmplitude)(int channel); - int (F_API *FSOUND_GetPan)(int channel); - signed char (F_API *FSOUND_GetSurround)(int channel); - signed char (F_API *FSOUND_GetMute)(int channel); - int (F_API *FSOUND_GetPriority)(int channel); - signed char (F_API *FSOUND_GetReserved)(int channel); - signed char (F_API *FSOUND_GetPaused)(int channel); - unsigned int (F_API *FSOUND_GetLoopMode)(int channel); - unsigned int (F_API *FSOUND_GetCurrentPosition)(int channel); - FSOUND_SAMPLE * (F_API *FSOUND_GetCurrentSample)(int channel); - signed char (F_API *FSOUND_GetCurrentLevels)(int channel, float *l, float *r); - int (F_API *FSOUND_GetNumSubChannels)(int channel); - int (F_API *FSOUND_GetSubChannel)(int channel, int subchannel); - signed char (F_API *FSOUND_3D_GetAttributes)(int channel, float *pos, float *vel); - signed char (F_API *FSOUND_3D_GetMinMaxDistance)(int channel, float *min, float *max); - void (F_API *FSOUND_3D_SetDopplerFactor)(float scale); - void (F_API *FSOUND_3D_SetDistanceFactor)(float scale); - void (F_API *FSOUND_3D_SetRolloffFactor)(float scale); - void (F_API *FSOUND_3D_Listener_SetCurrent)(int current, int numlisteners); /* use this if you use multiple listeners / splitscreen */ - void (F_API *FSOUND_3D_Listener_SetAttributes)(const float *pos, const float *vel, float fx, float fy, float fz, float tx, float ty, float tz); - void (F_API *FSOUND_3D_Listener_GetAttributes)(float *pos, float *vel, float *fx, float *fy, float *fz, float *tx, float *ty, float *tz); - int (F_API *FSOUND_FX_Enable)(int channel, unsigned int fx); /* See FSOUND_FX_MODES */ - signed char (F_API *FSOUND_FX_Disable)(int channel); - signed char (F_API *FSOUND_FX_SetChorus)(int fxid, float WetDryMix, float Depth, float Feedback, float Frequency, int Waveform, float Delay, int Phase); - signed char (F_API *FSOUND_FX_SetCompressor)(int fxid, float Gain, float Attack, float Release, float Threshold, float Ratio, float Predelay); - signed char (F_API *FSOUND_FX_SetDistortion)(int fxid, float Gain, float Edge, float PostEQCenterFrequency, float PostEQBandwidth, float PreLowpassCutoff); - signed char (F_API *FSOUND_FX_SetEcho)(int fxid, float WetDryMix, float Feedback, float LeftDelay, float RightDelay, int PanDelay); - signed char (F_API *FSOUND_FX_SetFlanger)(int fxid, float WetDryMix, float Depth, float Feedback, float Frequency, int Waveform, float Delay, int Phase); - signed char (F_API *FSOUND_FX_SetGargle)(int fxid, int RateHz, int WaveShape); - signed char (F_API *FSOUND_FX_SetI3DL2Reverb)(int fxid, int Room, int RoomHF, float RoomRolloffFactor, float DecayTime, float DecayHFRatio, int Reflections, float ReflectionsDelay, int Reverb, float ReverbDelay, float Diffusion, float Density, float HFReference); - signed char (F_API *FSOUND_FX_SetParamEQ)(int fxid, float Center, float Bandwidth, float Gain); - signed char (F_API *FSOUND_FX_SetWavesReverb)(int fxid, float InGain, float ReverbMix, float ReverbTime, float HighFreqRTRatio); - signed char (F_API *FSOUND_Stream_SetBufferSize)(int ms); /* call this before opening streams, not after */ - FSOUND_STREAM * (F_API *FSOUND_Stream_Open)(const char *name_or_data, unsigned int mode, int offset, int length); - FSOUND_STREAM * (F_API *FSOUND_Stream_Create)(FSOUND_STREAMCALLBACK callback, int length, unsigned int mode, int samplerate, void *userdata); - signed char (F_API *FSOUND_Stream_Close)(FSOUND_STREAM *stream); - int (F_API *FSOUND_Stream_Play)(int channel, FSOUND_STREAM *stream); - int (F_API *FSOUND_Stream_PlayEx)(int channel, FSOUND_STREAM *stream, FSOUND_DSPUNIT *dsp, signed char startpaused); - signed char (F_API *FSOUND_Stream_Stop)(FSOUND_STREAM *stream); - signed char (F_API *FSOUND_Stream_SetPosition)(FSOUND_STREAM *stream, unsigned int position); - unsigned int (F_API *FSOUND_Stream_GetPosition)(FSOUND_STREAM *stream); - signed char (F_API *FSOUND_Stream_SetTime)(FSOUND_STREAM *stream, int ms); - int (F_API *FSOUND_Stream_GetTime)(FSOUND_STREAM *stream); - int (F_API *FSOUND_Stream_GetLength)(FSOUND_STREAM *stream); - int (F_API *FSOUND_Stream_GetLengthMs)(FSOUND_STREAM *stream); - signed char (F_API *FSOUND_Stream_SetMode)(FSOUND_STREAM *stream, unsigned int mode); - unsigned int (F_API *FSOUND_Stream_GetMode)(FSOUND_STREAM *stream); - signed char (F_API *FSOUND_Stream_SetLoopPoints)(FSOUND_STREAM *stream, unsigned int loopstartpcm, unsigned int loopendpcm); - signed char (F_API *FSOUND_Stream_SetLoopCount)(FSOUND_STREAM *stream, int count); - int (F_API *FSOUND_Stream_GetOpenState)(FSOUND_STREAM *stream); - FSOUND_SAMPLE * (F_API *FSOUND_Stream_GetSample)(FSOUND_STREAM *stream); /* every stream contains a sample to playback on */ - FSOUND_DSPUNIT * (F_API *FSOUND_Stream_CreateDSP)(FSOUND_STREAM *stream, FSOUND_DSPCALLBACK callback, int priority, void *userdata); - signed char (F_API *FSOUND_Stream_SetEndCallback)(FSOUND_STREAM *stream, FSOUND_STREAMCALLBACK callback, void *userdata); - signed char (F_API *FSOUND_Stream_SetSyncCallback)(FSOUND_STREAM *stream, FSOUND_STREAMCALLBACK callback, void *userdata); - FSOUND_SYNCPOINT *(F_API *FSOUND_Stream_AddSyncPoint)(FSOUND_STREAM *stream, unsigned int pcmoffset, const char *name); - signed char (F_API *FSOUND_Stream_DeleteSyncPoint)(FSOUND_SYNCPOINT *point); - int (F_API *FSOUND_Stream_GetNumSyncPoints)(FSOUND_STREAM *stream); - FSOUND_SYNCPOINT *(F_API *FSOUND_Stream_GetSyncPoint)(FSOUND_STREAM *stream, int index); - char * (F_API *FSOUND_Stream_GetSyncPointInfo)(FSOUND_SYNCPOINT *point, unsigned int *pcmoffset); - signed char (F_API *FSOUND_Stream_SetSubStream)(FSOUND_STREAM *stream, int index); - int (F_API *FSOUND_Stream_GetNumSubStreams)(FSOUND_STREAM *stream); - signed char (F_API *FSOUND_Stream_SetSubStreamSentence)(FSOUND_STREAM *stream, const int *sentencelist, int numitems); - signed char (F_API *FSOUND_Stream_GetNumTagFields)(FSOUND_STREAM *stream, int *num); - signed char (F_API *FSOUND_Stream_GetTagField)(FSOUND_STREAM *stream, int num, int *type, char **name, void **value, int *length); - signed char (F_API *FSOUND_Stream_FindTagField)(FSOUND_STREAM *stream, int type, const char *name, void **value, int *length); - signed char (F_API *FSOUND_Stream_Net_SetProxy)(const char *proxy); - signed char (F_API *FSOUND_Stream_Net_SetTimeout)(int timeout); - char * (F_API *FSOUND_Stream_Net_GetLastServerStatus)(); - signed char (F_API *FSOUND_Stream_Net_SetBufferProperties)(int buffersize, int prebuffer_percent, int rebuffer_percent); - signed char (F_API *FSOUND_Stream_Net_GetBufferProperties)(int *buffersize, int *prebuffer_percent, int *rebuffer_percent); - signed char (F_API *FSOUND_Stream_Net_SetMetadataCallback)(FSOUND_STREAM *stream, FSOUND_METADATACALLBACK callback, void *userdata); - signed char (F_API *FSOUND_Stream_Net_GetStatus)(FSOUND_STREAM *stream, int *status, int *bufferpercentused, int *bitrate, unsigned int *flags); - signed char (F_API *FSOUND_CD_Play)(char drive, int track); - void (F_API *FSOUND_CD_SetPlayMode)(char drive, signed char mode); - signed char (F_API *FSOUND_CD_Stop)(char drive); - signed char (F_API *FSOUND_CD_SetPaused)(char drive, signed char paused); - signed char (F_API *FSOUND_CD_SetVolume)(char drive, int volume); - signed char (F_API *FSOUND_CD_SetTrackTime)(char drive, unsigned int ms); - signed char (F_API *FSOUND_CD_OpenTray)(char drive, signed char open); - signed char (F_API *FSOUND_CD_GetPaused)(char drive); - int (F_API *FSOUND_CD_GetTrack)(char drive); - int (F_API *FSOUND_CD_GetNumTracks)(char drive); - int (F_API *FSOUND_CD_GetVolume)(char drive); - int (F_API *FSOUND_CD_GetTrackLength)(char drive, int track); - int (F_API *FSOUND_CD_GetTrackTime)(char drive); - FSOUND_DSPUNIT * (F_API *FSOUND_DSP_Create)(FSOUND_DSPCALLBACK callback, int priority, void *userdata); - void (F_API *FSOUND_DSP_Free)(FSOUND_DSPUNIT *unit); - void (F_API *FSOUND_DSP_SetPriority)(FSOUND_DSPUNIT *unit, int priority); - int (F_API *FSOUND_DSP_GetPriority)(FSOUND_DSPUNIT *unit); - void (F_API *FSOUND_DSP_SetActive)(FSOUND_DSPUNIT *unit, signed char active); - signed char (F_API *FSOUND_DSP_GetActive)(FSOUND_DSPUNIT *unit); - FSOUND_DSPUNIT * (F_API *FSOUND_DSP_GetClearUnit)(); - FSOUND_DSPUNIT * (F_API *FSOUND_DSP_GetSFXUnit)(); - FSOUND_DSPUNIT * (F_API *FSOUND_DSP_GetMusicUnit)(); - FSOUND_DSPUNIT * (F_API *FSOUND_DSP_GetFFTUnit)(); - FSOUND_DSPUNIT * (F_API *FSOUND_DSP_GetClipAndCopyUnit)(); - signed char (F_API *FSOUND_DSP_MixBuffers)(void *destbuffer, void *srcbuffer, int len, int freq, int vol, int pan, unsigned int mode); - void (F_API *FSOUND_DSP_ClearMixBuffer)(); - int (F_API *FSOUND_DSP_GetBufferLength)(); /* Length of each DSP update */ - int (F_API *FSOUND_DSP_GetBufferLengthTotal)(); /* Total buffer length due to FSOUND_SetBufferSize */ - float * (F_API *FSOUND_DSP_GetSpectrum)(); /* Array of 512 floats - call FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(), TRUE)) for this to work. */ - signed char (F_API *FSOUND_Reverb_SetProperties)(const FSOUND_REVERB_PROPERTIES *prop); - signed char (F_API *FSOUND_Reverb_GetProperties)(FSOUND_REVERB_PROPERTIES *prop); - signed char (F_API *FSOUND_Reverb_SetChannelProperties)(int channel, const FSOUND_REVERB_CHANNELPROPERTIES *prop); - signed char (F_API *FSOUND_Reverb_GetChannelProperties)(int channel, FSOUND_REVERB_CHANNELPROPERTIES *prop); - signed char (F_API *FSOUND_Record_SetDriver)(int outputtype); - int (F_API *FSOUND_Record_GetNumDrivers)(); - const char * (F_API *FSOUND_Record_GetDriverName)(int id); - int (F_API *FSOUND_Record_GetDriver)(); - signed char (F_API *FSOUND_Record_StartSample)(FSOUND_SAMPLE *sptr, signed char loop); - signed char (F_API *FSOUND_Record_Stop)(); - int (F_API *FSOUND_Record_GetPosition)(); - FMUSIC_MODULE * (F_API *FMUSIC_LoadSong)(const char *name); - FMUSIC_MODULE * (F_API *FMUSIC_LoadSongEx)(const char *name_or_data, int offset, int length, unsigned int mode, const int *samplelist, int samplelistnum); - int (F_API *FMUSIC_GetOpenState)(FMUSIC_MODULE *mod); - signed char (F_API *FMUSIC_FreeSong)(FMUSIC_MODULE *mod); - signed char (F_API *FMUSIC_PlaySong)(FMUSIC_MODULE *mod); - signed char (F_API *FMUSIC_StopSong)(FMUSIC_MODULE *mod); - void (F_API *FMUSIC_StopAllSongs)(); - signed char (F_API *FMUSIC_SetZxxCallback)(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback); - signed char (F_API *FMUSIC_SetRowCallback)(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int rowstep); - signed char (F_API *FMUSIC_SetOrderCallback)(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int orderstep); - signed char (F_API *FMUSIC_SetInstCallback)(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int instrument); - signed char (F_API *FMUSIC_SetSample)(FMUSIC_MODULE *mod, int sampno, FSOUND_SAMPLE *sptr); - signed char (F_API *FMUSIC_SetUserData)(FMUSIC_MODULE *mod, void *userdata); - signed char (F_API *FMUSIC_OptimizeChannels)(FMUSIC_MODULE *mod, int maxchannels, int minvolume); - signed char (F_API *FMUSIC_SetReverb)(signed char reverb); /* MIDI only */ - signed char (F_API *FMUSIC_SetLooping)(FMUSIC_MODULE *mod, signed char looping); - signed char (F_API *FMUSIC_SetOrder)(FMUSIC_MODULE *mod, int order); - signed char (F_API *FMUSIC_SetPaused)(FMUSIC_MODULE *mod, signed char pause); - signed char (F_API *FMUSIC_SetMasterVolume)(FMUSIC_MODULE *mod, int volume); - signed char (F_API *FMUSIC_SetMasterSpeed)(FMUSIC_MODULE *mode, float speed); - signed char (F_API *FMUSIC_SetPanSeperation)(FMUSIC_MODULE *mod, float pansep); - const char * (F_API *FMUSIC_GetName)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetType)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetNumOrders)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetNumPatterns)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetNumInstruments)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetNumSamples)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetNumChannels)(FMUSIC_MODULE *mod); - FSOUND_SAMPLE * (F_API *FMUSIC_GetSample)(FMUSIC_MODULE *mod, int sampno); - int (F_API *FMUSIC_GetPatternLength)(FMUSIC_MODULE *mod, int orderno); - signed char (F_API *FMUSIC_IsFinished)(FMUSIC_MODULE *mod); - signed char (F_API *FMUSIC_IsPlaying)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetMasterVolume)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetGlobalVolume)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetOrder)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetPattern)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetSpeed)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetBPM)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetRow)(FMUSIC_MODULE *mod); - signed char (F_API *FMUSIC_GetPaused)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetTime)(FMUSIC_MODULE *mod); - int (F_API *FMUSIC_GetRealChannel)(FMUSIC_MODULE *mod, int modchannel); - unsigned int (F_API *FMUSIC_GetUserData)(FMUSIC_MODULE *mod); -} FMOD_INSTANCE; - - -static FMOD_INSTANCE *FMOD_CreateInstance(char *dllName) -{ - FMOD_INSTANCE *instance; - - instance = (FMOD_INSTANCE *)calloc(sizeof(FMOD_INSTANCE), 1); - if (!instance) - { - return NULL; - } - -#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) - instance->module = LoadLibrary(dllName); -#else - instance->module = dlopen(dllName, RTLD_LAZY); -#endif - if (!instance->module) - { - free(instance); - return NULL; - } - -#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) - #define F_GETPROC(_x, _y) \ - { \ - *((unsigned int *)&instance->_x) = (unsigned int)GetProcAddress((HMODULE)instance->module, _y); \ - if (!instance->_x) \ - { \ - FreeLibrary((HMODULE)instance->module); \ - free(instance); \ - return NULL; \ - } \ - } -#else - #define F_GETPROC(_x, _y) \ - { \ - char tmp[] = _y; \ - *(strchr(tmp, '@')) = 0; \ - *((unsigned int *)&instance->_x) = (unsigned int)dlsym(instance->module, &tmp[1]); \ - if (!instance->_x) \ - { \ - dlclose(instance->module); \ - free(instance); \ - return NULL; \ - } \ - } -#endif - - F_GETPROC(FSOUND_SetOutput, "_FSOUND_SetOutput@4"); - F_GETPROC(FSOUND_SetDriver, "_FSOUND_SetDriver@4"); - F_GETPROC(FSOUND_SetMixer, "_FSOUND_SetMixer@4"); - F_GETPROC(FSOUND_SetBufferSize, "_FSOUND_SetBufferSize@4"); - F_GETPROC(FSOUND_SetHWND, "_FSOUND_SetHWND@4"); - F_GETPROC(FSOUND_SetMinHardwareChannels, "_FSOUND_SetMinHardwareChannels@4"); - F_GETPROC(FSOUND_SetMaxHardwareChannels, "_FSOUND_SetMaxHardwareChannels@4"); - F_GETPROC(FSOUND_SetMemorySystem, "_FSOUND_SetMemorySystem@20"); - F_GETPROC(FSOUND_Init, "_FSOUND_Init@12"); - F_GETPROC(FSOUND_Close, "_FSOUND_Close@0"); - F_GETPROC(FSOUND_Update, "_FSOUND_Update@0"); - F_GETPROC(FSOUND_SetSFXMasterVolume, "_FSOUND_SetSFXMasterVolume@4"); - F_GETPROC(FSOUND_SetPanSeperation, "_FSOUND_SetPanSeperation@4"); - F_GETPROC(FSOUND_SetSpeakerMode, "_FSOUND_SetSpeakerMode@4"); - F_GETPROC(FSOUND_GetError, "_FSOUND_GetError@0"); - F_GETPROC(FSOUND_GetVersion, "_FSOUND_GetVersion@0"); - F_GETPROC(FSOUND_GetOutput, "_FSOUND_GetOutput@0"); - F_GETPROC(FSOUND_GetOutputHandle, "_FSOUND_GetOutputHandle@0"); - F_GETPROC(FSOUND_GetDriver, "_FSOUND_GetDriver@0"); - F_GETPROC(FSOUND_GetMixer, "_FSOUND_GetMixer@0"); - F_GETPROC(FSOUND_GetNumDrivers, "_FSOUND_GetNumDrivers@0"); - F_GETPROC(FSOUND_GetDriverName, "_FSOUND_GetDriverName@4"); - F_GETPROC(FSOUND_GetDriverCaps, "_FSOUND_GetDriverCaps@8"); - F_GETPROC(FSOUND_GetOutputRate, "_FSOUND_GetOutputRate@0"); - F_GETPROC(FSOUND_GetMaxChannels, "_FSOUND_GetMaxChannels@0"); - F_GETPROC(FSOUND_GetMaxSamples, "_FSOUND_GetMaxSamples@0"); - F_GETPROC(FSOUND_GetSpeakerMode, "_FSOUND_GetSpeakerMode@0"); - F_GETPROC(FSOUND_GetSFXMasterVolume, "_FSOUND_GetSFXMasterVolume@0"); - F_GETPROC(FSOUND_GetNumHWChannels, "_FSOUND_GetNumHWChannels@12"); - F_GETPROC(FSOUND_GetChannelsPlaying, "_FSOUND_GetChannelsPlaying@0"); - F_GETPROC(FSOUND_GetCPUUsage, "_FSOUND_GetCPUUsage@0"); - F_GETPROC(FSOUND_GetMemoryStats, "_FSOUND_GetMemoryStats@8"); - F_GETPROC(FSOUND_Sample_Load, "_FSOUND_Sample_Load@20"); - F_GETPROC(FSOUND_Sample_Alloc, "_FSOUND_Sample_Alloc@28"); - F_GETPROC(FSOUND_Sample_Free, "_FSOUND_Sample_Free@4"); - F_GETPROC(FSOUND_Sample_Upload, "_FSOUND_Sample_Upload@12"); - F_GETPROC(FSOUND_Sample_Lock, "_FSOUND_Sample_Lock@28"); - F_GETPROC(FSOUND_Sample_Unlock, "_FSOUND_Sample_Unlock@20"); - F_GETPROC(FSOUND_Sample_SetMode, "_FSOUND_Sample_SetMode@8"); - F_GETPROC(FSOUND_Sample_SetLoopPoints, "_FSOUND_Sample_SetLoopPoints@12"); - F_GETPROC(FSOUND_Sample_SetDefaults, "_FSOUND_Sample_SetDefaults@20"); - F_GETPROC(FSOUND_Sample_SetDefaultsEx, "_FSOUND_Sample_SetDefaultsEx@32"); - F_GETPROC(FSOUND_Sample_SetMinMaxDistance, "_FSOUND_Sample_SetMinMaxDistance@12"); - F_GETPROC(FSOUND_Sample_SetMaxPlaybacks, "_FSOUND_Sample_SetMaxPlaybacks@8"); - F_GETPROC(FSOUND_Sample_Get, "_FSOUND_Sample_Get@4"); - F_GETPROC(FSOUND_Sample_GetName, "_FSOUND_Sample_GetName@4"); - F_GETPROC(FSOUND_Sample_GetLength, "_FSOUND_Sample_GetLength@4"); - F_GETPROC(FSOUND_Sample_GetLoopPoints, "_FSOUND_Sample_GetLoopPoints@12"); - F_GETPROC(FSOUND_Sample_GetDefaults, "_FSOUND_Sample_GetDefaults@20"); - F_GETPROC(FSOUND_Sample_GetDefaultsEx, "_FSOUND_Sample_GetDefaultsEx@32"); - F_GETPROC(FSOUND_Sample_GetMode, "_FSOUND_Sample_GetMode@4"); - F_GETPROC(FSOUND_Sample_GetMinMaxDistance, "_FSOUND_Sample_GetMinMaxDistance@12"); - F_GETPROC(FSOUND_PlaySound, "_FSOUND_PlaySound@8"); - F_GETPROC(FSOUND_PlaySoundEx, "_FSOUND_PlaySoundEx@16"); - F_GETPROC(FSOUND_StopSound, "_FSOUND_StopSound@4"); - F_GETPROC(FSOUND_SetFrequency, "_FSOUND_SetFrequency@8"); - F_GETPROC(FSOUND_SetVolume, "_FSOUND_SetVolume@8"); - F_GETPROC(FSOUND_SetVolumeAbsolute, "_FSOUND_SetVolumeAbsolute@8"); - F_GETPROC(FSOUND_SetPan, "_FSOUND_SetPan@8"); - F_GETPROC(FSOUND_SetSurround, "_FSOUND_SetSurround@8"); - F_GETPROC(FSOUND_SetMute, "_FSOUND_SetMute@8"); - F_GETPROC(FSOUND_SetPriority, "_FSOUND_SetPriority@8"); - F_GETPROC(FSOUND_SetReserved, "_FSOUND_SetReserved@8"); - F_GETPROC(FSOUND_SetPaused, "_FSOUND_SetPaused@8"); - F_GETPROC(FSOUND_SetLoopMode, "_FSOUND_SetLoopMode@8"); - F_GETPROC(FSOUND_SetCurrentPosition, "_FSOUND_SetCurrentPosition@8"); - F_GETPROC(FSOUND_3D_SetAttributes, "_FSOUND_3D_SetAttributes@12"); - F_GETPROC(FSOUND_3D_SetMinMaxDistance, "_FSOUND_3D_SetMinMaxDistance@12"); - F_GETPROC(FSOUND_IsPlaying, "_FSOUND_IsPlaying@4"); - F_GETPROC(FSOUND_GetFrequency, "_FSOUND_GetFrequency@4"); - F_GETPROC(FSOUND_GetVolume, "_FSOUND_GetVolume@4"); - F_GETPROC(FSOUND_GetAmplitude, "_FSOUND_GetAmplitude@4"); - F_GETPROC(FSOUND_GetPan, "_FSOUND_GetPan@4"); - F_GETPROC(FSOUND_GetSurround, "_FSOUND_GetSurround@4"); - F_GETPROC(FSOUND_GetMute, "_FSOUND_GetMute@4"); - F_GETPROC(FSOUND_GetPriority, "_FSOUND_GetPriority@4"); - F_GETPROC(FSOUND_GetReserved, "_FSOUND_GetReserved@4"); - F_GETPROC(FSOUND_GetPaused, "_FSOUND_GetPaused@4"); - F_GETPROC(FSOUND_GetLoopMode, "_FSOUND_GetLoopMode@4"); - F_GETPROC(FSOUND_GetCurrentPosition, "_FSOUND_GetCurrentPosition@4"); - F_GETPROC(FSOUND_GetCurrentSample, "_FSOUND_GetCurrentSample@4"); - F_GETPROC(FSOUND_GetCurrentLevels, "_FSOUND_GetCurrentLevels@12"); - F_GETPROC(FSOUND_GetNumSubChannels, "_FSOUND_GetNumSubChannels@4"); - F_GETPROC(FSOUND_GetSubChannel, "_FSOUND_GetSubChannel@8"); - F_GETPROC(FSOUND_3D_GetAttributes, "_FSOUND_3D_GetAttributes@12"); - F_GETPROC(FSOUND_3D_GetMinMaxDistance, "_FSOUND_3D_GetMinMaxDistance@12"); - F_GETPROC(FSOUND_3D_Listener_SetCurrent, "_FSOUND_3D_Listener_SetCurrent@8"); - F_GETPROC(FSOUND_3D_Listener_SetAttributes, "_FSOUND_3D_Listener_SetAttributes@32"); - F_GETPROC(FSOUND_3D_Listener_GetAttributes, "_FSOUND_3D_Listener_GetAttributes@32"); - F_GETPROC(FSOUND_3D_SetDopplerFactor, "_FSOUND_3D_SetDopplerFactor@4"); - F_GETPROC(FSOUND_3D_SetDistanceFactor, "_FSOUND_3D_SetDistanceFactor@4"); - F_GETPROC(FSOUND_3D_SetRolloffFactor, "_FSOUND_3D_SetRolloffFactor@4"); - F_GETPROC(FSOUND_FX_Enable, "_FSOUND_FX_Enable@8"); - F_GETPROC(FSOUND_FX_Disable, "_FSOUND_FX_Disable@4"); - F_GETPROC(FSOUND_FX_SetChorus, "_FSOUND_FX_SetChorus@32"); - F_GETPROC(FSOUND_FX_SetCompressor, "_FSOUND_FX_SetCompressor@28"); - F_GETPROC(FSOUND_FX_SetDistortion, "_FSOUND_FX_SetDistortion@24"); - F_GETPROC(FSOUND_FX_SetEcho, "_FSOUND_FX_SetEcho@24"); - F_GETPROC(FSOUND_FX_SetFlanger, "_FSOUND_FX_SetFlanger@32"); - F_GETPROC(FSOUND_FX_SetGargle, "_FSOUND_FX_SetGargle@12"); - F_GETPROC(FSOUND_FX_SetI3DL2Reverb, "_FSOUND_FX_SetI3DL2Reverb@52"); - F_GETPROC(FSOUND_FX_SetParamEQ, "_FSOUND_FX_SetParamEQ@16"); - F_GETPROC(FSOUND_FX_SetWavesReverb, "_FSOUND_FX_SetWavesReverb@20"); - F_GETPROC(FSOUND_Stream_Open, "_FSOUND_Stream_Open@16"); - F_GETPROC(FSOUND_Stream_Create, "_FSOUND_Stream_Create@20"); - F_GETPROC(FSOUND_Stream_Play, "_FSOUND_Stream_Play@8"); - F_GETPROC(FSOUND_Stream_PlayEx, "_FSOUND_Stream_PlayEx@16"); - F_GETPROC(FSOUND_Stream_Stop, "_FSOUND_Stream_Stop@4"); - F_GETPROC(FSOUND_Stream_Close, "_FSOUND_Stream_Close@4"); - F_GETPROC(FSOUND_Stream_SetEndCallback, "_FSOUND_Stream_SetEndCallback@12"); - F_GETPROC(FSOUND_Stream_SetSyncCallback, "_FSOUND_Stream_SetSyncCallback@12"); - F_GETPROC(FSOUND_Stream_GetSample, "_FSOUND_Stream_GetSample@4"); - F_GETPROC(FSOUND_Stream_CreateDSP, "_FSOUND_Stream_CreateDSP@16"); - F_GETPROC(FSOUND_Stream_SetBufferSize, "_FSOUND_Stream_SetBufferSize@4"); - F_GETPROC(FSOUND_Stream_SetPosition, "_FSOUND_Stream_SetPosition@8"); - F_GETPROC(FSOUND_Stream_GetPosition, "_FSOUND_Stream_GetPosition@4"); - F_GETPROC(FSOUND_Stream_SetTime, "_FSOUND_Stream_SetTime@8"); - F_GETPROC(FSOUND_Stream_GetTime, "_FSOUND_Stream_GetTime@4"); - F_GETPROC(FSOUND_Stream_GetLength, "_FSOUND_Stream_GetLength@4"); - F_GETPROC(FSOUND_Stream_GetLengthMs, "_FSOUND_Stream_GetLengthMs@4"); - F_GETPROC(FSOUND_Stream_SetMode, "_FSOUND_Stream_SetMode@8"); - F_GETPROC(FSOUND_Stream_GetMode, "_FSOUND_Stream_GetMode@4"); - F_GETPROC(FSOUND_Stream_SetSubStream, "_FSOUND_Stream_SetSubStream@8"); - F_GETPROC(FSOUND_Stream_GetNumSubStreams, "_FSOUND_Stream_GetNumSubStreams@4"); - F_GETPROC(FSOUND_Stream_SetSubStreamSentence, "_FSOUND_Stream_SetSubStreamSentence@12"); - F_GETPROC(FSOUND_Stream_SetLoopPoints, "_FSOUND_Stream_SetLoopPoints@12"); - F_GETPROC(FSOUND_Stream_SetLoopCount, "_FSOUND_Stream_SetLoopCount@8"); - F_GETPROC(FSOUND_Stream_AddSyncPoint, "_FSOUND_Stream_AddSyncPoint@12"); - F_GETPROC(FSOUND_Stream_DeleteSyncPoint, "_FSOUND_Stream_DeleteSyncPoint@4"); - F_GETPROC(FSOUND_Stream_GetNumSyncPoints, "_FSOUND_Stream_GetNumSyncPoints@4"); - F_GETPROC(FSOUND_Stream_GetSyncPoint, "_FSOUND_Stream_GetSyncPoint@8"); - F_GETPROC(FSOUND_Stream_GetSyncPointInfo, "_FSOUND_Stream_GetSyncPointInfo@8"); - F_GETPROC(FSOUND_Stream_GetOpenState, "_FSOUND_Stream_GetOpenState@4"); - F_GETPROC(FSOUND_Stream_GetNumTagFields, "_FSOUND_Stream_GetNumTagFields@8"); - F_GETPROC(FSOUND_Stream_GetTagField, "_FSOUND_Stream_GetTagField@24"); - F_GETPROC(FSOUND_Stream_FindTagField, "_FSOUND_Stream_FindTagField@20"); - F_GETPROC(FSOUND_Stream_Net_SetProxy, "_FSOUND_Stream_Net_SetProxy@4"); - F_GETPROC(FSOUND_Stream_Net_GetLastServerStatus, "_FSOUND_Stream_Net_GetLastServerStatus@0"); - F_GETPROC(FSOUND_Stream_Net_SetBufferProperties, "_FSOUND_Stream_Net_SetBufferProperties@12"); - F_GETPROC(FSOUND_Stream_Net_GetBufferProperties, "_FSOUND_Stream_Net_GetBufferProperties@12"); - F_GETPROC(FSOUND_Stream_Net_SetMetadataCallback, "_FSOUND_Stream_Net_SetMetadataCallback@12"); - F_GETPROC(FSOUND_Stream_Net_GetStatus, "_FSOUND_Stream_Net_GetStatus@20"); - F_GETPROC(FSOUND_CD_Play, "_FSOUND_CD_Play@8"); - F_GETPROC(FSOUND_CD_SetPlayMode, "_FSOUND_CD_SetPlayMode@8"); - F_GETPROC(FSOUND_CD_Stop, "_FSOUND_CD_Stop@4"); - F_GETPROC(FSOUND_CD_SetPaused, "_FSOUND_CD_SetPaused@8"); - F_GETPROC(FSOUND_CD_SetVolume, "_FSOUND_CD_SetVolume@8"); - F_GETPROC(FSOUND_CD_SetTrackTime, "_FSOUND_CD_SetTrackTime@8"); - F_GETPROC(FSOUND_CD_OpenTray, "_FSOUND_CD_OpenTray@8"); - F_GETPROC(FSOUND_CD_GetPaused, "_FSOUND_CD_GetPaused@4"); - F_GETPROC(FSOUND_CD_GetTrack, "_FSOUND_CD_GetTrack@4"); - F_GETPROC(FSOUND_CD_GetNumTracks, "_FSOUND_CD_GetNumTracks@4"); - F_GETPROC(FSOUND_CD_GetVolume, "_FSOUND_CD_GetVolume@4"); - F_GETPROC(FSOUND_CD_GetTrackLength, "_FSOUND_CD_GetTrackLength@8"); - F_GETPROC(FSOUND_CD_GetTrackTime, "_FSOUND_CD_GetTrackTime@4"); - F_GETPROC(FSOUND_DSP_Create, "_FSOUND_DSP_Create@12"); - F_GETPROC(FSOUND_DSP_Free, "_FSOUND_DSP_Free@4"); - F_GETPROC(FSOUND_DSP_SetPriority, "_FSOUND_DSP_SetPriority@8"); - F_GETPROC(FSOUND_DSP_GetPriority, "_FSOUND_DSP_GetPriority@4"); - F_GETPROC(FSOUND_DSP_SetActive, "_FSOUND_DSP_SetActive@8"); - F_GETPROC(FSOUND_DSP_GetActive, "_FSOUND_DSP_GetActive@4"); - F_GETPROC(FSOUND_DSP_GetClearUnit, "_FSOUND_DSP_GetClearUnit@0"); - F_GETPROC(FSOUND_DSP_GetSFXUnit, "_FSOUND_DSP_GetSFXUnit@0"); - F_GETPROC(FSOUND_DSP_GetMusicUnit, "_FSOUND_DSP_GetMusicUnit@0"); - F_GETPROC(FSOUND_DSP_GetClipAndCopyUnit, "_FSOUND_DSP_GetClipAndCopyUnit@0"); - F_GETPROC(FSOUND_DSP_GetFFTUnit, "_FSOUND_DSP_GetFFTUnit@0"); - F_GETPROC(FSOUND_DSP_MixBuffers, "_FSOUND_DSP_MixBuffers@28"); - F_GETPROC(FSOUND_DSP_ClearMixBuffer, "_FSOUND_DSP_ClearMixBuffer@0"); - F_GETPROC(FSOUND_DSP_GetBufferLength, "_FSOUND_DSP_GetBufferLength@0"); - F_GETPROC(FSOUND_DSP_GetBufferLengthTotal, "_FSOUND_DSP_GetBufferLengthTotal@0"); - F_GETPROC(FSOUND_DSP_GetSpectrum, "_FSOUND_DSP_GetSpectrum@0"); - F_GETPROC(FSOUND_Reverb_SetProperties, "_FSOUND_Reverb_SetProperties@4"); - F_GETPROC(FSOUND_Reverb_GetProperties, "_FSOUND_Reverb_GetProperties@4"); - F_GETPROC(FSOUND_Reverb_SetChannelProperties, "_FSOUND_Reverb_SetChannelProperties@8"); - F_GETPROC(FSOUND_Reverb_GetChannelProperties, "_FSOUND_Reverb_GetChannelProperties@8"); - F_GETPROC(FSOUND_Record_SetDriver, "_FSOUND_Record_SetDriver@4"); - F_GETPROC(FSOUND_Record_GetNumDrivers, "_FSOUND_Record_GetNumDrivers@0"); - F_GETPROC(FSOUND_Record_GetDriverName, "_FSOUND_Record_GetDriverName@4"); - F_GETPROC(FSOUND_Record_GetDriver, "_FSOUND_Record_GetDriver@0"); - F_GETPROC(FSOUND_Record_StartSample, "_FSOUND_Record_StartSample@8"); - F_GETPROC(FSOUND_Record_Stop, "_FSOUND_Record_Stop@0"); - F_GETPROC(FSOUND_Record_GetPosition, "_FSOUND_Record_GetPosition@0"); - F_GETPROC(FSOUND_File_SetCallbacks, "_FSOUND_File_SetCallbacks@20"); - F_GETPROC(FMUSIC_LoadSong, "_FMUSIC_LoadSong@4"); - F_GETPROC(FMUSIC_LoadSongEx, "_FMUSIC_LoadSongEx@24"); - F_GETPROC(FMUSIC_GetOpenState, "_FMUSIC_GetOpenState@4"); - F_GETPROC(FMUSIC_FreeSong, "_FMUSIC_FreeSong@4"); - F_GETPROC(FMUSIC_PlaySong, "_FMUSIC_PlaySong@4"); - F_GETPROC(FMUSIC_StopSong, "_FMUSIC_StopSong@4"); - F_GETPROC(FMUSIC_StopAllSongs, "_FMUSIC_StopAllSongs@0"); - F_GETPROC(FMUSIC_SetZxxCallback, "_FMUSIC_SetZxxCallback@8"); - F_GETPROC(FMUSIC_SetRowCallback, "_FMUSIC_SetRowCallback@12"); - F_GETPROC(FMUSIC_SetOrderCallback, "_FMUSIC_SetOrderCallback@12"); - F_GETPROC(FMUSIC_SetInstCallback, "_FMUSIC_SetInstCallback@12"); - F_GETPROC(FMUSIC_SetSample, "_FMUSIC_SetSample@12"); - F_GETPROC(FMUSIC_SetUserData, "_FMUSIC_SetUserData@8"); - F_GETPROC(FMUSIC_OptimizeChannels, "_FMUSIC_OptimizeChannels@12"); - F_GETPROC(FMUSIC_SetReverb, "_FMUSIC_SetReverb@4"); - F_GETPROC(FMUSIC_SetLooping, "_FMUSIC_SetLooping@8"); - F_GETPROC(FMUSIC_SetOrder, "_FMUSIC_SetOrder@8"); - F_GETPROC(FMUSIC_SetPaused, "_FMUSIC_SetPaused@8"); - F_GETPROC(FMUSIC_SetMasterVolume, "_FMUSIC_SetMasterVolume@8"); - F_GETPROC(FMUSIC_SetMasterSpeed, "_FMUSIC_SetMasterSpeed@8"); - F_GETPROC(FMUSIC_SetPanSeperation, "_FMUSIC_SetPanSeperation@8"); - F_GETPROC(FMUSIC_GetName, "_FMUSIC_GetName@4"); - F_GETPROC(FMUSIC_GetType, "_FMUSIC_GetType@4"); - F_GETPROC(FMUSIC_GetNumOrders, "_FMUSIC_GetNumOrders@4"); - F_GETPROC(FMUSIC_GetNumPatterns, "_FMUSIC_GetNumPatterns@4"); - F_GETPROC(FMUSIC_GetNumInstruments, "_FMUSIC_GetNumInstruments@4"); - F_GETPROC(FMUSIC_GetNumSamples, "_FMUSIC_GetNumSamples@4"); - F_GETPROC(FMUSIC_GetNumChannels, "_FMUSIC_GetNumChannels@4"); - F_GETPROC(FMUSIC_GetSample, "_FMUSIC_GetSample@8"); - F_GETPROC(FMUSIC_GetPatternLength, "_FMUSIC_GetPatternLength@8"); - F_GETPROC(FMUSIC_IsFinished, "_FMUSIC_IsFinished@4"); - F_GETPROC(FMUSIC_IsPlaying, "_FMUSIC_IsPlaying@4"); - F_GETPROC(FMUSIC_GetMasterVolume, "_FMUSIC_GetMasterVolume@4"); - F_GETPROC(FMUSIC_GetGlobalVolume, "_FMUSIC_GetGlobalVolume@4"); - F_GETPROC(FMUSIC_GetOrder, "_FMUSIC_GetOrder@4"); - F_GETPROC(FMUSIC_GetPattern, "_FMUSIC_GetPattern@4"); - F_GETPROC(FMUSIC_GetSpeed, "_FMUSIC_GetSpeed@4"); - F_GETPROC(FMUSIC_GetBPM, "_FMUSIC_GetBPM@4"); - F_GETPROC(FMUSIC_GetRow, "_FMUSIC_GetRow@4"); - F_GETPROC(FMUSIC_GetPaused, "_FMUSIC_GetPaused@4"); - F_GETPROC(FMUSIC_GetTime, "_FMUSIC_GetTime@4"); - F_GETPROC(FMUSIC_GetRealChannel, "_FMUSIC_GetRealChannel@8"); - F_GETPROC(FMUSIC_GetUserData, "_FMUSIC_GetUserData@4"); - - return instance; -} - -static void FMOD_FreeInstance(FMOD_INSTANCE *instance) -{ - if (instance) - { - if (instance->module) - { -#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) - FreeLibrary((HMODULE)instance->module); -#else - dlclose(instance->module); -#endif - } - free(instance); - } -} - -#endif - +/* =========================================================================================== */ +/* FMOD Dynamic DLL loading header. Copyright (c), Firelight Technologies Pty, Ltd. 1999-2004. */ +/* =========================================================================================== */ + +#ifndef _FMODDYN_H_ +#define _FMODDYN_H_ + +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) + #include +#else + #include + #include +#endif +#include + +#include "fmod.h" + +typedef struct +{ + void *module; + + signed char (F_API *FSOUND_SetOutput)(int outputtype); + signed char (F_API *FSOUND_SetDriver)(int driver); + signed char (F_API *FSOUND_SetMixer)(int mixer); + signed char (F_API *FSOUND_SetBufferSize)(int len_ms); + signed char (F_API *FSOUND_SetHWND)(void *hwnd); + signed char (F_API *FSOUND_SetMinHardwareChannels)(int min); + signed char (F_API *FSOUND_SetMaxHardwareChannels)(int max); + signed char (F_API *FSOUND_SetMemorySystem)(void *pool, int poollen, FSOUND_ALLOCCALLBACK useralloc, FSOUND_REALLOCCALLBACK userrealloc, FSOUND_FREECALLBACK userfree); + signed char (F_API *FSOUND_Init)(int mixrate, int maxsoftwarechannels, unsigned int flags); + void (F_API *FSOUND_Close)(); + void (F_API *FSOUND_Update)(); /* you must call this once a frame */ + void (F_API *FSOUND_SetSpeakerMode)(unsigned int speakermode); + void (F_API *FSOUND_SetSFXMasterVolume)(int volume); + void (F_API *FSOUND_SetPanSeperation)(float pansep); + void (F_API *FSOUND_File_SetCallbacks)(FSOUND_OPENCALLBACK useropen, FSOUND_CLOSECALLBACK userclose, FSOUND_READCALLBACK userread, FSOUND_SEEKCALLBACK userseek, FSOUND_TELLCALLBACK usertell); + int (F_API *FSOUND_GetError)(); + float (F_API *FSOUND_GetVersion)(); + int (F_API *FSOUND_GetOutput)(); + void * (F_API *FSOUND_GetOutputHandle)(); + int (F_API *FSOUND_GetDriver)(); + int (F_API *FSOUND_GetMixer)(); + int (F_API *FSOUND_GetNumDrivers)(); + const char * (F_API *FSOUND_GetDriverName)(int id); + signed char (F_API *FSOUND_GetDriverCaps)(int id, unsigned int *caps); + int (F_API *FSOUND_GetOutputRate)(); + int (F_API *FSOUND_GetMaxChannels)(); + int (F_API *FSOUND_GetMaxSamples)(); + unsigned int (F_API *FSOUND_GetSpeakerMode)(); + int (F_API *FSOUND_GetSFXMasterVolume)(); + signed char (F_API *FSOUND_GetNumHWChannels)(int *num2d, int *num3d, int *total); + int (F_API *FSOUND_GetChannelsPlaying)(); + float (F_API *FSOUND_GetCPUUsage)(); + void (F_API *FSOUND_GetMemoryStats)(unsigned int *currentalloced, unsigned int *maxalloced); + FSOUND_SAMPLE * (F_API *FSOUND_Sample_Load)(int index, const char *name_or_data, unsigned int mode, int offset, int length); + FSOUND_SAMPLE * (F_API *FSOUND_Sample_Alloc)(int index, int length, unsigned int mode, int deffreq, int defvol, int defpan, int defpri); + void (F_API *FSOUND_Sample_Free)(FSOUND_SAMPLE *sptr); + signed char (F_API *FSOUND_Sample_Upload)(FSOUND_SAMPLE *sptr, void *srcdata, unsigned int mode); + signed char (F_API *FSOUND_Sample_Lock)(FSOUND_SAMPLE *sptr, int offset, int length, void **ptr1, void **ptr2, unsigned int *len1, unsigned int *len2); + signed char (F_API *FSOUND_Sample_Unlock)(FSOUND_SAMPLE *sptr, void *ptr1, void *ptr2, unsigned int len1, unsigned int len2); + signed char (F_API *FSOUND_Sample_SetMode)(FSOUND_SAMPLE *sptr, unsigned int mode); + signed char (F_API *FSOUND_Sample_SetLoopPoints)(FSOUND_SAMPLE *sptr, int loopstart, int loopend); + signed char (F_API *FSOUND_Sample_SetDefaults)(FSOUND_SAMPLE *sptr, int deffreq, int defvol, int defpan, int defpri); + signed char (F_API *FSOUND_Sample_SetDefaultsEx)(FSOUND_SAMPLE *sptr, int deffreq, int defvol, int defpan, int defpri, int varfreq, int varvol, int varpan); + signed char (F_API *FSOUND_Sample_SetMinMaxDistance)(FSOUND_SAMPLE *sptr, float min, float max); + signed char (F_API *FSOUND_Sample_SetMaxPlaybacks)(FSOUND_SAMPLE *sptr, int max); + FSOUND_SAMPLE * (F_API *FSOUND_Sample_Get)(int sampno); + const char * (F_API *FSOUND_Sample_GetName)(FSOUND_SAMPLE *sptr); + unsigned int (F_API *FSOUND_Sample_GetLength)(FSOUND_SAMPLE *sptr); + signed char (F_API *FSOUND_Sample_GetLoopPoints)(FSOUND_SAMPLE *sptr, int *loopstart, int *loopend); + signed char (F_API *FSOUND_Sample_GetDefaults)(FSOUND_SAMPLE *sptr, int *deffreq, int *defvol, int *defpan, int *defpri); + signed char (F_API *FSOUND_Sample_GetDefaultsEx)(FSOUND_SAMPLE *sptr, int *deffreq, int *defvol, int *defpan, int *defpri, int *varfreq, int *varvol, int *varpan); + unsigned int (F_API *FSOUND_Sample_GetMode)(FSOUND_SAMPLE *sptr); + signed char (F_API *FSOUND_Sample_GetMinMaxDistance)(FSOUND_SAMPLE *sptr, float *min, float *max); + int (F_API *FSOUND_PlaySound)(int channel, FSOUND_SAMPLE *sptr); + int (F_API *FSOUND_PlaySoundEx)(int channel, FSOUND_SAMPLE *sptr, FSOUND_DSPUNIT *dsp, signed char startpaused); + signed char (F_API *FSOUND_StopSound)(int channel); + signed char (F_API *FSOUND_SetFrequency)(int channel, int freq); + signed char (F_API *FSOUND_SetVolume)(int channel, int vol); + signed char (F_API *FSOUND_SetVolumeAbsolute)(int channel, int vol); + signed char (F_API *FSOUND_SetPan)(int channel, int pan); + signed char (F_API *FSOUND_SetSurround)(int channel, signed char surround); + signed char (F_API *FSOUND_SetMute)(int channel, signed char mute); + signed char (F_API *FSOUND_SetPriority)(int channel, int priority); + signed char (F_API *FSOUND_SetReserved)(int channel, signed char reserved); + signed char (F_API *FSOUND_SetPaused)(int channel, signed char paused); + signed char (F_API *FSOUND_SetLoopMode)(int channel, unsigned int loopmode); + signed char (F_API *FSOUND_SetCurrentPosition)(int channel, unsigned int offset); + signed char (F_API *FSOUND_3D_SetAttributes)(int channel, const float *pos, const float *vel); + signed char (F_API *FSOUND_3D_SetMinMaxDistance)(int channel, float min, float max); + signed char (F_API *FSOUND_IsPlaying)(int channel); + int (F_API *FSOUND_GetFrequency)(int channel); + int (F_API *FSOUND_GetVolume)(int channel); + int (F_API *FSOUND_GetAmplitude)(int channel); + int (F_API *FSOUND_GetPan)(int channel); + signed char (F_API *FSOUND_GetSurround)(int channel); + signed char (F_API *FSOUND_GetMute)(int channel); + int (F_API *FSOUND_GetPriority)(int channel); + signed char (F_API *FSOUND_GetReserved)(int channel); + signed char (F_API *FSOUND_GetPaused)(int channel); + unsigned int (F_API *FSOUND_GetLoopMode)(int channel); + unsigned int (F_API *FSOUND_GetCurrentPosition)(int channel); + FSOUND_SAMPLE * (F_API *FSOUND_GetCurrentSample)(int channel); + signed char (F_API *FSOUND_GetCurrentLevels)(int channel, float *l, float *r); + int (F_API *FSOUND_GetNumSubChannels)(int channel); + int (F_API *FSOUND_GetSubChannel)(int channel, int subchannel); + signed char (F_API *FSOUND_3D_GetAttributes)(int channel, float *pos, float *vel); + signed char (F_API *FSOUND_3D_GetMinMaxDistance)(int channel, float *min, float *max); + void (F_API *FSOUND_3D_SetDopplerFactor)(float scale); + void (F_API *FSOUND_3D_SetDistanceFactor)(float scale); + void (F_API *FSOUND_3D_SetRolloffFactor)(float scale); + void (F_API *FSOUND_3D_Listener_SetCurrent)(int current, int numlisteners); /* use this if you use multiple listeners / splitscreen */ + void (F_API *FSOUND_3D_Listener_SetAttributes)(const float *pos, const float *vel, float fx, float fy, float fz, float tx, float ty, float tz); + void (F_API *FSOUND_3D_Listener_GetAttributes)(float *pos, float *vel, float *fx, float *fy, float *fz, float *tx, float *ty, float *tz); + int (F_API *FSOUND_FX_Enable)(int channel, unsigned int fx); /* See FSOUND_FX_MODES */ + signed char (F_API *FSOUND_FX_Disable)(int channel); + signed char (F_API *FSOUND_FX_SetChorus)(int fxid, float WetDryMix, float Depth, float Feedback, float Frequency, int Waveform, float Delay, int Phase); + signed char (F_API *FSOUND_FX_SetCompressor)(int fxid, float Gain, float Attack, float Release, float Threshold, float Ratio, float Predelay); + signed char (F_API *FSOUND_FX_SetDistortion)(int fxid, float Gain, float Edge, float PostEQCenterFrequency, float PostEQBandwidth, float PreLowpassCutoff); + signed char (F_API *FSOUND_FX_SetEcho)(int fxid, float WetDryMix, float Feedback, float LeftDelay, float RightDelay, int PanDelay); + signed char (F_API *FSOUND_FX_SetFlanger)(int fxid, float WetDryMix, float Depth, float Feedback, float Frequency, int Waveform, float Delay, int Phase); + signed char (F_API *FSOUND_FX_SetGargle)(int fxid, int RateHz, int WaveShape); + signed char (F_API *FSOUND_FX_SetI3DL2Reverb)(int fxid, int Room, int RoomHF, float RoomRolloffFactor, float DecayTime, float DecayHFRatio, int Reflections, float ReflectionsDelay, int Reverb, float ReverbDelay, float Diffusion, float Density, float HFReference); + signed char (F_API *FSOUND_FX_SetParamEQ)(int fxid, float Center, float Bandwidth, float Gain); + signed char (F_API *FSOUND_FX_SetWavesReverb)(int fxid, float InGain, float ReverbMix, float ReverbTime, float HighFreqRTRatio); + signed char (F_API *FSOUND_Stream_SetBufferSize)(int ms); /* call this before opening streams, not after */ + FSOUND_STREAM * (F_API *FSOUND_Stream_Open)(const char *name_or_data, unsigned int mode, int offset, int length); + FSOUND_STREAM * (F_API *FSOUND_Stream_Create)(FSOUND_STREAMCALLBACK callback, int length, unsigned int mode, int samplerate, void *userdata); + signed char (F_API *FSOUND_Stream_Close)(FSOUND_STREAM *stream); + int (F_API *FSOUND_Stream_Play)(int channel, FSOUND_STREAM *stream); + int (F_API *FSOUND_Stream_PlayEx)(int channel, FSOUND_STREAM *stream, FSOUND_DSPUNIT *dsp, signed char startpaused); + signed char (F_API *FSOUND_Stream_Stop)(FSOUND_STREAM *stream); + signed char (F_API *FSOUND_Stream_SetPosition)(FSOUND_STREAM *stream, unsigned int position); + unsigned int (F_API *FSOUND_Stream_GetPosition)(FSOUND_STREAM *stream); + signed char (F_API *FSOUND_Stream_SetTime)(FSOUND_STREAM *stream, int ms); + int (F_API *FSOUND_Stream_GetTime)(FSOUND_STREAM *stream); + int (F_API *FSOUND_Stream_GetLength)(FSOUND_STREAM *stream); + int (F_API *FSOUND_Stream_GetLengthMs)(FSOUND_STREAM *stream); + signed char (F_API *FSOUND_Stream_SetMode)(FSOUND_STREAM *stream, unsigned int mode); + unsigned int (F_API *FSOUND_Stream_GetMode)(FSOUND_STREAM *stream); + signed char (F_API *FSOUND_Stream_SetLoopPoints)(FSOUND_STREAM *stream, unsigned int loopstartpcm, unsigned int loopendpcm); + signed char (F_API *FSOUND_Stream_SetLoopCount)(FSOUND_STREAM *stream, int count); + int (F_API *FSOUND_Stream_GetOpenState)(FSOUND_STREAM *stream); + FSOUND_SAMPLE * (F_API *FSOUND_Stream_GetSample)(FSOUND_STREAM *stream); /* every stream contains a sample to playback on */ + FSOUND_DSPUNIT * (F_API *FSOUND_Stream_CreateDSP)(FSOUND_STREAM *stream, FSOUND_DSPCALLBACK callback, int priority, void *userdata); + signed char (F_API *FSOUND_Stream_SetEndCallback)(FSOUND_STREAM *stream, FSOUND_STREAMCALLBACK callback, void *userdata); + signed char (F_API *FSOUND_Stream_SetSyncCallback)(FSOUND_STREAM *stream, FSOUND_STREAMCALLBACK callback, void *userdata); + FSOUND_SYNCPOINT *(F_API *FSOUND_Stream_AddSyncPoint)(FSOUND_STREAM *stream, unsigned int pcmoffset, const char *name); + signed char (F_API *FSOUND_Stream_DeleteSyncPoint)(FSOUND_SYNCPOINT *point); + int (F_API *FSOUND_Stream_GetNumSyncPoints)(FSOUND_STREAM *stream); + FSOUND_SYNCPOINT *(F_API *FSOUND_Stream_GetSyncPoint)(FSOUND_STREAM *stream, int index); + char * (F_API *FSOUND_Stream_GetSyncPointInfo)(FSOUND_SYNCPOINT *point, unsigned int *pcmoffset); + signed char (F_API *FSOUND_Stream_SetSubStream)(FSOUND_STREAM *stream, int index); + int (F_API *FSOUND_Stream_GetNumSubStreams)(FSOUND_STREAM *stream); + signed char (F_API *FSOUND_Stream_SetSubStreamSentence)(FSOUND_STREAM *stream, const int *sentencelist, int numitems); + signed char (F_API *FSOUND_Stream_GetNumTagFields)(FSOUND_STREAM *stream, int *num); + signed char (F_API *FSOUND_Stream_GetTagField)(FSOUND_STREAM *stream, int num, int *type, char **name, void **value, int *length); + signed char (F_API *FSOUND_Stream_FindTagField)(FSOUND_STREAM *stream, int type, const char *name, void **value, int *length); + signed char (F_API *FSOUND_Stream_Net_SetProxy)(const char *proxy); + signed char (F_API *FSOUND_Stream_Net_SetTimeout)(int timeout); + char * (F_API *FSOUND_Stream_Net_GetLastServerStatus)(); + signed char (F_API *FSOUND_Stream_Net_SetBufferProperties)(int buffersize, int prebuffer_percent, int rebuffer_percent); + signed char (F_API *FSOUND_Stream_Net_GetBufferProperties)(int *buffersize, int *prebuffer_percent, int *rebuffer_percent); + signed char (F_API *FSOUND_Stream_Net_SetMetadataCallback)(FSOUND_STREAM *stream, FSOUND_METADATACALLBACK callback, void *userdata); + signed char (F_API *FSOUND_Stream_Net_GetStatus)(FSOUND_STREAM *stream, int *status, int *bufferpercentused, int *bitrate, unsigned int *flags); + signed char (F_API *FSOUND_CD_Play)(char drive, int track); + void (F_API *FSOUND_CD_SetPlayMode)(char drive, signed char mode); + signed char (F_API *FSOUND_CD_Stop)(char drive); + signed char (F_API *FSOUND_CD_SetPaused)(char drive, signed char paused); + signed char (F_API *FSOUND_CD_SetVolume)(char drive, int volume); + signed char (F_API *FSOUND_CD_SetTrackTime)(char drive, unsigned int ms); + signed char (F_API *FSOUND_CD_OpenTray)(char drive, signed char open); + signed char (F_API *FSOUND_CD_GetPaused)(char drive); + int (F_API *FSOUND_CD_GetTrack)(char drive); + int (F_API *FSOUND_CD_GetNumTracks)(char drive); + int (F_API *FSOUND_CD_GetVolume)(char drive); + int (F_API *FSOUND_CD_GetTrackLength)(char drive, int track); + int (F_API *FSOUND_CD_GetTrackTime)(char drive); + FSOUND_DSPUNIT * (F_API *FSOUND_DSP_Create)(FSOUND_DSPCALLBACK callback, int priority, void *userdata); + void (F_API *FSOUND_DSP_Free)(FSOUND_DSPUNIT *unit); + void (F_API *FSOUND_DSP_SetPriority)(FSOUND_DSPUNIT *unit, int priority); + int (F_API *FSOUND_DSP_GetPriority)(FSOUND_DSPUNIT *unit); + void (F_API *FSOUND_DSP_SetActive)(FSOUND_DSPUNIT *unit, signed char active); + signed char (F_API *FSOUND_DSP_GetActive)(FSOUND_DSPUNIT *unit); + FSOUND_DSPUNIT * (F_API *FSOUND_DSP_GetClearUnit)(); + FSOUND_DSPUNIT * (F_API *FSOUND_DSP_GetSFXUnit)(); + FSOUND_DSPUNIT * (F_API *FSOUND_DSP_GetMusicUnit)(); + FSOUND_DSPUNIT * (F_API *FSOUND_DSP_GetFFTUnit)(); + FSOUND_DSPUNIT * (F_API *FSOUND_DSP_GetClipAndCopyUnit)(); + signed char (F_API *FSOUND_DSP_MixBuffers)(void *destbuffer, void *srcbuffer, int len, int freq, int vol, int pan, unsigned int mode); + void (F_API *FSOUND_DSP_ClearMixBuffer)(); + int (F_API *FSOUND_DSP_GetBufferLength)(); /* Length of each DSP update */ + int (F_API *FSOUND_DSP_GetBufferLengthTotal)(); /* Total buffer length due to FSOUND_SetBufferSize */ + float * (F_API *FSOUND_DSP_GetSpectrum)(); /* Array of 512 floats - call FSOUND_DSP_SetActive(FSOUND_DSP_GetFFTUnit(), TRUE)) for this to work. */ + signed char (F_API *FSOUND_Reverb_SetProperties)(const FSOUND_REVERB_PROPERTIES *prop); + signed char (F_API *FSOUND_Reverb_GetProperties)(FSOUND_REVERB_PROPERTIES *prop); + signed char (F_API *FSOUND_Reverb_SetChannelProperties)(int channel, const FSOUND_REVERB_CHANNELPROPERTIES *prop); + signed char (F_API *FSOUND_Reverb_GetChannelProperties)(int channel, FSOUND_REVERB_CHANNELPROPERTIES *prop); + signed char (F_API *FSOUND_Record_SetDriver)(int outputtype); + int (F_API *FSOUND_Record_GetNumDrivers)(); + const char * (F_API *FSOUND_Record_GetDriverName)(int id); + int (F_API *FSOUND_Record_GetDriver)(); + signed char (F_API *FSOUND_Record_StartSample)(FSOUND_SAMPLE *sptr, signed char loop); + signed char (F_API *FSOUND_Record_Stop)(); + int (F_API *FSOUND_Record_GetPosition)(); + FMUSIC_MODULE * (F_API *FMUSIC_LoadSong)(const char *name); + FMUSIC_MODULE * (F_API *FMUSIC_LoadSongEx)(const char *name_or_data, int offset, int length, unsigned int mode, const int *samplelist, int samplelistnum); + int (F_API *FMUSIC_GetOpenState)(FMUSIC_MODULE *mod); + signed char (F_API *FMUSIC_FreeSong)(FMUSIC_MODULE *mod); + signed char (F_API *FMUSIC_PlaySong)(FMUSIC_MODULE *mod); + signed char (F_API *FMUSIC_StopSong)(FMUSIC_MODULE *mod); + void (F_API *FMUSIC_StopAllSongs)(); + signed char (F_API *FMUSIC_SetZxxCallback)(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback); + signed char (F_API *FMUSIC_SetRowCallback)(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int rowstep); + signed char (F_API *FMUSIC_SetOrderCallback)(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int orderstep); + signed char (F_API *FMUSIC_SetInstCallback)(FMUSIC_MODULE *mod, FMUSIC_CALLBACK callback, int instrument); + signed char (F_API *FMUSIC_SetSample)(FMUSIC_MODULE *mod, int sampno, FSOUND_SAMPLE *sptr); + signed char (F_API *FMUSIC_SetUserData)(FMUSIC_MODULE *mod, void *userdata); + signed char (F_API *FMUSIC_OptimizeChannels)(FMUSIC_MODULE *mod, int maxchannels, int minvolume); + signed char (F_API *FMUSIC_SetReverb)(signed char reverb); /* MIDI only */ + signed char (F_API *FMUSIC_SetLooping)(FMUSIC_MODULE *mod, signed char looping); + signed char (F_API *FMUSIC_SetOrder)(FMUSIC_MODULE *mod, int order); + signed char (F_API *FMUSIC_SetPaused)(FMUSIC_MODULE *mod, signed char pause); + signed char (F_API *FMUSIC_SetMasterVolume)(FMUSIC_MODULE *mod, int volume); + signed char (F_API *FMUSIC_SetMasterSpeed)(FMUSIC_MODULE *mode, float speed); + signed char (F_API *FMUSIC_SetPanSeperation)(FMUSIC_MODULE *mod, float pansep); + const char * (F_API *FMUSIC_GetName)(FMUSIC_MODULE *mod); + int (F_API *FMUSIC_GetType)(FMUSIC_MODULE *mod); + int (F_API *FMUSIC_GetNumOrders)(FMUSIC_MODULE *mod); + int (F_API *FMUSIC_GetNumPatterns)(FMUSIC_MODULE *mod); + int (F_API *FMUSIC_GetNumInstruments)(FMUSIC_MODULE *mod); + int (F_API *FMUSIC_GetNumSamples)(FMUSIC_MODULE *mod); + int (F_API *FMUSIC_GetNumChannels)(FMUSIC_MODULE *mod); + FSOUND_SAMPLE * (F_API *FMUSIC_GetSample)(FMUSIC_MODULE *mod, int sampno); + int (F_API *FMUSIC_GetPatternLength)(FMUSIC_MODULE *mod, int orderno); + signed char (F_API *FMUSIC_IsFinished)(FMUSIC_MODULE *mod); + signed char (F_API *FMUSIC_IsPlaying)(FMUSIC_MODULE *mod); + int (F_API *FMUSIC_GetMasterVolume)(FMUSIC_MODULE *mod); + int (F_API *FMUSIC_GetGlobalVolume)(FMUSIC_MODULE *mod); + int (F_API *FMUSIC_GetOrder)(FMUSIC_MODULE *mod); + int (F_API *FMUSIC_GetPattern)(FMUSIC_MODULE *mod); + int (F_API *FMUSIC_GetSpeed)(FMUSIC_MODULE *mod); + int (F_API *FMUSIC_GetBPM)(FMUSIC_MODULE *mod); + int (F_API *FMUSIC_GetRow)(FMUSIC_MODULE *mod); + signed char (F_API *FMUSIC_GetPaused)(FMUSIC_MODULE *mod); + int (F_API *FMUSIC_GetTime)(FMUSIC_MODULE *mod); + int (F_API *FMUSIC_GetRealChannel)(FMUSIC_MODULE *mod, int modchannel); + unsigned int (F_API *FMUSIC_GetUserData)(FMUSIC_MODULE *mod); +} FMOD_INSTANCE; + + +static FMOD_INSTANCE *FMOD_CreateInstance(char *dllName) +{ + FMOD_INSTANCE *instance; + + instance = (FMOD_INSTANCE *)calloc(sizeof(FMOD_INSTANCE), 1); + if (!instance) + { + return NULL; + } + +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) + instance->module = LoadLibrary(dllName); +#else + instance->module = dlopen(dllName, RTLD_LAZY); +#endif + if (!instance->module) + { + free(instance); + return NULL; + } + +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) + #define F_GETPROC(_x, _y) \ + { \ + *((unsigned int *)&instance->_x) = (unsigned int)GetProcAddress((HMODULE)instance->module, _y); \ + if (!instance->_x) \ + { \ + FreeLibrary((HMODULE)instance->module); \ + free(instance); \ + return NULL; \ + } \ + } +#else + #define F_GETPROC(_x, _y) \ + { \ + char tmp[] = _y; \ + *(strchr(tmp, '@')) = 0; \ + *((unsigned int *)&instance->_x) = (unsigned int)dlsym(instance->module, &tmp[1]); \ + if (!instance->_x) \ + { \ + dlclose(instance->module); \ + free(instance); \ + return NULL; \ + } \ + } +#endif + + F_GETPROC(FSOUND_SetOutput, "_FSOUND_SetOutput@4"); + F_GETPROC(FSOUND_SetDriver, "_FSOUND_SetDriver@4"); + F_GETPROC(FSOUND_SetMixer, "_FSOUND_SetMixer@4"); + F_GETPROC(FSOUND_SetBufferSize, "_FSOUND_SetBufferSize@4"); + F_GETPROC(FSOUND_SetHWND, "_FSOUND_SetHWND@4"); + F_GETPROC(FSOUND_SetMinHardwareChannels, "_FSOUND_SetMinHardwareChannels@4"); + F_GETPROC(FSOUND_SetMaxHardwareChannels, "_FSOUND_SetMaxHardwareChannels@4"); + F_GETPROC(FSOUND_SetMemorySystem, "_FSOUND_SetMemorySystem@20"); + F_GETPROC(FSOUND_Init, "_FSOUND_Init@12"); + F_GETPROC(FSOUND_Close, "_FSOUND_Close@0"); + F_GETPROC(FSOUND_Update, "_FSOUND_Update@0"); + F_GETPROC(FSOUND_SetSFXMasterVolume, "_FSOUND_SetSFXMasterVolume@4"); + F_GETPROC(FSOUND_SetPanSeperation, "_FSOUND_SetPanSeperation@4"); + F_GETPROC(FSOUND_SetSpeakerMode, "_FSOUND_SetSpeakerMode@4"); + F_GETPROC(FSOUND_GetError, "_FSOUND_GetError@0"); + F_GETPROC(FSOUND_GetVersion, "_FSOUND_GetVersion@0"); + F_GETPROC(FSOUND_GetOutput, "_FSOUND_GetOutput@0"); + F_GETPROC(FSOUND_GetOutputHandle, "_FSOUND_GetOutputHandle@0"); + F_GETPROC(FSOUND_GetDriver, "_FSOUND_GetDriver@0"); + F_GETPROC(FSOUND_GetMixer, "_FSOUND_GetMixer@0"); + F_GETPROC(FSOUND_GetNumDrivers, "_FSOUND_GetNumDrivers@0"); + F_GETPROC(FSOUND_GetDriverName, "_FSOUND_GetDriverName@4"); + F_GETPROC(FSOUND_GetDriverCaps, "_FSOUND_GetDriverCaps@8"); + F_GETPROC(FSOUND_GetOutputRate, "_FSOUND_GetOutputRate@0"); + F_GETPROC(FSOUND_GetMaxChannels, "_FSOUND_GetMaxChannels@0"); + F_GETPROC(FSOUND_GetMaxSamples, "_FSOUND_GetMaxSamples@0"); + F_GETPROC(FSOUND_GetSpeakerMode, "_FSOUND_GetSpeakerMode@0"); + F_GETPROC(FSOUND_GetSFXMasterVolume, "_FSOUND_GetSFXMasterVolume@0"); + F_GETPROC(FSOUND_GetNumHWChannels, "_FSOUND_GetNumHWChannels@12"); + F_GETPROC(FSOUND_GetChannelsPlaying, "_FSOUND_GetChannelsPlaying@0"); + F_GETPROC(FSOUND_GetCPUUsage, "_FSOUND_GetCPUUsage@0"); + F_GETPROC(FSOUND_GetMemoryStats, "_FSOUND_GetMemoryStats@8"); + F_GETPROC(FSOUND_Sample_Load, "_FSOUND_Sample_Load@20"); + F_GETPROC(FSOUND_Sample_Alloc, "_FSOUND_Sample_Alloc@28"); + F_GETPROC(FSOUND_Sample_Free, "_FSOUND_Sample_Free@4"); + F_GETPROC(FSOUND_Sample_Upload, "_FSOUND_Sample_Upload@12"); + F_GETPROC(FSOUND_Sample_Lock, "_FSOUND_Sample_Lock@28"); + F_GETPROC(FSOUND_Sample_Unlock, "_FSOUND_Sample_Unlock@20"); + F_GETPROC(FSOUND_Sample_SetMode, "_FSOUND_Sample_SetMode@8"); + F_GETPROC(FSOUND_Sample_SetLoopPoints, "_FSOUND_Sample_SetLoopPoints@12"); + F_GETPROC(FSOUND_Sample_SetDefaults, "_FSOUND_Sample_SetDefaults@20"); + F_GETPROC(FSOUND_Sample_SetDefaultsEx, "_FSOUND_Sample_SetDefaultsEx@32"); + F_GETPROC(FSOUND_Sample_SetMinMaxDistance, "_FSOUND_Sample_SetMinMaxDistance@12"); + F_GETPROC(FSOUND_Sample_SetMaxPlaybacks, "_FSOUND_Sample_SetMaxPlaybacks@8"); + F_GETPROC(FSOUND_Sample_Get, "_FSOUND_Sample_Get@4"); + F_GETPROC(FSOUND_Sample_GetName, "_FSOUND_Sample_GetName@4"); + F_GETPROC(FSOUND_Sample_GetLength, "_FSOUND_Sample_GetLength@4"); + F_GETPROC(FSOUND_Sample_GetLoopPoints, "_FSOUND_Sample_GetLoopPoints@12"); + F_GETPROC(FSOUND_Sample_GetDefaults, "_FSOUND_Sample_GetDefaults@20"); + F_GETPROC(FSOUND_Sample_GetDefaultsEx, "_FSOUND_Sample_GetDefaultsEx@32"); + F_GETPROC(FSOUND_Sample_GetMode, "_FSOUND_Sample_GetMode@4"); + F_GETPROC(FSOUND_Sample_GetMinMaxDistance, "_FSOUND_Sample_GetMinMaxDistance@12"); + F_GETPROC(FSOUND_PlaySound, "_FSOUND_PlaySound@8"); + F_GETPROC(FSOUND_PlaySoundEx, "_FSOUND_PlaySoundEx@16"); + F_GETPROC(FSOUND_StopSound, "_FSOUND_StopSound@4"); + F_GETPROC(FSOUND_SetFrequency, "_FSOUND_SetFrequency@8"); + F_GETPROC(FSOUND_SetVolume, "_FSOUND_SetVolume@8"); + F_GETPROC(FSOUND_SetVolumeAbsolute, "_FSOUND_SetVolumeAbsolute@8"); + F_GETPROC(FSOUND_SetPan, "_FSOUND_SetPan@8"); + F_GETPROC(FSOUND_SetSurround, "_FSOUND_SetSurround@8"); + F_GETPROC(FSOUND_SetMute, "_FSOUND_SetMute@8"); + F_GETPROC(FSOUND_SetPriority, "_FSOUND_SetPriority@8"); + F_GETPROC(FSOUND_SetReserved, "_FSOUND_SetReserved@8"); + F_GETPROC(FSOUND_SetPaused, "_FSOUND_SetPaused@8"); + F_GETPROC(FSOUND_SetLoopMode, "_FSOUND_SetLoopMode@8"); + F_GETPROC(FSOUND_SetCurrentPosition, "_FSOUND_SetCurrentPosition@8"); + F_GETPROC(FSOUND_3D_SetAttributes, "_FSOUND_3D_SetAttributes@12"); + F_GETPROC(FSOUND_3D_SetMinMaxDistance, "_FSOUND_3D_SetMinMaxDistance@12"); + F_GETPROC(FSOUND_IsPlaying, "_FSOUND_IsPlaying@4"); + F_GETPROC(FSOUND_GetFrequency, "_FSOUND_GetFrequency@4"); + F_GETPROC(FSOUND_GetVolume, "_FSOUND_GetVolume@4"); + F_GETPROC(FSOUND_GetAmplitude, "_FSOUND_GetAmplitude@4"); + F_GETPROC(FSOUND_GetPan, "_FSOUND_GetPan@4"); + F_GETPROC(FSOUND_GetSurround, "_FSOUND_GetSurround@4"); + F_GETPROC(FSOUND_GetMute, "_FSOUND_GetMute@4"); + F_GETPROC(FSOUND_GetPriority, "_FSOUND_GetPriority@4"); + F_GETPROC(FSOUND_GetReserved, "_FSOUND_GetReserved@4"); + F_GETPROC(FSOUND_GetPaused, "_FSOUND_GetPaused@4"); + F_GETPROC(FSOUND_GetLoopMode, "_FSOUND_GetLoopMode@4"); + F_GETPROC(FSOUND_GetCurrentPosition, "_FSOUND_GetCurrentPosition@4"); + F_GETPROC(FSOUND_GetCurrentSample, "_FSOUND_GetCurrentSample@4"); + F_GETPROC(FSOUND_GetCurrentLevels, "_FSOUND_GetCurrentLevels@12"); + F_GETPROC(FSOUND_GetNumSubChannels, "_FSOUND_GetNumSubChannels@4"); + F_GETPROC(FSOUND_GetSubChannel, "_FSOUND_GetSubChannel@8"); + F_GETPROC(FSOUND_3D_GetAttributes, "_FSOUND_3D_GetAttributes@12"); + F_GETPROC(FSOUND_3D_GetMinMaxDistance, "_FSOUND_3D_GetMinMaxDistance@12"); + F_GETPROC(FSOUND_3D_Listener_SetCurrent, "_FSOUND_3D_Listener_SetCurrent@8"); + F_GETPROC(FSOUND_3D_Listener_SetAttributes, "_FSOUND_3D_Listener_SetAttributes@32"); + F_GETPROC(FSOUND_3D_Listener_GetAttributes, "_FSOUND_3D_Listener_GetAttributes@32"); + F_GETPROC(FSOUND_3D_SetDopplerFactor, "_FSOUND_3D_SetDopplerFactor@4"); + F_GETPROC(FSOUND_3D_SetDistanceFactor, "_FSOUND_3D_SetDistanceFactor@4"); + F_GETPROC(FSOUND_3D_SetRolloffFactor, "_FSOUND_3D_SetRolloffFactor@4"); + F_GETPROC(FSOUND_FX_Enable, "_FSOUND_FX_Enable@8"); + F_GETPROC(FSOUND_FX_Disable, "_FSOUND_FX_Disable@4"); + F_GETPROC(FSOUND_FX_SetChorus, "_FSOUND_FX_SetChorus@32"); + F_GETPROC(FSOUND_FX_SetCompressor, "_FSOUND_FX_SetCompressor@28"); + F_GETPROC(FSOUND_FX_SetDistortion, "_FSOUND_FX_SetDistortion@24"); + F_GETPROC(FSOUND_FX_SetEcho, "_FSOUND_FX_SetEcho@24"); + F_GETPROC(FSOUND_FX_SetFlanger, "_FSOUND_FX_SetFlanger@32"); + F_GETPROC(FSOUND_FX_SetGargle, "_FSOUND_FX_SetGargle@12"); + F_GETPROC(FSOUND_FX_SetI3DL2Reverb, "_FSOUND_FX_SetI3DL2Reverb@52"); + F_GETPROC(FSOUND_FX_SetParamEQ, "_FSOUND_FX_SetParamEQ@16"); + F_GETPROC(FSOUND_FX_SetWavesReverb, "_FSOUND_FX_SetWavesReverb@20"); + F_GETPROC(FSOUND_Stream_Open, "_FSOUND_Stream_Open@16"); + F_GETPROC(FSOUND_Stream_Create, "_FSOUND_Stream_Create@20"); + F_GETPROC(FSOUND_Stream_Play, "_FSOUND_Stream_Play@8"); + F_GETPROC(FSOUND_Stream_PlayEx, "_FSOUND_Stream_PlayEx@16"); + F_GETPROC(FSOUND_Stream_Stop, "_FSOUND_Stream_Stop@4"); + F_GETPROC(FSOUND_Stream_Close, "_FSOUND_Stream_Close@4"); + F_GETPROC(FSOUND_Stream_SetEndCallback, "_FSOUND_Stream_SetEndCallback@12"); + F_GETPROC(FSOUND_Stream_SetSyncCallback, "_FSOUND_Stream_SetSyncCallback@12"); + F_GETPROC(FSOUND_Stream_GetSample, "_FSOUND_Stream_GetSample@4"); + F_GETPROC(FSOUND_Stream_CreateDSP, "_FSOUND_Stream_CreateDSP@16"); + F_GETPROC(FSOUND_Stream_SetBufferSize, "_FSOUND_Stream_SetBufferSize@4"); + F_GETPROC(FSOUND_Stream_SetPosition, "_FSOUND_Stream_SetPosition@8"); + F_GETPROC(FSOUND_Stream_GetPosition, "_FSOUND_Stream_GetPosition@4"); + F_GETPROC(FSOUND_Stream_SetTime, "_FSOUND_Stream_SetTime@8"); + F_GETPROC(FSOUND_Stream_GetTime, "_FSOUND_Stream_GetTime@4"); + F_GETPROC(FSOUND_Stream_GetLength, "_FSOUND_Stream_GetLength@4"); + F_GETPROC(FSOUND_Stream_GetLengthMs, "_FSOUND_Stream_GetLengthMs@4"); + F_GETPROC(FSOUND_Stream_SetMode, "_FSOUND_Stream_SetMode@8"); + F_GETPROC(FSOUND_Stream_GetMode, "_FSOUND_Stream_GetMode@4"); + F_GETPROC(FSOUND_Stream_SetSubStream, "_FSOUND_Stream_SetSubStream@8"); + F_GETPROC(FSOUND_Stream_GetNumSubStreams, "_FSOUND_Stream_GetNumSubStreams@4"); + F_GETPROC(FSOUND_Stream_SetSubStreamSentence, "_FSOUND_Stream_SetSubStreamSentence@12"); + F_GETPROC(FSOUND_Stream_SetLoopPoints, "_FSOUND_Stream_SetLoopPoints@12"); + F_GETPROC(FSOUND_Stream_SetLoopCount, "_FSOUND_Stream_SetLoopCount@8"); + F_GETPROC(FSOUND_Stream_AddSyncPoint, "_FSOUND_Stream_AddSyncPoint@12"); + F_GETPROC(FSOUND_Stream_DeleteSyncPoint, "_FSOUND_Stream_DeleteSyncPoint@4"); + F_GETPROC(FSOUND_Stream_GetNumSyncPoints, "_FSOUND_Stream_GetNumSyncPoints@4"); + F_GETPROC(FSOUND_Stream_GetSyncPoint, "_FSOUND_Stream_GetSyncPoint@8"); + F_GETPROC(FSOUND_Stream_GetSyncPointInfo, "_FSOUND_Stream_GetSyncPointInfo@8"); + F_GETPROC(FSOUND_Stream_GetOpenState, "_FSOUND_Stream_GetOpenState@4"); + F_GETPROC(FSOUND_Stream_GetNumTagFields, "_FSOUND_Stream_GetNumTagFields@8"); + F_GETPROC(FSOUND_Stream_GetTagField, "_FSOUND_Stream_GetTagField@24"); + F_GETPROC(FSOUND_Stream_FindTagField, "_FSOUND_Stream_FindTagField@20"); + F_GETPROC(FSOUND_Stream_Net_SetProxy, "_FSOUND_Stream_Net_SetProxy@4"); + F_GETPROC(FSOUND_Stream_Net_GetLastServerStatus, "_FSOUND_Stream_Net_GetLastServerStatus@0"); + F_GETPROC(FSOUND_Stream_Net_SetBufferProperties, "_FSOUND_Stream_Net_SetBufferProperties@12"); + F_GETPROC(FSOUND_Stream_Net_GetBufferProperties, "_FSOUND_Stream_Net_GetBufferProperties@12"); + F_GETPROC(FSOUND_Stream_Net_SetMetadataCallback, "_FSOUND_Stream_Net_SetMetadataCallback@12"); + F_GETPROC(FSOUND_Stream_Net_GetStatus, "_FSOUND_Stream_Net_GetStatus@20"); + F_GETPROC(FSOUND_CD_Play, "_FSOUND_CD_Play@8"); + F_GETPROC(FSOUND_CD_SetPlayMode, "_FSOUND_CD_SetPlayMode@8"); + F_GETPROC(FSOUND_CD_Stop, "_FSOUND_CD_Stop@4"); + F_GETPROC(FSOUND_CD_SetPaused, "_FSOUND_CD_SetPaused@8"); + F_GETPROC(FSOUND_CD_SetVolume, "_FSOUND_CD_SetVolume@8"); + F_GETPROC(FSOUND_CD_SetTrackTime, "_FSOUND_CD_SetTrackTime@8"); + F_GETPROC(FSOUND_CD_OpenTray, "_FSOUND_CD_OpenTray@8"); + F_GETPROC(FSOUND_CD_GetPaused, "_FSOUND_CD_GetPaused@4"); + F_GETPROC(FSOUND_CD_GetTrack, "_FSOUND_CD_GetTrack@4"); + F_GETPROC(FSOUND_CD_GetNumTracks, "_FSOUND_CD_GetNumTracks@4"); + F_GETPROC(FSOUND_CD_GetVolume, "_FSOUND_CD_GetVolume@4"); + F_GETPROC(FSOUND_CD_GetTrackLength, "_FSOUND_CD_GetTrackLength@8"); + F_GETPROC(FSOUND_CD_GetTrackTime, "_FSOUND_CD_GetTrackTime@4"); + F_GETPROC(FSOUND_DSP_Create, "_FSOUND_DSP_Create@12"); + F_GETPROC(FSOUND_DSP_Free, "_FSOUND_DSP_Free@4"); + F_GETPROC(FSOUND_DSP_SetPriority, "_FSOUND_DSP_SetPriority@8"); + F_GETPROC(FSOUND_DSP_GetPriority, "_FSOUND_DSP_GetPriority@4"); + F_GETPROC(FSOUND_DSP_SetActive, "_FSOUND_DSP_SetActive@8"); + F_GETPROC(FSOUND_DSP_GetActive, "_FSOUND_DSP_GetActive@4"); + F_GETPROC(FSOUND_DSP_GetClearUnit, "_FSOUND_DSP_GetClearUnit@0"); + F_GETPROC(FSOUND_DSP_GetSFXUnit, "_FSOUND_DSP_GetSFXUnit@0"); + F_GETPROC(FSOUND_DSP_GetMusicUnit, "_FSOUND_DSP_GetMusicUnit@0"); + F_GETPROC(FSOUND_DSP_GetClipAndCopyUnit, "_FSOUND_DSP_GetClipAndCopyUnit@0"); + F_GETPROC(FSOUND_DSP_GetFFTUnit, "_FSOUND_DSP_GetFFTUnit@0"); + F_GETPROC(FSOUND_DSP_MixBuffers, "_FSOUND_DSP_MixBuffers@28"); + F_GETPROC(FSOUND_DSP_ClearMixBuffer, "_FSOUND_DSP_ClearMixBuffer@0"); + F_GETPROC(FSOUND_DSP_GetBufferLength, "_FSOUND_DSP_GetBufferLength@0"); + F_GETPROC(FSOUND_DSP_GetBufferLengthTotal, "_FSOUND_DSP_GetBufferLengthTotal@0"); + F_GETPROC(FSOUND_DSP_GetSpectrum, "_FSOUND_DSP_GetSpectrum@0"); + F_GETPROC(FSOUND_Reverb_SetProperties, "_FSOUND_Reverb_SetProperties@4"); + F_GETPROC(FSOUND_Reverb_GetProperties, "_FSOUND_Reverb_GetProperties@4"); + F_GETPROC(FSOUND_Reverb_SetChannelProperties, "_FSOUND_Reverb_SetChannelProperties@8"); + F_GETPROC(FSOUND_Reverb_GetChannelProperties, "_FSOUND_Reverb_GetChannelProperties@8"); + F_GETPROC(FSOUND_Record_SetDriver, "_FSOUND_Record_SetDriver@4"); + F_GETPROC(FSOUND_Record_GetNumDrivers, "_FSOUND_Record_GetNumDrivers@0"); + F_GETPROC(FSOUND_Record_GetDriverName, "_FSOUND_Record_GetDriverName@4"); + F_GETPROC(FSOUND_Record_GetDriver, "_FSOUND_Record_GetDriver@0"); + F_GETPROC(FSOUND_Record_StartSample, "_FSOUND_Record_StartSample@8"); + F_GETPROC(FSOUND_Record_Stop, "_FSOUND_Record_Stop@0"); + F_GETPROC(FSOUND_Record_GetPosition, "_FSOUND_Record_GetPosition@0"); + F_GETPROC(FSOUND_File_SetCallbacks, "_FSOUND_File_SetCallbacks@20"); + F_GETPROC(FMUSIC_LoadSong, "_FMUSIC_LoadSong@4"); + F_GETPROC(FMUSIC_LoadSongEx, "_FMUSIC_LoadSongEx@24"); + F_GETPROC(FMUSIC_GetOpenState, "_FMUSIC_GetOpenState@4"); + F_GETPROC(FMUSIC_FreeSong, "_FMUSIC_FreeSong@4"); + F_GETPROC(FMUSIC_PlaySong, "_FMUSIC_PlaySong@4"); + F_GETPROC(FMUSIC_StopSong, "_FMUSIC_StopSong@4"); + F_GETPROC(FMUSIC_StopAllSongs, "_FMUSIC_StopAllSongs@0"); + F_GETPROC(FMUSIC_SetZxxCallback, "_FMUSIC_SetZxxCallback@8"); + F_GETPROC(FMUSIC_SetRowCallback, "_FMUSIC_SetRowCallback@12"); + F_GETPROC(FMUSIC_SetOrderCallback, "_FMUSIC_SetOrderCallback@12"); + F_GETPROC(FMUSIC_SetInstCallback, "_FMUSIC_SetInstCallback@12"); + F_GETPROC(FMUSIC_SetSample, "_FMUSIC_SetSample@12"); + F_GETPROC(FMUSIC_SetUserData, "_FMUSIC_SetUserData@8"); + F_GETPROC(FMUSIC_OptimizeChannels, "_FMUSIC_OptimizeChannels@12"); + F_GETPROC(FMUSIC_SetReverb, "_FMUSIC_SetReverb@4"); + F_GETPROC(FMUSIC_SetLooping, "_FMUSIC_SetLooping@8"); + F_GETPROC(FMUSIC_SetOrder, "_FMUSIC_SetOrder@8"); + F_GETPROC(FMUSIC_SetPaused, "_FMUSIC_SetPaused@8"); + F_GETPROC(FMUSIC_SetMasterVolume, "_FMUSIC_SetMasterVolume@8"); + F_GETPROC(FMUSIC_SetMasterSpeed, "_FMUSIC_SetMasterSpeed@8"); + F_GETPROC(FMUSIC_SetPanSeperation, "_FMUSIC_SetPanSeperation@8"); + F_GETPROC(FMUSIC_GetName, "_FMUSIC_GetName@4"); + F_GETPROC(FMUSIC_GetType, "_FMUSIC_GetType@4"); + F_GETPROC(FMUSIC_GetNumOrders, "_FMUSIC_GetNumOrders@4"); + F_GETPROC(FMUSIC_GetNumPatterns, "_FMUSIC_GetNumPatterns@4"); + F_GETPROC(FMUSIC_GetNumInstruments, "_FMUSIC_GetNumInstruments@4"); + F_GETPROC(FMUSIC_GetNumSamples, "_FMUSIC_GetNumSamples@4"); + F_GETPROC(FMUSIC_GetNumChannels, "_FMUSIC_GetNumChannels@4"); + F_GETPROC(FMUSIC_GetSample, "_FMUSIC_GetSample@8"); + F_GETPROC(FMUSIC_GetPatternLength, "_FMUSIC_GetPatternLength@8"); + F_GETPROC(FMUSIC_IsFinished, "_FMUSIC_IsFinished@4"); + F_GETPROC(FMUSIC_IsPlaying, "_FMUSIC_IsPlaying@4"); + F_GETPROC(FMUSIC_GetMasterVolume, "_FMUSIC_GetMasterVolume@4"); + F_GETPROC(FMUSIC_GetGlobalVolume, "_FMUSIC_GetGlobalVolume@4"); + F_GETPROC(FMUSIC_GetOrder, "_FMUSIC_GetOrder@4"); + F_GETPROC(FMUSIC_GetPattern, "_FMUSIC_GetPattern@4"); + F_GETPROC(FMUSIC_GetSpeed, "_FMUSIC_GetSpeed@4"); + F_GETPROC(FMUSIC_GetBPM, "_FMUSIC_GetBPM@4"); + F_GETPROC(FMUSIC_GetRow, "_FMUSIC_GetRow@4"); + F_GETPROC(FMUSIC_GetPaused, "_FMUSIC_GetPaused@4"); + F_GETPROC(FMUSIC_GetTime, "_FMUSIC_GetTime@4"); + F_GETPROC(FMUSIC_GetRealChannel, "_FMUSIC_GetRealChannel@8"); + F_GETPROC(FMUSIC_GetUserData, "_FMUSIC_GetUserData@4"); + + return instance; +} + +static void FMOD_FreeInstance(FMOD_INSTANCE *instance) +{ + if (instance) + { + if (instance->module) + { +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) + FreeLibrary((HMODULE)instance->module); +#else + dlclose(instance->module); +#endif + } + free(instance); + } +} + +#endif + diff --git a/#ThirdParty/fmodapi375win/api/inc/wincompat.h b/third-party/fmod/api/inc/wincompat.h similarity index 94% rename from #ThirdParty/fmodapi375win/api/inc/wincompat.h rename to third-party/fmod/api/inc/wincompat.h index f660001..3bdbc4f 100644 --- a/#ThirdParty/fmodapi375win/api/inc/wincompat.h +++ b/third-party/fmod/api/inc/wincompat.h @@ -1,81 +1,81 @@ -#if !defined(WINCOMPAT_INCLUDED) && !defined(PLATFORM_WINDOWS) && !defined(WIN32) && !defined(WINDOWS) && !defined(__WIN32__) -#define WINCOMPAT_INCLUDED - -/** - * - * Author: Magnus Naeslund (mag@fbab.net, mag@bahnhof.se) - * (c) 2000 Magnus Naeslund, all rights reserved - * - */ - -#include -#include -#include -#include -#include -#include - -#ifndef TRUE - #define TRUE 1 -#endif -#ifndef FALSE - #define FALSE 0 -#endif - -#define _kbhit kbhit -#define stricmp strcasecmp -#define strnicmp strncasecmp - -#define Sleep(x) usleep((x)*1000) - -static int inited=0; -static struct termios ori; - -static void tcatexit(){ - tcsetattr(0,0,&ori); -} - -static void init_terminal(){ - struct termios t; - tcgetattr(0,&t); - tcgetattr(0,&ori); - t.c_lflag &= ~(ICANON); - tcsetattr(0,0,&t); - atexit(tcatexit); -} - -static inline int kbhit(){ - fd_set rfds; - struct timeval tv; - - if (!inited){ - inited=1; - init_terminal(); - } - - FD_ZERO(&rfds); - FD_SET(0, &rfds); - tv.tv_sec = 0; - tv.tv_usec = 10*1000; - return select(1, &rfds, NULL, NULL, &tv)>0; -} - -static inline int getch(){ - fd_set rfds; - - if (!inited){ - inited=1; - init_terminal(); - } - - FD_ZERO(&rfds); - FD_SET(0, &rfds); - if (select(1, &rfds, NULL, NULL, NULL)>0) - return getchar(); - else{ - printf("wincompat.h: select() on fd 0 failed\n"); - return 0xDeadBeef; - } -} - -#endif +#if !defined(WINCOMPAT_INCLUDED) && !defined(PLATFORM_WINDOWS) && !defined(WIN32) && !defined(WINDOWS) && !defined(__WIN32__) +#define WINCOMPAT_INCLUDED + +/** + * + * Author: Magnus Naeslund (mag@fbab.net, mag@bahnhof.se) + * (c) 2000 Magnus Naeslund, all rights reserved + * + */ + +#include +#include +#include +#include +#include +#include + +#ifndef TRUE + #define TRUE 1 +#endif +#ifndef FALSE + #define FALSE 0 +#endif + +#define _kbhit kbhit +#define stricmp strcasecmp +#define strnicmp strncasecmp + +#define Sleep(x) usleep((x)*1000) + +static int inited=0; +static struct termios ori; + +static void tcatexit(){ + tcsetattr(0,0,&ori); +} + +static void init_terminal(){ + struct termios t; + tcgetattr(0,&t); + tcgetattr(0,&ori); + t.c_lflag &= ~(ICANON); + tcsetattr(0,0,&t); + atexit(tcatexit); +} + +static inline int kbhit(){ + fd_set rfds; + struct timeval tv; + + if (!inited){ + inited=1; + init_terminal(); + } + + FD_ZERO(&rfds); + FD_SET(0, &rfds); + tv.tv_sec = 0; + tv.tv_usec = 10*1000; + return select(1, &rfds, NULL, NULL, &tv)>0; +} + +static inline int getch(){ + fd_set rfds; + + if (!inited){ + inited=1; + init_terminal(); + } + + FD_ZERO(&rfds); + FD_SET(0, &rfds); + if (select(1, &rfds, NULL, NULL, NULL)>0) + return getchar(); + else{ + printf("wincompat.h: select() on fd 0 failed\n"); + return 0xDeadBeef; + } +} + +#endif diff --git a/#ThirdParty/fmodapi375win/api/lib/fmod64vc.lib b/third-party/fmod/api/lib/fmod64vc.lib similarity index 100% rename from #ThirdParty/fmodapi375win/api/lib/fmod64vc.lib rename to third-party/fmod/api/lib/fmod64vc.lib diff --git a/#ThirdParty/fmodapi375win/api/lib/fmodbc.lib b/third-party/fmod/api/lib/fmodbc.lib similarity index 100% rename from #ThirdParty/fmodapi375win/api/lib/fmodbc.lib rename to third-party/fmod/api/lib/fmodbc.lib diff --git a/#ThirdParty/fmodapi375win/api/lib/fmodlcc.lib b/third-party/fmod/api/lib/fmodlcc.lib similarity index 100% rename from #ThirdParty/fmodapi375win/api/lib/fmodlcc.lib rename to third-party/fmod/api/lib/fmodlcc.lib diff --git a/#ThirdParty/fmodapi375win/api/lib/fmodvc.lib b/third-party/fmod/api/lib/fmodvc.lib similarity index 100% rename from #ThirdParty/fmodapi375win/api/lib/fmodvc.lib rename to third-party/fmod/api/lib/fmodvc.lib diff --git a/#ThirdParty/fmodapi375win/api/lib/fmodwc.lib b/third-party/fmod/api/lib/fmodwc.lib similarity index 100% rename from #ThirdParty/fmodapi375win/api/lib/fmodwc.lib rename to third-party/fmod/api/lib/fmodwc.lib diff --git a/#ThirdParty/fmodapi375win/api/lib/libfmod.a b/third-party/fmod/api/lib/libfmod.a similarity index 100% rename from #ThirdParty/fmodapi375win/api/lib/libfmod.a rename to third-party/fmod/api/lib/libfmod.a diff --git a/#ThirdParty/FreeImage/Dist/delete.me b/third-party/freeimage/Dist/delete.me similarity index 100% rename from #ThirdParty/FreeImage/Dist/delete.me rename to third-party/freeimage/Dist/delete.me diff --git a/#ThirdParty/FreeImage/Dist/x32/FreeImage.dll b/third-party/freeimage/Dist/x32/FreeImage.dll similarity index 61% rename from #ThirdParty/FreeImage/Dist/x32/FreeImage.dll rename to third-party/freeimage/Dist/x32/FreeImage.dll index cb4cf6e..1959c17 100644 Binary files a/#ThirdParty/FreeImage/Dist/x32/FreeImage.dll and b/third-party/freeimage/Dist/x32/FreeImage.dll differ diff --git a/#ThirdParty/FreeImage/Dist/x64/FreeImage.h b/third-party/freeimage/Dist/x32/FreeImage.h similarity index 97% rename from #ThirdParty/FreeImage/Dist/x64/FreeImage.h rename to third-party/freeimage/Dist/x32/FreeImage.h index e2d1c5a..12182cd 100644 --- a/#ThirdParty/FreeImage/Dist/x64/FreeImage.h +++ b/third-party/freeimage/Dist/x32/FreeImage.h @@ -29,7 +29,7 @@ // Version information ------------------------------------------------------ #define FREEIMAGE_MAJOR_VERSION 3 -#define FREEIMAGE_MINOR_VERSION 17 +#define FREEIMAGE_MINOR_VERSION 18 #define FREEIMAGE_RELEASE_SERIAL 0 // Compiler options --------------------------------------------------------- @@ -75,7 +75,7 @@ // or define any of FREEIMAGE_BIGENDIAN and FREEIMAGE_LITTLEENDIAN directly // to specify the desired endianness. #if (!defined(FREEIMAGE_BIGENDIAN) && !defined(FREEIMAGE_LITTLEENDIAN)) - #if (defined(BYTE_ORDER) && BYTE_ORDER==BIG_ENDIAN) || (defined(__BYTE_ORDER) && __BYTE_ORDER==__BIG_ENDIAN) || defined(__BIG_ENDIAN__) +#if (defined(BYTE_ORDER) && BYTE_ORDER==BIG_ENDIAN) || (defined(__BYTE_ORDER) && __BYTE_ORDER==__BIG_ENDIAN) || (defined(__BYTE_ORDER) && __BYTE_ORDER==__ORDER_BIG_ENDIAN__) || defined(__BIG_ENDIAN__) #define FREEIMAGE_BIGENDIAN #endif // BYTE_ORDER #endif // !FREEIMAGE_[BIG|LITTLE]ENDIAN @@ -731,6 +731,9 @@ typedef void (DLL_CALLCONV *FI_InitProc)(Plugin *plugin, int format_id); #define PSD_DEFAULT 0 #define PSD_CMYK 1 //! reads tags for separated CMYK (default is conversion to RGB) #define PSD_LAB 2 //! reads tags for CIELab (default is conversion to RGB) +#define PSD_NONE 0x0100 //! save without any compression +#define PSD_RLE 0x0200 //! save using RLE compression +#define PSD_PSB 0x2000 //! save using Adobe Large Document Format (use | to combine with other save flags) #define RAS_DEFAULT 0 #define RAW_DEFAULT 0 //! load the file as linear RGB 48-bit #define RAW_PREVIEW 1 //! try to load the embedded JPEG preview with included Exif Data or default to RGB 24-bit @@ -873,13 +876,19 @@ DLL_API void DLL_CALLCONV FreeImage_UnlockPage(FIMULTIBITMAP *bitmap, FIBITMAP * DLL_API BOOL DLL_CALLCONV FreeImage_MovePage(FIMULTIBITMAP *bitmap, int target, int source); DLL_API BOOL DLL_CALLCONV FreeImage_GetLockedPageNumbers(FIMULTIBITMAP *bitmap, int *pages, int *count); -// Filetype request routines ------------------------------------------------ +// File type request routines ------------------------------------------------ DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileType(const char *filename, int size FI_DEFAULT(0)); DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeU(const wchar_t *filename, int size FI_DEFAULT(0)); DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeFromHandle(FreeImageIO *io, fi_handle handle, int size FI_DEFAULT(0)); DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeFromMemory(FIMEMORY *stream, int size FI_DEFAULT(0)); +DLL_API BOOL DLL_CALLCONV FreeImage_Validate(FREE_IMAGE_FORMAT fif, const char *filename); +DLL_API BOOL DLL_CALLCONV FreeImage_ValidateU(FREE_IMAGE_FORMAT fif, const wchar_t *filename); +DLL_API BOOL DLL_CALLCONV FreeImage_ValidateFromHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle); +DLL_API BOOL DLL_CALLCONV FreeImage_ValidateFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY *stream); + + // Image type request routine ----------------------------------------------- DLL_API FREE_IMAGE_TYPE DLL_CALLCONV FreeImage_GetImageType(FIBITMAP *dib); @@ -979,8 +988,11 @@ DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To24_555(BYTE *target, BYTE *so DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To24_565(BYTE *target, BYTE *source, int width_in_pixels); DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To24(BYTE *target, BYTE *source, int width_in_pixels); DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To32MapTransparency(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette, BYTE *table, int transparent_pixels); DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To32MapTransparency(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette, BYTE *table, int transparent_pixels); DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To32MapTransparency(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette, BYTE *table, int transparent_pixels); DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To32_555(BYTE *target, BYTE *source, int width_in_pixels); DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To32_565(BYTE *target, BYTE *source, int width_in_pixels); DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To32(BYTE *target, BYTE *source, int width_in_pixels); @@ -1092,8 +1104,6 @@ DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformCombinedFromMemory(FIMEMORY* sr // -------------------------------------------------------------------------- // rotation and flipping -/// @deprecated see FreeImage_Rotate -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_RotateClassic(FIBITMAP *dib, double angle); DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Rotate(FIBITMAP *dib, double angle, const void *bkcolor FI_DEFAULT(NULL)); DLL_API FIBITMAP *DLL_CALLCONV FreeImage_RotateEx(FIBITMAP *dib, double angle, double x_shift, double y_shift, double x_origin, double y_origin, BOOL use_mask); DLL_API BOOL DLL_CALLCONV FreeImage_FlipHorizontal(FIBITMAP *dib); diff --git a/third-party/freeimage/Dist/x32/FreeImage.lib b/third-party/freeimage/Dist/x32/FreeImage.lib new file mode 100644 index 0000000..433ad8f Binary files /dev/null and b/third-party/freeimage/Dist/x32/FreeImage.lib differ diff --git a/#ThirdParty/FreeImage/Dist/x64/FreeImage.dll b/third-party/freeimage/Dist/x64/FreeImage.dll similarity index 59% rename from #ThirdParty/FreeImage/Dist/x64/FreeImage.dll rename to third-party/freeimage/Dist/x64/FreeImage.dll index 0562f4a..ddf9120 100644 Binary files a/#ThirdParty/FreeImage/Dist/x64/FreeImage.dll and b/third-party/freeimage/Dist/x64/FreeImage.dll differ diff --git a/#ThirdParty/FreeImage/Dist/x32/FreeImage.h b/third-party/freeimage/Dist/x64/FreeImage.h similarity index 97% rename from #ThirdParty/FreeImage/Dist/x32/FreeImage.h rename to third-party/freeimage/Dist/x64/FreeImage.h index e2d1c5a..12182cd 100644 --- a/#ThirdParty/FreeImage/Dist/x32/FreeImage.h +++ b/third-party/freeimage/Dist/x64/FreeImage.h @@ -29,7 +29,7 @@ // Version information ------------------------------------------------------ #define FREEIMAGE_MAJOR_VERSION 3 -#define FREEIMAGE_MINOR_VERSION 17 +#define FREEIMAGE_MINOR_VERSION 18 #define FREEIMAGE_RELEASE_SERIAL 0 // Compiler options --------------------------------------------------------- @@ -75,7 +75,7 @@ // or define any of FREEIMAGE_BIGENDIAN and FREEIMAGE_LITTLEENDIAN directly // to specify the desired endianness. #if (!defined(FREEIMAGE_BIGENDIAN) && !defined(FREEIMAGE_LITTLEENDIAN)) - #if (defined(BYTE_ORDER) && BYTE_ORDER==BIG_ENDIAN) || (defined(__BYTE_ORDER) && __BYTE_ORDER==__BIG_ENDIAN) || defined(__BIG_ENDIAN__) +#if (defined(BYTE_ORDER) && BYTE_ORDER==BIG_ENDIAN) || (defined(__BYTE_ORDER) && __BYTE_ORDER==__BIG_ENDIAN) || (defined(__BYTE_ORDER) && __BYTE_ORDER==__ORDER_BIG_ENDIAN__) || defined(__BIG_ENDIAN__) #define FREEIMAGE_BIGENDIAN #endif // BYTE_ORDER #endif // !FREEIMAGE_[BIG|LITTLE]ENDIAN @@ -731,6 +731,9 @@ typedef void (DLL_CALLCONV *FI_InitProc)(Plugin *plugin, int format_id); #define PSD_DEFAULT 0 #define PSD_CMYK 1 //! reads tags for separated CMYK (default is conversion to RGB) #define PSD_LAB 2 //! reads tags for CIELab (default is conversion to RGB) +#define PSD_NONE 0x0100 //! save without any compression +#define PSD_RLE 0x0200 //! save using RLE compression +#define PSD_PSB 0x2000 //! save using Adobe Large Document Format (use | to combine with other save flags) #define RAS_DEFAULT 0 #define RAW_DEFAULT 0 //! load the file as linear RGB 48-bit #define RAW_PREVIEW 1 //! try to load the embedded JPEG preview with included Exif Data or default to RGB 24-bit @@ -873,13 +876,19 @@ DLL_API void DLL_CALLCONV FreeImage_UnlockPage(FIMULTIBITMAP *bitmap, FIBITMAP * DLL_API BOOL DLL_CALLCONV FreeImage_MovePage(FIMULTIBITMAP *bitmap, int target, int source); DLL_API BOOL DLL_CALLCONV FreeImage_GetLockedPageNumbers(FIMULTIBITMAP *bitmap, int *pages, int *count); -// Filetype request routines ------------------------------------------------ +// File type request routines ------------------------------------------------ DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileType(const char *filename, int size FI_DEFAULT(0)); DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeU(const wchar_t *filename, int size FI_DEFAULT(0)); DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeFromHandle(FreeImageIO *io, fi_handle handle, int size FI_DEFAULT(0)); DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeFromMemory(FIMEMORY *stream, int size FI_DEFAULT(0)); +DLL_API BOOL DLL_CALLCONV FreeImage_Validate(FREE_IMAGE_FORMAT fif, const char *filename); +DLL_API BOOL DLL_CALLCONV FreeImage_ValidateU(FREE_IMAGE_FORMAT fif, const wchar_t *filename); +DLL_API BOOL DLL_CALLCONV FreeImage_ValidateFromHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle); +DLL_API BOOL DLL_CALLCONV FreeImage_ValidateFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY *stream); + + // Image type request routine ----------------------------------------------- DLL_API FREE_IMAGE_TYPE DLL_CALLCONV FreeImage_GetImageType(FIBITMAP *dib); @@ -979,8 +988,11 @@ DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To24_555(BYTE *target, BYTE *so DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To24_565(BYTE *target, BYTE *source, int width_in_pixels); DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To24(BYTE *target, BYTE *source, int width_in_pixels); DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To32MapTransparency(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette, BYTE *table, int transparent_pixels); DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To32MapTransparency(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette, BYTE *table, int transparent_pixels); DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); +DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To32MapTransparency(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette, BYTE *table, int transparent_pixels); DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To32_555(BYTE *target, BYTE *source, int width_in_pixels); DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To32_565(BYTE *target, BYTE *source, int width_in_pixels); DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To32(BYTE *target, BYTE *source, int width_in_pixels); @@ -1092,8 +1104,6 @@ DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformCombinedFromMemory(FIMEMORY* sr // -------------------------------------------------------------------------- // rotation and flipping -/// @deprecated see FreeImage_Rotate -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_RotateClassic(FIBITMAP *dib, double angle); DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Rotate(FIBITMAP *dib, double angle, const void *bkcolor FI_DEFAULT(NULL)); DLL_API FIBITMAP *DLL_CALLCONV FreeImage_RotateEx(FIBITMAP *dib, double angle, double x_shift, double y_shift, double x_origin, double y_origin, BOOL use_mask); DLL_API BOOL DLL_CALLCONV FreeImage_FlipHorizontal(FIBITMAP *dib); diff --git a/third-party/freeimage/Dist/x64/FreeImage.lib b/third-party/freeimage/Dist/x64/FreeImage.lib new file mode 100644 index 0000000..8a93d25 Binary files /dev/null and b/third-party/freeimage/Dist/x64/FreeImage.lib differ diff --git a/#ThirdParty/libSDL/include/SDL.h b/third-party/sdl2/include/SDL.h similarity index 77% rename from #ThirdParty/libSDL/include/SDL.h rename to third-party/sdl2/include/SDL.h index 7647b51..fc35a41 100644 --- a/#ThirdParty/libSDL/include/SDL.h +++ b/third-party/sdl2/include/SDL.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,8 +26,8 @@ */ -#ifndef _SDL_H -#define _SDL_H +#ifndef SDL_h_ +#define SDL_h_ #include "SDL_main.h" #include "SDL_stdinc.h" @@ -40,10 +40,10 @@ #include "SDL_error.h" #include "SDL_events.h" #include "SDL_filesystem.h" -#include "SDL_joystick.h" #include "SDL_gamecontroller.h" #include "SDL_haptic.h" #include "SDL_hints.h" +#include "SDL_joystick.h" #include "SDL_loadso.h" #include "SDL_log.h" #include "SDL_messagebox.h" @@ -51,6 +51,8 @@ #include "SDL_power.h" #include "SDL_render.h" #include "SDL_rwops.h" +#include "SDL_sensor.h" +#include "SDL_shape.h" #include "SDL_system.h" #include "SDL_thread.h" #include "SDL_timer.h" @@ -72,17 +74,18 @@ extern "C" { * specify the subsystems which you will be using in your application. */ /* @{ */ -#define SDL_INIT_TIMER 0x00000001 -#define SDL_INIT_AUDIO 0x00000010 -#define SDL_INIT_VIDEO 0x00000020 /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */ -#define SDL_INIT_JOYSTICK 0x00000200 /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */ -#define SDL_INIT_HAPTIC 0x00001000 -#define SDL_INIT_GAMECONTROLLER 0x00002000 /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */ -#define SDL_INIT_EVENTS 0x00004000 -#define SDL_INIT_NOPARACHUTE 0x00100000 /**< compatibility; this flag is ignored. */ +#define SDL_INIT_TIMER 0x00000001u +#define SDL_INIT_AUDIO 0x00000010u +#define SDL_INIT_VIDEO 0x00000020u /**< SDL_INIT_VIDEO implies SDL_INIT_EVENTS */ +#define SDL_INIT_JOYSTICK 0x00000200u /**< SDL_INIT_JOYSTICK implies SDL_INIT_EVENTS */ +#define SDL_INIT_HAPTIC 0x00001000u +#define SDL_INIT_GAMECONTROLLER 0x00002000u /**< SDL_INIT_GAMECONTROLLER implies SDL_INIT_JOYSTICK */ +#define SDL_INIT_EVENTS 0x00004000u +#define SDL_INIT_SENSOR 0x00008000u +#define SDL_INIT_NOPARACHUTE 0x00100000u /**< compatibility; this flag is ignored. */ #define SDL_INIT_EVERYTHING ( \ SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_EVENTS | \ - SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER \ + SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC | SDL_INIT_GAMECONTROLLER | SDL_INIT_SENSOR \ ) /* @} */ @@ -95,8 +98,8 @@ extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags); * This function initializes specific SDL subsystems * * Subsystem initialization is ref-counted, you must call - * SDL_QuitSubSystem for each SDL_InitSubSystem to correctly - * shutdown a subsystem manually (or call SDL_Quit to force shutdown). + * SDL_QuitSubSystem() for each SDL_InitSubSystem() to correctly + * shutdown a subsystem manually (or call SDL_Quit() to force shutdown). * If a subsystem is already loaded then this call will * increase the ref-count and return. */ @@ -127,6 +130,6 @@ extern DECLSPEC void SDLCALL SDL_Quit(void); #endif #include "close_code.h" -#endif /* _SDL_H */ +#endif /* SDL_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_assert.h b/third-party/sdl2/include/SDL_assert.h similarity index 94% rename from #ThirdParty/libSDL/include/SDL_assert.h rename to third-party/sdl2/include/SDL_assert.h index 402981f..b38f928 100644 --- a/#ThirdParty/libSDL/include/SDL_assert.h +++ b/third-party/sdl2/include/SDL_assert.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_assert_h -#define _SDL_assert_h +#ifndef SDL_assert_h_ +#define SDL_assert_h_ #include "SDL_config.h" @@ -51,9 +51,11 @@ assert can have unique static variables associated with it. /* Don't include intrin.h here because it contains C++ code */ extern void __cdecl __debugbreak(void); #define SDL_TriggerBreakpoint() __debugbreak() -#elif (!defined(__NACL__) && defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))) +#elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) ) #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" ) -#elif defined(HAVE_SIGNAL_H) +#elif defined(__386__) && defined(__WATCOMC__) + #define SDL_TriggerBreakpoint() { _asm { int 0x03 } } +#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__) #include #define SDL_TriggerBreakpoint() raise(SIGTRAP) #else @@ -63,7 +65,7 @@ assert can have unique static variables associated with it. #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */ # define SDL_FUNCTION __func__ -#elif ((__GNUC__ >= 2) || defined(_MSC_VER)) +#elif ((__GNUC__ >= 2) || defined(_MSC_VER) || defined (__WATCOMC__)) # define SDL_FUNCTION __FUNCTION__ #else # define SDL_FUNCTION "???" @@ -201,7 +203,7 @@ typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)( * * This callback is NOT reset to SDL's internal handler upon SDL_Quit()! * - * \return SDL_AssertState value of how to handle the assertion failure. + * Return SDL_AssertState value of how to handle the assertion failure. * * \param handler Callback function, called when an assertion fails. * \param userdata A pointer passed to the callback as-is. @@ -250,7 +252,7 @@ extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puse * * const SDL_AssertData *item = SDL_GetAssertionReport(); * while (item) { - * printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\n", + * printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\\n", * item->condition, item->function, item->filename, * item->linenum, item->trigger_count, * item->always_ignore ? "yes" : "no"); @@ -284,6 +286,6 @@ extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void); #endif #include "close_code.h" -#endif /* _SDL_assert_h */ +#endif /* SDL_assert_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_atomic.h b/third-party/sdl2/include/SDL_atomic.h similarity index 90% rename from #ThirdParty/libSDL/include/SDL_atomic.h rename to third-party/sdl2/include/SDL_atomic.h index 56aa81d..b228774 100644 --- a/#ThirdParty/libSDL/include/SDL_atomic.h +++ b/third-party/sdl2/include/SDL_atomic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -56,8 +56,8 @@ * All of the atomic operations that modify memory are full memory barriers. */ -#ifndef _SDL_atomic_h_ -#define _SDL_atomic_h_ +#ifndef SDL_atomic_h_ +#define SDL_atomic_h_ #include "SDL_stdinc.h" #include "SDL_platform.h" @@ -118,13 +118,16 @@ extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock); * The compiler barrier prevents the compiler from reordering * reads and writes to globally visible variables across the call. */ -#if defined(_MSC_VER) && (_MSC_VER > 1200) +#if defined(_MSC_VER) && (_MSC_VER > 1200) && !defined(__clang__) void _ReadWriteBarrier(void); #pragma intrinsic(_ReadWriteBarrier) #define SDL_CompilerBarrier() _ReadWriteBarrier() #elif (defined(__GNUC__) && !defined(__EMSCRIPTEN__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120)) /* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */ #define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory") +#elif defined(__WATCOMC__) +extern _inline void SDL_CompilerBarrier (void); +#pragma aux SDL_CompilerBarrier = "" parm [] modify exact []; #else #define SDL_CompilerBarrier() \ { SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); } @@ -149,18 +152,24 @@ void _ReadWriteBarrier(void); * For more information on these semantics, take a look at the blog post: * http://preshing.com/20120913/acquire-and-release-semantics */ +extern DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void); +extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void); + #if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("lwsync" : : : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("lwsync" : : : "memory") +#elif defined(__GNUC__) && defined(__aarch64__) +#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") +#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory") #elif defined(__GNUC__) && defined(__arm__) #if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory") -#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) +#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_5TE__) #ifdef __thumb__ /* The mcr instruction isn't available in thumb mode, use real functions */ -extern DECLSPEC void SDLCALL SDL_MemoryBarrierRelease(); -extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquire(); +#define SDL_MemoryBarrierRelease() SDL_MemoryBarrierReleaseFunction() +#define SDL_MemoryBarrierAcquire() SDL_MemoryBarrierAcquireFunction() #else #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory") @@ -263,6 +272,6 @@ extern DECLSPEC void* SDLCALL SDL_AtomicGetPtr(void **a); #include "close_code.h" -#endif /* _SDL_atomic_h_ */ +#endif /* SDL_atomic_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_audio.h b/third-party/sdl2/include/SDL_audio.h similarity index 69% rename from #ThirdParty/libSDL/include/SDL_audio.h rename to third-party/sdl2/include/SDL_audio.h index 4f65521..d3e1bfa 100644 --- a/#ThirdParty/libSDL/include/SDL_audio.h +++ b/third-party/sdl2/include/SDL_audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Access to the raw audio mixing buffer for the SDL library. */ -#ifndef _SDL_audio_h -#define _SDL_audio_h +#ifndef SDL_audio_h_ +#define SDL_audio_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -140,7 +140,8 @@ typedef Uint16 SDL_AudioFormat; #define SDL_AUDIO_ALLOW_FREQUENCY_CHANGE 0x00000001 #define SDL_AUDIO_ALLOW_FORMAT_CHANGE 0x00000002 #define SDL_AUDIO_ALLOW_CHANNELS_CHANGE 0x00000004 -#define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE) +#define SDL_AUDIO_ALLOW_SAMPLES_CHANGE 0x00000008 +#define SDL_AUDIO_ALLOW_ANY_CHANGE (SDL_AUDIO_ALLOW_FREQUENCY_CHANGE|SDL_AUDIO_ALLOW_FORMAT_CHANGE|SDL_AUDIO_ALLOW_CHANNELS_CHANGE|SDL_AUDIO_ALLOW_SAMPLES_CHANGE) /* @} */ /* @} *//* Audio flags */ @@ -164,6 +165,15 @@ typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream, /** * The calculated values in this structure are calculated by SDL_OpenAudio(). + * + * For multi-channel audio, the default SDL channel mapping is: + * 2: FL FR (stereo) + * 3: FL FR LFE (2.1 surround) + * 4: FL FR BL BR (quad) + * 5: FL FR FC BL BR (quad + center) + * 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR) + * 7: FL FR FC LFE BC SL SR (6.1 surround) + * 8: FL FR FC LFE BL BR SL SR (7.1 surround) */ typedef struct SDL_AudioSpec { @@ -171,7 +181,7 @@ typedef struct SDL_AudioSpec SDL_AudioFormat format; /**< Audio data format */ Uint8 channels; /**< Number of channels: 1 mono, 2 stereo */ Uint8 silence; /**< Audio buffer silence value (calculated) */ - Uint16 samples; /**< Audio buffer size in samples (power of 2) */ + Uint16 samples; /**< Audio buffer size in sample FRAMES (total samples divided by channel count) */ Uint16 padding; /**< Necessary for some compile environments */ Uint32 size; /**< Audio buffer size in bytes (calculated) */ SDL_AudioCallback callback; /**< Callback that feeds the audio device (NULL to use SDL_QueueAudio()). */ @@ -184,7 +194,23 @@ typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT * cvt, SDL_AudioFormat format); /** - * A structure to hold a set of audio conversion filters and buffers. + * \brief Upper limit of filters in SDL_AudioCVT + * + * The maximum number of SDL_AudioFilter functions in SDL_AudioCVT is + * currently limited to 9. The SDL_AudioCVT.filters array has 10 pointers, + * one of which is the terminating NULL pointer. + */ +#define SDL_AUDIOCVT_MAX_FILTERS 9 + +/** + * \struct SDL_AudioCVT + * \brief A structure to hold a set of audio conversion filters and buffers. + * + * Note that various parts of the conversion pipeline can take advantage + * of SIMD operations (like SSE2, for example). SDL_AudioCVT doesn't require + * you to pass it aligned data, but can possibly run much faster if you + * set both its (buf) field to a pointer that is aligned to 16 bytes, and its + * (len) field to something that's a multiple of 16, if possible. */ #ifdef __GNUC__ /* This structure is 84 bytes on 32-bit architectures, make sure GCC doesn't @@ -208,7 +234,7 @@ typedef struct SDL_AudioCVT int len_cvt; /**< Length of converted audio buffer */ int len_mult; /**< buffer must be len*len_mult big */ double len_ratio; /**< Given len, final size is len*len_ratio */ - SDL_AudioFilter filters[10]; /**< Filter list */ + SDL_AudioFilter filters[SDL_AUDIOCVT_MAX_FILTERS + 1]; /**< NULL-terminated list of filter functions */ int filter_index; /**< Current audio conversion function */ } SDL_AUDIOCVT_PACKED SDL_AudioCVT; @@ -278,7 +304,8 @@ extern DECLSPEC const char *SDLCALL SDL_GetCurrentAudioDriver(void); * protect data structures that it accesses by calling SDL_LockAudio() * and SDL_UnlockAudio() in your code. Alternately, you may pass a NULL * pointer here, and call SDL_QueueAudio() with some frequency, to queue - * more audio samples to be played. + * more audio samples to be played (or for capture devices, call + * SDL_DequeueAudio() with some frequency, to obtain audio samples). * - \c desired->userdata is passed as the first parameter to your callback * function. If you passed a NULL callback, this value is ignored. * @@ -433,10 +460,10 @@ extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf); * This function takes a source format and rate and a destination format * and rate, and initializes the \c cvt structure with information needed * by SDL_ConvertAudio() to convert a buffer of audio data from one format - * to the other. + * to the other. An unsupported format causes an error and -1 will be returned. * - * \return -1 if the format conversion is not supported, 0 if there's - * no conversion needed, or 1 if the audio filter is set up. + * \return 0 if no conversion is needed, 1 if the audio filter is set up, + * or -1 on error. */ extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt, SDL_AudioFormat src_format, @@ -455,9 +482,137 @@ extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt, * The data conversion may expand the size of the audio data, so the buffer * \c cvt->buf should be allocated after the \c cvt structure is initialized by * SDL_BuildAudioCVT(), and should be \c cvt->len*cvt->len_mult bytes long. + * + * \return 0 on success or -1 if \c cvt->buf is NULL. */ extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT * cvt); +/* SDL_AudioStream is a new audio conversion interface. + The benefits vs SDL_AudioCVT: + - it can handle resampling data in chunks without generating + artifacts, when it doesn't have the complete buffer available. + - it can handle incoming data in any variable size. + - You push data as you have it, and pull it when you need it + */ +/* this is opaque to the outside world. */ +struct _SDL_AudioStream; +typedef struct _SDL_AudioStream SDL_AudioStream; + +/** + * Create a new audio stream + * + * \param src_format The format of the source audio + * \param src_channels The number of channels of the source audio + * \param src_rate The sampling rate of the source audio + * \param dst_format The format of the desired audio output + * \param dst_channels The number of channels of the desired audio output + * \param dst_rate The sampling rate of the desired audio output + * \return 0 on success, or -1 on error. + * + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + */ +extern DECLSPEC SDL_AudioStream * SDLCALL SDL_NewAudioStream(const SDL_AudioFormat src_format, + const Uint8 src_channels, + const int src_rate, + const SDL_AudioFormat dst_format, + const Uint8 dst_channels, + const int dst_rate); + +/** + * Add data to be converted/resampled to the stream + * + * \param stream The stream the audio data is being added to + * \param buf A pointer to the audio data to add + * \param len The number of bytes to write to the stream + * \return 0 on success, or -1 on error. + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + */ +extern DECLSPEC int SDLCALL SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, int len); + +/** + * Get converted/resampled data from the stream + * + * \param stream The stream the audio is being requested from + * \param buf A buffer to fill with audio data + * \param len The maximum number of bytes to fill + * \return The number of bytes read from the stream, or -1 on error + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + */ +extern DECLSPEC int SDLCALL SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, int len); + +/** + * Get the number of converted/resampled bytes available. The stream may be + * buffering data behind the scenes until it has enough to resample + * correctly, so this number might be lower than what you expect, or even + * be zero. Add more data or flush the stream if you need the data now. + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + */ +extern DECLSPEC int SDLCALL SDL_AudioStreamAvailable(SDL_AudioStream *stream); + +/** + * Tell the stream that you're done sending data, and anything being buffered + * should be converted/resampled and made available immediately. + * + * It is legal to add more data to a stream after flushing, but there will + * be audio gaps in the output. Generally this is intended to signal the + * end of input, so the complete output becomes available. + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + */ +extern DECLSPEC int SDLCALL SDL_AudioStreamFlush(SDL_AudioStream *stream); + +/** + * Clear any pending data in the stream without converting it + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_FreeAudioStream + */ +extern DECLSPEC void SDLCALL SDL_AudioStreamClear(SDL_AudioStream *stream); + +/** + * Free an audio stream + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + */ +extern DECLSPEC void SDLCALL SDL_FreeAudioStream(SDL_AudioStream *stream); + #define SDL_MIX_MAXVOLUME 128 /** * This takes two audio buffers of the playing audio format and mixes @@ -482,6 +637,10 @@ extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst, /** * Queue more audio on non-callback devices. * + * (If you are looking to retrieve queued audio from a non-callback capture + * device, you want SDL_DequeueAudio() instead. This will return -1 to + * signify an error if you use it with capture devices.) + * * SDL offers two ways to feed audio to the device: you can either supply a * callback that SDL triggers with some frequency to obtain more audio * (pull method), or you can supply no callback, and then SDL will expect @@ -509,28 +668,83 @@ extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst, * \param dev The device ID to which we will queue audio. * \param data The data to queue to the device for later playback. * \param len The number of bytes (not samples!) to which (data) points. - * \return zero on success, -1 on error. + * \return 0 on success, or -1 on error. * * \sa SDL_GetQueuedAudioSize * \sa SDL_ClearQueuedAudio */ extern DECLSPEC int SDLCALL SDL_QueueAudio(SDL_AudioDeviceID dev, const void *data, Uint32 len); +/** + * Dequeue more audio on non-callback devices. + * + * (If you are looking to queue audio for output on a non-callback playback + * device, you want SDL_QueueAudio() instead. This will always return 0 + * if you use it with playback devices.) + * + * SDL offers two ways to retrieve audio from a capture device: you can + * either supply a callback that SDL triggers with some frequency as the + * device records more audio data, (push method), or you can supply no + * callback, and then SDL will expect you to retrieve data at regular + * intervals (pull method) with this function. + * + * There are no limits on the amount of data you can queue, short of + * exhaustion of address space. Data from the device will keep queuing as + * necessary without further intervention from you. This means you will + * eventually run out of memory if you aren't routinely dequeueing data. + * + * Capture devices will not queue data when paused; if you are expecting + * to not need captured audio for some length of time, use + * SDL_PauseAudioDevice() to stop the capture device from queueing more + * data. This can be useful during, say, level loading times. When + * unpaused, capture devices will start queueing data from that point, + * having flushed any capturable data available while paused. + * + * This function is thread-safe, but dequeueing from the same device from + * two threads at once does not promise which thread will dequeued data + * first. + * + * You may not dequeue audio from a device that is using an + * application-supplied callback; doing so returns an error. You have to use + * the audio callback, or dequeue audio with this function, but not both. + * + * You should not call SDL_LockAudio() on the device before queueing; SDL + * handles locking internally for this function. + * + * \param dev The device ID from which we will dequeue audio. + * \param data A pointer into where audio data should be copied. + * \param len The number of bytes (not samples!) to which (data) points. + * \return number of bytes dequeued, which could be less than requested. + * + * \sa SDL_GetQueuedAudioSize + * \sa SDL_ClearQueuedAudio + */ +extern DECLSPEC Uint32 SDLCALL SDL_DequeueAudio(SDL_AudioDeviceID dev, void *data, Uint32 len); + /** * Get the number of bytes of still-queued audio. * - * This is the number of bytes that have been queued for playback with - * SDL_QueueAudio(), but have not yet been sent to the hardware. + * For playback device: * - * Once we've sent it to the hardware, this function can not decide the exact - * byte boundary of what has been played. It's possible that we just gave the - * hardware several kilobytes right before you called this function, but it - * hasn't played any of it yet, or maybe half of it, etc. + * This is the number of bytes that have been queued for playback with + * SDL_QueueAudio(), but have not yet been sent to the hardware. This + * number may shrink at any time, so this only informs of pending data. + * + * Once we've sent it to the hardware, this function can not decide the + * exact byte boundary of what has been played. It's possible that we just + * gave the hardware several kilobytes right before you called this + * function, but it hasn't played any of it yet, or maybe half of it, etc. + * + * For capture devices: + * + * This is the number of bytes that have been captured by the device and + * are waiting for you to dequeue. This number may grow at any time, so + * this only informs of the lower-bound of available data. * * You may not queue audio on a device that is using an application-supplied * callback; calling this function on such a device always returns 0. - * You have to use the audio callback or queue audio with SDL_QueueAudio(), - * but not both. + * You have to queue audio with SDL_QueueAudio()/SDL_DequeueAudio(), or use + * the audio callback, but not both. * * You should not call SDL_LockAudio() on the device before querying; SDL * handles locking internally for this function. @@ -544,10 +758,17 @@ extern DECLSPEC int SDLCALL SDL_QueueAudio(SDL_AudioDeviceID dev, const void *da extern DECLSPEC Uint32 SDLCALL SDL_GetQueuedAudioSize(SDL_AudioDeviceID dev); /** - * Drop any queued audio data waiting to be sent to the hardware. + * Drop any queued audio data. For playback devices, this is any queued data + * still waiting to be submitted to the hardware. For capture devices, this + * is any data that was queued by the device that hasn't yet been dequeued by + * the application. * - * Immediately after this call, SDL_GetQueuedAudioSize() will return 0 and - * the hardware will start playing silence if more audio isn't queued. + * Immediately after this call, SDL_GetQueuedAudioSize() will return 0. For + * playback devices, the hardware will start playing silence if more audio + * isn't queued. Unpaused capture devices will start filling the queue again + * as soon as they have more data available (which, depending on the state + * of the hardware and the thread, could be before this function call + * returns!). * * This will not prevent playback of queued audio that's already been sent * to the hardware, as we can not undo that, so expect there to be some @@ -557,8 +778,8 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetQueuedAudioSize(SDL_AudioDeviceID dev); * * You may not queue audio on a device that is using an application-supplied * callback; calling this function on such a device is always a no-op. - * You have to use the audio callback or queue audio with SDL_QueueAudio(), - * but not both. + * You have to queue audio with SDL_QueueAudio()/SDL_DequeueAudio(), or use + * the audio callback, but not both. * * You should not call SDL_LockAudio() on the device before clearing the * queue; SDL handles locking internally for this function. @@ -600,6 +821,6 @@ extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev); #endif #include "close_code.h" -#endif /* _SDL_audio_h */ +#endif /* SDL_audio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_bits.h b/third-party/sdl2/include/SDL_bits.h similarity index 80% rename from #ThirdParty/libSDL/include/SDL_bits.h rename to third-party/sdl2/include/SDL_bits.h index 528da2e..eb8322f 100644 --- a/#ThirdParty/libSDL/include/SDL_bits.h +++ b/third-party/sdl2/include/SDL_bits.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Functions for fiddling with bits and bitmasks. */ -#ifndef _SDL_bits_h -#define _SDL_bits_h +#ifndef SDL_bits_h_ +#define SDL_bits_h_ #include "SDL_stdinc.h" @@ -47,10 +47,20 @@ extern "C" { * * \return Index of the most significant bit, or -1 if the value is 0. */ +#if defined(__WATCOMC__) && defined(__386__) +extern _inline int _SDL_clz_watcom (Uint32); +#pragma aux _SDL_clz_watcom = \ + "bsr eax, eax" \ + "xor eax, 31" \ + parm [eax] nomemory \ + value [eax] \ + modify exact [eax] nomemory; +#endif + SDL_FORCE_INLINE int SDL_MostSignificantBitIndex32(Uint32 x) { -#if defined(__GNUC__) && __GNUC__ >= 4 +#if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) /* Count Leading Zeroes builtin in GCC. * http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html */ @@ -58,6 +68,11 @@ SDL_MostSignificantBitIndex32(Uint32 x) return -1; } return 31 - __builtin_clz(x); +#elif defined(__WATCOMC__) && defined(__386__) + if (x == 0) { + return -1; + } + return 31 - _SDL_clz_watcom(x); #else /* Based off of Bit Twiddling Hacks by Sean Eron Anderson * , released in the public domain. @@ -92,6 +107,6 @@ SDL_MostSignificantBitIndex32(Uint32 x) #endif #include "close_code.h" -#endif /* _SDL_bits_h */ +#endif /* SDL_bits_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/third-party/sdl2/include/SDL_blendmode.h b/third-party/sdl2/include/SDL_blendmode.h new file mode 100644 index 0000000..36a5ea7 --- /dev/null +++ b/third-party/sdl2/include/SDL_blendmode.h @@ -0,0 +1,120 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_blendmode.h + * + * Header file declaring the SDL_BlendMode enumeration + */ + +#ifndef SDL_blendmode_h_ +#define SDL_blendmode_h_ + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \brief The blend mode used in SDL_RenderCopy() and drawing operations. + */ +typedef enum +{ + SDL_BLENDMODE_NONE = 0x00000000, /**< no blending + dstRGBA = srcRGBA */ + SDL_BLENDMODE_BLEND = 0x00000001, /**< alpha blending + dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA)) + dstA = srcA + (dstA * (1-srcA)) */ + SDL_BLENDMODE_ADD = 0x00000002, /**< additive blending + dstRGB = (srcRGB * srcA) + dstRGB + dstA = dstA */ + SDL_BLENDMODE_MOD = 0x00000004, /**< color modulate + dstRGB = srcRGB * dstRGB + dstA = dstA */ + SDL_BLENDMODE_INVALID = 0x7FFFFFFF + + /* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */ + +} SDL_BlendMode; + +/** + * \brief The blend operation used when combining source and destination pixel components + */ +typedef enum +{ + SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */ + SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */ + SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */ + SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D11 */ + SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D11 */ + +} SDL_BlendOperation; + +/** + * \brief The normalized factor used to multiply pixel components + */ +typedef enum +{ + SDL_BLENDFACTOR_ZERO = 0x1, /**< 0, 0, 0, 0 */ + SDL_BLENDFACTOR_ONE = 0x2, /**< 1, 1, 1, 1 */ + SDL_BLENDFACTOR_SRC_COLOR = 0x3, /**< srcR, srcG, srcB, srcA */ + SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 0x4, /**< 1-srcR, 1-srcG, 1-srcB, 1-srcA */ + SDL_BLENDFACTOR_SRC_ALPHA = 0x5, /**< srcA, srcA, srcA, srcA */ + SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 0x6, /**< 1-srcA, 1-srcA, 1-srcA, 1-srcA */ + SDL_BLENDFACTOR_DST_COLOR = 0x7, /**< dstR, dstG, dstB, dstA */ + SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8, /**< 1-dstR, 1-dstG, 1-dstB, 1-dstA */ + SDL_BLENDFACTOR_DST_ALPHA = 0x9, /**< dstA, dstA, dstA, dstA */ + SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA /**< 1-dstA, 1-dstA, 1-dstA, 1-dstA */ + +} SDL_BlendFactor; + +/** + * \brief Create a custom blend mode, which may or may not be supported by a given renderer + * + * \param srcColorFactor + * \param dstColorFactor + * \param colorOperation + * \param srcAlphaFactor + * \param dstAlphaFactor + * \param alphaOperation + * + * The result of the blend mode operation will be: + * dstRGB = dstRGB * dstColorFactor colorOperation srcRGB * srcColorFactor + * and + * dstA = dstA * dstAlphaFactor alphaOperation srcA * srcAlphaFactor + */ +extern DECLSPEC SDL_BlendMode SDLCALL SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor, + SDL_BlendFactor dstColorFactor, + SDL_BlendOperation colorOperation, + SDL_BlendFactor srcAlphaFactor, + SDL_BlendFactor dstAlphaFactor, + SDL_BlendOperation alphaOperation); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_blendmode_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_clipboard.h b/third-party/sdl2/include/SDL_clipboard.h similarity index 92% rename from #ThirdParty/libSDL/include/SDL_clipboard.h rename to third-party/sdl2/include/SDL_clipboard.h index a5556f2..f28751e 100644 --- a/#ThirdParty/libSDL/include/SDL_clipboard.h +++ b/third-party/sdl2/include/SDL_clipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL clipboard handling */ -#ifndef _SDL_clipboard_h -#define _SDL_clipboard_h +#ifndef SDL_clipboard_h_ +#define SDL_clipboard_h_ #include "SDL_stdinc.h" @@ -66,6 +66,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void); #endif #include "close_code.h" -#endif /* _SDL_clipboard_h */ +#endif /* SDL_clipboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/third-party/sdl2/include/SDL_config.h b/third-party/sdl2/include/SDL_config.h new file mode 100644 index 0000000..c58be8e --- /dev/null +++ b/third-party/sdl2/include/SDL_config.h @@ -0,0 +1,257 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_config_windows_h_ +#define SDL_config_windows_h_ +#define SDL_config_h_ + +#include "SDL_platform.h" + +/* This is a set of defines to configure the SDL features */ + +#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) +#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__) +#define HAVE_STDINT_H 1 +#elif defined(_MSC_VER) +typedef signed __int8 int8_t; +typedef unsigned __int8 uint8_t; +typedef signed __int16 int16_t; +typedef unsigned __int16 uint16_t; +typedef signed __int32 int32_t; +typedef unsigned __int32 uint32_t; +typedef signed __int64 int64_t; +typedef unsigned __int64 uint64_t; +#ifndef _UINTPTR_T_DEFINED +#ifdef _WIN64 +typedef unsigned __int64 uintptr_t; +#else +typedef unsigned int uintptr_t; +#endif +#define _UINTPTR_T_DEFINED +#endif +/* Older Visual C++ headers don't have the Win64-compatible typedefs... */ +#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR))) +#define DWORD_PTR DWORD +#endif +#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR))) +#define LONG_PTR LONG +#endif +#else /* !__GNUC__ && !_MSC_VER */ +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef signed short int16_t; +typedef unsigned short uint16_t; +typedef signed int int32_t; +typedef unsigned int uint32_t; +typedef signed long long int64_t; +typedef unsigned long long uint64_t; +#ifndef _SIZE_T_DEFINED_ +#define _SIZE_T_DEFINED_ +typedef unsigned int size_t; +#endif +typedef unsigned int uintptr_t; +#endif /* __GNUC__ || _MSC_VER */ +#endif /* !_STDINT_H_ && !HAVE_STDINT_H */ + +#ifdef _WIN64 +# define SIZEOF_VOIDP 8 +#else +# define SIZEOF_VOIDP 4 +#endif + +#define HAVE_DDRAW_H 1 +#define HAVE_DINPUT_H 1 +#define HAVE_DSOUND_H 1 +#define HAVE_DXGI_H 1 +#define HAVE_XINPUT_H 1 +#define HAVE_MMDEVICEAPI_H 1 +#define HAVE_AUDIOCLIENT_H 1 +#define HAVE_ENDPOINTVOLUME_H 1 + +/* This is disabled by default to avoid C runtime dependencies and manifest requirements */ +#ifdef HAVE_LIBC +/* Useful headers */ +#define STDC_HEADERS 1 +#define HAVE_CTYPE_H 1 +#define HAVE_FLOAT_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_MATH_H 1 +#define HAVE_SIGNAL_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STRING_H 1 + +/* C library functions */ +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +#define HAVE__STRREV 1 +/* These functions have security warnings, so we won't use them */ +/* #undef HAVE__STRUPR */ +/* #undef HAVE__STRLWR */ +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +/* These functions have security warnings, so we won't use them */ +/* #undef HAVE__LTOA */ +/* #undef HAVE__ULTOA */ +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE__STRICMP 1 +#define HAVE__STRNICMP 1 +#define HAVE_ACOS 1 +#define HAVE_ACOSF 1 +#define HAVE_ASIN 1 +#define HAVE_ASINF 1 +#define HAVE_ATAN 1 +#define HAVE_ATANF 1 +#define HAVE_ATAN2 1 +#define HAVE_ATAN2F 1 +#define HAVE_CEILF 1 +#define HAVE__COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_EXP 1 +#define HAVE_EXPF 1 +#define HAVE_FABS 1 +#define HAVE_FABSF 1 +#define HAVE_FLOOR 1 +#define HAVE_FLOORF 1 +#define HAVE_FMOD 1 +#define HAVE_FMODF 1 +#define HAVE_LOG 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10 1 +#define HAVE_LOG10F 1 +#define HAVE_POW 1 +#define HAVE_POWF 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 +#if defined(_MSC_VER) +/* These functions were added with the VC++ 2013 C runtime library */ +#if _MSC_VER >= 1800 +#define HAVE_STRTOLL 1 +#define HAVE_VSSCANF 1 +#define HAVE_SCALBN 1 +#define HAVE_SCALBNF 1 +#endif +/* This function is available with at least the VC++ 2008 C runtime library */ +#if _MSC_VER >= 1400 +#define HAVE__FSEEKI64 1 +#endif +#endif +#if !defined(_MSC_VER) || defined(_USE_MATH_DEFINES) +#define HAVE_M_PI 1 +#endif +#else +#define HAVE_STDARG_H 1 +#define HAVE_STDDEF_H 1 +#endif + +/* Enable various audio drivers */ +#define SDL_AUDIO_DRIVER_WASAPI 1 +#define SDL_AUDIO_DRIVER_DSOUND 1 +#define SDL_AUDIO_DRIVER_WINMM 1 +#define SDL_AUDIO_DRIVER_DISK 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 + +/* Enable various input drivers */ +#define SDL_JOYSTICK_DINPUT 1 +#define SDL_JOYSTICK_XINPUT 1 +#define SDL_JOYSTICK_HIDAPI 1 +#define SDL_HAPTIC_DINPUT 1 +#define SDL_HAPTIC_XINPUT 1 + +/* Enable the dummy sensor driver */ +#define SDL_SENSOR_DUMMY 1 + +/* Enable various shared object loading systems */ +#define SDL_LOADSO_WINDOWS 1 + +/* Enable various threading systems */ +#define SDL_THREAD_WINDOWS 1 + +/* Enable various timer systems */ +#define SDL_TIMER_WINDOWS 1 + +/* Enable various video drivers */ +#define SDL_VIDEO_DRIVER_DUMMY 1 +#define SDL_VIDEO_DRIVER_WINDOWS 1 + +#ifndef SDL_VIDEO_RENDER_D3D +#define SDL_VIDEO_RENDER_D3D 1 +#endif +#ifndef SDL_VIDEO_RENDER_D3D11 +#define SDL_VIDEO_RENDER_D3D11 0 +#endif + +/* Enable OpenGL support */ +#ifndef SDL_VIDEO_OPENGL +#define SDL_VIDEO_OPENGL 1 +#endif +#ifndef SDL_VIDEO_OPENGL_WGL +#define SDL_VIDEO_OPENGL_WGL 1 +#endif +#ifndef SDL_VIDEO_RENDER_OGL +#define SDL_VIDEO_RENDER_OGL 1 +#endif +#ifndef SDL_VIDEO_RENDER_OGL_ES2 +#define SDL_VIDEO_RENDER_OGL_ES2 1 +#endif +#ifndef SDL_VIDEO_OPENGL_ES2 +#define SDL_VIDEO_OPENGL_ES2 1 +#endif +#ifndef SDL_VIDEO_OPENGL_EGL +#define SDL_VIDEO_OPENGL_EGL 1 +#endif + +/* Enable Vulkan support */ +#define SDL_VIDEO_VULKAN 1 + +/* Enable system power support */ +#define SDL_POWER_WINDOWS 1 + +/* Enable filesystem support */ +#define SDL_FILESYSTEM_WINDOWS 1 + +/* Enable assembly routines (Win64 doesn't have inline asm) */ +#ifndef _WIN64 +#define SDL_ASSEMBLY_ROUTINES 1 +#endif + +#endif /* SDL_config_windows_h_ */ diff --git a/third-party/sdl2/include/SDL_config.h.cmake b/third-party/sdl2/include/SDL_config.h.cmake new file mode 100644 index 0000000..c57266c --- /dev/null +++ b/third-party/sdl2/include/SDL_config.h.cmake @@ -0,0 +1,445 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2017 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_config_h_ +#define SDL_config_h_ + +/** + * \file SDL_config.h.in + * + * This is a set of defines to configure the SDL features + */ + +/* General platform specific identifiers */ +#include "SDL_platform.h" + +/* C language features */ +#cmakedefine const @HAVE_CONST@ +#cmakedefine inline @HAVE_INLINE@ +#cmakedefine volatile @HAVE_VOLATILE@ + +/* C datatypes */ +/* Define SIZEOF_VOIDP for 64/32 architectures */ +#ifdef __LP64__ +#define SIZEOF_VOIDP 8 +#else +#define SIZEOF_VOIDP 4 +#endif + +#cmakedefine HAVE_GCC_ATOMICS @HAVE_GCC_ATOMICS@ +#cmakedefine HAVE_GCC_SYNC_LOCK_TEST_AND_SET @HAVE_GCC_SYNC_LOCK_TEST_AND_SET@ + +#cmakedefine HAVE_D3D_H @HAVE_D3D_H@ +#cmakedefine HAVE_D3D11_H @HAVE_D3D11_H@ +#cmakedefine HAVE_DDRAW_H @HAVE_DDRAW_H@ +#cmakedefine HAVE_DSOUND_H @HAVE_DSOUND_H@ +#cmakedefine HAVE_DINPUT_H @HAVE_DINPUT_H@ +#cmakedefine HAVE_XAUDIO2_H @HAVE_XAUDIO2_H@ +#cmakedefine HAVE_XINPUT_H @HAVE_XINPUT_H@ +#cmakedefine HAVE_DXGI_H @HAVE_DXGI_H@ +#cmakedefine HAVE_XINPUT_GAMEPAD_EX @HAVE_XINPUT_GAMEPAD_EX@ +#cmakedefine HAVE_XINPUT_STATE_EX @HAVE_XINPUT_STATE_EX@ + +/* Comment this if you want to build without any C library requirements */ +#cmakedefine HAVE_LIBC 1 +#if HAVE_LIBC + +/* Useful headers */ +#cmakedefine HAVE_ALLOCA_H 1 +#cmakedefine HAVE_SYS_TYPES_H 1 +#cmakedefine HAVE_STDIO_H 1 +#cmakedefine STDC_HEADERS 1 +#cmakedefine HAVE_STDLIB_H 1 +#cmakedefine HAVE_STDARG_H 1 +#cmakedefine HAVE_MALLOC_H 1 +#cmakedefine HAVE_MEMORY_H 1 +#cmakedefine HAVE_STRING_H 1 +#cmakedefine HAVE_STRINGS_H 1 +#cmakedefine HAVE_WCHAR_H 1 +#cmakedefine HAVE_INTTYPES_H 1 +#cmakedefine HAVE_STDINT_H 1 +#cmakedefine HAVE_CTYPE_H 1 +#cmakedefine HAVE_MATH_H 1 +#cmakedefine HAVE_ICONV_H 1 +#cmakedefine HAVE_SIGNAL_H 1 +#cmakedefine HAVE_ALTIVEC_H 1 +#cmakedefine HAVE_PTHREAD_NP_H 1 +#cmakedefine HAVE_LIBUDEV_H 1 +#cmakedefine HAVE_DBUS_DBUS_H 1 +#cmakedefine HAVE_IBUS_IBUS_H 1 +#cmakedefine HAVE_FCITX_FRONTEND_H 1 +#cmakedefine HAVE_LIBSAMPLERATE_H 1 + +/* C library functions */ +#cmakedefine HAVE_MALLOC 1 +#cmakedefine HAVE_CALLOC 1 +#cmakedefine HAVE_REALLOC 1 +#cmakedefine HAVE_FREE 1 +#cmakedefine HAVE_ALLOCA 1 +#ifndef __WIN32__ /* Don't use C runtime versions of these on Windows */ +#cmakedefine HAVE_GETENV 1 +#cmakedefine HAVE_SETENV 1 +#cmakedefine HAVE_PUTENV 1 +#cmakedefine HAVE_UNSETENV 1 +#endif +#cmakedefine HAVE_QSORT 1 +#cmakedefine HAVE_ABS 1 +#cmakedefine HAVE_BCOPY 1 +#cmakedefine HAVE_MEMSET 1 +#cmakedefine HAVE_MEMCPY 1 +#cmakedefine HAVE_MEMMOVE 1 +#cmakedefine HAVE_MEMCMP 1 +#cmakedefine HAVE_WCSLEN 1 +#cmakedefine HAVE_WCSLCPY 1 +#cmakedefine HAVE_WCSLCAT 1 +#cmakedefine HAVE_WCSCMP 1 +#cmakedefine HAVE_STRLEN 1 +#cmakedefine HAVE_STRLCPY 1 +#cmakedefine HAVE_STRLCAT 1 +#cmakedefine HAVE_STRDUP 1 +#cmakedefine HAVE__STRREV 1 +#cmakedefine HAVE__STRUPR 1 +#cmakedefine HAVE__STRLWR 1 +#cmakedefine HAVE_INDEX 1 +#cmakedefine HAVE_RINDEX 1 +#cmakedefine HAVE_STRCHR 1 +#cmakedefine HAVE_STRRCHR 1 +#cmakedefine HAVE_STRSTR 1 +#cmakedefine HAVE_ITOA 1 +#cmakedefine HAVE__LTOA 1 +#cmakedefine HAVE__UITOA 1 +#cmakedefine HAVE__ULTOA 1 +#cmakedefine HAVE_STRTOL 1 +#cmakedefine HAVE_STRTOUL 1 +#cmakedefine HAVE__I64TOA 1 +#cmakedefine HAVE__UI64TOA 1 +#cmakedefine HAVE_STRTOLL 1 +#cmakedefine HAVE_STRTOULL 1 +#cmakedefine HAVE_STRTOD 1 +#cmakedefine HAVE_ATOI 1 +#cmakedefine HAVE_ATOF 1 +#cmakedefine HAVE_STRCMP 1 +#cmakedefine HAVE_STRNCMP 1 +#cmakedefine HAVE__STRICMP 1 +#cmakedefine HAVE_STRCASECMP 1 +#cmakedefine HAVE__STRNICMP 1 +#cmakedefine HAVE_STRNCASECMP 1 +#cmakedefine HAVE_VSSCANF 1 +#cmakedefine HAVE_VSNPRINTF 1 +#cmakedefine HAVE_M_PI 1 +#cmakedefine HAVE_ATAN 1 +#cmakedefine HAVE_ATAN2 1 +#cmakedefine HAVE_ACOS 1 +#cmakedefine HAVE_ASIN 1 +#cmakedefine HAVE_CEIL 1 +#cmakedefine HAVE_COPYSIGN 1 +#cmakedefine HAVE_COS 1 +#cmakedefine HAVE_COSF 1 +#cmakedefine HAVE_FABS 1 +#cmakedefine HAVE_FLOOR 1 +#cmakedefine HAVE_LOG 1 +#cmakedefine HAVE_POW 1 +#cmakedefine HAVE_SCALBN 1 +#cmakedefine HAVE_SIN 1 +#cmakedefine HAVE_SINF 1 +#cmakedefine HAVE_SQRT 1 +#cmakedefine HAVE_SQRTF 1 +#cmakedefine HAVE_TAN 1 +#cmakedefine HAVE_TANF 1 +#cmakedefine HAVE_FOPEN64 1 +#cmakedefine HAVE_FSEEKO 1 +#cmakedefine HAVE_FSEEKO64 1 +#cmakedefine HAVE_SIGACTION 1 +#cmakedefine HAVE_SA_SIGACTION 1 +#cmakedefine HAVE_SETJMP 1 +#cmakedefine HAVE_NANOSLEEP 1 +#cmakedefine HAVE_SYSCONF 1 +#cmakedefine HAVE_SYSCTLBYNAME 1 +#cmakedefine HAVE_CLOCK_GETTIME 1 +#cmakedefine HAVE_GETPAGESIZE 1 +#cmakedefine HAVE_MPROTECT 1 +#cmakedefine HAVE_ICONV 1 +#cmakedefine HAVE_PTHREAD_SETNAME_NP 1 +#cmakedefine HAVE_PTHREAD_SET_NAME_NP 1 +#cmakedefine HAVE_SEM_TIMEDWAIT 1 +#cmakedefine HAVE_GETAUXVAL 1 +#cmakedefine HAVE_POLL 1 + +#elif __WIN32__ +#cmakedefine HAVE_STDARG_H 1 +#cmakedefine HAVE_STDDEF_H 1 +#else +/* We may need some replacement for stdarg.h here */ +#include +#endif /* HAVE_LIBC */ + +/* SDL internal assertion support */ +#cmakedefine SDL_DEFAULT_ASSERT_LEVEL @SDL_DEFAULT_ASSERT_LEVEL@ + +/* Allow disabling of core subsystems */ +#cmakedefine SDL_ATOMIC_DISABLED @SDL_ATOMIC_DISABLED@ +#cmakedefine SDL_AUDIO_DISABLED @SDL_AUDIO_DISABLED@ +#cmakedefine SDL_CPUINFO_DISABLED @SDL_CPUINFO_DISABLED@ +#cmakedefine SDL_EVENTS_DISABLED @SDL_EVENTS_DISABLED@ +#cmakedefine SDL_FILE_DISABLED @SDL_FILE_DISABLED@ +#cmakedefine SDL_JOYSTICK_DISABLED @SDL_JOYSTICK_DISABLED@ +#cmakedefine SDL_HAPTIC_DISABLED @SDL_HAPTIC_DISABLED@ +#cmakedefine SDL_LOADSO_DISABLED @SDL_LOADSO_DISABLED@ +#cmakedefine SDL_RENDER_DISABLED @SDL_RENDER_DISABLED@ +#cmakedefine SDL_THREADS_DISABLED @SDL_THREADS_DISABLED@ +#cmakedefine SDL_TIMERS_DISABLED @SDL_TIMERS_DISABLED@ +#cmakedefine SDL_VIDEO_DISABLED @SDL_VIDEO_DISABLED@ +#cmakedefine SDL_POWER_DISABLED @SDL_POWER_DISABLED@ +#cmakedefine SDL_FILESYSTEM_DISABLED @SDL_FILESYSTEM_DISABLED@ + +/* Enable various audio drivers */ +#cmakedefine SDL_AUDIO_DRIVER_ALSA @SDL_AUDIO_DRIVER_ALSA@ +#cmakedefine SDL_AUDIO_DRIVER_ALSA_DYNAMIC @SDL_AUDIO_DRIVER_ALSA_DYNAMIC@ +#cmakedefine SDL_AUDIO_DRIVER_ANDROID @SDL_AUDIO_DRIVER_ANDROID@ +#cmakedefine SDL_AUDIO_DRIVER_ARTS @SDL_AUDIO_DRIVER_ARTS@ +#cmakedefine SDL_AUDIO_DRIVER_ARTS_DYNAMIC @SDL_AUDIO_DRIVER_ARTS_DYNAMIC@ +#cmakedefine SDL_AUDIO_DRIVER_COREAUDIO @SDL_AUDIO_DRIVER_COREAUDIO@ +#cmakedefine SDL_AUDIO_DRIVER_DISK @SDL_AUDIO_DRIVER_DISK@ +#cmakedefine SDL_AUDIO_DRIVER_DSOUND @SDL_AUDIO_DRIVER_DSOUND@ +#cmakedefine SDL_AUDIO_DRIVER_DUMMY @SDL_AUDIO_DRIVER_DUMMY@ +#cmakedefine SDL_AUDIO_DRIVER_EMSCRIPTEN @SDL_AUDIO_DRIVER_EMSCRIPTEN@ +#cmakedefine SDL_AUDIO_DRIVER_ESD @SDL_AUDIO_DRIVER_ESD@ +#cmakedefine SDL_AUDIO_DRIVER_ESD_DYNAMIC @SDL_AUDIO_DRIVER_ESD_DYNAMIC@ +#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND @SDL_AUDIO_DRIVER_FUSIONSOUND@ +#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC @SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC@ +#cmakedefine SDL_AUDIO_DRIVER_HAIKU @SDL_AUDIO_DRIVER_HAIKU@ +#cmakedefine SDL_AUDIO_DRIVER_JACK @SDL_AUDIO_DRIVER_JACK@ +#cmakedefine SDL_AUDIO_DRIVER_JACK_DYNAMIC @SDL_AUDIO_DRIVER_JACK_DYNAMIC@ +#cmakedefine SDL_AUDIO_DRIVER_NAS @SDL_AUDIO_DRIVER_NAS@ +#cmakedefine SDL_AUDIO_DRIVER_NAS_DYNAMIC @SDL_AUDIO_DRIVER_NAS_DYNAMIC@ +#cmakedefine SDL_AUDIO_DRIVER_NETBSD @SDL_AUDIO_DRIVER_NETBSD@ +#cmakedefine SDL_AUDIO_DRIVER_OSS @SDL_AUDIO_DRIVER_OSS@ +#cmakedefine SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H @SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H@ +#cmakedefine SDL_AUDIO_DRIVER_PAUDIO @SDL_AUDIO_DRIVER_PAUDIO@ +#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO @SDL_AUDIO_DRIVER_PULSEAUDIO@ +#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC @SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC@ +#cmakedefine SDL_AUDIO_DRIVER_QSA @SDL_AUDIO_DRIVER_QSA@ +#cmakedefine SDL_AUDIO_DRIVER_SNDIO @SDL_AUDIO_DRIVER_SNDIO@ +#cmakedefine SDL_AUDIO_DRIVER_SNDIO_DYNAMIC @SDL_AUDIO_DRIVER_SNDIO_DYNAMIC@ +#cmakedefine SDL_AUDIO_DRIVER_SUNAUDIO @SDL_AUDIO_DRIVER_SUNAUDIO@ +#cmakedefine SDL_AUDIO_DRIVER_WASAPI @SDL_AUDIO_DRIVER_WASAPI@ +#cmakedefine SDL_AUDIO_DRIVER_WINMM @SDL_AUDIO_DRIVER_WINMM@ +#cmakedefine SDL_AUDIO_DRIVER_XAUDIO2 @SDL_AUDIO_DRIVER_XAUDIO2@ + +/* Enable various input drivers */ +#cmakedefine SDL_INPUT_LINUXEV @SDL_INPUT_LINUXEV@ +#cmakedefine SDL_INPUT_LINUXKD @SDL_INPUT_LINUXKD@ +#cmakedefine SDL_INPUT_TSLIB @SDL_INPUT_TSLIB@ +#cmakedefine SDL_JOYSTICK_ANDROID @SDL_JOYSTICK_ANDROID@ +#cmakedefine SDL_JOYSTICK_HAIKU @SDL_JOYSTICK_HAIKU@ +#cmakedefine SDL_JOYSTICK_DINPUT @SDL_JOYSTICK_DINPUT@ +#cmakedefine SDL_JOYSTICK_XINPUT @SDL_JOYSTICK_XINPUT@ +#cmakedefine SDL_JOYSTICK_DUMMY @SDL_JOYSTICK_DUMMY@ +#cmakedefine SDL_JOYSTICK_IOKIT @SDL_JOYSTICK_IOKIT@ +#cmakedefine SDL_JOYSTICK_MFI @SDL_JOYSTICK_MFI@ +#cmakedefine SDL_JOYSTICK_LINUX @SDL_JOYSTICK_LINUX@ +#cmakedefine SDL_JOYSTICK_WINMM @SDL_JOYSTICK_WINMM@ +#cmakedefine SDL_JOYSTICK_USBHID @SDL_JOYSTICK_USBHID@ +#cmakedefine SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H @SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H@ +#cmakedefine SDL_JOYSTICK_EMSCRIPTEN @SDL_JOYSTICK_EMSCRIPTEN@ +#cmakedefine SDL_HAPTIC_DUMMY @SDL_HAPTIC_DUMMY@ +#cmakedefine SDL_HAPTIC_LINUX @SDL_HAPTIC_LINUX@ +#cmakedefine SDL_HAPTIC_IOKIT @SDL_HAPTIC_IOKIT@ +#cmakedefine SDL_HAPTIC_DINPUT @SDL_HAPTIC_DINPUT@ +#cmakedefine SDL_HAPTIC_XINPUT @SDL_HAPTIC_XINPUT@ +#cmakedefine SDL_HAPTIC_ANDROID @SDL_HAPTIC_ANDROID@ + +/* Enable various shared object loading systems */ +#cmakedefine SDL_LOADSO_DLOPEN @SDL_LOADSO_DLOPEN@ +#cmakedefine SDL_LOADSO_DUMMY @SDL_LOADSO_DUMMY@ +#cmakedefine SDL_LOADSO_LDG @SDL_LOADSO_LDG@ +#cmakedefine SDL_LOADSO_WINDOWS @SDL_LOADSO_WINDOWS@ + +/* Enable various threading systems */ +#cmakedefine SDL_THREAD_PTHREAD @SDL_THREAD_PTHREAD@ +#cmakedefine SDL_THREAD_PTHREAD_RECURSIVE_MUTEX @SDL_THREAD_PTHREAD_RECURSIVE_MUTEX@ +#cmakedefine SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP @SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP@ +#cmakedefine SDL_THREAD_WINDOWS @SDL_THREAD_WINDOWS@ + +/* Enable various timer systems */ +#cmakedefine SDL_TIMER_HAIKU @SDL_TIMER_HAIKU@ +#cmakedefine SDL_TIMER_DUMMY @SDL_TIMER_DUMMY@ +#cmakedefine SDL_TIMER_UNIX @SDL_TIMER_UNIX@ +#cmakedefine SDL_TIMER_WINDOWS @SDL_TIMER_WINDOWS@ +#cmakedefine SDL_TIMER_WINCE @SDL_TIMER_WINCE@ + +/* Enable various video drivers */ +#cmakedefine SDL_VIDEO_DRIVER_ANDROID @SDL_VIDEO_DRIVER_ANDROID@ +#cmakedefine SDL_VIDEO_DRIVER_HAIKU @SDL_VIDEO_DRIVER_HAIKU@ +#cmakedefine SDL_VIDEO_DRIVER_COCOA @SDL_VIDEO_DRIVER_COCOA@ +#cmakedefine SDL_VIDEO_DRIVER_DIRECTFB @SDL_VIDEO_DRIVER_DIRECTFB@ +#cmakedefine SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC @SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC@ +#cmakedefine SDL_VIDEO_DRIVER_DUMMY @SDL_VIDEO_DRIVER_DUMMY@ +#cmakedefine SDL_VIDEO_DRIVER_WINDOWS @SDL_VIDEO_DRIVER_WINDOWS@ +#cmakedefine SDL_VIDEO_DRIVER_WAYLAND @SDL_VIDEO_DRIVER_WAYLAND@ +#cmakedefine SDL_VIDEO_DRIVER_RPI @SDL_VIDEO_DRIVER_RPI@ +#cmakedefine SDL_VIDEO_DRIVER_VIVANTE @SDL_VIDEO_DRIVER_VIVANTE@ +#cmakedefine SDL_VIDEO_DRIVER_VIVANTE_VDK @SDL_VIDEO_DRIVER_VIVANTE_VDK@ + +#cmakedefine SDL_VIDEO_DRIVER_KMSDRM @SDL_VIDEO_DRIVER_KMSDRM@ +#cmakedefine SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC @SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC@ +#cmakedefine SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM @SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM@ + +#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH @SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH@ +#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC@ +#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL@ +#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR@ +#cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON@ + +#cmakedefine SDL_VIDEO_DRIVER_MIR @SDL_VIDEO_DRIVER_MIR@ +#cmakedefine SDL_VIDEO_DRIVER_MIR_DYNAMIC @SDL_VIDEO_DRIVER_MIR_DYNAMIC@ +#cmakedefine SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON @SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON@ +#cmakedefine SDL_VIDEO_DRIVER_EMSCRIPTEN @SDL_VIDEO_DRIVER_EMSCRIPTEN@ +#cmakedefine SDL_VIDEO_DRIVER_X11 @SDL_VIDEO_DRIVER_X11@ +#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC @SDL_VIDEO_DRIVER_X11_DYNAMIC@ +#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT @SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT@ +#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR @SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR@ +#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA @SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA@ +#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 @SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2@ +#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR @SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR@ +#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS @SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS@ +#cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE @SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE@ +#cmakedefine SDL_VIDEO_DRIVER_X11_XCURSOR @SDL_VIDEO_DRIVER_X11_XCURSOR@ +#cmakedefine SDL_VIDEO_DRIVER_X11_XDBE @SDL_VIDEO_DRIVER_X11_XDBE@ +#cmakedefine SDL_VIDEO_DRIVER_X11_XINERAMA @SDL_VIDEO_DRIVER_X11_XINERAMA@ +#cmakedefine SDL_VIDEO_DRIVER_X11_XINPUT2 @SDL_VIDEO_DRIVER_X11_XINPUT2@ +#cmakedefine SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH @SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH@ +#cmakedefine SDL_VIDEO_DRIVER_X11_XRANDR @SDL_VIDEO_DRIVER_X11_XRANDR@ +#cmakedefine SDL_VIDEO_DRIVER_X11_XSCRNSAVER @SDL_VIDEO_DRIVER_X11_XSCRNSAVER@ +#cmakedefine SDL_VIDEO_DRIVER_X11_XSHAPE @SDL_VIDEO_DRIVER_X11_XSHAPE@ +#cmakedefine SDL_VIDEO_DRIVER_X11_XVIDMODE @SDL_VIDEO_DRIVER_X11_XVIDMODE@ +#cmakedefine SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS @SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS@ +#cmakedefine SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY @SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY@ +#cmakedefine SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM @SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM@ + +#cmakedefine SDL_VIDEO_RENDER_D3D @SDL_VIDEO_RENDER_D3D@ +#cmakedefine SDL_VIDEO_RENDER_D3D11 @SDL_VIDEO_RENDER_D3D11@ +#cmakedefine SDL_VIDEO_RENDER_OGL @SDL_VIDEO_RENDER_OGL@ +#cmakedefine SDL_VIDEO_RENDER_OGL_ES @SDL_VIDEO_RENDER_OGL_ES@ +#cmakedefine SDL_VIDEO_RENDER_OGL_ES2 @SDL_VIDEO_RENDER_OGL_ES2@ +#cmakedefine SDL_VIDEO_RENDER_DIRECTFB @SDL_VIDEO_RENDER_DIRECTFB@ + +/* Enable OpenGL support */ +#cmakedefine SDL_VIDEO_OPENGL @SDL_VIDEO_OPENGL@ +#cmakedefine SDL_VIDEO_OPENGL_ES @SDL_VIDEO_OPENGL_ES@ +#cmakedefine SDL_VIDEO_OPENGL_ES2 @SDL_VIDEO_OPENGL_ES2@ +#cmakedefine SDL_VIDEO_OPENGL_BGL @SDL_VIDEO_OPENGL_BGL@ +#cmakedefine SDL_VIDEO_OPENGL_CGL @SDL_VIDEO_OPENGL_CGL@ +#cmakedefine SDL_VIDEO_OPENGL_GLX @SDL_VIDEO_OPENGL_GLX@ +#cmakedefine SDL_VIDEO_OPENGL_WGL @SDL_VIDEO_OPENGL_WGL@ +#cmakedefine SDL_VIDEO_OPENGL_EGL @SDL_VIDEO_OPENGL_EGL@ +#cmakedefine SDL_VIDEO_OPENGL_OSMESA @SDL_VIDEO_OPENGL_OSMESA@ +#cmakedefine SDL_VIDEO_OPENGL_OSMESA_DYNAMIC @SDL_VIDEO_OPENGL_OSMESA_DYNAMIC@ + +/* Enable Vulkan support */ +#cmakedefine SDL_VIDEO_VULKAN @SDL_VIDEO_VULKAN@ + +/* Enable system power support */ +#cmakedefine SDL_POWER_ANDROID @SDL_POWER_ANDROID@ +#cmakedefine SDL_POWER_LINUX @SDL_POWER_LINUX@ +#cmakedefine SDL_POWER_WINDOWS @SDL_POWER_WINDOWS@ +#cmakedefine SDL_POWER_MACOSX @SDL_POWER_MACOSX@ +#cmakedefine SDL_POWER_HAIKU @SDL_POWER_HAIKU@ +#cmakedefine SDL_POWER_EMSCRIPTEN @SDL_POWER_EMSCRIPTEN@ +#cmakedefine SDL_POWER_HARDWIRED @SDL_POWER_HARDWIRED@ + +/* Enable system filesystem support */ +#cmakedefine SDL_FILESYSTEM_ANDROID @SDL_FILESYSTEM_ANDROID@ +#cmakedefine SDL_FILESYSTEM_HAIKU @SDL_FILESYSTEM_HAIKU@ +#cmakedefine SDL_FILESYSTEM_COCOA @SDL_FILESYSTEM_COCOA@ +#cmakedefine SDL_FILESYSTEM_DUMMY @SDL_FILESYSTEM_DUMMY@ +#cmakedefine SDL_FILESYSTEM_UNIX @SDL_FILESYSTEM_UNIX@ +#cmakedefine SDL_FILESYSTEM_WINDOWS @SDL_FILESYSTEM_WINDOWS@ +#cmakedefine SDL_FILESYSTEM_EMSCRIPTEN @SDL_FILESYSTEM_EMSCRIPTEN@ + +/* Enable assembly routines */ +#cmakedefine SDL_ASSEMBLY_ROUTINES @SDL_ASSEMBLY_ROUTINES@ +#cmakedefine SDL_ALTIVEC_BLITTERS @SDL_ALTIVEC_BLITTERS@ + +/* Enable dynamic libsamplerate support */ +#cmakedefine SDL_LIBSAMPLERATE_DYNAMIC @SDL_LIBSAMPLERATE_DYNAMIC@ + +/* Platform specific definitions */ +#if !defined(__WIN32__) +# if !defined(_STDINT_H_) && !defined(_STDINT_H) && !defined(HAVE_STDINT_H) && !defined(_HAVE_STDINT_H) +typedef unsigned int size_t; +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef signed short int16_t; +typedef unsigned short uint16_t; +typedef signed int int32_t; +typedef unsigned int uint32_t; +typedef signed long long int64_t; +typedef unsigned long long uint64_t; +typedef unsigned long uintptr_t; +# endif /* if (stdint.h isn't available) */ +#else /* __WIN32__ */ +# if !defined(_STDINT_H_) && !defined(HAVE_STDINT_H) && !defined(_HAVE_STDINT_H) +# if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__) +#define HAVE_STDINT_H 1 +# elif defined(_MSC_VER) +typedef signed __int8 int8_t; +typedef unsigned __int8 uint8_t; +typedef signed __int16 int16_t; +typedef unsigned __int16 uint16_t; +typedef signed __int32 int32_t; +typedef unsigned __int32 uint32_t; +typedef signed __int64 int64_t; +typedef unsigned __int64 uint64_t; +# ifndef _UINTPTR_T_DEFINED +# ifdef _WIN64 +typedef unsigned __int64 uintptr_t; +# else +typedef unsigned int uintptr_t; +# endif +#define _UINTPTR_T_DEFINED +# endif +/* Older Visual C++ headers don't have the Win64-compatible typedefs... */ +# if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR))) +#define DWORD_PTR DWORD +# endif +# if ((_MSC_VER <= 1200) && (!defined(LONG_PTR))) +#define LONG_PTR LONG +# endif +# else /* !__GNUC__ && !_MSC_VER */ +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef signed short int16_t; +typedef unsigned short uint16_t; +typedef signed int int32_t; +typedef unsigned int uint32_t; +typedef signed long long int64_t; +typedef unsigned long long uint64_t; +# ifndef _SIZE_T_DEFINED_ +#define _SIZE_T_DEFINED_ +typedef unsigned int size_t; +# endif +typedef unsigned int uintptr_t; +# endif /* __GNUC__ || _MSC_VER */ +# endif /* !_STDINT_H_ && !HAVE_STDINT_H */ +#endif /* __WIN32__ */ + +#endif /* SDL_config_h_ */ diff --git a/third-party/sdl2/include/SDL_config.h.in b/third-party/sdl2/include/SDL_config.h.in new file mode 100644 index 0000000..8b3d208 --- /dev/null +++ b/third-party/sdl2/include/SDL_config.h.in @@ -0,0 +1,389 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2017 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_config_h_ +#define SDL_config_h_ + +/** + * \file SDL_config.h.in + * + * This is a set of defines to configure the SDL features + */ + +/* General platform specific identifiers */ +#include "SDL_platform.h" + +/* Make sure that this isn't included by Visual C++ */ +#ifdef _MSC_VER +#error You should run hg revert SDL_config.h +#endif + +/* C language features */ +#undef const +#undef inline +#undef volatile + +/* C datatypes */ +#ifdef __LP64__ +#define SIZEOF_VOIDP 8 +#else +#define SIZEOF_VOIDP 4 +#endif +#undef HAVE_GCC_ATOMICS +#undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET + +#undef HAVE_DDRAW_H +#undef HAVE_DINPUT_H +#undef HAVE_DSOUND_H +#undef HAVE_DXGI_H +#undef HAVE_XINPUT_H +#undef HAVE_XINPUT_GAMEPAD_EX +#undef HAVE_XINPUT_STATE_EX + +/* Comment this if you want to build without any C library requirements */ +#undef HAVE_LIBC +#if HAVE_LIBC + +/* Useful headers */ +#undef HAVE_ALLOCA_H +#undef HAVE_SYS_TYPES_H +#undef HAVE_STDIO_H +#undef STDC_HEADERS +#undef HAVE_STDLIB_H +#undef HAVE_STDARG_H +#undef HAVE_MALLOC_H +#undef HAVE_MEMORY_H +#undef HAVE_STRING_H +#undef HAVE_STRINGS_H +#undef HAVE_WCHAR_H +#undef HAVE_INTTYPES_H +#undef HAVE_STDINT_H +#undef HAVE_CTYPE_H +#undef HAVE_MATH_H +#undef HAVE_ICONV_H +#undef HAVE_SIGNAL_H +#undef HAVE_ALTIVEC_H +#undef HAVE_PTHREAD_NP_H +#undef HAVE_LIBUDEV_H +#undef HAVE_DBUS_DBUS_H +#undef HAVE_IBUS_IBUS_H +#undef HAVE_FCITX_FRONTEND_H +#undef HAVE_LIBSAMPLERATE_H + +/* C library functions */ +#undef HAVE_MALLOC +#undef HAVE_CALLOC +#undef HAVE_REALLOC +#undef HAVE_FREE +#undef HAVE_ALLOCA +#ifndef __WIN32__ /* Don't use C runtime versions of these on Windows */ +#undef HAVE_GETENV +#undef HAVE_SETENV +#undef HAVE_PUTENV +#undef HAVE_UNSETENV +#endif +#undef HAVE_QSORT +#undef HAVE_ABS +#undef HAVE_BCOPY +#undef HAVE_MEMSET +#undef HAVE_MEMCPY +#undef HAVE_MEMMOVE +#undef HAVE_MEMCMP +#undef HAVE_WCSLEN +#undef HAVE_WCSLCPY +#undef HAVE_WCSLCAT +#undef HAVE_WCSCMP +#undef HAVE_STRLEN +#undef HAVE_STRLCPY +#undef HAVE_STRLCAT +#undef HAVE_STRDUP +#undef HAVE__STRREV +#undef HAVE__STRUPR +#undef HAVE__STRLWR +#undef HAVE_INDEX +#undef HAVE_RINDEX +#undef HAVE_STRCHR +#undef HAVE_STRRCHR +#undef HAVE_STRSTR +#undef HAVE_ITOA +#undef HAVE__LTOA +#undef HAVE__UITOA +#undef HAVE__ULTOA +#undef HAVE_STRTOL +#undef HAVE_STRTOUL +#undef HAVE__I64TOA +#undef HAVE__UI64TOA +#undef HAVE_STRTOLL +#undef HAVE_STRTOULL +#undef HAVE_STRTOD +#undef HAVE_ATOI +#undef HAVE_ATOF +#undef HAVE_STRCMP +#undef HAVE_STRNCMP +#undef HAVE__STRICMP +#undef HAVE_STRCASECMP +#undef HAVE__STRNICMP +#undef HAVE_STRNCASECMP +#undef HAVE_SSCANF +#undef HAVE_VSSCANF +#undef HAVE_SNPRINTF +#undef HAVE_VSNPRINTF +#undef HAVE_M_PI +#undef HAVE_ATAN +#undef HAVE_ATAN2 +#undef HAVE_ACOS +#undef HAVE_ASIN +#undef HAVE_CEIL +#undef HAVE_COPYSIGN +#undef HAVE_COS +#undef HAVE_COSF +#undef HAVE_FABS +#undef HAVE_FLOOR +#undef HAVE_LOG +#undef HAVE_POW +#undef HAVE_SCALBN +#undef HAVE_SIN +#undef HAVE_SINF +#undef HAVE_SQRT +#undef HAVE_SQRTF +#undef HAVE_TAN +#undef HAVE_TANF +#undef HAVE_FOPEN64 +#undef HAVE_FSEEKO +#undef HAVE_FSEEKO64 +#undef HAVE_SIGACTION +#undef HAVE_SA_SIGACTION +#undef HAVE_SETJMP +#undef HAVE_NANOSLEEP +#undef HAVE_SYSCONF +#undef HAVE_SYSCTLBYNAME +#undef HAVE_CLOCK_GETTIME +#undef HAVE_GETPAGESIZE +#undef HAVE_MPROTECT +#undef HAVE_ICONV +#undef HAVE_PTHREAD_SETNAME_NP +#undef HAVE_PTHREAD_SET_NAME_NP +#undef HAVE_SEM_TIMEDWAIT +#undef HAVE_GETAUXVAL +#undef HAVE_POLL + +#else +#define HAVE_STDARG_H 1 +#define HAVE_STDDEF_H 1 +#define HAVE_STDINT_H 1 +#endif /* HAVE_LIBC */ + +/* SDL internal assertion support */ +#undef SDL_DEFAULT_ASSERT_LEVEL + +/* Allow disabling of core subsystems */ +#undef SDL_ATOMIC_DISABLED +#undef SDL_AUDIO_DISABLED +#undef SDL_CPUINFO_DISABLED +#undef SDL_EVENTS_DISABLED +#undef SDL_FILE_DISABLED +#undef SDL_JOYSTICK_DISABLED +#undef SDL_HAPTIC_DISABLED +#undef SDL_LOADSO_DISABLED +#undef SDL_RENDER_DISABLED +#undef SDL_THREADS_DISABLED +#undef SDL_TIMERS_DISABLED +#undef SDL_VIDEO_DISABLED +#undef SDL_POWER_DISABLED +#undef SDL_FILESYSTEM_DISABLED + +/* Enable various audio drivers */ +#undef SDL_AUDIO_DRIVER_ALSA +#undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC +#undef SDL_AUDIO_DRIVER_ANDROID +#undef SDL_AUDIO_DRIVER_ARTS +#undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC +#undef SDL_AUDIO_DRIVER_COREAUDIO +#undef SDL_AUDIO_DRIVER_DISK +#undef SDL_AUDIO_DRIVER_DSOUND +#undef SDL_AUDIO_DRIVER_DUMMY +#undef SDL_AUDIO_DRIVER_EMSCRIPTEN +#undef SDL_AUDIO_DRIVER_ESD +#undef SDL_AUDIO_DRIVER_ESD_DYNAMIC +#undef SDL_AUDIO_DRIVER_FUSIONSOUND +#undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC +#undef SDL_AUDIO_DRIVER_HAIKU +#undef SDL_AUDIO_DRIVER_JACK +#undef SDL_AUDIO_DRIVER_JACK_DYNAMIC +#undef SDL_AUDIO_DRIVER_NACL +#undef SDL_AUDIO_DRIVER_NAS +#undef SDL_AUDIO_DRIVER_NAS_DYNAMIC +#undef SDL_AUDIO_DRIVER_NETBSD +#undef SDL_AUDIO_DRIVER_OSS +#undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H +#undef SDL_AUDIO_DRIVER_PAUDIO +#undef SDL_AUDIO_DRIVER_PULSEAUDIO +#undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC +#undef SDL_AUDIO_DRIVER_QSA +#undef SDL_AUDIO_DRIVER_SNDIO +#undef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC +#undef SDL_AUDIO_DRIVER_SUNAUDIO +#undef SDL_AUDIO_DRIVER_WASAPI +#undef SDL_AUDIO_DRIVER_WINMM +#undef SDL_AUDIO_DRIVER_XAUDIO2 + +/* Enable various input drivers */ +#undef SDL_INPUT_LINUXEV +#undef SDL_INPUT_LINUXKD +#undef SDL_INPUT_TSLIB +#undef SDL_JOYSTICK_HAIKU +#undef SDL_JOYSTICK_DINPUT +#undef SDL_JOYSTICK_XINPUT +#undef SDL_JOYSTICK_DUMMY +#undef SDL_JOYSTICK_IOKIT +#undef SDL_JOYSTICK_LINUX +#undef SDL_JOYSTICK_ANDROID +#undef SDL_JOYSTICK_WINMM +#undef SDL_JOYSTICK_USBHID +#undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H +#undef SDL_JOYSTICK_EMSCRIPTEN +#undef SDL_HAPTIC_DUMMY +#undef SDL_HAPTIC_LINUX +#undef SDL_HAPTIC_IOKIT +#undef SDL_HAPTIC_DINPUT +#undef SDL_HAPTIC_XINPUT + +/* Enable various shared object loading systems */ +#undef SDL_LOADSO_DLOPEN +#undef SDL_LOADSO_DUMMY +#undef SDL_LOADSO_LDG +#undef SDL_LOADSO_WINDOWS + +/* Enable various threading systems */ +#undef SDL_THREAD_PTHREAD +#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX +#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP +#undef SDL_THREAD_WINDOWS + +/* Enable various timer systems */ +#undef SDL_TIMER_HAIKU +#undef SDL_TIMER_DUMMY +#undef SDL_TIMER_UNIX +#undef SDL_TIMER_WINDOWS + +/* Enable various video drivers */ +#undef SDL_VIDEO_DRIVER_HAIKU +#undef SDL_VIDEO_DRIVER_COCOA +#undef SDL_VIDEO_DRIVER_DIRECTFB +#undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC +#undef SDL_VIDEO_DRIVER_DUMMY +#undef SDL_VIDEO_DRIVER_WINDOWS +#undef SDL_VIDEO_DRIVER_WAYLAND +#undef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH +#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC +#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL +#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR +#undef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON +#undef SDL_VIDEO_DRIVER_MIR +#undef SDL_VIDEO_DRIVER_MIR_DYNAMIC +#undef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON +#undef SDL_VIDEO_DRIVER_X11 +#undef SDL_VIDEO_DRIVER_RPI +#undef SDL_VIDEO_DRIVER_KMSDRM +#undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC +#undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM +#undef SDL_VIDEO_DRIVER_ANDROID +#undef SDL_VIDEO_DRIVER_EMSCRIPTEN +#undef SDL_VIDEO_DRIVER_X11_DYNAMIC +#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT +#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR +#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA +#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 +#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR +#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS +#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE +#undef SDL_VIDEO_DRIVER_X11_XCURSOR +#undef SDL_VIDEO_DRIVER_X11_XDBE +#undef SDL_VIDEO_DRIVER_X11_XINERAMA +#undef SDL_VIDEO_DRIVER_X11_XINPUT2 +#undef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH +#undef SDL_VIDEO_DRIVER_X11_XRANDR +#undef SDL_VIDEO_DRIVER_X11_XSCRNSAVER +#undef SDL_VIDEO_DRIVER_X11_XSHAPE +#undef SDL_VIDEO_DRIVER_X11_XVIDMODE +#undef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS +#undef SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY +#undef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM +#undef SDL_VIDEO_DRIVER_NACL +#undef SDL_VIDEO_DRIVER_VIVANTE +#undef SDL_VIDEO_DRIVER_VIVANTE_VDK +#undef SDL_VIDEO_DRIVER_QNX + +#undef SDL_VIDEO_RENDER_D3D +#undef SDL_VIDEO_RENDER_D3D11 +#undef SDL_VIDEO_RENDER_OGL +#undef SDL_VIDEO_RENDER_OGL_ES +#undef SDL_VIDEO_RENDER_OGL_ES2 +#undef SDL_VIDEO_RENDER_DIRECTFB + +/* Enable OpenGL support */ +#undef SDL_VIDEO_OPENGL +#undef SDL_VIDEO_OPENGL_ES +#undef SDL_VIDEO_OPENGL_ES2 +#undef SDL_VIDEO_OPENGL_BGL +#undef SDL_VIDEO_OPENGL_CGL +#undef SDL_VIDEO_OPENGL_EGL +#undef SDL_VIDEO_OPENGL_GLX +#undef SDL_VIDEO_OPENGL_WGL +#undef SDL_VIDEO_OPENGL_OSMESA +#undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC + +/* Enable Vulkan support */ +#undef SDL_VIDEO_VULKAN + +/* Enable system power support */ +#undef SDL_POWER_LINUX +#undef SDL_POWER_WINDOWS +#undef SDL_POWER_MACOSX +#undef SDL_POWER_HAIKU +#undef SDL_POWER_ANDROID +#undef SDL_POWER_EMSCRIPTEN +#undef SDL_POWER_HARDWIRED + +/* Enable system filesystem support */ +#undef SDL_FILESYSTEM_HAIKU +#undef SDL_FILESYSTEM_COCOA +#undef SDL_FILESYSTEM_DUMMY +#undef SDL_FILESYSTEM_UNIX +#undef SDL_FILESYSTEM_WINDOWS +#undef SDL_FILESYSTEM_NACL +#undef SDL_FILESYSTEM_ANDROID +#undef SDL_FILESYSTEM_EMSCRIPTEN + +/* Enable assembly routines */ +#undef SDL_ASSEMBLY_ROUTINES +#undef SDL_ALTIVEC_BLITTERS + +/* Enable ime support */ +#undef SDL_USE_IME + +/* Enable dynamic udev support */ +#undef SDL_UDEV_DYNAMIC + +/* Enable dynamic libsamplerate support */ +#undef SDL_LIBSAMPLERATE_DYNAMIC + +#endif /* SDL_config_h_ */ diff --git a/third-party/sdl2/include/SDL_config_android.h b/third-party/sdl2/include/SDL_config_android.h new file mode 100644 index 0000000..361bad8 --- /dev/null +++ b/third-party/sdl2/include/SDL_config_android.h @@ -0,0 +1,157 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2017 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_config_android_h_ +#define SDL_config_android_h_ +#define SDL_config_h_ + +#include "SDL_platform.h" + +/** + * \file SDL_config_android.h + * + * This is a configuration that can be used to build SDL for Android + */ + +#include + +#define HAVE_GCC_ATOMICS 1 + +#define HAVE_ALLOCA_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STRING_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_SIGNAL_H 1 + +/* C library functions */ +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_GETENV 1 +#define HAVE_SETENV 1 +#define HAVE_PUTENV 1 +#define HAVE_SETENV 1 +#define HAVE_UNSETENV 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +#define HAVE_STRLCPY 1 +#define HAVE_STRLCAT 1 +#define HAVE_STRDUP 1 +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRNCASECMP 1 +#define HAVE_VSSCANF 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_M_PI 1 +#define HAVE_ATAN 1 +#define HAVE_ATAN2 1 +#define HAVE_ACOS 1 +#define HAVE_ASIN 1 +#define HAVE_CEIL 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_LOG 1 +#define HAVE_POW 1 +#define HAVE_SCALBN 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 +#define HAVE_SIGACTION 1 +#define HAVE_SETJMP 1 +#define HAVE_NANOSLEEP 1 +#define HAVE_SYSCONF 1 +#define HAVE_CLOCK_GETTIME 1 + +#define SIZEOF_VOIDP 4 + +/* Enable various audio drivers */ +#define SDL_AUDIO_DRIVER_ANDROID 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 + +/* Enable various input drivers */ +#define SDL_JOYSTICK_ANDROID 1 +#define SDL_HAPTIC_ANDROID 1 + +/* Enable various shared object loading systems */ +#define SDL_LOADSO_DLOPEN 1 + +/* Enable various threading systems */ +#define SDL_THREAD_PTHREAD 1 +#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 + +/* Enable various timer systems */ +#define SDL_TIMER_UNIX 1 + +/* Enable various video drivers */ +#define SDL_VIDEO_DRIVER_ANDROID 1 + +/* Enable OpenGL ES */ +#define SDL_VIDEO_OPENGL_ES 1 +#define SDL_VIDEO_OPENGL_ES2 1 +#define SDL_VIDEO_OPENGL_EGL 1 +#define SDL_VIDEO_RENDER_OGL_ES 1 +#define SDL_VIDEO_RENDER_OGL_ES2 1 + +/* Enable Vulkan support */ +/* Android does not support Vulkan in native code using the "armeabi" ABI. */ +#if defined(__ARM_ARCH) && __ARM_ARCH < 7 +#define SDL_VIDEO_VULKAN 0 +#else +#define SDL_VIDEO_VULKAN 1 +#endif + +/* Enable system power support */ +#define SDL_POWER_ANDROID 1 + +/* Enable the filesystem driver */ +#define SDL_FILESYSTEM_ANDROID 1 + +#endif /* SDL_config_android_h_ */ diff --git a/third-party/sdl2/include/SDL_config_iphoneos.h b/third-party/sdl2/include/SDL_config_iphoneos.h new file mode 100644 index 0000000..deea030 --- /dev/null +++ b/third-party/sdl2/include/SDL_config_iphoneos.h @@ -0,0 +1,166 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2017 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_config_iphoneos_h_ +#define SDL_config_iphoneos_h_ +#define SDL_config_h_ + +#include "SDL_platform.h" + +#ifdef __LP64__ +#define SIZEOF_VOIDP 8 +#else +#define SIZEOF_VOIDP 4 +#endif + +#define HAVE_GCC_ATOMICS 1 + +#define HAVE_ALLOCA_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STRING_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_SIGNAL_H 1 + +/* C library functions */ +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_GETENV 1 +#define HAVE_SETENV 1 +#define HAVE_PUTENV 1 +#define HAVE_SETENV 1 +#define HAVE_UNSETENV 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +#define HAVE_STRLCPY 1 +#define HAVE_STRLCAT 1 +#define HAVE_STRDUP 1 +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRNCASECMP 1 +#define HAVE_VSSCANF 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_M_PI 1 +#define HAVE_ATAN 1 +#define HAVE_ATAN2 1 +#define HAVE_ACOS 1 +#define HAVE_ASIN 1 +#define HAVE_CEIL 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_LOG 1 +#define HAVE_POW 1 +#define HAVE_SCALBN 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 +#define HAVE_SIGACTION 1 +#define HAVE_SETJMP 1 +#define HAVE_NANOSLEEP 1 +#define HAVE_SYSCONF 1 +#define HAVE_SYSCTLBYNAME 1 + +/* enable iPhone version of Core Audio driver */ +#define SDL_AUDIO_DRIVER_COREAUDIO 1 +/* Enable the dummy audio driver (src/audio/dummy/\*.c) */ +#define SDL_AUDIO_DRIVER_DUMMY 1 + +/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */ +#define SDL_HAPTIC_DUMMY 1 + +/* Enable MFi joystick support */ +#define SDL_JOYSTICK_MFI 1 + +/* Enable Unix style SO loading */ +#define SDL_LOADSO_DLOPEN 1 + +/* Enable various threading systems */ +#define SDL_THREAD_PTHREAD 1 +#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 + +/* Enable various timer systems */ +#define SDL_TIMER_UNIX 1 + +/* Supported video drivers */ +#define SDL_VIDEO_DRIVER_UIKIT 1 +#define SDL_VIDEO_DRIVER_DUMMY 1 + +/* enable OpenGL ES */ +#define SDL_VIDEO_OPENGL_ES2 1 +#define SDL_VIDEO_OPENGL_ES 1 +#define SDL_VIDEO_RENDER_OGL_ES 1 +#define SDL_VIDEO_RENDER_OGL_ES2 1 + +/* Enable Vulkan support */ +#if !TARGET_OS_SIMULATOR && !TARGET_CPU_ARM // Only 64-bit devices have Metal +#define SDL_VIDEO_VULKAN 1 +#else +#define SDL_VIDEO_VULKAN 0 +#endif + +/* Enable system power support */ +#define SDL_POWER_UIKIT 1 + +/* enable iPhone keyboard support */ +#define SDL_IPHONE_KEYBOARD 1 + +/* enable iOS extended launch screen */ +#define SDL_IPHONE_LAUNCHSCREEN 1 + +/* Set max recognized G-force from accelerometer + See src/joystick/uikit/SDL_sysjoystick.m for notes on why this is needed + */ +#define SDL_IPHONE_MAX_GFORCE 5.0 + +/* enable filesystem support */ +#define SDL_FILESYSTEM_COCOA 1 + +#endif /* SDL_config_iphoneos_h_ */ diff --git a/third-party/sdl2/include/SDL_config_macosx.h b/third-party/sdl2/include/SDL_config_macosx.h new file mode 100644 index 0000000..9b09899 --- /dev/null +++ b/third-party/sdl2/include/SDL_config_macosx.h @@ -0,0 +1,197 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2017 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_config_macosx_h_ +#define SDL_config_macosx_h_ +#define SDL_config_h_ + +#include "SDL_platform.h" + +/* This gets us MAC_OS_X_VERSION_MIN_REQUIRED... */ +#include + +/* This is a set of defines to configure the SDL features */ + +#ifdef __LP64__ + #define SIZEOF_VOIDP 8 +#else + #define SIZEOF_VOIDP 4 +#endif + +/* Useful headers */ +#define HAVE_ALLOCA_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STRING_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_SIGNAL_H 1 + +/* C library functions */ +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_GETENV 1 +#define HAVE_SETENV 1 +#define HAVE_PUTENV 1 +#define HAVE_UNSETENV 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +#define HAVE_STRLCPY 1 +#define HAVE_STRLCAT 1 +#define HAVE_STRDUP 1 +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRNCASECMP 1 +#define HAVE_VSSCANF 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_CEIL 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_LOG 1 +#define HAVE_POW 1 +#define HAVE_SCALBN 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 +#define HAVE_SIGACTION 1 +#define HAVE_SETJMP 1 +#define HAVE_NANOSLEEP 1 +#define HAVE_SYSCONF 1 +#define HAVE_SYSCTLBYNAME 1 +#define HAVE_ATAN 1 +#define HAVE_ATAN2 1 +#define HAVE_ACOS 1 +#define HAVE_ASIN 1 + +/* Enable various audio drivers */ +#define SDL_AUDIO_DRIVER_COREAUDIO 1 +#define SDL_AUDIO_DRIVER_DISK 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 + +/* Enable various input drivers */ +#define SDL_JOYSTICK_IOKIT 1 +#define SDL_HAPTIC_IOKIT 1 + +/* Enable various shared object loading systems */ +#define SDL_LOADSO_DLOPEN 1 + +/* Enable various threading systems */ +#define SDL_THREAD_PTHREAD 1 +#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 + +/* Enable various timer systems */ +#define SDL_TIMER_UNIX 1 + +/* Enable various video drivers */ +#define SDL_VIDEO_DRIVER_COCOA 1 +#define SDL_VIDEO_DRIVER_DUMMY 1 +#undef SDL_VIDEO_DRIVER_X11 +#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/usr/X11R6/lib/libXinerama.1.dylib" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/usr/X11R6/lib/libXi.6.dylib" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.1.dylib" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib" +#define SDL_VIDEO_DRIVER_X11_XDBE 1 +#define SDL_VIDEO_DRIVER_X11_XINERAMA 1 +#define SDL_VIDEO_DRIVER_X11_XRANDR 1 +#define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1 +#define SDL_VIDEO_DRIVER_X11_XSHAPE 1 +#define SDL_VIDEO_DRIVER_X11_XVIDMODE 1 +#define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1 + +#ifdef MAC_OS_X_VERSION_10_8 +/* + * No matter the versions targeted, this is the 10.8 or later SDK, so you have + * to use the external Xquartz, which is a more modern Xlib. Previous SDKs + * used an older Xlib. + */ +#define SDL_VIDEO_DRIVER_X11_XINPUT2 1 +#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1 +#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1 +#endif + +#ifndef SDL_VIDEO_RENDER_OGL +#define SDL_VIDEO_RENDER_OGL 1 +#endif + +/* Enable OpenGL support */ +#ifndef SDL_VIDEO_OPENGL +#define SDL_VIDEO_OPENGL 1 +#endif +#ifndef SDL_VIDEO_OPENGL_CGL +#define SDL_VIDEO_OPENGL_CGL 1 +#endif +#ifndef SDL_VIDEO_OPENGL_GLX +#define SDL_VIDEO_OPENGL_GLX 1 +#endif + +/* Enable Vulkan support */ +/* Metal/MoltenVK/Vulkan only supported on 64-bit architectures with 10.11+ */ +#if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100) +#define SDL_VIDEO_VULKAN 1 +#else +#define SDL_VIDEO_VULKAN 0 +#endif + +/* Enable system power support */ +#define SDL_POWER_MACOSX 1 + +/* enable filesystem support */ +#define SDL_FILESYSTEM_COCOA 1 + +/* Enable assembly routines */ +#define SDL_ASSEMBLY_ROUTINES 1 +#ifdef __ppc__ +#define SDL_ALTIVEC_BLITTERS 1 +#endif + +#endif /* SDL_config_macosx_h_ */ diff --git a/third-party/sdl2/include/SDL_config_macosx.h.orig b/third-party/sdl2/include/SDL_config_macosx.h.orig new file mode 100644 index 0000000..f03f1ae --- /dev/null +++ b/third-party/sdl2/include/SDL_config_macosx.h.orig @@ -0,0 +1,197 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2017 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_config_macosx_h_ +#define SDL_config_macosx_h_ +#define SDL_config_h_ + +#include "SDL_platform.h" + +/* This gets us MAC_OS_X_VERSION_MIN_REQUIRED... */ +#include + +/* This is a set of defines to configure the SDL features */ + +#ifdef __LP64__ + #define SIZEOF_VOIDP 8 +#else + #define SIZEOF_VOIDP 4 +#endif + +/* Useful headers */ +#define HAVE_ALLOCA_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STRING_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_SIGNAL_H 1 + +/* C library functions */ +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_GETENV 1 +#define HAVE_SETENV 1 +#define HAVE_PUTENV 1 +#define HAVE_UNSETENV 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +#define HAVE_STRLCPY 1 +#define HAVE_STRLCAT 1 +#define HAVE_STRDUP 1 +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRNCASECMP 1 +#define HAVE_VSSCANF 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_CEIL 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_LOG 1 +#define HAVE_POW 1 +#define HAVE_SCALBN 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 +#define HAVE_SIGACTION 1 +#define HAVE_SETJMP 1 +#define HAVE_NANOSLEEP 1 +#define HAVE_SYSCONF 1 +#define HAVE_SYSCTLBYNAME 1 +#define HAVE_ATAN 1 +#define HAVE_ATAN2 1 +#define HAVE_ACOS 1 +#define HAVE_ASIN 1 + +/* Enable various audio drivers */ +#define SDL_AUDIO_DRIVER_COREAUDIO 1 +#define SDL_AUDIO_DRIVER_DISK 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 + +/* Enable various input drivers */ +#define SDL_JOYSTICK_IOKIT 1 +#define SDL_HAPTIC_IOKIT 1 + +/* Enable various shared object loading systems */ +#define SDL_LOADSO_DLOPEN 1 + +/* Enable various threading systems */ +#define SDL_THREAD_PTHREAD 1 +#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1 + +/* Enable various timer systems */ +#define SDL_TIMER_UNIX 1 + +/* Enable various video drivers */ +#define SDL_VIDEO_DRIVER_COCOA 1 +#define SDL_VIDEO_DRIVER_DUMMY 1 +#undef SDL_VIDEO_DRIVER_X11 +#define SDL_VIDEO_DRIVER_X11_DYNAMIC "/usr/X11R6/lib/libX11.6.dylib" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT "/usr/X11R6/lib/libXext.6.dylib" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA "/usr/X11R6/lib/libXinerama.1.dylib" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2 "/usr/X11R6/lib/libXi.6.dylib" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR "/usr/X11R6/lib/libXrandr.2.dylib" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS "/usr/X11R6/lib/libXss.1.dylib" +#define SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE "/usr/X11R6/lib/libXxf86vm.1.dylib" +#define SDL_VIDEO_DRIVER_X11_XDBE 1 +#define SDL_VIDEO_DRIVER_X11_XINERAMA 1 +#define SDL_VIDEO_DRIVER_X11_XRANDR 1 +#define SDL_VIDEO_DRIVER_X11_XSCRNSAVER 1 +#define SDL_VIDEO_DRIVER_X11_XSHAPE 1 +#define SDL_VIDEO_DRIVER_X11_XVIDMODE 1 +#define SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM 1 + +#ifdef MAC_OS_X_VERSION_10_8 +/* + * No matter the versions targeted, this is the 10.8 or later SDK, so you have + * to use the external Xquartz, which is a more modern Xlib. Previous SDKs + * used an older Xlib. + */ +#define SDL_VIDEO_DRIVER_X11_XINPUT2 1 +#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1 +#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1 +#endif + +#ifndef SDL_VIDEO_RENDER_OGL +#define SDL_VIDEO_RENDER_OGL 1 +#endif + +/* Enable OpenGL support */ +#ifndef SDL_VIDEO_OPENGL +#define SDL_VIDEO_OPENGL 1 +#endif +#ifndef SDL_VIDEO_OPENGL_CGL +#define SDL_VIDEO_OPENGL_CGL 1 +#endif +#ifndef SDL_VIDEO_OPENGL_GLX +#define SDL_VIDEO_OPENGL_GLX 1 +#endif + +/* Enable Vulkan support */ +/* Metal/MoltenVK/Vulkan only supported on 64-bit architectures and 10.11+ */ +#if TARGET_CPU_X86_64 +#define SDL_VIDEO_VULKAN 1 +#else +#define SDL_VIDEO_VULKAN 0 +#endif + +/* Enable system power support */ +#define SDL_POWER_MACOSX 1 + +/* enable filesystem support */ +#define SDL_FILESYSTEM_COCOA 1 + +/* Enable assembly routines */ +#define SDL_ASSEMBLY_ROUTINES 1 +#ifdef __ppc__ +#define SDL_ALTIVEC_BLITTERS 1 +#endif + +#endif /* SDL_config_macosx_h_ */ diff --git a/third-party/sdl2/include/SDL_config_minimal.h b/third-party/sdl2/include/SDL_config_minimal.h new file mode 100644 index 0000000..3112700 --- /dev/null +++ b/third-party/sdl2/include/SDL_config_minimal.h @@ -0,0 +1,82 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2017 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_config_minimal_h_ +#define SDL_config_minimal_h_ +#define SDL_config_h_ + +#include "SDL_platform.h" + +/** + * \file SDL_config_minimal.h + * + * This is the minimal configuration that can be used to build SDL. + */ + +#define HAVE_STDARG_H 1 +#define HAVE_STDDEF_H 1 + +/* Most everything except Visual Studio 2008 and earlier has stdint.h now */ +#if defined(_MSC_VER) && (_MSC_VER < 1600) +/* Here are some reasonable defaults */ +typedef unsigned int size_t; +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef signed short int16_t; +typedef unsigned short uint16_t; +typedef signed int int32_t; +typedef unsigned int uint32_t; +typedef signed long long int64_t; +typedef unsigned long long uint64_t; +typedef unsigned long uintptr_t; +#else +#define HAVE_STDINT_H 1 +#endif /* Visual Studio 2008 */ + +#ifdef __GNUC__ +#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1 +#endif + +/* Enable the dummy audio driver (src/audio/dummy/\*.c) */ +#define SDL_AUDIO_DRIVER_DUMMY 1 + +/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */ +#define SDL_JOYSTICK_DISABLED 1 + +/* Enable the stub haptic driver (src/haptic/dummy/\*.c) */ +#define SDL_HAPTIC_DISABLED 1 + +/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */ +#define SDL_LOADSO_DISABLED 1 + +/* Enable the stub thread support (src/thread/generic/\*.c) */ +#define SDL_THREADS_DISABLED 1 + +/* Enable the stub timer support (src/timer/dummy/\*.c) */ +#define SDL_TIMERS_DISABLED 1 + +/* Enable the dummy video driver (src/video/dummy/\*.c) */ +#define SDL_VIDEO_DRIVER_DUMMY 1 + +/* Enable the dummy filesystem driver (src/filesystem/dummy/\*.c) */ +#define SDL_FILESYSTEM_DUMMY 1 + +#endif /* SDL_config_minimal_h_ */ diff --git a/third-party/sdl2/include/SDL_config_pandora.h b/third-party/sdl2/include/SDL_config_pandora.h new file mode 100644 index 0000000..ea62fe5 --- /dev/null +++ b/third-party/sdl2/include/SDL_config_pandora.h @@ -0,0 +1,128 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2017 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_config_pandora_h_ +#define SDL_config_pandora_h_ +#define SDL_config_h_ + +/* This is a set of defines to configure the SDL features */ + +/* General platform specific identifiers */ +#include "SDL_platform.h" + +#ifdef __LP64__ +#define SIZEOF_VOIDP 8 +#else +#define SIZEOF_VOIDP 4 +#endif + +#define SDL_BYTEORDER 1234 + +#define HAVE_ALLOCA_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STDARG_H 1 +#define HAVE_MALLOC_H 1 +#define HAVE_MEMORY_H 1 +#define HAVE_STRING_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_ICONV_H 1 +#define HAVE_SIGNAL_H 1 +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_GETENV 1 +#define HAVE_SETENV 1 +#define HAVE_PUTENV 1 +#define HAVE_UNSETENV 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_STRLEN 1 +#define HAVE_STRDUP 1 +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRNCASECMP 1 +#define HAVE_VSSCANF 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_M_PI 1 +#define HAVE_CEIL 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_LOG 1 +#define HAVE_SCALBN 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 +#define HAVE_SIGACTION 1 +#define HAVE_SETJMP 1 +#define HAVE_NANOSLEEP 1 + +#define SDL_AUDIO_DRIVER_DUMMY 1 +#define SDL_AUDIO_DRIVER_OSS 1 + +#define SDL_INPUT_LINUXEV 1 +#define SDL_INPUT_TSLIB 1 +#define SDL_JOYSTICK_LINUX 1 +#define SDL_HAPTIC_LINUX 1 + +#define SDL_LOADSO_DLOPEN 1 + +#define SDL_THREAD_PTHREAD 1 +#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1 + +#define SDL_TIMER_UNIX 1 +#define SDL_FILESYSTEM_UNIX 1 + +#define SDL_VIDEO_DRIVER_DUMMY 1 +#define SDL_VIDEO_DRIVER_X11 1 +#define SDL_VIDEO_DRIVER_PANDORA 1 +#define SDL_VIDEO_RENDER_OGL_ES 1 +#define SDL_VIDEO_OPENGL_ES 1 + +#endif /* SDL_config_pandora_h_ */ diff --git a/third-party/sdl2/include/SDL_config_psp.h b/third-party/sdl2/include/SDL_config_psp.h new file mode 100644 index 0000000..28efb4c --- /dev/null +++ b/third-party/sdl2/include/SDL_config_psp.h @@ -0,0 +1,144 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2017 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_config_psp_h_ +#define SDL_config_psp_h_ +#define SDL_config_h_ + +#include "SDL_platform.h" + + + +#ifdef __GNUC__ +#define HAVE_GCC_SYNC_LOCK_TEST_AND_SET 1 +#endif + +#define HAVE_GCC_ATOMICS 1 + +#define HAVE_ALLOCA_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STRING_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_SIGNAL_H 1 + +/* C library functions */ +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_GETENV 1 +#define HAVE_SETENV 1 +#define HAVE_PUTENV 1 +#define HAVE_SETENV 1 +#define HAVE_UNSETENV 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +#define HAVE_STRLCPY 1 +#define HAVE_STRLCAT 1 +#define HAVE_STRDUP 1 +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRNCASECMP 1 +#define HAVE_VSSCANF 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_M_PI 1 +#define HAVE_ATAN 1 +#define HAVE_ATAN2 1 +#define HAVE_ACOS 1 +#define HAVE_ASIN 1 +#define HAVE_CEIL 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_LOG 1 +#define HAVE_POW 1 +#define HAVE_SCALBN 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 +#define HAVE_SETJMP 1 +#define HAVE_NANOSLEEP 1 +/* #define HAVE_SYSCONF 1 */ +/* #define HAVE_SIGACTION 1 */ + + +/* PSP isn't that sophisticated */ +#define LACKS_SYS_MMAN_H 1 + +/* Enable the stub thread support (src/thread/psp/\*.c) */ +#define SDL_THREAD_PSP 1 + +/* Enable the stub timer support (src/timer/psp/\*.c) */ +#define SDL_TIMERS_PSP 1 + +/* Enable the stub joystick driver (src/joystick/psp/\*.c) */ +#define SDL_JOYSTICK_PSP 1 + +/* Enable the stub audio driver (src/audio/psp/\*.c) */ +#define SDL_AUDIO_DRIVER_PSP 1 + +/* PSP video dirver */ +#define SDL_VIDEO_DRIVER_PSP 1 + +/* PSP render dirver */ +#define SDL_VIDEO_RENDER_PSP 1 + +#define SDL_POWER_PSP 1 + +/* !!! FIXME: what does PSP do for filesystem stuff? */ +#define SDL_FILESYSTEM_DUMMY 1 + +/* PSP doesn't have haptic device (src/haptic/dummy/\*.c) */ +#define SDL_HAPTIC_DISABLED 1 + +/* PSP can't load shared object (src/loadso/dummy/\*.c) */ +#define SDL_LOADSO_DISABLED 1 + + +#endif /* SDL_config_psp_h_ */ diff --git a/#ThirdParty/libSDL/include/SDL_config.h b/third-party/sdl2/include/SDL_config_windows.h similarity index 94% rename from #ThirdParty/libSDL/include/SDL_config.h rename to third-party/sdl2/include/SDL_config_windows.h index 890986c..2456c84 100644 --- a/#ThirdParty/libSDL/include/SDL_config.h +++ b/third-party/sdl2/include/SDL_config_windows.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2017 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_windows_h -#define _SDL_config_windows_h +#ifndef SDL_config_windows_h_ +#define SDL_config_windows_h_ +#define SDL_config_h_ #include "SDL_platform.h" @@ -154,8 +155,9 @@ typedef unsigned int uintptr_t; #endif /* Enable various audio drivers */ +#define SDL_AUDIO_DRIVER_WASAPI 1 #define SDL_AUDIO_DRIVER_DSOUND 1 -#define SDL_AUDIO_DRIVER_XAUDIO2 1 +#define SDL_AUDIO_DRIVER_XAUDIO2 0 #define SDL_AUDIO_DRIVER_WINMM 1 #define SDL_AUDIO_DRIVER_DISK 1 #define SDL_AUDIO_DRIVER_DUMMY 1 @@ -206,6 +208,8 @@ typedef unsigned int uintptr_t; #define SDL_VIDEO_OPENGL_EGL 1 #endif +/* Enable Vulkan support */ +#define SDL_VIDEO_VULKAN 1 /* Enable system power support */ #define SDL_POWER_WINDOWS 1 @@ -218,4 +222,4 @@ typedef unsigned int uintptr_t; #define SDL_ASSEMBLY_ROUTINES 1 #endif -#endif /* _SDL_config_windows_h */ +#endif /* SDL_config_windows_h_ */ diff --git a/third-party/sdl2/include/SDL_config_winrt.h b/third-party/sdl2/include/SDL_config_winrt.h new file mode 100644 index 0000000..24f9e17 --- /dev/null +++ b/third-party/sdl2/include/SDL_config_winrt.h @@ -0,0 +1,215 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2017 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_config_winrt_h_ +#define SDL_config_winrt_h_ +#define SDL_config_h_ + +#include "SDL_platform.h" + +/* Make sure the Windows SDK's NTDDI_VERSION macro gets defined. This is used + by SDL to determine which version of the Windows SDK is being used. +*/ +#include + +/* Define possibly-undefined NTDDI values (used when compiling SDL against + older versions of the Windows SDK. +*/ +#ifndef NTDDI_WINBLUE +#define NTDDI_WINBLUE 0x06030000 +#endif +#ifndef NTDDI_WIN10 +#define NTDDI_WIN10 0x0A000000 +#endif + +/* This is a set of defines to configure the SDL features */ + +#if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) +#if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__) +#define HAVE_STDINT_H 1 +#elif defined(_MSC_VER) +typedef signed __int8 int8_t; +typedef unsigned __int8 uint8_t; +typedef signed __int16 int16_t; +typedef unsigned __int16 uint16_t; +typedef signed __int32 int32_t; +typedef unsigned __int32 uint32_t; +typedef signed __int64 int64_t; +typedef unsigned __int64 uint64_t; +#ifndef _UINTPTR_T_DEFINED +#ifdef _WIN64 +typedef unsigned __int64 uintptr_t; +#else +typedef unsigned int uintptr_t; +#endif +#define _UINTPTR_T_DEFINED +#endif +/* Older Visual C++ headers don't have the Win64-compatible typedefs... */ +#if ((_MSC_VER <= 1200) && (!defined(DWORD_PTR))) +#define DWORD_PTR DWORD +#endif +#if ((_MSC_VER <= 1200) && (!defined(LONG_PTR))) +#define LONG_PTR LONG +#endif +#else /* !__GNUC__ && !_MSC_VER */ +typedef signed char int8_t; +typedef unsigned char uint8_t; +typedef signed short int16_t; +typedef unsigned short uint16_t; +typedef signed int int32_t; +typedef unsigned int uint32_t; +typedef signed long long int64_t; +typedef unsigned long long uint64_t; +#ifndef _SIZE_T_DEFINED_ +#define _SIZE_T_DEFINED_ +typedef unsigned int size_t; +#endif +typedef unsigned int uintptr_t; +#endif /* __GNUC__ || _MSC_VER */ +#endif /* !_STDINT_H_ && !HAVE_STDINT_H */ + +#ifdef _WIN64 +# define SIZEOF_VOIDP 8 +#else +# define SIZEOF_VOIDP 4 +#endif + +/* Useful headers */ +#define HAVE_DXGI_H 1 +#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP +#define HAVE_XINPUT_H 1 +#endif +#define HAVE_LIBC 1 +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STRING_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_FLOAT_H 1 +#define HAVE_SIGNAL_H 1 + +/* C library functions */ +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMCMP 1 +#define HAVE_STRLEN 1 +#define HAVE__STRREV 1 +#define HAVE__STRUPR 1 +//#define HAVE__STRLWR 1 // TODO, WinRT: consider using _strlwr_s instead +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +//#define HAVE_ITOA 1 // TODO, WinRT: consider using _itoa_s instead +//#define HAVE__LTOA 1 // TODO, WinRT: consider using _ltoa_s instead +//#define HAVE__ULTOA 1 // TODO, WinRT: consider using _ultoa_s instead +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +//#define HAVE_STRTOLL 1 +#define HAVE_STRTOD 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE__STRICMP 1 +#define HAVE__STRNICMP 1 +#define HAVE_VSNPRINTF 1 +//#define HAVE_SSCANF 1 // TODO, WinRT: consider using sscanf_s instead +#define HAVE_M_PI 1 +#define HAVE_ATAN 1 +#define HAVE_ATAN2 1 +#define HAVE_CEIL 1 +#define HAVE__COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_LOG 1 +#define HAVE_POW 1 +//#define HAVE_SCALBN 1 +#define HAVE__SCALB 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 +#define HAVE__FSEEKI64 1 + +/* Enable various audio drivers */ +#define SDL_AUDIO_DRIVER_XAUDIO2 1 +#define SDL_AUDIO_DRIVER_DISK 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 + +/* Enable various input drivers */ +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#define SDL_JOYSTICK_DISABLED 1 +#define SDL_HAPTIC_DISABLED 1 +#else +#define SDL_JOYSTICK_XINPUT 1 +#define SDL_HAPTIC_XINPUT 1 +#endif + +/* Enable various shared object loading systems */ +#define SDL_LOADSO_WINDOWS 1 + +/* Enable various threading systems */ +#if (NTDDI_VERSION >= NTDDI_WINBLUE) +#define SDL_THREAD_WINDOWS 1 +#else +/* WinRT on Windows 8.0 and Windows Phone 8.0 don't support CreateThread() */ +#define SDL_THREAD_STDCPP 1 +#endif + +/* Enable various timer systems */ +#define SDL_TIMER_WINDOWS 1 + +/* Enable various video drivers */ +#define SDL_VIDEO_DRIVER_WINRT 1 +#define SDL_VIDEO_DRIVER_DUMMY 1 + +/* Enable OpenGL ES 2.0 (via a modified ANGLE library) */ +#define SDL_VIDEO_OPENGL_ES2 1 +#define SDL_VIDEO_OPENGL_EGL 1 + +/* Enable appropriate renderer(s) */ +#define SDL_VIDEO_RENDER_D3D11 1 + +#if SDL_VIDEO_OPENGL_ES2 +#define SDL_VIDEO_RENDER_OGL_ES2 1 +#endif + +/* Enable system power support */ +#define SDL_POWER_WINRT 1 + +/* Enable assembly routines (Win64 doesn't have inline asm) */ +#ifndef _WIN64 +#define SDL_ASSEMBLY_ROUTINES 1 +#endif + +#endif /* SDL_config_winrt_h_ */ diff --git a/third-party/sdl2/include/SDL_config_wiz.h b/third-party/sdl2/include/SDL_config_wiz.h new file mode 100644 index 0000000..5bb845a --- /dev/null +++ b/third-party/sdl2/include/SDL_config_wiz.h @@ -0,0 +1,121 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2017 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_config_wiz_h_ +#define SDL_config_wiz_h_ +#define SDL_config_h_ + +/* This is a set of defines to configure the SDL features */ + +/* General platform specific identifiers */ +#include "SDL_platform.h" + +#define SDL_BYTEORDER 1234 + +#define HAVE_ALLOCA_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_STDIO_H 1 +#define STDC_HEADERS 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STDARG_H 1 +#define HAVE_MALLOC_H 1 +#define HAVE_MEMORY_H 1 +#define HAVE_STRING_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_CTYPE_H 1 +#define HAVE_MATH_H 1 +#define HAVE_ICONV_H 1 +#define HAVE_SIGNAL_H 1 +#define HAVE_MALLOC 1 +#define HAVE_CALLOC 1 +#define HAVE_REALLOC 1 +#define HAVE_FREE 1 +#define HAVE_ALLOCA 1 +#define HAVE_GETENV 1 +#define HAVE_SETENV 1 +#define HAVE_PUTENV 1 +#define HAVE_UNSETENV 1 +#define HAVE_QSORT 1 +#define HAVE_ABS 1 +#define HAVE_BCOPY 1 +#define HAVE_MEMSET 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMMOVE 1 +#define HAVE_STRLEN 1 +#define HAVE_STRDUP 1 +#define HAVE_STRCHR 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRSTR 1 +#define HAVE_STRTOL 1 +#define HAVE_STRTOUL 1 +#define HAVE_STRTOLL 1 +#define HAVE_STRTOULL 1 +#define HAVE_ATOI 1 +#define HAVE_ATOF 1 +#define HAVE_STRCMP 1 +#define HAVE_STRNCMP 1 +#define HAVE_STRCASECMP 1 +#define HAVE_STRNCASECMP 1 +#define HAVE_VSSCANF 1 +#define HAVE_VSNPRINTF 1 +#define HAVE_M_PI 1 +#define HAVE_CEIL 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FLOOR 1 +#define HAVE_LOG 1 +#define HAVE_SCALBN 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 +#define HAVE_SIGACTION 1 +#define HAVE_SETJMP 1 +#define HAVE_NANOSLEEP 1 +#define HAVE_POW 1 + +#define SDL_AUDIO_DRIVER_DUMMY 1 +#define SDL_AUDIO_DRIVER_OSS 1 + +#define SDL_INPUT_LINUXEV 1 +#define SDL_INPUT_TSLIB 1 +#define SDL_JOYSTICK_LINUX 1 +#define SDL_HAPTIC_LINUX 1 + +#define SDL_LOADSO_DLOPEN 1 + +#define SDL_THREAD_PTHREAD 1 +#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP 1 + +#define SDL_TIMER_UNIX 1 + +#define SDL_VIDEO_DRIVER_DUMMY 1 +#define SDL_VIDEO_DRIVER_PANDORA 1 +#define SDL_VIDEO_RENDER_OGL_ES 1 +#define SDL_VIDEO_OPENGL_ES 1 + +#endif /* SDL_config_wiz_h_ */ diff --git a/third-party/sdl2/include/SDL_copying.h b/third-party/sdl2/include/SDL_copying.h new file mode 100644 index 0000000..8f60af6 --- /dev/null +++ b/third-party/sdl2/include/SDL_copying.h @@ -0,0 +1,20 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2017 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ diff --git a/#ThirdParty/libSDL/include/SDL_cpuinfo.h b/third-party/sdl2/include/SDL_cpuinfo.h similarity index 75% rename from #ThirdParty/libSDL/include/SDL_cpuinfo.h rename to third-party/sdl2/include/SDL_cpuinfo.h index d0ba47b..ee3a47e 100644 --- a/#ThirdParty/libSDL/include/SDL_cpuinfo.h +++ b/third-party/sdl2/include/SDL_cpuinfo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,14 +25,20 @@ * CPU feature detection for SDL. */ -#ifndef _SDL_cpuinfo_h -#define _SDL_cpuinfo_h +#ifndef SDL_cpuinfo_h_ +#define SDL_cpuinfo_h_ #include "SDL_stdinc.h" /* Need to do this here because intrin.h has C++ code in it */ /* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */ #if defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_IX86) || defined(_M_X64)) +#ifdef __clang__ +/* Many of the intrinsics SDL uses are not implemented by clang with Visual Studio */ +#undef __MMX__ +#undef __SSE__ +#undef __SSE2__ +#else #include #ifndef _WIN64 #define __MMX__ @@ -40,28 +46,40 @@ #endif #define __SSE__ #define __SSE2__ +#endif /* __clang__ */ #elif defined(__MINGW64_VERSION_MAJOR) #include #else #ifdef __ALTIVEC__ -#if HAVE_ALTIVEC_H && !defined(__APPLE_ALTIVEC__) +#if defined(HAVE_ALTIVEC_H) && !defined(__APPLE_ALTIVEC__) && !defined(SDL_DISABLE_ALTIVEC_H) #include #undef pixel +#undef bool #endif #endif -#ifdef __MMX__ -#include +#if defined(__ARM_NEON__) && !defined(SDL_DISABLE_ARM_NEON_H) +#include #endif -#ifdef __3dNOW__ +#if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H) #include #endif -#ifdef __SSE__ +#if defined(HAVE_IMMINTRIN_H) && !defined(SDL_DISABLE_IMMINTRIN_H) +#include +#else +#if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H) +#include +#endif +#if defined(__SSE__) && !defined(SDL_DISABLE_XMMINTRIN_H) #include #endif -#ifdef __SSE2__ +#if defined(__SSE2__) && !defined(SDL_DISABLE_EMMINTRIN_H) #include #endif +#if defined(__SSE3__) && !defined(SDL_DISABLE_PMMINTRIN_H) +#include #endif +#endif /* HAVE_IMMINTRIN_H */ +#endif /* compiler version */ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -144,18 +162,27 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX(void); */ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void); +/** + * This function returns true if the CPU has AVX-512F (foundation) features. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX512F(void); + +/** + * This function returns true if the CPU has NEON (ARM SIMD) features. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void); + /** * This function returns the amount of RAM configured in the system, in MB. */ extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void); - /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" -#endif /* _SDL_cpuinfo_h */ +#endif /* SDL_cpuinfo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_egl.h b/third-party/sdl2/include/SDL_egl.h similarity index 99% rename from #ThirdParty/libSDL/include/SDL_egl.h rename to third-party/sdl2/include/SDL_egl.h index bea2a6c..d65ed43 100644 --- a/#ThirdParty/libSDL/include/SDL_egl.h +++ b/third-party/sdl2/include/SDL_egl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ * * This is a simple file to encapsulate the EGL API headers. */ -#ifndef _MSC_VER +#if !defined(_MSC_VER) && !defined(__ANDROID__) #include #include @@ -132,7 +132,7 @@ *------------------------------------------------------------------------- * This precedes the return type of the function in the function prototype. */ -#if defined(_WIN32) && !defined(__SCITECH_SNAP__) +#if defined(_WIN32) && !defined(__SCITECH_SNAP__) && !defined(SDL_VIDEO_STATIC_ANGLE) # define KHRONOS_APICALL __declspec(dllimport) #elif defined (__SYMBIAN32__) # define KHRONOS_APICALL IMPORT_C diff --git a/#ThirdParty/libSDL/include/SDL_endian.h b/third-party/sdl2/include/SDL_endian.h similarity index 90% rename from #ThirdParty/libSDL/include/SDL_endian.h rename to third-party/sdl2/include/SDL_endian.h index 9100b10..ed0bf5b 100644 --- a/#ThirdParty/libSDL/include/SDL_endian.h +++ b/third-party/sdl2/include/SDL_endian.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Functions for reading and writing endian-specific values */ -#ifndef _SDL_endian_h -#define _SDL_endian_h +#ifndef SDL_endian_h_ +#define SDL_endian_h_ #include "SDL_stdinc.h" @@ -96,6 +96,12 @@ SDL_Swap16(Uint16 x) __asm__("rorw #8,%0": "=d"(x): "0"(x):"cc"); return x; } +#elif defined(__WATCOMC__) && defined(__386__) +extern _inline Uint16 SDL_Swap16(Uint16); +#pragma aux SDL_Swap16 = \ + "xchg al, ah" \ + parm [ax] \ + modify [ax]; #else SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x) @@ -136,6 +142,21 @@ SDL_Swap32(Uint32 x) __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc"); return x; } +#elif defined(__WATCOMC__) && defined(__386__) +extern _inline Uint32 SDL_Swap32(Uint32); +#ifndef __SW_3 /* 486+ */ +#pragma aux SDL_Swap32 = \ + "bswap eax" \ + parm [eax] \ + modify [eax]; +#else /* 386-only */ +#pragma aux SDL_Swap32 = \ + "xchg al, ah" \ + "ror eax, 16" \ + "xchg al, ah" \ + parm [eax] \ + modify [eax]; +#endif #else SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) @@ -234,6 +255,6 @@ SDL_SwapFloat(float x) #endif #include "close_code.h" -#endif /* _SDL_endian_h */ +#endif /* SDL_endian_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_error.h b/third-party/sdl2/include/SDL_error.h similarity index 94% rename from #ThirdParty/libSDL/include/SDL_error.h rename to third-party/sdl2/include/SDL_error.h index 2f3b4b5..c0e4629 100644 --- a/#ThirdParty/libSDL/include/SDL_error.h +++ b/third-party/sdl2/include/SDL_error.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Simple error message routines for SDL. */ -#ifndef _SDL_error_h -#define _SDL_error_h +#ifndef SDL_error_h_ +#define SDL_error_h_ #include "SDL_stdinc.h" @@ -71,6 +71,6 @@ extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code); #endif #include "close_code.h" -#endif /* _SDL_error_h */ +#endif /* SDL_error_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_events.h b/third-party/sdl2/include/SDL_events.h similarity index 87% rename from #ThirdParty/libSDL/include/SDL_events.h rename to third-party/sdl2/include/SDL_events.h index 1437f4c..af22eb6 100644 --- a/#ThirdParty/libSDL/include/SDL_events.h +++ b/third-party/sdl2/include/SDL_events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL event handling. */ -#ifndef _SDL_events_h -#define _SDL_events_h +#ifndef SDL_events_h_ +#define SDL_events_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -85,6 +85,9 @@ typedef enum Called on Android in onResume() */ + /* Display events */ + SDL_DISPLAYEVENT = 0x150, /**< Display state change */ + /* Window events */ SDL_WINDOWEVENT = 0x200, /**< Window state change */ SDL_SYSWMEVENT, /**< System specific event */ @@ -136,11 +139,17 @@ typedef enum /* Drag and drop events */ SDL_DROPFILE = 0x1000, /**< The system requests a file open */ + SDL_DROPTEXT, /**< text/plain drag-and-drop event */ + SDL_DROPBEGIN, /**< A new set of drops is beginning (NULL filename) */ + SDL_DROPCOMPLETE, /**< Current set of drops is now complete (NULL filename) */ /* Audio hotplug events */ SDL_AUDIODEVICEADDED = 0x1100, /**< A new audio device is available */ SDL_AUDIODEVICEREMOVED, /**< An audio device has been removed. */ + /* Sensor events */ + SDL_SENSORUPDATE = 0x1200, /**< A sensor was updated */ + /* Render events */ SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */ SDL_RENDER_DEVICE_RESET, /**< The device has been reset and all textures need to be recreated */ @@ -162,16 +171,31 @@ typedef enum typedef struct SDL_CommonEvent { Uint32 type; - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ } SDL_CommonEvent; +/** + * \brief Display state change event data (event.display.*) + */ +typedef struct SDL_DisplayEvent +{ + Uint32 type; /**< ::SDL_DISPLAYEVENT */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + Uint32 display; /**< The associated display index */ + Uint8 event; /**< ::SDL_DisplayEventID */ + Uint8 padding1; + Uint8 padding2; + Uint8 padding3; + Sint32 data1; /**< event dependent data */ +} SDL_DisplayEvent; + /** * \brief Window state change event data (event.window.*) */ typedef struct SDL_WindowEvent { Uint32 type; /**< ::SDL_WINDOWEVENT */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The associated window */ Uint8 event; /**< ::SDL_WindowEventID */ Uint8 padding1; @@ -187,7 +211,7 @@ typedef struct SDL_WindowEvent typedef struct SDL_KeyboardEvent { Uint32 type; /**< ::SDL_KEYDOWN or ::SDL_KEYUP */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The window with keyboard focus, if any */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ Uint8 repeat; /**< Non-zero if this is a key repeat */ @@ -203,7 +227,7 @@ typedef struct SDL_KeyboardEvent typedef struct SDL_TextEditingEvent { Uint32 type; /**< ::SDL_TEXTEDITING */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The window with keyboard focus, if any */ char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */ Sint32 start; /**< The start cursor of selected editing text */ @@ -218,7 +242,7 @@ typedef struct SDL_TextEditingEvent typedef struct SDL_TextInputEvent { Uint32 type; /**< ::SDL_TEXTINPUT */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The window with keyboard focus, if any */ char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text */ } SDL_TextInputEvent; @@ -229,7 +253,7 @@ typedef struct SDL_TextInputEvent typedef struct SDL_MouseMotionEvent { Uint32 type; /**< ::SDL_MOUSEMOTION */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The window with mouse focus, if any */ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ Uint32 state; /**< The current button state */ @@ -245,7 +269,7 @@ typedef struct SDL_MouseMotionEvent typedef struct SDL_MouseButtonEvent { Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The window with mouse focus, if any */ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ Uint8 button; /**< The mouse button index */ @@ -262,7 +286,7 @@ typedef struct SDL_MouseButtonEvent typedef struct SDL_MouseWheelEvent { Uint32 type; /**< ::SDL_MOUSEWHEEL */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The window with mouse focus, if any */ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ Sint32 x; /**< The amount scrolled horizontally, positive to the right and negative to the left */ @@ -276,7 +300,7 @@ typedef struct SDL_MouseWheelEvent typedef struct SDL_JoyAxisEvent { Uint32 type; /**< ::SDL_JOYAXISMOTION */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_JoystickID which; /**< The joystick instance id */ Uint8 axis; /**< The joystick axis index */ Uint8 padding1; @@ -292,7 +316,7 @@ typedef struct SDL_JoyAxisEvent typedef struct SDL_JoyBallEvent { Uint32 type; /**< ::SDL_JOYBALLMOTION */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_JoystickID which; /**< The joystick instance id */ Uint8 ball; /**< The joystick trackball index */ Uint8 padding1; @@ -308,7 +332,7 @@ typedef struct SDL_JoyBallEvent typedef struct SDL_JoyHatEvent { Uint32 type; /**< ::SDL_JOYHATMOTION */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_JoystickID which; /**< The joystick instance id */ Uint8 hat; /**< The joystick hat index */ Uint8 value; /**< The hat position value. @@ -328,7 +352,7 @@ typedef struct SDL_JoyHatEvent typedef struct SDL_JoyButtonEvent { Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_JoystickID which; /**< The joystick instance id */ Uint8 button; /**< The joystick button index */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ @@ -342,7 +366,7 @@ typedef struct SDL_JoyButtonEvent typedef struct SDL_JoyDeviceEvent { Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */ } SDL_JoyDeviceEvent; @@ -353,7 +377,7 @@ typedef struct SDL_JoyDeviceEvent typedef struct SDL_ControllerAxisEvent { Uint32 type; /**< ::SDL_CONTROLLERAXISMOTION */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_JoystickID which; /**< The joystick instance id */ Uint8 axis; /**< The controller axis (SDL_GameControllerAxis) */ Uint8 padding1; @@ -370,7 +394,7 @@ typedef struct SDL_ControllerAxisEvent typedef struct SDL_ControllerButtonEvent { Uint32 type; /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_JoystickID which; /**< The joystick instance id */ Uint8 button; /**< The controller button (SDL_GameControllerButton) */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ @@ -385,7 +409,7 @@ typedef struct SDL_ControllerButtonEvent typedef struct SDL_ControllerDeviceEvent { Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */ } SDL_ControllerDeviceEvent; @@ -395,7 +419,7 @@ typedef struct SDL_ControllerDeviceEvent typedef struct SDL_AudioDeviceEvent { Uint32 type; /**< ::SDL_AUDIODEVICEADDED, or ::SDL_AUDIODEVICEREMOVED */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 which; /**< The audio device index for the ADDED event (valid until next SDL_GetNumAudioDevices() call), SDL_AudioDeviceID for the REMOVED event */ Uint8 iscapture; /**< zero if an output device, non-zero if a capture device. */ Uint8 padding1; @@ -410,7 +434,7 @@ typedef struct SDL_AudioDeviceEvent typedef struct SDL_TouchFingerEvent { Uint32 type; /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_TouchID touchId; /**< The touch device id */ SDL_FingerID fingerId; float x; /**< Normalized in the range 0...1 */ @@ -427,8 +451,8 @@ typedef struct SDL_TouchFingerEvent typedef struct SDL_MultiGestureEvent { Uint32 type; /**< ::SDL_MULTIGESTURE */ - Uint32 timestamp; - SDL_TouchID touchId; /**< The touch device index */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + SDL_TouchID touchId; /**< The touch device id */ float dTheta; float dDist; float x; @@ -444,7 +468,7 @@ typedef struct SDL_MultiGestureEvent typedef struct SDL_DollarGestureEvent { Uint32 type; /**< ::SDL_DOLLARGESTURE or ::SDL_DOLLARRECORD */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_TouchID touchId; /**< The touch device id */ SDL_GestureID gestureId; Uint32 numFingers; @@ -461,19 +485,31 @@ typedef struct SDL_DollarGestureEvent */ typedef struct SDL_DropEvent { - Uint32 type; /**< ::SDL_DROPFILE */ - Uint32 timestamp; - char *file; /**< The file name, which should be freed with SDL_free() */ + Uint32 type; /**< ::SDL_DROPBEGIN or ::SDL_DROPFILE or ::SDL_DROPTEXT or ::SDL_DROPCOMPLETE */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + char *file; /**< The file name, which should be freed with SDL_free(), is NULL on begin/complete */ + Uint32 windowID; /**< The window that was dropped on, if any */ } SDL_DropEvent; +/** + * \brief Sensor event structure (event.sensor.*) + */ +typedef struct SDL_SensorEvent +{ + Uint32 type; /**< ::SDL_SENSORUPDATE */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + Sint32 which; /**< The instance ID of the sensor */ + float data[6]; /**< Up to 6 values from the sensor - additional values can be queried using SDL_SensorGetData() */ +} SDL_SensorEvent; + /** * \brief The "quit requested" event */ typedef struct SDL_QuitEvent { Uint32 type; /**< ::SDL_QUIT */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ } SDL_QuitEvent; /** @@ -482,7 +518,7 @@ typedef struct SDL_QuitEvent typedef struct SDL_OSEvent { Uint32 type; /**< ::SDL_QUIT */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ } SDL_OSEvent; /** @@ -491,7 +527,7 @@ typedef struct SDL_OSEvent typedef struct SDL_UserEvent { Uint32 type; /**< ::SDL_USEREVENT through ::SDL_LASTEVENT-1 */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The associated window if any */ Sint32 code; /**< User defined event code */ void *data1; /**< User defined data pointer */ @@ -511,7 +547,7 @@ typedef struct SDL_SysWMmsg SDL_SysWMmsg; typedef struct SDL_SysWMEvent { Uint32 type; /**< ::SDL_SYSWMEVENT */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */ } SDL_SysWMEvent; @@ -522,6 +558,7 @@ typedef union SDL_Event { Uint32 type; /**< Event type, shared with all events */ SDL_CommonEvent common; /**< Common event data */ + SDL_DisplayEvent display; /**< Window event data */ SDL_WindowEvent window; /**< Window event data */ SDL_KeyboardEvent key; /**< Keyboard event data */ SDL_TextEditingEvent edit; /**< Text editing event data */ @@ -538,6 +575,7 @@ typedef union SDL_Event SDL_ControllerButtonEvent cbutton; /**< Game Controller button event data */ SDL_ControllerDeviceEvent cdevice; /**< Game Controller device event data */ SDL_AudioDeviceEvent adevice; /**< Audio device event data */ + SDL_SensorEvent sensor; /**< Sensor event data */ SDL_QuitEvent quit; /**< Quit request event data */ SDL_UserEvent user; /**< Custom event data */ SDL_SysWMEvent syswm; /**< System dependent window event data */ @@ -720,7 +758,7 @@ extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter, /** * This function allows you to set the state of processing certain events. * - If \c state is set to ::SDL_IGNORE, that event will be automatically - * dropped from the event queue and will not event be filtered. + * dropped from the event queue and will not be filtered. * - If \c state is set to ::SDL_ENABLE, that event will be processed * normally. * - If \c state is set to ::SDL_QUERY, SDL_EventState() will return the @@ -745,6 +783,6 @@ extern DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents); #endif #include "close_code.h" -#endif /* _SDL_events_h */ +#endif /* SDL_events_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_filesystem.h b/third-party/sdl2/include/SDL_filesystem.h similarity index 97% rename from #ThirdParty/libSDL/include/SDL_filesystem.h rename to third-party/sdl2/include/SDL_filesystem.h index 02999ed..fa6a1fa 100644 --- a/#ThirdParty/libSDL/include/SDL_filesystem.h +++ b/third-party/sdl2/include/SDL_filesystem.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * \brief Include file for filesystem SDL API functions */ -#ifndef _SDL_filesystem_h -#define _SDL_filesystem_h +#ifndef SDL_filesystem_h_ +#define SDL_filesystem_h_ #include "SDL_stdinc.h" @@ -131,6 +131,6 @@ extern DECLSPEC char *SDLCALL SDL_GetPrefPath(const char *org, const char *app); #endif #include "close_code.h" -#endif /* _SDL_filesystem_h */ +#endif /* SDL_filesystem_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_gamecontroller.h b/third-party/sdl2/include/SDL_gamecontroller.h similarity index 71% rename from #ThirdParty/libSDL/include/SDL_gamecontroller.h rename to third-party/sdl2/include/SDL_gamecontroller.h index 42087ee..6ae9c95 100644 --- a/#ThirdParty/libSDL/include/SDL_gamecontroller.h +++ b/third-party/sdl2/include/SDL_gamecontroller.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL game controller event handling */ -#ifndef _SDL_gamecontroller_h -#define _SDL_gamecontroller_h +#ifndef SDL_gamecontroller_h_ +#define SDL_gamecontroller_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -51,7 +51,9 @@ extern "C" { * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS */ -/* The gamecontroller structure used to identify an SDL game controller */ +/** + * The gamecontroller structure used to identify an SDL game controller + */ struct _SDL_GameController; typedef struct _SDL_GameController SDL_GameController; @@ -87,13 +89,13 @@ typedef struct SDL_GameControllerButtonBind * To count the number of game controllers in the system for the following: * int nJoysticks = SDL_NumJoysticks(); * int nGameControllers = 0; - * for ( int i = 0; i < nJoysticks; i++ ) { - * if ( SDL_IsGameController(i) ) { + * for (int i = 0; i < nJoysticks; i++) { + * if (SDL_IsGameController(i)) { * nGameControllers++; * } * } * - * Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is: + * Using the SDL_HINT_GAMECONTROLLERCONFIG hint or the SDL_GameControllerAddMapping() you can add support for controllers SDL is unaware of or cause an existing controller to have a different binding. The format is: * guid,name,mappings * * Where GUID is the string value from SDL_JoystickGetGUIDString(), name is the human readable string for the device and mappings are controller mappings to joystick ones. @@ -105,7 +107,7 @@ typedef struct SDL_GameControllerButtonBind * Buttons can be used as a controller axis and vice versa. * * This string shows an example of a valid mapping for a controller - * "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7", + * "03000000341a00003608000000000000,PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7", * */ @@ -117,7 +119,7 @@ typedef struct SDL_GameControllerButtonBind * * \return number of mappings added, -1 on error */ -extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW( SDL_RWops * rw, int freerw ); +extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw, int freerw); /** * Load a set of mappings from a file, filtered by the current SDL_GetPlatform() @@ -131,28 +133,41 @@ extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW( SDL_RWops * rw, * * \return 1 if mapping is added, 0 if updated, -1 on error */ -extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping( const char* mappingString ); +extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char* mappingString); + +/** + * Get the number of mappings installed + * + * \return the number of mappings + */ +extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings(void); + +/** + * Get the mapping at a particular index. + * + * \return the mapping string. Must be freed with SDL_free(). Returns NULL if the index is out of range. + */ +extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForIndex(int mapping_index); /** * Get a mapping string for a GUID * - * \return the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available + * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available */ -extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID( SDL_JoystickGUID guid ); +extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID(SDL_JoystickGUID guid); /** * Get a mapping string for an open GameController * - * \return the mapping string. Must be freed with SDL_free. Returns NULL if no mapping is available + * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available */ -extern DECLSPEC char * SDLCALL SDL_GameControllerMapping( SDL_GameController * gamecontroller ); +extern DECLSPEC char * SDLCALL SDL_GameControllerMapping(SDL_GameController * gamecontroller); /** * Is the joystick on this index supported by the game controller interface? */ extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index); - /** * Get the implementation dependent name of a game controller. * This can be called before any controllers are opened. @@ -160,6 +175,14 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index); */ extern DECLSPEC const char *SDLCALL SDL_GameControllerNameForIndex(int joystick_index); +/** + * Get the mapping of a game controller. + * This can be called before any controllers are opened. + * + * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available + */ +extern DECLSPEC char *SDLCALL SDL_GameControllerMappingForDeviceIndex(int joystick_index); + /** * Open a game controller for use. * The index passed as an argument refers to the N'th game controller on the system. @@ -181,6 +204,31 @@ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL */ extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller); +/** + * Get the player index of an opened game controller, or -1 if it's not available + * + * For XInput controllers this returns the XInput user index. + */ +extern DECLSPEC int SDLCALL SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller); + +/** + * Get the USB vendor ID of an opened controller, if available. + * If the vendor ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetVendor(SDL_GameController * gamecontroller); + +/** + * Get the USB product ID of an opened controller, if available. + * If the product ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProduct(SDL_GameController * gamecontroller); + +/** + * Get the product version of an opened controller, if available. + * If the product version isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProductVersion(SDL_GameController * gamecontroller); + /** * Returns SDL_TRUE if the controller has been opened and currently connected, * or SDL_FALSE if it has not. @@ -214,6 +262,12 @@ extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void); /** * The list of axes available from a controller + * + * Thumbstick axis values range from SDL_JOYSTICK_AXIS_MIN to SDL_JOYSTICK_AXIS_MAX, + * and are centered within ~8000 of zero, though advanced UI will allow users to set + * or autodetect the dead zone, which varies between controllers. + * + * Trigger axis values range from 0 to SDL_JOYSTICK_AXIS_MAX. */ typedef enum { @@ -306,6 +360,19 @@ SDL_GameControllerGetBindForButton(SDL_GameController *gamecontroller, extern DECLSPEC Uint8 SDLCALL SDL_GameControllerGetButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button); +/** + * Trigger a rumble effect + * Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling. + * + * \param gamecontroller The controller to vibrate + * \param low_frequency_rumble The intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF + * \param high_frequency_rumble The intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF + * \param duration_ms The duration of the rumble effect, in milliseconds + * + * \return 0, or -1 if rumble isn't supported on this joystick + */ +extern DECLSPEC int SDLCALL SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); + /** * Close a controller previously opened with SDL_GameControllerOpen(). */ @@ -318,6 +385,6 @@ extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecon #endif #include "close_code.h" -#endif /* _SDL_gamecontroller_h */ +#endif /* SDL_gamecontroller_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_gesture.h b/third-party/sdl2/include/SDL_gesture.h similarity index 93% rename from #ThirdParty/libSDL/include/SDL_gesture.h rename to third-party/sdl2/include/SDL_gesture.h index 3c29ca7..b223d80 100644 --- a/#ThirdParty/libSDL/include/SDL_gesture.h +++ b/third-party/sdl2/include/SDL_gesture.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL gesture event handling. */ -#ifndef _SDL_gesture_h -#define _SDL_gesture_h +#ifndef SDL_gesture_h_ +#define SDL_gesture_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -82,6 +82,6 @@ extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWo #endif #include "close_code.h" -#endif /* _SDL_gesture_h */ +#endif /* SDL_gesture_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_haptic.h b/third-party/sdl2/include/SDL_haptic.h similarity index 93% rename from #ThirdParty/libSDL/include/SDL_haptic.h rename to third-party/sdl2/include/SDL_haptic.h index b36d78b..2ea1bfc 100644 --- a/#ThirdParty/libSDL/include/SDL_haptic.h +++ b/third-party/sdl2/include/SDL_haptic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,12 +22,12 @@ /** * \file SDL_haptic.h * - * \brief The SDL Haptic subsystem allows you to control haptic (force feedback) + * \brief The SDL haptic subsystem allows you to control haptic (force feedback) * devices. * * The basic usage is as follows: - * - Initialize the Subsystem (::SDL_INIT_HAPTIC). - * - Open a Haptic Device. + * - Initialize the subsystem (::SDL_INIT_HAPTIC). + * - Open a haptic device. * - SDL_HapticOpen() to open from index. * - SDL_HapticOpenFromJoystick() to open from an existing joystick. * - Create an effect (::SDL_HapticEffect). @@ -104,8 +104,8 @@ * \endcode */ -#ifndef _SDL_haptic_h -#define _SDL_haptic_h +#ifndef SDL_haptic_h_ +#define SDL_haptic_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -117,6 +117,17 @@ extern "C" { #endif /* __cplusplus */ +/* FIXME: For SDL 2.1, adjust all the magnitude variables to be Uint16 (0xFFFF). + * + * At the moment the magnitude variables are mixed between signed/unsigned, and + * it is also not made clear that ALL of those variables expect a max of 0x7FFF. + * + * Some platforms may have higher precision than that (Linux FF, Windows XInput) + * so we should fix the inconsistency in favor of higher possible precision, + * adjusting for platforms that use different scales. + * -flibit + */ + /** * \typedef SDL_Haptic * @@ -149,7 +160,7 @@ typedef struct _SDL_Haptic SDL_Haptic; * * \sa SDL_HapticCondition */ -#define SDL_HAPTIC_CONSTANT (1<<0) +#define SDL_HAPTIC_CONSTANT (1u<<0) /** * \brief Sine wave effect supported. @@ -158,7 +169,7 @@ typedef struct _SDL_Haptic SDL_Haptic; * * \sa SDL_HapticPeriodic */ -#define SDL_HAPTIC_SINE (1<<1) +#define SDL_HAPTIC_SINE (1u<<1) /** * \brief Left/Right effect supported. @@ -169,7 +180,7 @@ typedef struct _SDL_Haptic SDL_Haptic; * \warning this value was SDL_HAPTIC_SQUARE right before 2.0.0 shipped. Sorry, * we ran out of bits, and this is important for XInput devices. */ -#define SDL_HAPTIC_LEFTRIGHT (1<<2) +#define SDL_HAPTIC_LEFTRIGHT (1u<<2) /* !!! FIXME: put this back when we have more bits in 2.1 */ /* #define SDL_HAPTIC_SQUARE (1<<2) */ @@ -181,7 +192,7 @@ typedef struct _SDL_Haptic SDL_Haptic; * * \sa SDL_HapticPeriodic */ -#define SDL_HAPTIC_TRIANGLE (1<<3) +#define SDL_HAPTIC_TRIANGLE (1u<<3) /** * \brief Sawtoothup wave effect supported. @@ -190,7 +201,7 @@ typedef struct _SDL_Haptic SDL_Haptic; * * \sa SDL_HapticPeriodic */ -#define SDL_HAPTIC_SAWTOOTHUP (1<<4) +#define SDL_HAPTIC_SAWTOOTHUP (1u<<4) /** * \brief Sawtoothdown wave effect supported. @@ -199,7 +210,7 @@ typedef struct _SDL_Haptic SDL_Haptic; * * \sa SDL_HapticPeriodic */ -#define SDL_HAPTIC_SAWTOOTHDOWN (1<<5) +#define SDL_HAPTIC_SAWTOOTHDOWN (1u<<5) /** * \brief Ramp effect supported. @@ -208,7 +219,7 @@ typedef struct _SDL_Haptic SDL_Haptic; * * \sa SDL_HapticRamp */ -#define SDL_HAPTIC_RAMP (1<<6) +#define SDL_HAPTIC_RAMP (1u<<6) /** * \brief Spring effect supported - uses axes position. @@ -218,7 +229,7 @@ typedef struct _SDL_Haptic SDL_Haptic; * * \sa SDL_HapticCondition */ -#define SDL_HAPTIC_SPRING (1<<7) +#define SDL_HAPTIC_SPRING (1u<<7) /** * \brief Damper effect supported - uses axes velocity. @@ -228,7 +239,7 @@ typedef struct _SDL_Haptic SDL_Haptic; * * \sa SDL_HapticCondition */ -#define SDL_HAPTIC_DAMPER (1<<8) +#define SDL_HAPTIC_DAMPER (1u<<8) /** * \brief Inertia effect supported - uses axes acceleration. @@ -238,7 +249,7 @@ typedef struct _SDL_Haptic SDL_Haptic; * * \sa SDL_HapticCondition */ -#define SDL_HAPTIC_INERTIA (1<<9) +#define SDL_HAPTIC_INERTIA (1u<<9) /** * \brief Friction effect supported - uses axes movement. @@ -248,14 +259,14 @@ typedef struct _SDL_Haptic SDL_Haptic; * * \sa SDL_HapticCondition */ -#define SDL_HAPTIC_FRICTION (1<<10) +#define SDL_HAPTIC_FRICTION (1u<<10) /** * \brief Custom effect is supported. * * User defined custom haptic effect. */ -#define SDL_HAPTIC_CUSTOM (1<<11) +#define SDL_HAPTIC_CUSTOM (1u<<11) /* @} *//* Haptic effects */ @@ -268,7 +279,7 @@ typedef struct _SDL_Haptic SDL_Haptic; * * \sa SDL_HapticSetGain */ -#define SDL_HAPTIC_GAIN (1<<12) +#define SDL_HAPTIC_GAIN (1u<<12) /** * \brief Device can set autocenter. @@ -277,24 +288,26 @@ typedef struct _SDL_Haptic SDL_Haptic; * * \sa SDL_HapticSetAutocenter */ -#define SDL_HAPTIC_AUTOCENTER (1<<13) +#define SDL_HAPTIC_AUTOCENTER (1u<<13) /** * \brief Device can be queried for effect status. * - * Device can be queried for effect status. + * Device supports querying effect status. * * \sa SDL_HapticGetEffectStatus */ -#define SDL_HAPTIC_STATUS (1<<14) +#define SDL_HAPTIC_STATUS (1u<<14) /** * \brief Device can be paused. * + * Devices supports being paused. + * * \sa SDL_HapticPause * \sa SDL_HapticUnpause */ -#define SDL_HAPTIC_PAUSE (1<<15) +#define SDL_HAPTIC_PAUSE (1u<<15) /** @@ -444,7 +457,7 @@ typedef struct SDL_HapticDirection /** * \brief A structure containing a template for a Constant effect. * - * The struct is exclusive to the ::SDL_HAPTIC_CONSTANT effect. + * This struct is exclusively for the ::SDL_HAPTIC_CONSTANT effect. * * A constant effect applies a constant force in the specified direction * to the joystick. @@ -654,8 +667,8 @@ typedef struct SDL_HapticRamp * This struct is exclusively for the ::SDL_HAPTIC_LEFTRIGHT effect. * * The Left/Right effect is used to explicitly control the large and small - * motors, commonly found in modern game controllers. One motor is high - * frequency, the other is low frequency. + * motors, commonly found in modern game controllers. The small (right) motor + * is high frequency, and the large (left) motor is low frequency. * * \sa SDL_HAPTIC_LEFTRIGHT * \sa SDL_HapticEffect @@ -666,7 +679,7 @@ typedef struct SDL_HapticLeftRight Uint16 type; /**< ::SDL_HAPTIC_LEFTRIGHT */ /* Replay */ - Uint32 length; /**< Duration of the effect. */ + Uint32 length; /**< Duration of the effect in milliseconds. */ /* Rumble */ Uint16 large_magnitude; /**< Control of the large controller motor. */ @@ -676,6 +689,8 @@ typedef struct SDL_HapticLeftRight /** * \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect. * + * This struct is exclusively for the ::SDL_HAPTIC_CUSTOM effect. + * * A custom force feedback effect is much like a periodic effect, where the * application can define its exact shape. You will have to allocate the * data yourself. Data should consist of channels * samples Uint16 samples. @@ -804,7 +819,7 @@ typedef union SDL_HapticEffect extern DECLSPEC int SDLCALL SDL_NumHaptics(void); /** - * \brief Get the implementation dependent name of a Haptic device. + * \brief Get the implementation dependent name of a haptic device. * * This can be called before any joysticks are opened. * If no name can be found, this function returns NULL. @@ -817,9 +832,9 @@ extern DECLSPEC int SDLCALL SDL_NumHaptics(void); extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index); /** - * \brief Opens a Haptic device for usage. + * \brief Opens a haptic device for use. * - * The index passed as an argument refers to the N'th Haptic device on this + * The index passed as an argument refers to the N'th haptic device on this * system. * * When opening a haptic device, its gain will be set to maximum and @@ -885,15 +900,15 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromMouse(void); * \brief Checks to see if a joystick has haptic features. * * \param joystick Joystick to test for haptic capabilities. - * \return 1 if the joystick is haptic, 0 if it isn't - * or -1 if an error ocurred. + * \return SDL_TRUE if the joystick is haptic, SDL_FALSE if it isn't + * or -1 if an error occurred. * * \sa SDL_HapticOpenFromJoystick */ extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick); /** - * \brief Opens a Haptic device for usage from a Joystick device. + * \brief Opens a haptic device for use from a joystick device. * * You must still close the haptic device separately. It will not be closed * with the joystick. @@ -913,7 +928,7 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick * joystick); /** - * \brief Closes a Haptic device previously opened with SDL_HapticOpen(). + * \brief Closes a haptic device previously opened with SDL_HapticOpen(). * * \param haptic Haptic device to close. */ @@ -957,7 +972,7 @@ extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic); * Example: * \code * if (SDL_HapticQuery(haptic) & SDL_HAPTIC_CONSTANT) { - * printf("We have constant haptic effect!"); + * printf("We have constant haptic effect!\n"); * } * \endcode * @@ -996,7 +1011,7 @@ extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic, * * \param haptic Haptic device to create the effect on. * \param effect Properties of the effect to create. - * \return The id of the effect on success or -1 on error. + * \return The identifier of the effect on success or -1 on error. * * \sa SDL_HapticUpdateEffect * \sa SDL_HapticRunEffect @@ -1008,13 +1023,13 @@ extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic, /** * \brief Updates the properties of an effect. * - * Can be used dynamically, although behaviour when dynamically changing + * Can be used dynamically, although behavior when dynamically changing * direction may be strange. Specifically the effect may reupload itself * and start playing from the start. You cannot change the type either when * running SDL_HapticUpdateEffect(). * * \param haptic Haptic device that has the effect. - * \param effect Effect to update. + * \param effect Identifier of the effect to update. * \param data New effect properties to use. * \return 0 on success or -1 on error. * @@ -1218,6 +1233,6 @@ extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic); #endif #include "close_code.h" -#endif /* _SDL_haptic_h */ +#endif /* SDL_haptic_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_hints.h b/third-party/sdl2/include/SDL_hints.h similarity index 58% rename from #ThirdParty/libSDL/include/SDL_hints.h rename to third-party/sdl2/include/SDL_hints.h index 3bd5435..4ee72e9 100644 --- a/#ThirdParty/libSDL/include/SDL_hints.h +++ b/third-party/sdl2/include/SDL_hints.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,8 +36,8 @@ * to how they would like the library to work. */ -#ifndef _SDL_hints_h -#define _SDL_hints_h +#ifndef SDL_hints_h_ +#define SDL_hints_h_ #include "SDL_stdinc.h" @@ -76,6 +76,7 @@ extern "C" { * "opengl" * "opengles2" * "opengles" + * "metal" * "software" * * The default varies by platform, but it's the first one in the list that @@ -118,6 +119,17 @@ extern "C" { */ #define SDL_HINT_RENDER_DIRECT3D11_DEBUG "SDL_RENDER_DIRECT3D11_DEBUG" +/** + * \brief A variable controlling the scaling policy for SDL_RenderSetLogicalSize. + * + * This variable can be set to the following values: + * "0" or "letterbox" - Uses letterbox/sidebars to fit the entire rendering on screen + * "1" or "overscan" - Will zoom the rendering so it fills the entire screen, allowing edges to be drawn offscreen + * + * By default letterbox is used + */ +#define SDL_HINT_RENDER_LOGICAL_SIZE_MODE "SDL_RENDER_LOGICAL_SIZE_MODE" + /** * \brief A variable controlling the scaling quality * @@ -199,6 +211,18 @@ extern "C" { */ #define SDL_HINT_VIDEO_X11_NET_WM_PING "SDL_VIDEO_X11_NET_WM_PING" +/** + * \brief A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint should be used. + * + * This variable can be set to the following values: + * "0" - Disable _NET_WM_BYPASS_COMPOSITOR + * "1" - Enable _NET_WM_BYPASS_COMPOSITOR + * + * By default SDL will use _NET_WM_BYPASS_COMPOSITOR + * + */ +#define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR" + /** * \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden * @@ -210,6 +234,12 @@ extern "C" { */ #define SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN" +/** + * \brief A variable to specify custom icon resource id from RC file on Windows platform + */ +#define SDL_HINT_WINDOWS_INTRESOURCE_ICON "SDL_WINDOWS_INTRESOURCE_ICON" +#define SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL "SDL_WINDOWS_INTRESOURCE_ICON_SMALL" + /** * \brief A variable controlling whether the windows message loop is processed by SDL * @@ -233,16 +263,58 @@ extern "C" { #define SDL_HINT_GRAB_KEYBOARD "SDL_GRAB_KEYBOARD" /** -* \brief A variable controlling whether relative mouse mode is implemented using mouse warping -* -* This variable can be set to the following values: -* "0" - Relative mouse mode uses raw input -* "1" - Relative mouse mode uses mouse warping -* -* By default SDL will use raw input for relative mouse mode -*/ + * \brief A variable setting the double click time, in milliseconds. + */ +#define SDL_HINT_MOUSE_DOUBLE_CLICK_TIME "SDL_MOUSE_DOUBLE_CLICK_TIME" + +/** + * \brief A variable setting the double click radius, in pixels. + */ +#define SDL_HINT_MOUSE_DOUBLE_CLICK_RADIUS "SDL_MOUSE_DOUBLE_CLICK_RADIUS" + +/** + * \brief A variable setting the speed scale for mouse motion, in floating point, when the mouse is not in relative mode + */ +#define SDL_HINT_MOUSE_NORMAL_SPEED_SCALE "SDL_MOUSE_NORMAL_SPEED_SCALE" + +/** + * \brief A variable setting the scale for mouse motion, in floating point, when the mouse is in relative mode + */ +#define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE "SDL_MOUSE_RELATIVE_SPEED_SCALE" + +/** + * \brief A variable controlling whether relative mouse mode is implemented using mouse warping + * + * This variable can be set to the following values: + * "0" - Relative mouse mode uses raw input + * "1" - Relative mouse mode uses mouse warping + * + * By default SDL will use raw input for relative mouse mode + */ #define SDL_HINT_MOUSE_RELATIVE_MODE_WARP "SDL_MOUSE_RELATIVE_MODE_WARP" +/** + * \brief Allow mouse click events when clicking to focus an SDL window + * + * This variable can be set to the following values: + * "0" - Ignore mouse clicks that activate a window + * "1" - Generate events for mouse clicks that activate a window + * + * By default SDL will ignore mouse clicks that activate a window + */ +#define SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH "SDL_MOUSE_FOCUS_CLICKTHROUGH" + +/** + * \brief A variable controlling whether touch events should generate synthetic mouse events + * + * This variable can be set to the following values: + * "0" - Touch events will not generate mouse events + * "1" - Touch events will generate mouse events + * + * By default SDL will generate mouse events for touch events + */ +#define SDL_HINT_TOUCH_MOUSE_EVENTS "SDL_TOUCH_MOUSE_EVENTS" + /** * \brief Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true. * @@ -257,8 +329,8 @@ extern "C" { * this is problematic. This functionality can be disabled by setting this * hint. * - * As of SDL 2.0.4, SDL_EnableScreenSaver and SDL_DisableScreenSaver accomplish - * the same thing on iOS. They should be preferred over this hint. + * As of SDL 2.0.4, SDL_EnableScreenSaver() and SDL_DisableScreenSaver() + * accomplish the same thing on iOS. They should be preferred over this hint. * * This variable can be set to the following values: * "0" - Enable idle timer @@ -267,7 +339,7 @@ extern "C" { #define SDL_HINT_IDLE_TIMER_DISABLED "SDL_IOS_IDLE_TIMER_DISABLED" /** - * \brief A variable controlling which orientations are allowed on iOS. + * \brief A variable controlling which orientations are allowed on iOS/Android. * * In some circumstances it is necessary to be able to explicitly control * which UI orientations are allowed. @@ -276,18 +348,65 @@ extern "C" { * "LandscapeLeft", "LandscapeRight", "Portrait" "PortraitUpsideDown" */ #define SDL_HINT_ORIENTATIONS "SDL_IOS_ORIENTATIONS" - + /** - * \brief A variable controlling whether the Android / iOS built-in - * accelerometer should be listed as a joystick device, rather than listing - * actual joysticks only. + * \brief A variable controlling whether controllers used with the Apple TV + * generate UI events. + * + * When UI events are generated by controller input, the app will be + * backgrounded when the Apple TV remote's menu button is pressed, and when the + * pause or B buttons on gamepads are pressed. + * + * More information about properly making use of controllers for the Apple TV + * can be found here: + * https://developer.apple.com/tvos/human-interface-guidelines/remote-and-controllers/ * * This variable can be set to the following values: - * "0" - List only real joysticks and accept input from them - * "1" - List real joysticks along with the accelerometer as if it were a 3 axis joystick (the default). + * "0" - Controller input does not generate UI events (the default). + * "1" - Controller input generates UI events. + */ +#define SDL_HINT_APPLE_TV_CONTROLLER_UI_EVENTS "SDL_APPLE_TV_CONTROLLER_UI_EVENTS" + +/** + * \brief A variable controlling whether the Apple TV remote's joystick axes + * will automatically match the rotation of the remote. + * + * This variable can be set to the following values: + * "0" - Remote orientation does not affect joystick axes (the default). + * "1" - Joystick axes are based on the orientation of the remote. + */ +#define SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION" + +/** + * \brief A variable controlling whether the home indicator bar on iPhone X + * should be hidden. + * + * This variable can be set to the following values: + * "0" - The indicator bar is not hidden (default for windowed applications) + * "1" - The indicator bar is hidden and is shown when the screen is touched (useful for movie playback applications) + * "2" - The indicator bar is dim and the first swipe makes it visible and the second swipe performs the "home" action (default for fullscreen applications) + */ +#define SDL_HINT_IOS_HIDE_HOME_INDICATOR "SDL_IOS_HIDE_HOME_INDICATOR" + +/** + * \brief A variable controlling whether the Android / iOS built-in + * accelerometer should be listed as a joystick device. + * + * This variable can be set to the following values: + * "0" - The accelerometer is not listed as a joystick + * "1" - The accelerometer is available as a 3 axis joystick (the default). */ #define SDL_HINT_ACCELEROMETER_AS_JOYSTICK "SDL_ACCELEROMETER_AS_JOYSTICK" +/** + * \brief A variable controlling whether the Android / tvOS remotes + * should be listed as joystick devices, instead of sending keyboard events. + * + * This variable can be set to the following values: + * "0" - Remotes send enter/escape/arrow key events + * "1" - Remotes are available as 2 axis, 2 button joysticks (the default). + */ +#define SDL_HINT_TV_REMOTE_AS_JOYSTICK "SDL_TV_REMOTE_AS_JOYSTICK" /** * \brief A variable that lets you disable the detection and use of Xinput gamepad devices @@ -298,7 +417,6 @@ extern "C" { */ #define SDL_HINT_XINPUT_ENABLED "SDL_XINPUT_ENABLED" - /** * \brief A variable that causes SDL to use the old axis and button mapping for XInput devices. * @@ -308,9 +426,8 @@ extern "C" { */ #define SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING "SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING" - /** - * \brief A variable that lets you manually hint extra gamecontroller db entries + * \brief A variable that lets you manually hint extra gamecontroller db entries. * * The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h * @@ -319,6 +436,31 @@ extern "C" { */ #define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG" +/** + * \brief A variable containing a list of devices to skip when scanning for game controllers. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES "SDL_GAMECONTROLLER_IGNORE_DEVICES" + +/** + * \brief If set, all devices will be skipped when scanning for game controllers except for the ones listed in this variable. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT" /** * \brief A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background. @@ -333,6 +475,87 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS" +/** + * \brief A variable controlling whether the HIDAPI joystick drivers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI drivers are not used + * "1" - HIDAPI drivers are used (the default) + * + * This variable is the default for all drivers, but can be overridden by the hints for specific drivers below. + */ +#define SDL_HINT_JOYSTICK_HIDAPI "SDL_JOYSTICK_HIDAPI" + +/** + * \brief A variable controlling whether the HIDAPI driver for PS4 controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */ +#define SDL_HINT_JOYSTICK_HIDAPI_PS4 "SDL_JOYSTICK_HIDAPI_PS4" + +/** + * \brief A variable controlling whether extended input reports should be used for PS4 controllers when using the HIDAPI driver. + * + * This variable can be set to the following values: + * "0" - extended reports are not enabled (the default) + * "1" - extended reports + * + * Extended input reports allow rumble on Bluetooth PS4 controllers, but + * break DirectInput handling for applications that don't use SDL. + * + * Once extended reports are enabled, they can not be disabled without + * power cycling the controller. + */ +#define SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE "SDL_JOYSTICK_HIDAPI_PS4_RUMBLE" + +/** + * \brief A variable controlling whether the HIDAPI driver for Steam Controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */ +#define SDL_HINT_JOYSTICK_HIDAPI_STEAM "SDL_JOYSTICK_HIDAPI_STEAM" + +/** + * \brief A variable controlling whether the HIDAPI driver for Nintendo Switch controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */ +#define SDL_HINT_JOYSTICK_HIDAPI_SWITCH "SDL_JOYSTICK_HIDAPI_SWITCH" + +/** + * \brief A variable controlling whether the HIDAPI driver for XBox controllers should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */ +#define SDL_HINT_JOYSTICK_HIDAPI_XBOX "SDL_JOYSTICK_HIDAPI_XBOX" + +/** + * \brief A variable that controls whether Steam Controllers should be exposed using the SDL joystick and game controller APIs + * + * The variable can be set to the following values: + * "0" - Do not scan for Steam Controllers + * "1" - Scan for Steam Controllers (the default) + * + * The default value is "1". This hint must be set before initializing the joystick subsystem. + */ +#define SDL_HINT_ENABLE_STEAM_CONTROLLERS "SDL_ENABLE_STEAM_CONTROLLERS" + /** * \brief If set to "0" then never set the top most bit on a SDL Window, even if the video mode expects it. @@ -344,7 +567,6 @@ extern "C" { */ #define SDL_HINT_ALLOW_TOPMOST "SDL_ALLOW_TOPMOST" - /** * \brief A variable that controls the timer resolution, in milliseconds. * @@ -362,6 +584,33 @@ extern "C" { #define SDL_HINT_TIMER_RESOLUTION "SDL_TIMER_RESOLUTION" +/** + * \brief A variable describing the content orientation on QtWayland-based platforms. + * + * On QtWayland platforms, windows are rotated client-side to allow for custom + * transitions. In order to correctly position overlays (e.g. volume bar) and + * gestures (e.g. events view, close/minimize gestures), the system needs to + * know in which orientation the application is currently drawing its contents. + * + * This does not cause the window to be rotated or resized, the application + * needs to take care of drawing the content in the right orientation (the + * framebuffer is always in portrait mode). + * + * This variable can be one of the following values: + * "primary" (default), "portrait", "landscape", "inverted-portrait", "inverted-landscape" + */ +#define SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION "SDL_QTWAYLAND_CONTENT_ORIENTATION" + +/** + * \brief Flags to set on QtWayland windows to integrate with the native window manager. + * + * On QtWayland platforms, this hint controls the flags to set on the windows. + * For example, on Sailfish OS "OverridesSystemGestures" disables swipe gestures. + * + * This variable is a space-separated list of the following values (empty = no flags): + * "OverridesSystemGestures", "StaysOnTop", "BypassWindowManager" + */ +#define SDL_HINT_QTWAYLAND_WINDOW_FLAGS "SDL_QTWAYLAND_WINDOW_FLAGS" /** * \brief A string specifying SDL's threads stack size in bytes or "0" for the backend's default size @@ -369,7 +618,11 @@ extern "C" { * Use this hint in case you need to set SDL's threads stack size to other than the default. * This is specially useful if you build SDL against a non glibc libc library (such as musl) which * provides a relatively small default thread stack size (a few kilobytes versus the default 8MB glibc uses). -* Support for this hint is currently available only in the pthread backend. +* Support for this hint is currently available only in the pthread, Windows, and PSP backend. +* +* Instead of this hint, in 2.0.9 and later, you can use +* SDL_CreateThreadWithStackSize(). This hint only works with the classic +* SDL_CreateThread(). */ #define SDL_HINT_THREAD_STACK_SIZE "SDL_THREAD_STACK_SIZE" @@ -431,7 +684,7 @@ extern "C" { * privacy policy. * * To setup a URL to an app's privacy policy, set SDL_HINT_WINRT_PRIVACY_POLICY_URL - * before calling any SDL_Init functions. The contents of the hint should + * before calling any SDL_Init() functions. The contents of the hint should * be a valid URL. For example, "http://www.example.com". * * The default value is "", which will prevent SDL from adding a privacy policy @@ -461,7 +714,7 @@ extern "C" { * The contents of this hint should be encoded as a UTF8 string. * * The default value is "Privacy Policy". This hint should only be set during app - * initialization, preferably before any calls to SDL_Init. + * initialization, preferably before any calls to SDL_Init(). * * For additional information on linking to a privacy policy, see the documentation for * SDL_HINT_WINRT_PRIVACY_POLICY_URL. @@ -595,6 +848,35 @@ extern "C" { */ #define SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH "SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH" + /** + * \brief A variable to control whether we trap the Android back button to handle it manually. + * This is necessary for the right mouse button to work on some Android devices, or + * to be able to trap the back button for use in your code reliably. If set to true, + * the back button will show up as an SDL_KEYDOWN / SDL_KEYUP pair with a keycode of + * SDL_SCANCODE_AC_BACK. + * + * The variable can be set to the following values: + * "0" - Back button will be handled as usual for system. (default) + * "1" - Back button will be trapped, allowing you to handle the key press + * manually. (This will also let right mouse click work on systems + * where the right mouse button functions as back.) + * + * The value of this hint is used at runtime, so it can be changed at any time. + */ +#define SDL_HINT_ANDROID_TRAP_BACK_BUTTON "SDL_ANDROID_TRAP_BACK_BUTTON" + + /** + * \brief A variable to control whether the return key on the soft keyboard + * should hide the soft keyboard on Android and iOS. + * + * The variable can be set to the following values: + * "0" - The return key will be handled as a key event. This is the behaviour of SDL <= 2.0.3. (default) + * "1" - The return key will hide the keyboard. + * + * The value of this hint is used at runtime, so it can be changed at any time. + */ +#define SDL_HINT_RETURN_KEY_HIDES_IME "SDL_RETURN_KEY_HIDES_IME" + /** * \brief override the binding element for keyboard inputs for Emscripten builds * @@ -628,7 +910,138 @@ extern "C" { * "0" - SDL will generate a window-close event when it sees Alt+F4. * "1" - SDL will only do normal key handling for Alt+F4. */ -#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4" +#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4" + +/** + * \brief Prevent SDL from using version 4 of the bitmap header when saving BMPs. + * + * The bitmap header version 4 is required for proper alpha channel support and + * SDL will use it when required. Should this not be desired, this hint can + * force the use of the 40 byte header version which is supported everywhere. + * + * The variable can be set to the following values: + * "0" - Surfaces with a colorkey or an alpha channel are saved to a + * 32-bit BMP file with an alpha mask. SDL will use the bitmap + * header version 4 and set the alpha mask accordingly. + * "1" - Surfaces with a colorkey or an alpha channel are saved to a + * 32-bit BMP file without an alpha mask. The alpha channel data + * will be in the file, but applications are going to ignore it. + * + * The default value is "0". + */ +#define SDL_HINT_BMP_SAVE_LEGACY_FORMAT "SDL_BMP_SAVE_LEGACY_FORMAT" + +/** + * \brief Tell SDL not to name threads on Windows with the 0x406D1388 Exception. + * The 0x406D1388 Exception is a trick used to inform Visual Studio of a + * thread's name, but it tends to cause problems with other debuggers, + * and the .NET runtime. Note that SDL 2.0.6 and later will still use + * the (safer) SetThreadDescription API, introduced in the Windows 10 + * Creators Update, if available. + * + * The variable can be set to the following values: + * "0" - SDL will raise the 0x406D1388 Exception to name threads. + * This is the default behavior of SDL <= 2.0.4. + * "1" - SDL will not raise this exception, and threads will be unnamed. (default) + * This is necessary with .NET languages or debuggers that aren't Visual Studio. + */ +#define SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING "SDL_WINDOWS_DISABLE_THREAD_NAMING" + +/** + * \brief Tell SDL which Dispmanx layer to use on a Raspberry PI + * + * Also known as Z-order. The variable can take a negative or positive value. + * The default is 10000. + */ +#define SDL_HINT_RPI_VIDEO_LAYER "SDL_RPI_VIDEO_LAYER" + +/** + * \brief Tell the video driver that we only want a double buffer. + * + * By default, most lowlevel 2D APIs will use a triple buffer scheme that + * wastes no CPU time on waiting for vsync after issuing a flip, but + * introduces a frame of latency. On the other hand, using a double buffer + * scheme instead is recommended for cases where low latency is an important + * factor because we save a whole frame of latency. + * We do so by waiting for vsync immediately after issuing a flip, usually just + * after eglSwapBuffers call in the backend's *_SwapWindow function. + * + * Since it's driver-specific, it's only supported where possible and + * implemented. Currently supported the following drivers: + * - KMSDRM (kmsdrm) + * - Raspberry Pi (raspberrypi) + */ +#define SDL_HINT_VIDEO_DOUBLE_BUFFER "SDL_VIDEO_DOUBLE_BUFFER" + +/** + * \brief A variable controlling what driver to use for OpenGL ES contexts. + * + * On some platforms, currently Windows and X11, OpenGL drivers may support + * creating contexts with an OpenGL ES profile. By default SDL uses these + * profiles, when available, otherwise it attempts to load an OpenGL ES + * library, e.g. that provided by the ANGLE project. This variable controls + * whether SDL follows this default behaviour or will always load an + * OpenGL ES library. + * + * Circumstances where this is useful include + * - Testing an app with a particular OpenGL ES implementation, e.g ANGLE, + * or emulator, e.g. those from ARM, Imagination or Qualcomm. + * - Resolving OpenGL ES function addresses at link time by linking with + * the OpenGL ES library instead of querying them at run time with + * SDL_GL_GetProcAddress(). + * + * Caution: for an application to work with the default behaviour across + * different OpenGL drivers it must query the OpenGL ES function + * addresses at run time using SDL_GL_GetProcAddress(). + * + * This variable is ignored on most platforms because OpenGL ES is native + * or not supported. + * + * This variable can be set to the following values: + * "0" - Use ES profile of OpenGL, if available. (Default when not set.) + * "1" - Load OpenGL ES library using the default library names. + * + */ +#define SDL_HINT_OPENGL_ES_DRIVER "SDL_OPENGL_ES_DRIVER" + +/** + * \brief A variable controlling speed/quality tradeoff of audio resampling. + * + * If available, SDL can use libsamplerate ( http://www.mega-nerd.com/SRC/ ) + * to handle audio resampling. There are different resampling modes available + * that produce different levels of quality, using more CPU. + * + * If this hint isn't specified to a valid setting, or libsamplerate isn't + * available, SDL will use the default, internal resampling algorithm. + * + * Note that this is currently only applicable to resampling audio that is + * being written to a device for playback or audio being read from a device + * for capture. SDL_AudioCVT always uses the default resampler (although this + * might change for SDL 2.1). + * + * This hint is currently only checked at audio subsystem initialization. + * + * This variable can be set to the following values: + * + * "0" or "default" - Use SDL's internal resampling (Default when not set - low quality, fast) + * "1" or "fast" - Use fast, slightly higher quality resampling, if available + * "2" or "medium" - Use medium quality resampling, if available + * "3" or "best" - Use high quality resampling, if available + */ +#define SDL_HINT_AUDIO_RESAMPLING_MODE "SDL_AUDIO_RESAMPLING_MODE" + +/** + * \brief A variable controlling the audio category on iOS and Mac OS X + * + * This variable can be set to the following values: + * + * "ambient" - Use the AVAudioSessionCategoryAmbient audio category, will be muted by the phone mute switch (default) + * "playback" - Use the AVAudioSessionCategoryPlayback category + * + * For more information, see Apple's documentation: + * https://developer.apple.com/library/content/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/AudioSessionCategoriesandModes/AudioSessionCategoriesandModes.html + */ +#define SDL_HINT_AUDIO_CATEGORY "SDL_AUDIO_CATEGORY" /** * \brief An enumeration of hint priorities @@ -669,6 +1082,18 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name, */ extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name); +/** + * \brief Get a hint + * + * \return The boolean value of a hint variable. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_GetHintBoolean(const char *name, SDL_bool default_value); + +/** + * \brief type definition of the hint callback function. + */ +typedef void (SDLCALL *SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue); + /** * \brief Add a function to watch a particular hint * @@ -676,7 +1101,6 @@ extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name); * \param callback The function to call when the hint value changes * \param userdata A pointer to pass to the callback function */ -typedef void (*SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue); extern DECLSPEC void SDLCALL SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata); @@ -706,6 +1130,6 @@ extern DECLSPEC void SDLCALL SDL_ClearHints(void); #endif #include "close_code.h" -#endif /* _SDL_hints_h */ +#endif /* SDL_hints_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_joystick.h b/third-party/sdl2/include/SDL_joystick.h similarity index 60% rename from #ThirdParty/libSDL/include/SDL_joystick.h rename to third-party/sdl2/include/SDL_joystick.h index 266f3b3..6e05a9c 100644 --- a/#ThirdParty/libSDL/include/SDL_joystick.h +++ b/third-party/sdl2/include/SDL_joystick.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ * * Include file for SDL joystick event handling * - * The term "device_index" identifies currently plugged in joystick devices between 0 and SDL_NumJoysticks, with the exact joystick + * The term "device_index" identifies currently plugged in joystick devices between 0 and SDL_NumJoysticks(), with the exact joystick * behind a device_index changing as joysticks are plugged and unplugged. * * The term "instance_id" is the current instantiation of a joystick device in the system, if the joystick is removed and then re-inserted @@ -36,8 +36,8 @@ * */ -#ifndef _SDL_joystick_h -#define _SDL_joystick_h +#ifndef SDL_joystick_h_ +#define SDL_joystick_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -60,7 +60,9 @@ extern "C" { * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS */ -/* The joystick structure used to identify an SDL joystick */ +/** + * The joystick structure used to identify an SDL joystick + */ struct _SDL_Joystick; typedef struct _SDL_Joystick SDL_Joystick; @@ -69,20 +71,55 @@ typedef struct { Uint8 data[16]; } SDL_JoystickGUID; +/** + * This is a unique ID for a joystick for the time it is connected to the system, + * and is never reused for the lifetime of the application. If the joystick is + * disconnected and reconnected, it will get a new ID. + * + * The ID value starts at 0 and increments from there. The value -1 is an invalid ID. + */ typedef Sint32 SDL_JoystickID; +typedef enum +{ + SDL_JOYSTICK_TYPE_UNKNOWN, + SDL_JOYSTICK_TYPE_GAMECONTROLLER, + SDL_JOYSTICK_TYPE_WHEEL, + SDL_JOYSTICK_TYPE_ARCADE_STICK, + SDL_JOYSTICK_TYPE_FLIGHT_STICK, + SDL_JOYSTICK_TYPE_DANCE_PAD, + SDL_JOYSTICK_TYPE_GUITAR, + SDL_JOYSTICK_TYPE_DRUM_KIT, + SDL_JOYSTICK_TYPE_ARCADE_PAD, + SDL_JOYSTICK_TYPE_THROTTLE +} SDL_JoystickType; + typedef enum { SDL_JOYSTICK_POWER_UNKNOWN = -1, - SDL_JOYSTICK_POWER_EMPTY, - SDL_JOYSTICK_POWER_LOW, - SDL_JOYSTICK_POWER_MEDIUM, - SDL_JOYSTICK_POWER_FULL, + SDL_JOYSTICK_POWER_EMPTY, /* <= 5% */ + SDL_JOYSTICK_POWER_LOW, /* <= 20% */ + SDL_JOYSTICK_POWER_MEDIUM, /* <= 70% */ + SDL_JOYSTICK_POWER_FULL, /* <= 100% */ SDL_JOYSTICK_POWER_WIRED, SDL_JOYSTICK_POWER_MAX } SDL_JoystickPowerLevel; /* Function prototypes */ + +/** + * Locking for multi-threaded access to the joystick API + * + * If you are using the joystick API or handling events from multiple threads + * you should use these locking functions to protect access to the joysticks. + * + * In particular, you are guaranteed that the joystick list won't change, so + * the API functions that take a joystick index will be valid, and joystick + * and game controller events will not be delivered. + */ +extern DECLSPEC void SDLCALL SDL_LockJoysticks(void); +extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void); + /** * Count the number of joysticks attached to the system right now */ @@ -95,6 +132,52 @@ extern DECLSPEC int SDLCALL SDL_NumJoysticks(void); */ extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index); +/** + * Get the player index of a joystick, or -1 if it's not available + * This can be called before any joysticks are opened. + */ +extern DECLSPEC int SDLCALL SDL_JoystickGetDevicePlayerIndex(int device_index); + +/** + * Return the GUID for the joystick at this index + * This can be called before any joysticks are opened. + */ +extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index); + +/** + * Get the USB vendor ID of a joystick, if available. + * This can be called before any joysticks are opened. + * If the vendor ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceVendor(int device_index); + +/** + * Get the USB product ID of a joystick, if available. + * This can be called before any joysticks are opened. + * If the product ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProduct(int device_index); + +/** + * Get the product version of a joystick, if available. + * This can be called before any joysticks are opened. + * If the product version isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProductVersion(int device_index); + +/** + * Get the type of a joystick, if available. + * This can be called before any joysticks are opened. + */ +extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetDeviceType(int device_index); + +/** + * Get the instance ID of a joystick. + * This can be called before any joysticks are opened. + * If the index is out of range, this function will return -1. + */ +extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickGetDeviceInstanceID(int device_index); + /** * Open a joystick for use. * The index passed as an argument refers to the N'th joystick on the system. @@ -118,15 +201,40 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick); /** - * Return the GUID for the joystick at this index + * Get the player index of an opened joystick, or -1 if it's not available + * + * For XInput controllers this returns the XInput user index. */ -extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index); +extern DECLSPEC int SDLCALL SDL_JoystickGetPlayerIndex(SDL_Joystick * joystick); /** * Return the GUID for this opened joystick */ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joystick); +/** + * Get the USB vendor ID of an opened joystick, if available. + * If the vendor ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetVendor(SDL_Joystick * joystick); + +/** + * Get the USB product ID of an opened joystick, if available. + * If the product ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick * joystick); + +/** + * Get the product version of an opened joystick, if available. + * If the product version isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick * joystick); + +/** + * Get the type of an opened joystick. + */ +extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetType(SDL_Joystick * joystick); + /** * Return a string representation for this guid. pszGUID must point to at least 33 bytes * (32 for the string plus a NULL terminator). @@ -134,7 +242,7 @@ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joys extern DECLSPEC void SDLCALL SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID); /** - * convert a string into a joystick formatted guid + * Convert a string into a joystick guid */ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const char *pchGUID); @@ -190,6 +298,8 @@ extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void); */ extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state); +#define SDL_JOYSTICK_AXIS_MAX 32767 +#define SDL_JOYSTICK_AXIS_MIN -32768 /** * Get the current state of an axis control on a joystick. * @@ -200,6 +310,18 @@ extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state); extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick * joystick, int axis); +/** + * Get the initial state of an axis control on a joystick. + * + * The state is a value ranging from -32768 to 32767. + * + * The axis indices start at index 0. + * + * \return SDL_TRUE if this axis has any initial value, or SDL_FALSE if not. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick * joystick, + int axis, Sint16 *state); + /** * \name Hat positions */ @@ -252,6 +374,19 @@ extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick * joystick, extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick * joystick, int button); +/** + * Trigger a rumble effect + * Each call to this function cancels any previous rumble effect, and calling it with 0 intensity stops any rumbling. + * + * \param joystick The joystick to vibrate + * \param low_frequency_rumble The intensity of the low frequency (left) rumble motor, from 0 to 0xFFFF + * \param high_frequency_rumble The intensity of the high frequency (right) rumble motor, from 0 to 0xFFFF + * \param duration_ms The duration of the rumble effect, in milliseconds + * + * \return 0, or -1 if rumble isn't supported on this joystick + */ +extern DECLSPEC int SDLCALL SDL_JoystickRumble(SDL_Joystick * joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); + /** * Close a joystick previously opened with SDL_JoystickOpen(). */ @@ -268,6 +403,6 @@ extern DECLSPEC SDL_JoystickPowerLevel SDLCALL SDL_JoystickCurrentPowerLevel(SDL #endif #include "close_code.h" -#endif /* _SDL_joystick_h */ +#endif /* SDL_joystick_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_keyboard.h b/third-party/sdl2/include/SDL_keyboard.h similarity index 97% rename from #ThirdParty/libSDL/include/SDL_keyboard.h rename to third-party/sdl2/include/SDL_keyboard.h index bbba0f0..8748231 100644 --- a/#ThirdParty/libSDL/include/SDL_keyboard.h +++ b/third-party/sdl2/include/SDL_keyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL keyboard event handling */ -#ifndef _SDL_keyboard_h -#define _SDL_keyboard_h +#ifndef SDL_keyboard_h_ +#define SDL_keyboard_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -136,7 +136,7 @@ extern DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromName(const char *name); * copy it. If the key doesn't have a name, this function returns an * empty string (""). * - * \sa SDL_Key + * \sa SDL_Keycode */ extern DECLSPEC const char *SDLCALL SDL_GetKeyName(SDL_Keycode key); @@ -212,6 +212,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenKeyboardShown(SDL_Window *window); #endif #include "close_code.h" -#endif /* _SDL_keyboard_h */ +#endif /* SDL_keyboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_keycode.h b/third-party/sdl2/include/SDL_keycode.h similarity index 96% rename from #ThirdParty/libSDL/include/SDL_keycode.h rename to third-party/sdl2/include/SDL_keycode.h index 7be9635..d7d5b1d 100644 --- a/#ThirdParty/libSDL/include/SDL_keycode.h +++ b/third-party/sdl2/include/SDL_keycode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Defines constants which identify keyboard keys and modifiers. */ -#ifndef _SDL_keycode_h -#define _SDL_keycode_h +#ifndef SDL_keycode_h_ +#define SDL_keycode_h_ #include "SDL_stdinc.h" #include "SDL_scancode.h" @@ -38,6 +38,9 @@ * layout of the keyboard. These values include Unicode values representing * the unmodified character that would be generated by pressing the key, or * an SDLK_* constant for those keys that do not generate characters. + * + * A special exception is the number keys at the top of the keyboard which + * always map to SDLK_0...SDLK_9, regardless of layout. */ typedef Sint32 SDL_Keycode; @@ -308,7 +311,12 @@ enum SDLK_KBDILLUMDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMDOWN), SDLK_KBDILLUMUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMUP), SDLK_EJECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EJECT), - SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP) + SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP), + SDLK_APP1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP1), + SDLK_APP2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP2), + + SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND), + SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD) }; /** @@ -336,6 +344,6 @@ typedef enum #define KMOD_ALT (KMOD_LALT|KMOD_RALT) #define KMOD_GUI (KMOD_LGUI|KMOD_RGUI) -#endif /* _SDL_keycode_h */ +#endif /* SDL_keycode_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_loadso.h b/third-party/sdl2/include/SDL_loadso.h similarity index 95% rename from #ThirdParty/libSDL/include/SDL_loadso.h rename to third-party/sdl2/include/SDL_loadso.h index 3d540bd..da56fb4 100644 --- a/#ThirdParty/libSDL/include/SDL_loadso.h +++ b/third-party/sdl2/include/SDL_loadso.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,8 +38,8 @@ * the results you expect. :) */ -#ifndef _SDL_loadso_h -#define _SDL_loadso_h +#ifndef SDL_loadso_h_ +#define SDL_loadso_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -76,6 +76,6 @@ extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle); #endif #include "close_code.h" -#endif /* _SDL_loadso_h */ +#endif /* SDL_loadso_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_log.h b/third-party/sdl2/include/SDL_log.h similarity index 96% rename from #ThirdParty/libSDL/include/SDL_log.h rename to third-party/sdl2/include/SDL_log.h index 09be110..e12b658 100644 --- a/#ThirdParty/libSDL/include/SDL_log.h +++ b/third-party/sdl2/include/SDL_log.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,8 +34,8 @@ * Others: standard error output (stderr) */ -#ifndef _SDL_log_h -#define _SDL_log_h +#ifndef SDL_log_h_ +#define SDL_log_h_ #include "SDL_stdinc.h" @@ -186,7 +186,7 @@ extern DECLSPEC void SDLCALL SDL_LogMessageV(int category, /** * \brief The prototype for the log output function */ -typedef void (*SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message); +typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message); /** * \brief Get the current log output function. @@ -206,6 +206,6 @@ extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction call #endif #include "close_code.h" -#endif /* _SDL_log_h */ +#endif /* SDL_log_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_main.h b/third-party/sdl2/include/SDL_main.h similarity index 91% rename from #ThirdParty/libSDL/include/SDL_main.h rename to third-party/sdl2/include/SDL_main.h index 9ce3754..9855821 100644 --- a/#ThirdParty/libSDL/include/SDL_main.h +++ b/third-party/sdl2/include/SDL_main.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_main_h -#define _SDL_main_h +#ifndef SDL_main_h_ +#define SDL_main_h_ #include "SDL_stdinc.h" @@ -63,10 +63,13 @@ /* On Android SDL provides a Java class in SDLActivity.java that is the main activity entry point. - See README-android.txt for more details on extending that class. + See docs/README-android.md for more details on extending that class. */ #define SDL_MAIN_NEEDED +/* We need to export SDL_main so it can be launched from Java */ +#define SDLMAIN_DECLSPEC DECLSPEC + #elif defined(__NACL__) /* On NACL we use ppapi_simple to set up the application helper code, then wait for the first PSE_INSTANCE_DIDCHANGEVIEW event before @@ -85,6 +88,10 @@ #define C_LINKAGE #endif /* __cplusplus */ +#ifndef SDLMAIN_DECLSPEC +#define SDLMAIN_DECLSPEC +#endif + /** * \file SDL_main.h * @@ -107,7 +114,7 @@ /** * The prototype for the application's main() function */ -extern C_LINKAGE int SDL_main(int argc, char *argv[]); +extern C_LINKAGE SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]); #include "begin_code.h" @@ -156,6 +163,6 @@ extern DECLSPEC int SDLCALL SDL_WinRTRunApp(int (*mainFunction)(int, char **), v #endif #include "close_code.h" -#endif /* _SDL_main_h */ +#endif /* SDL_main_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_messagebox.h b/third-party/sdl2/include/SDL_messagebox.h similarity index 96% rename from #ThirdParty/libSDL/include/SDL_messagebox.h rename to third-party/sdl2/include/SDL_messagebox.h index ec370db..b7be59d 100644 --- a/#ThirdParty/libSDL/include/SDL_messagebox.h +++ b/third-party/sdl2/include/SDL_messagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_messagebox_h -#define _SDL_messagebox_h +#ifndef SDL_messagebox_h_ +#define SDL_messagebox_h_ #include "SDL_stdinc.h" #include "SDL_video.h" /* For SDL_Window */ @@ -139,6 +139,6 @@ extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *t #endif #include "close_code.h" -#endif /* _SDL_messagebox_h */ +#endif /* SDL_messagebox_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_mouse.h b/third-party/sdl2/include/SDL_mouse.h similarity index 96% rename from #ThirdParty/libSDL/include/SDL_mouse.h rename to third-party/sdl2/include/SDL_mouse.h index ea9622f..d3c9f61 100644 --- a/#ThirdParty/libSDL/include/SDL_mouse.h +++ b/third-party/sdl2/include/SDL_mouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL mouse event handling. */ -#ifndef _SDL_mouse_h -#define _SDL_mouse_h +#ifndef SDL_mouse_h_ +#define SDL_mouse_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -38,10 +38,10 @@ extern "C" { #endif -typedef struct SDL_Cursor SDL_Cursor; /* Implementation dependent */ +typedef struct SDL_Cursor SDL_Cursor; /**< Implementation dependent */ /** - * \brief Cursor types for SDL_CreateSystemCursor. + * \brief Cursor types for SDL_CreateSystemCursor(). */ typedef enum { @@ -254,9 +254,11 @@ extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetCursor(void); extern DECLSPEC SDL_Cursor *SDLCALL SDL_GetDefaultCursor(void); /** - * \brief Frees a cursor created with SDL_CreateCursor(). + * \brief Frees a cursor created with SDL_CreateCursor() or similar functions. * * \sa SDL_CreateCursor() + * \sa SDL_CreateColorCursor() + * \sa SDL_CreateSystemCursor() */ extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor * cursor); @@ -295,6 +297,6 @@ extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle); #endif #include "close_code.h" -#endif /* _SDL_mouse_h */ +#endif /* SDL_mouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_mutex.h b/third-party/sdl2/include/SDL_mutex.h similarity index 98% rename from #ThirdParty/libSDL/include/SDL_mutex.h rename to third-party/sdl2/include/SDL_mutex.h index b7e3973..ba4247c 100644 --- a/#ThirdParty/libSDL/include/SDL_mutex.h +++ b/third-party/sdl2/include/SDL_mutex.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_mutex_h -#define _SDL_mutex_h +#ifndef SDL_mutex_h_ +#define SDL_mutex_h_ /** * \file SDL_mutex.h @@ -246,6 +246,6 @@ extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond, #endif #include "close_code.h" -#endif /* _SDL_mutex_h */ +#endif /* SDL_mutex_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_name.h b/third-party/sdl2/include/SDL_name.h similarity index 89% rename from #ThirdParty/libSDL/include/SDL_name.h rename to third-party/sdl2/include/SDL_name.h index 06cd4a5..ecd863f 100644 --- a/#ThirdParty/libSDL/include/SDL_name.h +++ b/third-party/sdl2/include/SDL_name.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDLname_h_ -#define _SDLname_h_ +#ifndef SDLname_h_ +#define SDLname_h_ #if defined(__STDC__) || defined(__cplusplus) #define NeedFunctionPrototypes 1 @@ -28,6 +28,6 @@ #define SDL_NAME(X) SDL_##X -#endif /* _SDLname_h_ */ +#endif /* SDLname_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_opengl.h b/third-party/sdl2/include/SDL_opengl.h similarity index 99% rename from #ThirdParty/libSDL/include/SDL_opengl.h rename to third-party/sdl2/include/SDL_opengl.h index 780919b..253d9c9 100644 --- a/#ThirdParty/libSDL/include/SDL_opengl.h +++ b/third-party/sdl2/include/SDL_opengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,8 +32,8 @@ * version included in SDL_opengl.h. */ -#ifndef _SDL_opengl_h -#define _SDL_opengl_h +#ifndef SDL_opengl_h_ +#define SDL_opengl_h_ #include "SDL_config.h" @@ -97,6 +97,13 @@ #elif defined(__CYGWIN__) && defined(USE_OPENGL32) /* use native windows opengl32 */ # define GLAPI extern # define GLAPIENTRY __stdcall +#elif defined(__OS2__) || defined(__EMX__) /* native os/2 opengl */ +# define GLAPI extern +# define GLAPIENTRY _System +# define APIENTRY _System +# if defined(__GNUC__) && !defined(_System) +# define _System +# endif #elif (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) # define GLAPI __attribute__((visibility("default"))) # define GLAPIENTRY @@ -2171,6 +2178,6 @@ typedef void (APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum t #endif /* !__IPHONEOS__ */ -#endif /* _SDL_opengl_h */ +#endif /* SDL_opengl_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_opengl_glext.h b/third-party/sdl2/include/SDL_opengl_glext.h similarity index 100% rename from #ThirdParty/libSDL/include/SDL_opengl_glext.h rename to third-party/sdl2/include/SDL_opengl_glext.h diff --git a/#ThirdParty/libSDL/include/SDL_opengles.h b/third-party/sdl2/include/SDL_opengles.h similarity index 93% rename from #ThirdParty/libSDL/include/SDL_opengles.h rename to third-party/sdl2/include/SDL_opengles.h index bcc1277..18dd984 100644 --- a/#ThirdParty/libSDL/include/SDL_opengles.h +++ b/third-party/sdl2/include/SDL_opengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,7 @@ * * This is a simple file to encapsulate the OpenGL ES 1.X API headers. */ +#include "SDL_config.h" #ifdef __IPHONEOS__ #include diff --git a/#ThirdParty/libSDL/include/SDL_opengles2.h b/third-party/sdl2/include/SDL_opengles2.h similarity index 94% rename from #ThirdParty/libSDL/include/SDL_opengles2.h rename to third-party/sdl2/include/SDL_opengles2.h index edcd1a2..6ccecf2 100644 --- a/#ThirdParty/libSDL/include/SDL_opengles2.h +++ b/third-party/sdl2/include/SDL_opengles2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,8 @@ * * This is a simple file to encapsulate the OpenGL ES 2.0 API headers. */ +#include "SDL_config.h" + #ifndef _MSC_VER #ifdef __IPHONEOS__ diff --git a/#ThirdParty/libSDL/include/SDL_opengles2_gl2.h b/third-party/sdl2/include/SDL_opengles2_gl2.h similarity index 100% rename from #ThirdParty/libSDL/include/SDL_opengles2_gl2.h rename to third-party/sdl2/include/SDL_opengles2_gl2.h diff --git a/#ThirdParty/libSDL/include/SDL_opengles2_gl2ext.h b/third-party/sdl2/include/SDL_opengles2_gl2ext.h similarity index 100% rename from #ThirdParty/libSDL/include/SDL_opengles2_gl2ext.h rename to third-party/sdl2/include/SDL_opengles2_gl2ext.h diff --git a/#ThirdParty/libSDL/include/SDL_opengles2_gl2platform.h b/third-party/sdl2/include/SDL_opengles2_gl2platform.h similarity index 100% rename from #ThirdParty/libSDL/include/SDL_opengles2_gl2platform.h rename to third-party/sdl2/include/SDL_opengles2_gl2platform.h diff --git a/#ThirdParty/libSDL/include/SDL_opengles2_khrplatform.h b/third-party/sdl2/include/SDL_opengles2_khrplatform.h similarity index 100% rename from #ThirdParty/libSDL/include/SDL_opengles2_khrplatform.h rename to third-party/sdl2/include/SDL_opengles2_khrplatform.h diff --git a/#ThirdParty/libSDL/include/SDL_pixels.h b/third-party/sdl2/include/SDL_pixels.h similarity index 94% rename from #ThirdParty/libSDL/include/SDL_pixels.h rename to third-party/sdl2/include/SDL_pixels.h index 8499c32..0b4364b 100644 --- a/#ThirdParty/libSDL/include/SDL_pixels.h +++ b/third-party/sdl2/include/SDL_pixels.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,10 +25,11 @@ * Header for the enumerated pixel format definitions. */ -#ifndef _SDL_pixels_h -#define _SDL_pixels_h +#ifndef SDL_pixels_h_ +#define SDL_pixels_h_ #include "SDL_stdinc.h" +#include "SDL_endian.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -260,6 +261,19 @@ enum SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_PACKED32, SDL_PACKEDORDER_ARGB, SDL_PACKEDLAYOUT_2101010, 32, 4), + /* Aliases for RGBA byte arrays of color data, for the current platform */ +#if SDL_BYTEORDER == SDL_BIG_ENDIAN + SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_RGBA8888, + SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_ARGB8888, + SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_BGRA8888, + SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_ABGR8888, +#else + SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_ABGR8888, + SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_BGRA8888, + SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_ARGB8888, + SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_RGBA8888, +#endif + SDL_PIXELFORMAT_YV12 = /**< Planar mode: Y + V + U (3 planes) */ SDL_DEFINE_PIXELFOURCC('Y', 'V', '1', '2'), SDL_PIXELFORMAT_IYUV = /**< Planar mode: Y + U + V (3 planes) */ @@ -273,7 +287,9 @@ enum SDL_PIXELFORMAT_NV12 = /**< Planar mode: Y + U/V interleaved (2 planes) */ SDL_DEFINE_PIXELFOURCC('N', 'V', '1', '2'), SDL_PIXELFORMAT_NV21 = /**< Planar mode: Y + V/U interleaved (2 planes) */ - SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1') + SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1'), + SDL_PIXELFORMAT_EXTERNAL_OES = /**< Android video texture format */ + SDL_DEFINE_PIXELFOURCC('O', 'E', 'S', ' ') }; typedef struct SDL_Color @@ -449,6 +465,6 @@ extern DECLSPEC void SDLCALL SDL_CalculateGammaRamp(float gamma, Uint16 * ramp); #endif #include "close_code.h" -#endif /* _SDL_pixels_h */ +#endif /* SDL_pixels_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_platform.h b/third-party/sdl2/include/SDL_platform.h similarity index 77% rename from #ThirdParty/libSDL/include/SDL_platform.h rename to third-party/sdl2/include/SDL_platform.h index c6c2139..7dea4ce 100644 --- a/#ThirdParty/libSDL/include/SDL_platform.h +++ b/third-party/sdl2/include/SDL_platform.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Try to get a standard set of platform defines. */ -#ifndef _SDL_platform_h -#define _SDL_platform_h +#ifndef SDL_platform_h_ +#define SDL_platform_h_ #if defined(_AIX) #undef __AIX__ @@ -70,18 +70,22 @@ /* lets us know what version of Mac OS X we're compiling on */ #include "AvailabilityMacros.h" #include "TargetConditionals.h" +#if TARGET_OS_TV +#undef __TVOS__ +#define __TVOS__ 1 +#endif #if TARGET_OS_IPHONE -/* if compiling for iPhone */ +/* if compiling for iOS */ #undef __IPHONEOS__ #define __IPHONEOS__ 1 #undef __MACOSX__ #else -/* if not compiling for iPhone */ +/* if not compiling for iOS */ #undef __MACOSX__ #define __MACOSX__ 1 -#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050 -# error SDL for Mac OS X only supports deploying on 10.5 and above. -#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1050 */ +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060 +# error SDL for Mac OS X only supports deploying on 10.6 and above. +#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1060 */ #endif /* TARGET_OS_IPHONE */ #endif /* defined(__APPLE__) */ @@ -93,7 +97,7 @@ #undef __OPENBSD__ #define __OPENBSD__ 1 #endif -#if defined(__OS2__) +#if defined(__OS2__) || defined(__EMX__) #undef __OS2__ #define __OS2__ 1 #endif @@ -116,21 +120,34 @@ #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) /* Try to find out if we're compiling for WinRT or non-WinRT */ -/* If _USING_V110_SDK71_ is defined it means we are using the v110_xp or v120_xp toolset. */ -#if (defined(_MSC_VER) && (_MSC_VER >= 1700) && !_USING_V110_SDK71_) /* _MSC_VER==1700 for MSVC 2012 */ +#if defined(_MSC_VER) && defined(__has_include) +#if __has_include() +#define HAVE_WINAPIFAMILY_H 1 +#else +#define HAVE_WINAPIFAMILY_H 0 +#endif + +/* If _USING_V110_SDK71_ is defined it means we are using the Windows XP toolset. */ +#elif defined(_MSC_VER) && (_MSC_VER >= 1700 && !_USING_V110_SDK71_) /* _MSC_VER == 1700 for Visual Studio 2012 */ +#define HAVE_WINAPIFAMILY_H 1 +#else +#define HAVE_WINAPIFAMILY_H 0 +#endif + +#if HAVE_WINAPIFAMILY_H #include -#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) -#undef __WINDOWS__ -#define __WINDOWS__ 1 -/* See if we're compiling for WinRT: */ -#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) +#define WINAPI_FAMILY_WINRT (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)) +#else +#define WINAPI_FAMILY_WINRT 0 +#endif /* HAVE_WINAPIFAMILY_H */ + +#if WINAPI_FAMILY_WINRT #undef __WINRT__ #define __WINRT__ 1 -#endif #else #undef __WINDOWS__ -#define __WINDOWS__ 1 -#endif /* _MSC_VER < 1700 */ +#define __WINDOWS__ 1 +#endif #endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */ #if defined(__WINDOWS__) @@ -176,6 +193,6 @@ extern DECLSPEC const char * SDLCALL SDL_GetPlatform (void); #endif #include "close_code.h" -#endif /* _SDL_platform_h */ +#endif /* SDL_platform_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_power.h b/third-party/sdl2/include/SDL_power.h similarity index 94% rename from #ThirdParty/libSDL/include/SDL_power.h rename to third-party/sdl2/include/SDL_power.h index 24c0501..a4fe8a9 100644 --- a/#ThirdParty/libSDL/include/SDL_power.h +++ b/third-party/sdl2/include/SDL_power.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_power_h -#define _SDL_power_h +#ifndef SDL_power_h_ +#define SDL_power_h_ /** * \file SDL_power.h @@ -70,6 +70,6 @@ extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct); #endif #include "close_code.h" -#endif /* _SDL_power_h */ +#endif /* SDL_power_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_quit.h b/third-party/sdl2/include/SDL_quit.h similarity index 94% rename from #ThirdParty/libSDL/include/SDL_quit.h rename to third-party/sdl2/include/SDL_quit.h index cc06f28..fea56a8 100644 --- a/#ThirdParty/libSDL/include/SDL_quit.h +++ b/third-party/sdl2/include/SDL_quit.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL quit event handling. */ -#ifndef _SDL_quit_h -#define _SDL_quit_h +#ifndef SDL_quit_h_ +#define SDL_quit_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -55,4 +55,4 @@ #define SDL_QuitRequested() \ (SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0)) -#endif /* _SDL_quit_h */ +#endif /* SDL_quit_h_ */ diff --git a/#ThirdParty/libSDL/include/SDL_rect.h b/third-party/sdl2/include/SDL_rect.h similarity index 97% rename from #ThirdParty/libSDL/include/SDL_rect.h rename to third-party/sdl2/include/SDL_rect.h index bbcb9a3..543bb61 100644 --- a/#ThirdParty/libSDL/include/SDL_rect.h +++ b/third-party/sdl2/include/SDL_rect.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Header file for SDL_rect definition and management functions. */ -#ifndef _SDL_rect_h -#define _SDL_rect_h +#ifndef SDL_rect_h_ +#define SDL_rect_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -143,6 +143,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect * #endif #include "close_code.h" -#endif /* _SDL_rect_h */ +#endif /* SDL_rect_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_render.h b/third-party/sdl2/include/SDL_render.h similarity index 94% rename from #ThirdParty/libSDL/include/SDL_render.h rename to third-party/sdl2/include/SDL_render.h index e4ed2af..d336192 100644 --- a/#ThirdParty/libSDL/include/SDL_render.h +++ b/third-party/sdl2/include/SDL_render.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -45,8 +45,8 @@ * See this bug for details: http://bugzilla.libsdl.org/show_bug.cgi?id=1995 */ -#ifndef _SDL_render_h -#define _SDL_render_h +#ifndef SDL_render_h_ +#define SDL_render_h_ #include "SDL_stdinc.h" #include "SDL_rect.h" @@ -233,6 +233,8 @@ extern DECLSPEC int SDLCALL SDL_GetRendererOutputSize(SDL_Renderer * renderer, * active, the format was unsupported, or the width or height were out * of range. * + * \note The contents of the texture are not defined at creation. + * * \sa SDL_QueryTexture() * \sa SDL_UpdateTexture() * \sa SDL_DestroyTexture() @@ -370,9 +372,12 @@ extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture, * \param texture The texture to update * \param rect A pointer to the rectangle of pixels to update, or NULL to * update the entire texture. - * \param pixels The raw pixel data. + * \param pixels The raw pixel data in the format of the texture. * \param pitch The number of bytes in a row of pixel data, including padding between lines. * + * The pixel data must be in the format of the texture. The pixel format can be + * queried with SDL_QueryTexture. + * * \return 0 on success, or -1 if the texture is not valid. * * \note This is a fairly slow function. @@ -499,6 +504,30 @@ extern DECLSPEC int SDLCALL SDL_RenderSetLogicalSize(SDL_Renderer * renderer, in */ extern DECLSPEC void SDLCALL SDL_RenderGetLogicalSize(SDL_Renderer * renderer, int *w, int *h); +/** + * \brief Set whether to force integer scales for resolution-independent rendering + * + * \param renderer The renderer for which integer scaling should be set. + * \param enable Enable or disable integer scaling + * + * This function restricts the logical viewport to integer values - that is, when + * a resolution is between two multiples of a logical size, the viewport size is + * rounded down to the lower multiple. + * + * \sa SDL_RenderSetLogicalSize() + */ +extern DECLSPEC int SDLCALL SDL_RenderSetIntegerScale(SDL_Renderer * renderer, + SDL_bool enable); + +/** + * \brief Get whether integer scales are forced for resolution-independent rendering + * + * \param renderer The renderer from which integer scaling should be queried. + * + * \sa SDL_RenderSetIntegerScale() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_RenderGetIntegerScale(SDL_Renderer * renderer); + /** * \brief Set the drawing area for rendering on the current target. * @@ -658,7 +687,8 @@ extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer * renderer, /** * \brief Clear the current rendering target with the drawing color * - * This function clears the entire rendering target, ignoring the viewport. + * This function clears the entire rendering target, ignoring the viewport and + * the clip rectangle. * * \return 0 on success, or -1 on error */ @@ -791,7 +821,7 @@ extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer, * texture. * \param dstrect A pointer to the destination rectangle, or NULL for the * entire rendering target. - * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect + * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction * \param center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done around dstrect.w/2, dstrect.h/2). * \param flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture * @@ -868,6 +898,27 @@ extern DECLSPEC int SDLCALL SDL_GL_BindTexture(SDL_Texture *texture, float *texw */ extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture); +/** + * \brief Get the CAMetalLayer associated with the given Metal renderer + * + * \param renderer The renderer to query + * + * \return CAMetalLayer* on success, or NULL if the renderer isn't a Metal renderer + * + * \sa SDL_RenderGetMetalCommandEncoder() + */ +extern DECLSPEC void *SDLCALL SDL_RenderGetMetalLayer(SDL_Renderer * renderer); + +/** + * \brief Get the Metal command encoder for the current frame + * + * \param renderer The renderer to query + * + * \return id on success, or NULL if the renderer isn't a Metal renderer + * + * \sa SDL_RenderGetMetalLayer() + */ +extern DECLSPEC void *SDLCALL SDL_RenderGetMetalCommandEncoder(SDL_Renderer * renderer); /* Ends C function definitions when using C++ */ #ifdef __cplusplus @@ -875,6 +926,6 @@ extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture); #endif #include "close_code.h" -#endif /* _SDL_render_h */ +#endif /* SDL_render_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/third-party/sdl2/include/SDL_revision.h b/third-party/sdl2/include/SDL_revision.h new file mode 100644 index 0000000..92fbe67 --- /dev/null +++ b/third-party/sdl2/include/SDL_revision.h @@ -0,0 +1,2 @@ +#define SDL_REVISION "hg-12373:8feb5da6f2fb" +#define SDL_REVISION_NUMBER 12373 diff --git a/#ThirdParty/libSDL/include/SDL_rwops.h b/third-party/sdl2/include/SDL_rwops.h similarity index 85% rename from #ThirdParty/libSDL/include/SDL_rwops.h rename to third-party/sdl2/include/SDL_rwops.h index f460ae7..0960699 100644 --- a/#ThirdParty/libSDL/include/SDL_rwops.h +++ b/third-party/sdl2/include/SDL_rwops.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,8 +26,8 @@ * data streams. It can easily be extended to files, memory, etc. */ -#ifndef _SDL_rwops_h -#define _SDL_rwops_h +#ifndef SDL_rwops_h_ +#define SDL_rwops_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -39,12 +39,12 @@ extern "C" { #endif /* RWops Types */ -#define SDL_RWOPS_UNKNOWN 0 /* Unknown stream type */ -#define SDL_RWOPS_WINFILE 1 /* Win32 file */ -#define SDL_RWOPS_STDFILE 2 /* Stdio file */ -#define SDL_RWOPS_JNIFILE 3 /* Android asset */ -#define SDL_RWOPS_MEMORY 4 /* Memory stream */ -#define SDL_RWOPS_MEMORY_RO 5 /* Read-Only memory stream */ +#define SDL_RWOPS_UNKNOWN 0U /**< Unknown stream type */ +#define SDL_RWOPS_WINFILE 1U /**< Win32 file */ +#define SDL_RWOPS_STDFILE 2U /**< Stdio file */ +#define SDL_RWOPS_JNIFILE 3U /**< Android asset */ +#define SDL_RWOPS_MEMORY 4U /**< Memory stream */ +#define SDL_RWOPS_MEMORY_RO 5U /**< Read-Only memory stream */ /** * This is the read/write operation structure -- very basic. @@ -190,6 +190,29 @@ extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area); /* @} *//* Read/write macros */ +/** + * Load all the data from an SDL data stream. + * + * The data is allocated with a zero byte at the end (null terminated) + * + * If \c datasize is not NULL, it is filled with the size of the data read. + * + * If \c freesrc is non-zero, the stream will be closed after being read. + * + * The data should be freed with SDL_free(). + * + * \return the data, or NULL if there was an error. + */ +extern DECLSPEC void *SDLCALL SDL_LoadFile_RW(SDL_RWops * src, size_t *datasize, + int freesrc); + +/** + * Load an entire file. + * + * Convenience macro. + */ +#define SDL_LoadFile(file, datasize) SDL_LoadFile_RW(SDL_RWFromFile(file, "rb"), datasize, 1) + /** * \name Read endian functions * @@ -226,6 +249,6 @@ extern DECLSPEC size_t SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value); #endif #include "close_code.h" -#endif /* _SDL_rwops_h */ +#endif /* SDL_rwops_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_scancode.h b/third-party/sdl2/include/SDL_scancode.h similarity index 96% rename from #ThirdParty/libSDL/include/SDL_scancode.h rename to third-party/sdl2/include/SDL_scancode.h index 0af1dd5..63871aa 100644 --- a/#ThirdParty/libSDL/include/SDL_scancode.h +++ b/third-party/sdl2/include/SDL_scancode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Defines keyboard scancodes. */ -#ifndef _SDL_scancode_h -#define _SDL_scancode_h +#ifndef SDL_scancode_h_ +#define SDL_scancode_h_ #include "SDL_stdinc.h" @@ -38,7 +38,7 @@ * SDL_Event structure. * * The values in this enumeration are based on the USB usage page standard: - * http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf + * http://www.usb.org/developers/hidpage/Hut1_12v2.pdf */ typedef enum { @@ -390,12 +390,24 @@ typedef enum /* @} *//* Walther keys */ + /** + * \name Usage page 0x0C (additional media keys) + * + * These values are mapped from usage page 0x0C (USB consumer page). + */ + /* @{ */ + + SDL_SCANCODE_AUDIOREWIND = 285, + SDL_SCANCODE_AUDIOFASTFORWARD = 286, + + /* @} *//* Usage page 0x0C (additional media keys) */ + /* Add any other keys here. */ SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes for array bounds */ } SDL_Scancode; -#endif /* _SDL_scancode_h */ +#endif /* SDL_scancode_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/third-party/sdl2/include/SDL_sensor.h b/third-party/sdl2/include/SDL_sensor.h new file mode 100644 index 0000000..ac163a8 --- /dev/null +++ b/third-party/sdl2/include/SDL_sensor.h @@ -0,0 +1,251 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_sensor.h + * + * Include file for SDL sensor event handling + * + */ + +#ifndef _SDL_sensor_h +#define _SDL_sensor_h + +#include "SDL_stdinc.h" +#include "SDL_error.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +extern "C" { +/* *INDENT-ON* */ +#endif + +/** + * \brief SDL_sensor.h + * + * In order to use these functions, SDL_Init() must have been called + * with the ::SDL_INIT_SENSOR flag. This causes SDL to scan the system + * for sensors, and load appropriate drivers. + */ + +struct _SDL_Sensor; +typedef struct _SDL_Sensor SDL_Sensor; + +/** + * This is a unique ID for a sensor for the time it is connected to the system, + * and is never reused for the lifetime of the application. + * + * The ID value starts at 0 and increments from there. The value -1 is an invalid ID. + */ +typedef Sint32 SDL_SensorID; + +/* The different sensors defined by SDL + * + * Additional sensors may be available, using platform dependent semantics. + * + * Hare are the additional Android sensors: + * https://developer.android.com/reference/android/hardware/SensorEvent.html#values + */ +typedef enum +{ + SDL_SENSOR_INVALID = -1, /**< Returned for an invalid sensor */ + SDL_SENSOR_UNKNOWN, /**< Unknown sensor type */ + SDL_SENSOR_ACCEL, /**< Accelerometer */ + SDL_SENSOR_GYRO /**< Gyroscope */ +} SDL_SensorType; + +/** + * Accelerometer sensor + * + * The accelerometer returns the current acceleration in SI meters per + * second squared. This includes gravity, so a device at rest will have + * an acceleration of SDL_STANDARD_GRAVITY straight down. + * + * values[0]: Acceleration on the x axis + * values[1]: Acceleration on the y axis + * values[2]: Acceleration on the z axis + * + * For phones held in portrait mode, the axes are defined as follows: + * -X ... +X : left ... right + * -Y ... +Y : bottom ... top + * -Z ... +Z : farther ... closer + * + * The axis data is not changed when the phone is rotated. + * + * \sa SDL_GetDisplayOrientation() + */ +#define SDL_STANDARD_GRAVITY 9.80665f + +/** + * Gyroscope sensor + * + * The gyroscope returns the current rate of rotation in radians per second. + * The rotation is positive in the counter-clockwise direction. That is, + * an observer looking from a positive location on one of the axes would + * see positive rotation on that axis when it appeared to be rotating + * counter-clockwise. + * + * values[0]: Angular speed around the x axis + * values[1]: Angular speed around the y axis + * values[2]: Angular speed around the z axis + * + * For phones held in portrait mode, the axes are defined as follows: + * -X ... +X : left ... right + * -Y ... +Y : bottom ... top + * -Z ... +Z : farther ... closer + * + * The axis data is not changed when the phone is rotated. + * + * \sa SDL_GetDisplayOrientation() + */ + +/* Function prototypes */ + +/** + * \brief Count the number of sensors attached to the system right now + */ +extern DECLSPEC int SDLCALL SDL_NumSensors(void); + +/** + * \brief Get the implementation dependent name of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor name, or NULL if device_index is out of range. + */ +extern DECLSPEC const char *SDLCALL SDL_SensorGetDeviceName(int device_index); + +/** + * \brief Get the type of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor type, or SDL_SENSOR_INVALID if device_index is out of range. + */ +extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetDeviceType(int device_index); + +/** + * \brief Get the platform dependent type of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor platform dependent type, or -1 if device_index is out of range. + */ +extern DECLSPEC int SDLCALL SDL_SensorGetDeviceNonPortableType(int device_index); + +/** + * \brief Get the instance ID of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor instance ID, or -1 if device_index is out of range. + */ +extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetDeviceInstanceID(int device_index); + +/** + * \brief Open a sensor for use. + * + * The index passed as an argument refers to the N'th sensor on the system. + * + * \return A sensor identifier, or NULL if an error occurred. + */ +extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorOpen(int device_index); + +/** + * Return the SDL_Sensor associated with an instance id. + */ +extern DECLSPEC SDL_Sensor *SDLCALL SDL_SensorFromInstanceID(SDL_SensorID instance_id); + +/** + * \brief Get the implementation dependent name of a sensor. + * + * \return The sensor name, or NULL if the sensor is NULL. + */ +extern DECLSPEC const char *SDLCALL SDL_SensorGetName(SDL_Sensor *sensor); + +/** + * \brief Get the type of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor type, or SDL_SENSOR_INVALID if the sensor is NULL. + */ +extern DECLSPEC SDL_SensorType SDLCALL SDL_SensorGetType(SDL_Sensor *sensor); + +/** + * \brief Get the platform dependent type of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor platform dependent type, or -1 if the sensor is NULL. + */ +extern DECLSPEC int SDLCALL SDL_SensorGetNonPortableType(SDL_Sensor *sensor); + +/** + * \brief Get the instance ID of a sensor. + * + * This can be called before any sensors are opened. + * + * \return The sensor instance ID, or -1 if the sensor is NULL. + */ +extern DECLSPEC SDL_SensorID SDLCALL SDL_SensorGetInstanceID(SDL_Sensor *sensor); + +/** + * Get the current state of an opened sensor. + * + * The number of values and interpretation of the data is sensor dependent. + * + * \param sensor The sensor to query + * \param data A pointer filled with the current sensor state + * \param num_values The number of values to write to data + * + * \return 0 or -1 if an error occurred. + */ +extern DECLSPEC int SDLCALL SDL_SensorGetData(SDL_Sensor * sensor, float *data, int num_values); + +/** + * Close a sensor previously opened with SDL_SensorOpen() + */ +extern DECLSPEC void SDLCALL SDL_SensorClose(SDL_Sensor * sensor); + +/** + * Update the current state of the open sensors. + * + * This is called automatically by the event loop if sensor events are enabled. + * + * This needs to be called from the thread that initialized the sensor subsystem. + */ +extern DECLSPEC void SDLCALL SDL_SensorUpdate(void); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +/* *INDENT-OFF* */ +} +/* *INDENT-ON* */ +#endif +#include "close_code.h" + +#endif /* _SDL_sensor_h */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_shape.h b/third-party/sdl2/include/SDL_shape.h similarity index 91% rename from #ThirdParty/libSDL/include/SDL_shape.h rename to third-party/sdl2/include/SDL_shape.h index db10a8f..40a6baa 100644 --- a/#ThirdParty/libSDL/include/SDL_shape.h +++ b/third-party/sdl2/include/SDL_shape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_shape_h -#define _SDL_shape_h +#ifndef SDL_shape_h_ +#define SDL_shape_h_ #include "SDL_stdinc.h" #include "SDL_pixels.h" @@ -71,6 +71,7 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(const char *title,un * \param window The window to query for being shaped. * * \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if the window is unshaped or NULL. + * * \sa SDL_CreateShapedWindow */ extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window); @@ -91,7 +92,7 @@ typedef enum { /** \brief A union containing parameters for shaped windows. */ typedef union { - /** \brief a cutoff alpha value for binarization of the window shape's alpha channel. */ + /** \brief A cutoff alpha value for binarization of the window shape's alpha channel. */ Uint8 binarizationCutoff; SDL_Color colorKey; } SDL_WindowShapeParams; @@ -111,8 +112,8 @@ typedef struct SDL_WindowShapeMode { * \param shape A surface encoding the desired shape for the window. * \param shape_mode The parameters to set for the shaped window. * - * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on invalid an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW - * if the SDL_Window* given does not reference a valid shaped window. + * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW + * if the SDL_Window given does not reference a valid shaped window. * * \sa SDL_WindowShapeMode * \sa SDL_GetShapedWindowMode. @@ -127,7 +128,7 @@ extern DECLSPEC int SDLCALL SDL_SetWindowShape(SDL_Window *window,SDL_Surface *s * * \return 0 if the window has a shape and, provided shape_mode was not NULL, shape_mode has been filled with the mode * data, SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped window, or SDL_WINDOW_LACKS_SHAPE if - * the SDL_Window* given is a shapeable window currently lacking a shape. + * the SDL_Window given is a shapeable window currently lacking a shape. * * \sa SDL_WindowShapeMode * \sa SDL_SetWindowShape @@ -140,4 +141,4 @@ extern DECLSPEC int SDLCALL SDL_GetShapedWindowMode(SDL_Window *window,SDL_Windo #endif #include "close_code.h" -#endif /* _SDL_shape_h */ +#endif /* SDL_shape_h_ */ diff --git a/#ThirdParty/libSDL/include/SDL_stdinc.h b/third-party/sdl2/include/SDL_stdinc.h similarity index 79% rename from #ThirdParty/libSDL/include/SDL_stdinc.h rename to third-party/sdl2/include/SDL_stdinc.h index 887bcd2..e373bc3 100644 --- a/#ThirdParty/libSDL/include/SDL_stdinc.h +++ b/third-party/sdl2/include/SDL_stdinc.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * This is a general header that includes C language support. */ -#ifndef _SDL_stdinc_h -#define _SDL_stdinc_h +#ifndef SDL_stdinc_h_ +#define SDL_stdinc_h_ #include "SDL_config.h" @@ -62,6 +62,9 @@ #ifdef HAVE_STRINGS_H # include #endif +#ifdef HAVE_WCHAR_H +# include +#endif #if defined(HAVE_INTTYPES_H) # include #elif defined(HAVE_STDINT_H) @@ -83,8 +86,27 @@ #ifdef HAVE_FLOAT_H # include #endif -#if defined(HAVE_ICONV) && defined(HAVE_ICONV_H) -# include +#if defined(HAVE_ALLOCA) && !defined(alloca) +# if defined(HAVE_ALLOCA_H) +# include +# elif defined(__GNUC__) +# define alloca __builtin_alloca +# elif defined(_MSC_VER) +# include +# define alloca _alloca +# elif defined(__WATCOMC__) +# include +# elif defined(__BORLANDC__) +# include +# elif defined(__DMC__) +# include +# elif defined(__AIX__) +#pragma alloca +# elif defined(__MRC__) +void *alloca(unsigned); +# else +char *alloca(); +# endif #endif /** @@ -93,6 +115,13 @@ #define SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) #define SDL_TABLESIZE(table) SDL_arraysize(table) +/** + * Macro useful for building other macros with strings in them + * + * e.g. #define LOG_ERROR(X) OutputDebugString(SDL_STRINGIFY_ARG(__FUNCTION__) ": " X "\n") + */ +#define SDL_STRINGIFY_ARG(arg) #arg + /** * \name Cast operators * @@ -123,44 +152,67 @@ */ /* @{ */ +#ifdef __CC_ARM +/* ARM's compiler throws warnings if we use an enum: like "SDL_bool x = a < b;" */ +#define SDL_FALSE 0 +#define SDL_TRUE 1 +typedef int SDL_bool; +#else typedef enum { SDL_FALSE = 0, SDL_TRUE = 1 } SDL_bool; +#endif /** * \brief A signed 8-bit integer type. */ +#define SDL_MAX_SINT8 ((Sint8)0x7F) /* 127 */ +#define SDL_MIN_SINT8 ((Sint8)(~0x7F)) /* -128 */ typedef int8_t Sint8; /** * \brief An unsigned 8-bit integer type. */ +#define SDL_MAX_UINT8 ((Uint8)0xFF) /* 255 */ +#define SDL_MIN_UINT8 ((Uint8)0x00) /* 0 */ typedef uint8_t Uint8; /** * \brief A signed 16-bit integer type. */ +#define SDL_MAX_SINT16 ((Sint16)0x7FFF) /* 32767 */ +#define SDL_MIN_SINT16 ((Sint16)(~0x7FFF)) /* -32768 */ typedef int16_t Sint16; /** * \brief An unsigned 16-bit integer type. */ +#define SDL_MAX_UINT16 ((Uint16)0xFFFF) /* 65535 */ +#define SDL_MIN_UINT16 ((Uint16)0x0000) /* 0 */ typedef uint16_t Uint16; /** * \brief A signed 32-bit integer type. */ +#define SDL_MAX_SINT32 ((Sint32)0x7FFFFFFF) /* 2147483647 */ +#define SDL_MIN_SINT32 ((Sint32)(~0x7FFFFFFF)) /* -2147483648 */ typedef int32_t Sint32; /** * \brief An unsigned 32-bit integer type. */ +#define SDL_MAX_UINT32 ((Uint32)0xFFFFFFFFu) /* 4294967295 */ +#define SDL_MIN_UINT32 ((Uint32)0x00000000) /* 0 */ typedef uint32_t Uint32; /** * \brief A signed 64-bit integer type. */ +#define SDL_MAX_SINT64 ((Sint64)0x7FFFFFFFFFFFFFFFll) /* 9223372036854775807 */ +#define SDL_MIN_SINT64 ((Sint64)(~0x7FFFFFFFFFFFFFFFll)) /* -9223372036854775808 */ typedef int64_t Sint64; /** * \brief An unsigned 64-bit integer type. */ +#define SDL_MAX_UINT64 ((Uint64)0xFFFFFFFFFFFFFFFFull) /* 18446744073709551615 */ +#define SDL_MIN_UINT64 ((Uint64)(0x0000000000000000ull)) /* 0 */ typedef uint64_t Uint64; /* @} *//* Basic data types */ @@ -258,7 +310,7 @@ typedef uint64_t Uint64; #endif /* SDL_DISABLE_ANALYZE_MACROS */ #define SDL_COMPILE_TIME_ASSERT(name, x) \ - typedef int SDL_dummy_ ## name[(x) * 2 - 1] + typedef int SDL_compile_time_assert_ ## name[(x) * 2 - 1] /** \cond */ #ifndef DOXYGEN_SHOULD_IGNORE_THIS SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1); @@ -298,28 +350,6 @@ SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int)); extern "C" { #endif -#if defined(HAVE_ALLOCA) && !defined(alloca) -# if defined(HAVE_ALLOCA_H) -# include -# elif defined(__GNUC__) -# define alloca __builtin_alloca -# elif defined(_MSC_VER) -# include -# define alloca _alloca -# elif defined(__WATCOMC__) -# include -# elif defined(__BORLANDC__) -# include -# elif defined(__DMC__) -# include -# elif defined(__AIX__) -#pragma alloca -# elif defined(__MRC__) -void *alloca(unsigned); -# else -char *alloca(); -# endif -#endif #ifdef HAVE_ALLOCA #define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count)) #define SDL_stack_free(data) @@ -333,6 +363,37 @@ extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size); extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size); extern DECLSPEC void SDLCALL SDL_free(void *mem); +typedef void *(SDLCALL *SDL_malloc_func)(size_t size); +typedef void *(SDLCALL *SDL_calloc_func)(size_t nmemb, size_t size); +typedef void *(SDLCALL *SDL_realloc_func)(void *mem, size_t size); +typedef void (SDLCALL *SDL_free_func)(void *mem); + +/** + * \brief Get the current set of SDL memory functions + */ +extern DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func, + SDL_calloc_func *calloc_func, + SDL_realloc_func *realloc_func, + SDL_free_func *free_func); + +/** + * \brief Replace SDL's memory allocation functions with a custom set + * + * \note If you are replacing SDL's memory functions, you should call + * SDL_GetNumAllocations() and be very careful if it returns non-zero. + * That means that your free function will be called with memory + * allocated by the previous memory allocation functions. + */ +extern DECLSPEC int SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func, + SDL_calloc_func calloc_func, + SDL_realloc_func realloc_func, + SDL_free_func free_func); + +/** + * \brief Get the number of outstanding (unfreed) allocations + */ +extern DECLSPEC int SDLCALL SDL_GetNumAllocations(void); + extern DECLSPEC char *SDLCALL SDL_getenv(const char *name); extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite); @@ -375,24 +436,25 @@ SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords) return; switch (dwords % 4) { - case 0: do { *_p++ = _val; - case 3: *_p++ = _val; - case 2: *_p++ = _val; - case 1: *_p++ = _val; + case 0: do { *_p++ = _val; /* fallthrough */ + case 3: *_p++ = _val; /* fallthrough */ + case 2: *_p++ = _val; /* fallthrough */ + case 1: *_p++ = _val; /* fallthrough */ } while ( --_n ); } #endif } - extern DECLSPEC void *SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len); extern DECLSPEC void *SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len); extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len); +extern DECLSPEC wchar_t *SDLCALL SDL_wcsdup(const wchar_t *wstr); extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr); extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen); extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen); +extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2); extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str); extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen); @@ -405,6 +467,7 @@ extern DECLSPEC char *SDLCALL SDL_strlwr(char *str); extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c); extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c); extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle); +extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str); extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix); extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix); @@ -433,23 +496,40 @@ extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size #ifndef HAVE_M_PI #ifndef M_PI -#define M_PI 3.14159265358979323846264338327950288 /* pi */ +#define M_PI 3.14159265358979323846264338327950288 /**< pi */ #endif #endif extern DECLSPEC double SDLCALL SDL_acos(double x); +extern DECLSPEC float SDLCALL SDL_acosf(float x); extern DECLSPEC double SDLCALL SDL_asin(double x); +extern DECLSPEC float SDLCALL SDL_asinf(float x); extern DECLSPEC double SDLCALL SDL_atan(double x); +extern DECLSPEC float SDLCALL SDL_atanf(float x); extern DECLSPEC double SDLCALL SDL_atan2(double x, double y); +extern DECLSPEC float SDLCALL SDL_atan2f(float x, float y); extern DECLSPEC double SDLCALL SDL_ceil(double x); +extern DECLSPEC float SDLCALL SDL_ceilf(float x); extern DECLSPEC double SDLCALL SDL_copysign(double x, double y); +extern DECLSPEC float SDLCALL SDL_copysignf(float x, float y); extern DECLSPEC double SDLCALL SDL_cos(double x); extern DECLSPEC float SDLCALL SDL_cosf(float x); +extern DECLSPEC double SDLCALL SDL_exp(double x); +extern DECLSPEC float SDLCALL SDL_expf(float x); extern DECLSPEC double SDLCALL SDL_fabs(double x); +extern DECLSPEC float SDLCALL SDL_fabsf(float x); extern DECLSPEC double SDLCALL SDL_floor(double x); +extern DECLSPEC float SDLCALL SDL_floorf(float x); +extern DECLSPEC double SDLCALL SDL_fmod(double x, double y); +extern DECLSPEC float SDLCALL SDL_fmodf(float x, float y); extern DECLSPEC double SDLCALL SDL_log(double x); +extern DECLSPEC float SDLCALL SDL_logf(float x); +extern DECLSPEC double SDLCALL SDL_log10(double x); +extern DECLSPEC float SDLCALL SDL_log10f(float x); extern DECLSPEC double SDLCALL SDL_pow(double x, double y); +extern DECLSPEC float SDLCALL SDL_powf(float x, float y); extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n); +extern DECLSPEC float SDLCALL SDL_scalbnf(float x, int n); extern DECLSPEC double SDLCALL SDL_sin(double x); extern DECLSPEC float SDLCALL SDL_sinf(float x); extern DECLSPEC double SDLCALL SDL_sqrt(double x); @@ -522,6 +602,6 @@ SDL_FORCE_INLINE void *SDL_memcpy4(SDL_OUT_BYTECAP(dwords*4) void *dst, SDL_IN_B #endif #include "close_code.h" -#endif /* _SDL_stdinc_h */ +#endif /* SDL_stdinc_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_surface.h b/third-party/sdl2/include/SDL_surface.h similarity index 88% rename from #ThirdParty/libSDL/include/SDL_surface.h rename to third-party/sdl2/include/SDL_surface.h index e63ca89..730d49f 100644 --- a/#ThirdParty/libSDL/include/SDL_surface.h +++ b/third-party/sdl2/include/SDL_surface.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Header file for ::SDL_Surface definition and management functions. */ -#ifndef _SDL_surface_h -#define _SDL_surface_h +#ifndef SDL_surface_h_ +#define SDL_surface_h_ #include "SDL_stdinc.h" #include "SDL_pixels.h" @@ -94,8 +94,19 @@ typedef struct SDL_Surface /** * \brief The type of function used for surface blitting functions. */ -typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect, - struct SDL_Surface * dst, SDL_Rect * dstrect); +typedef int (SDLCALL *SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect, + struct SDL_Surface * dst, SDL_Rect * dstrect); + +/** + * \brief The formula used for converting between YUV and RGB + */ +typedef enum +{ + SDL_YUV_CONVERSION_JPEG, /**< Full range JPEG */ + SDL_YUV_CONVERSION_BT601, /**< BT.601 (the default) */ + SDL_YUV_CONVERSION_BT709, /**< BT.709 */ + SDL_YUV_CONVERSION_AUTOMATIC /**< BT.601 for SD content, BT.709 for HD content */ +} SDL_YUV_CONVERSION_MODE; /** * Allocate and free an RGB surface. @@ -118,6 +129,11 @@ typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect, extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface (Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); + +/* !!! FIXME for 2.1: why does this ask for depth? Format provides that. */ +extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormat + (Uint32 flags, int width, int height, int depth, Uint32 format); + extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels, int width, int height, @@ -127,6 +143,8 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); +extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormatFrom + (void *pixels, int width, int height, int depth, int pitch, Uint32 format); extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface * surface); /** @@ -184,6 +202,12 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_LoadBMP_RW(SDL_RWops * src, /** * Save a surface to a seekable SDL data stream (memory or file). * + * Surfaces with a 24-bit, 32-bit and paletted 8-bit format get saved in the + * BMP directly. Other RGB formats with 8-bit or higher get converted to a + * 24-bit surface or, if they have an alpha mask or a colorkey, to a 32-bit + * surface before they are saved. YUV and paletted 1-bit and 4-bit formats are + * not supported. + * * If \c freedst is non-zero, the stream will be closed after being written. * * \return 0 if successful or -1 if there was an error. @@ -224,6 +248,13 @@ extern DECLSPEC int SDLCALL SDL_SetSurfaceRLE(SDL_Surface * surface, extern DECLSPEC int SDLCALL SDL_SetColorKey(SDL_Surface * surface, int flag, Uint32 key); +/** + * \brief Returns whether the surface has a color key + * + * \return SDL_TRUE if the surface has a color key, or SDL_FALSE if the surface is NULL or has no color key + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasColorKey(SDL_Surface * surface); + /** * \brief Gets the color key (transparent pixel) in a blittable surface. * @@ -346,6 +377,11 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface, extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface, SDL_Rect * rect); +/* + * Creates a new surface identical to the existing surface + */ +extern DECLSPEC SDL_Surface *SDLCALL SDL_DuplicateSurface(SDL_Surface * surface); + /** * Creates a new surface of the specified format, and then copies and maps * the given surface to it so the blit of the converted surface will be as @@ -491,6 +527,20 @@ extern DECLSPEC int SDLCALL SDL_LowerBlitScaled (SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect); +/** + * \brief Set the YUV conversion mode + */ +extern DECLSPEC void SDLCALL SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode); + +/** + * \brief Get the YUV conversion mode + */ +extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionMode(void); + +/** + * \brief Get the YUV conversion mode, returning the correct mode for the resolution when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC + */ +extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionModeForResolution(int width, int height); /* Ends C function definitions when using C++ */ #ifdef __cplusplus @@ -498,6 +548,6 @@ extern DECLSPEC int SDLCALL SDL_LowerBlitScaled #endif #include "close_code.h" -#endif /* _SDL_surface_h */ +#endif /* SDL_surface_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_system.h b/third-party/sdl2/include/SDL_system.h similarity index 79% rename from #ThirdParty/libSDL/include/SDL_system.h rename to third-party/sdl2/include/SDL_system.h index 5da9adb..4dc372d 100644 --- a/#ThirdParty/libSDL/include/SDL_system.h +++ b/third-party/sdl2/include/SDL_system.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for platform specific SDL API functions */ -#ifndef _SDL_system_h -#define _SDL_system_h +#ifndef SDL_system_h_ +#define SDL_system_h_ #include "SDL_stdinc.h" #include "SDL_keyboard.h" @@ -76,6 +76,18 @@ extern DECLSPEC SDL_bool SDLCALL SDL_DXGIGetOutputInfo( int displayIndex, int *a #endif /* __WIN32__ */ +/* Platform specific functions for Linux */ +#ifdef __LINUX__ + +/** + \brief Sets the UNIX nice value for a thread, using setpriority() if possible, and RealtimeKit if available. + + \return 0 on success, or -1 on error. + */ +extern DECLSPEC int SDLCALL SDL_LinuxSetThreadPriority(Sint64 threadID, int priority); + +#endif /* __LINUX__ */ + /* Platform specific functions for iOS */ #if defined(__IPHONEOS__) && __IPHONEOS__ @@ -96,7 +108,7 @@ extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled); This returns JNIEnv*, but the prototype is void* so we don't need jni.h */ -extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(); +extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(void); /** \brief Get the SDL Activity object for the application @@ -106,7 +118,27 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(); It is the caller's responsibility to properly release it (using env->Push/PopLocalFrame or manually with env->DeleteLocalRef) */ -extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(); +extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void); + +/** + \brief Return true if the application is running on Android TV + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsAndroidTV(void); + +/** + \brief Return true if the application is running on a Chromebook + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsChromebook(void); + +/** + \brief Return true is the application is running on a Samsung DeX docking station + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsDeXMode(void); + +/** + \brief Trigger the Android system back button behavior. + */ +extern DECLSPEC void SDLCALL SDL_AndroidBackButton(void); /** See the official Android developer guide for more information: @@ -121,7 +153,7 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(); This path is unique to your application and cannot be written to by other applications. */ -extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(); +extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(void); /** \brief Get the current state of external storage, a bitmask of these values: @@ -130,7 +162,7 @@ extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(); If external storage is currently unavailable, this will return 0. */ -extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(); +extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(void); /** \brief Get the path used for external storage for this application. @@ -138,7 +170,7 @@ extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(); This path is unique to your application, but is public and can be written to by other applications. */ -extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(); +extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(void); #endif /* __ANDROID__ */ @@ -169,6 +201,25 @@ typedef enum } SDL_WinRT_Path; +/** + * \brief WinRT Device Family + */ +typedef enum +{ + /** \brief Unknown family */ + SDL_WINRT_DEVICEFAMILY_UNKNOWN, + + /** \brief Desktop family*/ + SDL_WINRT_DEVICEFAMILY_DESKTOP, + + /** \brief Mobile family (for example smartphone) */ + SDL_WINRT_DEVICEFAMILY_MOBILE, + + /** \brief XBox family */ + SDL_WINRT_DEVICEFAMILY_XBOX, +} SDL_WinRT_DeviceFamily; + + /** * \brief Retrieves a WinRT defined path on the local file system * @@ -203,14 +254,26 @@ extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path */ extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType); +/** + * \brief Detects the device family of WinRT plattform on runtime + * + * \return Device family + */ +extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily(); + #endif /* __WINRT__ */ +/** + \brief Return true if the current device is a tablet. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsTablet(void); + /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" -#endif /* _SDL_system_h */ +#endif /* SDL_system_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_syswm.h b/third-party/sdl2/include/SDL_syswm.h similarity index 83% rename from #ThirdParty/libSDL/include/SDL_syswm.h rename to third-party/sdl2/include/SDL_syswm.h index 1056e52..f1c4021 100644 --- a/#ThirdParty/libSDL/include/SDL_syswm.h +++ b/third-party/sdl2/include/SDL_syswm.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,20 +25,14 @@ * Include file for SDL custom system window manager hooks. */ -#ifndef _SDL_syswm_h -#define _SDL_syswm_h +#ifndef SDL_syswm_h_ +#define SDL_syswm_h_ #include "SDL_stdinc.h" #include "SDL_error.h" #include "SDL_video.h" #include "SDL_version.h" -#include "begin_code.h" -/* Set up for C function definitions, even when using C++ */ -#ifdef __cplusplus -extern "C" { -#endif - /** * \file SDL_syswm.h * @@ -106,6 +100,16 @@ typedef struct ANativeWindow ANativeWindow; typedef void *EGLSurface; #endif +#if defined(SDL_VIDEO_DRIVER_VIVANTE) +#include "SDL_egl.h" +#endif + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + /** * These are the various supported windowing subsystems */ @@ -120,7 +124,9 @@ typedef enum SDL_SYSWM_WAYLAND, SDL_SYSWM_MIR, SDL_SYSWM_WINRT, - SDL_SYSWM_ANDROID + SDL_SYSWM_ANDROID, + SDL_SYSWM_VIVANTE, + SDL_SYSWM_OS2 } SDL_SYSWM_TYPE; /** @@ -166,6 +172,13 @@ struct SDL_SysWMmsg int dummy; /* No UIKit window events yet */ } uikit; +#endif +#if defined(SDL_VIDEO_DRIVER_VIVANTE) + struct + { + int dummy; + /* No Vivante window events yet */ + } vivante; #endif /* Can't have an empty union */ int dummy; @@ -189,6 +202,7 @@ struct SDL_SysWMinfo { HWND window; /**< The window handle */ HDC hdc; /**< The window device context */ + HINSTANCE hinstance; /**< The instance handle */ } win; #endif #if defined(SDL_VIDEO_DRIVER_WINRT) @@ -216,9 +230,9 @@ struct SDL_SysWMinfo struct { #if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc) - NSWindow __unsafe_unretained *window; /* The Cocoa window */ + NSWindow __unsafe_unretained *window; /**< The Cocoa window */ #else - NSWindow *window; /* The Cocoa window */ + NSWindow *window; /**< The Cocoa window */ #endif } cocoa; #endif @@ -226,13 +240,13 @@ struct SDL_SysWMinfo struct { #if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc) - UIWindow __unsafe_unretained *window; /* The UIKit window */ + UIWindow __unsafe_unretained *window; /**< The UIKit window */ #else - UIWindow *window; /* The UIKit window */ + UIWindow *window; /**< The UIKit window */ #endif - GLuint framebuffer; /* The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */ - GLuint colorbuffer; /* The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */ - GLuint resolveFramebuffer; /* The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */ + GLuint framebuffer; /**< The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */ + GLuint colorbuffer; /**< The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */ + GLuint resolveFramebuffer; /**< The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */ } uikit; #endif #if defined(SDL_VIDEO_DRIVER_WAYLAND) @@ -259,8 +273,17 @@ struct SDL_SysWMinfo } android; #endif - /* Can't have an empty union */ - int dummy; +#if defined(SDL_VIDEO_DRIVER_VIVANTE) + struct + { + EGLNativeDisplayType display; + EGLNativeWindowType window; + } vivante; +#endif + + /* Make sure this union is always 64 bytes (8 64-bit pointers). */ + /* Be careful not to overflow this if you add a new target! */ + Uint8 dummy[64]; } info; }; @@ -296,6 +319,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window, #endif #include "close_code.h" -#endif /* _SDL_syswm_h */ +#endif /* SDL_syswm_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_test.h b/third-party/sdl2/include/SDL_test.h similarity index 92% rename from #ThirdParty/libSDL/include/SDL_test.h rename to third-party/sdl2/include/SDL_test.h index 217847b..6cc373b 100644 --- a/#ThirdParty/libSDL/include/SDL_test.h +++ b/third-party/sdl2/include/SDL_test.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,21 +27,22 @@ * This code is a part of the SDL2_test library, not the main SDL library. */ -#ifndef _SDL_test_h -#define _SDL_test_h +#ifndef SDL_test_h_ +#define SDL_test_h_ #include "SDL.h" -#include "SDL_test_common.h" -#include "SDL_test_font.h" -#include "SDL_test_random.h" -#include "SDL_test_fuzzer.h" -#include "SDL_test_crc32.h" -#include "SDL_test_md5.h" -#include "SDL_test_log.h" #include "SDL_test_assert.h" +#include "SDL_test_common.h" +#include "SDL_test_compare.h" +#include "SDL_test_crc32.h" +#include "SDL_test_font.h" +#include "SDL_test_fuzzer.h" #include "SDL_test_harness.h" #include "SDL_test_images.h" -#include "SDL_test_compare.h" +#include "SDL_test_log.h" +#include "SDL_test_md5.h" +#include "SDL_test_memory.h" +#include "SDL_test_random.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -63,6 +64,6 @@ extern "C" { #endif #include "close_code.h" -#endif /* _SDL_test_h */ +#endif /* SDL_test_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_test_assert.h b/third-party/sdl2/include/SDL_test_assert.h similarity index 91% rename from #ThirdParty/libSDL/include/SDL_test_assert.h rename to third-party/sdl2/include/SDL_test_assert.h index 29277e1..1788d7a 100644 --- a/#ThirdParty/libSDL/include/SDL_test_assert.h +++ b/third-party/sdl2/include/SDL_test_assert.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ * */ -#ifndef _SDL_test_assert_h -#define _SDL_test_assert_h +#ifndef SDL_test_assert_h_ +#define SDL_test_assert_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -80,12 +80,12 @@ void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription, /** * \brief Resets the assert summary counters to zero. */ -void SDLTest_ResetAssertSummary(); +void SDLTest_ResetAssertSummary(void); /** * \brief Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR. */ -void SDLTest_LogAssertSummary(); +void SDLTest_LogAssertSummary(void); /** @@ -93,13 +93,13 @@ void SDLTest_LogAssertSummary(); * * \returns TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT */ -int SDLTest_AssertSummaryToTestResult(); +int SDLTest_AssertSummaryToTestResult(void); #ifdef __cplusplus } #endif #include "close_code.h" -#endif /* _SDL_test_assert_h */ +#endif /* SDL_test_assert_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_test_common.h b/third-party/sdl2/include/SDL_test_common.h similarity index 97% rename from #ThirdParty/libSDL/include/SDL_test_common.h rename to third-party/sdl2/include/SDL_test_common.h index 0ebf31c..be2e6b2 100644 --- a/#ThirdParty/libSDL/include/SDL_test_common.h +++ b/third-party/sdl2/include/SDL_test_common.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,8 +29,8 @@ /* Ported from original test\common.h file. */ -#ifndef _SDL_test_common_h -#define _SDL_test_common_h +#ifndef SDL_test_common_h_ +#define SDL_test_common_h_ #include "SDL.h" @@ -183,6 +183,6 @@ void SDLTest_CommonQuit(SDLTest_CommonState * state); #endif #include "close_code.h" -#endif /* _SDL_test_common_h */ +#endif /* SDL_test_common_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_test_compare.h b/third-party/sdl2/include/SDL_test_compare.h similarity index 93% rename from #ThirdParty/libSDL/include/SDL_test_compare.h rename to third-party/sdl2/include/SDL_test_compare.h index 772cf9f..c22e447 100644 --- a/#ThirdParty/libSDL/include/SDL_test_compare.h +++ b/third-party/sdl2/include/SDL_test_compare.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ */ -#ifndef _SDL_test_compare_h -#define _SDL_test_compare_h +#ifndef SDL_test_compare_h_ +#define SDL_test_compare_h_ #include "SDL.h" @@ -64,6 +64,6 @@ int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, #endif #include "close_code.h" -#endif /* _SDL_test_compare_h */ +#endif /* SDL_test_compare_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_test_crc32.h b/third-party/sdl2/include/SDL_test_crc32.h similarity index 93% rename from #ThirdParty/libSDL/include/SDL_test_crc32.h rename to third-party/sdl2/include/SDL_test_crc32.h index 572a3d9..3d235d0 100644 --- a/#ThirdParty/libSDL/include/SDL_test_crc32.h +++ b/third-party/sdl2/include/SDL_test_crc32.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ */ -#ifndef _SDL_test_crc32_h -#define _SDL_test_crc32_h +#ifndef SDL_test_crc32_h_ +#define SDL_test_crc32_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -93,7 +93,7 @@ extern "C" { * \returns 0 for OK, -1 on error * */ -int SDLTest_crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32); +int SDLTest_Crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32); /* Same routine broken down into three steps */ int SDLTest_Crc32CalcStart(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32); @@ -119,6 +119,6 @@ int SDLTest_Crc32Done(SDLTest_Crc32Context * crcContext); #endif #include "close_code.h" -#endif /* _SDL_test_crc32_h */ +#endif /* SDL_test_crc32_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_test_font.h b/third-party/sdl2/include/SDL_test_font.h similarity index 83% rename from #ThirdParty/libSDL/include/SDL_test_font.h rename to third-party/sdl2/include/SDL_test_font.h index 3378ea8..59cbdca 100644 --- a/#ThirdParty/libSDL/include/SDL_test_font.h +++ b/third-party/sdl2/include/SDL_test_font.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,8 +27,8 @@ * This code is a part of the SDL2_test library, not the main SDL library. */ -#ifndef _SDL_test_font_h -#define _SDL_test_font_h +#ifndef SDL_test_font_h_ +#define SDL_test_font_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -50,7 +50,7 @@ extern "C" { * * \returns Returns 0 on success, -1 on failure. */ -int SDLTest_DrawCharacter( SDL_Renderer *renderer, int x, int y, char c ); +int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c); /** * \brief Draw a string in the currently set font. @@ -62,15 +62,20 @@ int SDLTest_DrawCharacter( SDL_Renderer *renderer, int x, int y, char c ); * * \returns Returns 0 on success, -1 on failure. */ -int SDLTest_DrawString( SDL_Renderer * renderer, int x, int y, const char *s ); +int SDLTest_DrawString(SDL_Renderer *renderer, int x, int y, const char *s); +/** + * \brief Cleanup textures used by font drawing functions. + */ +void SDLTest_CleanupTextDrawing(void); + /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" -#endif /* _SDL_test_font_h */ +#endif /* SDL_test_font_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_test_fuzzer.h b/third-party/sdl2/include/SDL_test_fuzzer.h similarity index 95% rename from #ThirdParty/libSDL/include/SDL_test_fuzzer.h rename to third-party/sdl2/include/SDL_test_fuzzer.h index 9603652..8fcb9eb 100644 --- a/#ThirdParty/libSDL/include/SDL_test_fuzzer.h +++ b/third-party/sdl2/include/SDL_test_fuzzer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ */ -#ifndef _SDL_test_fuzzer_h -#define _SDL_test_fuzzer_h +#ifndef SDL_test_fuzzer_h_ +#define SDL_test_fuzzer_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -68,14 +68,14 @@ void SDLTest_FuzzerInit(Uint64 execKey); * * \returns Generated integer */ -Uint8 SDLTest_RandomUint8(); +Uint8 SDLTest_RandomUint8(void); /** * Returns a random Sint8 * * \returns Generated signed integer */ -Sint8 SDLTest_RandomSint8(); +Sint8 SDLTest_RandomSint8(void); /** @@ -83,14 +83,14 @@ Sint8 SDLTest_RandomSint8(); * * \returns Generated integer */ -Uint16 SDLTest_RandomUint16(); +Uint16 SDLTest_RandomUint16(void); /** * Returns a random Sint16 * * \returns Generated signed integer */ -Sint16 SDLTest_RandomSint16(); +Sint16 SDLTest_RandomSint16(void); /** @@ -98,7 +98,7 @@ Sint16 SDLTest_RandomSint16(); * * \returns Generated integer */ -Sint32 SDLTest_RandomSint32(); +Sint32 SDLTest_RandomSint32(void); /** @@ -106,14 +106,14 @@ Sint32 SDLTest_RandomSint32(); * * \returns Generated integer */ -Uint32 SDLTest_RandomUint32(); +Uint32 SDLTest_RandomUint32(void); /** * Returns random Uint64. * * \returns Generated integer */ -Uint64 SDLTest_RandomUint64(); +Uint64 SDLTest_RandomUint64(void); /** @@ -121,29 +121,29 @@ Uint64 SDLTest_RandomUint64(); * * \returns Generated signed integer */ -Sint64 SDLTest_RandomSint64(); +Sint64 SDLTest_RandomSint64(void); /** * \returns random float in range [0.0 - 1.0[ */ -float SDLTest_RandomUnitFloat(); +float SDLTest_RandomUnitFloat(void); /** * \returns random double in range [0.0 - 1.0[ */ -double SDLTest_RandomUnitDouble(); +double SDLTest_RandomUnitDouble(void); /** * \returns random float. * */ -float SDLTest_RandomFloat(); +float SDLTest_RandomFloat(void); /** * \returns random double. * */ -double SDLTest_RandomDouble(); +double SDLTest_RandomDouble(void); /** * Returns a random boundary value for Uint8 within the given boundaries. @@ -338,7 +338,7 @@ Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max); * * \returns Newly allocated random string; or NULL if length was invalid or string could not be allocated. */ -char * SDLTest_RandomAsciiString(); +char * SDLTest_RandomAsciiString(void); /** @@ -371,7 +371,7 @@ char * SDLTest_RandomAsciiStringOfSize(int size); /** * Returns the invocation count for the fuzzer since last ...FuzzerInit. */ -int SDLTest_GetFuzzerInvocationCount(); +int SDLTest_GetFuzzerInvocationCount(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus @@ -379,6 +379,6 @@ int SDLTest_GetFuzzerInvocationCount(); #endif #include "close_code.h" -#endif /* _SDL_test_fuzzer_h */ +#endif /* SDL_test_fuzzer_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_test_harness.h b/third-party/sdl2/include/SDL_test_harness.h similarity index 88% rename from #ThirdParty/libSDL/include/SDL_test_harness.h rename to third-party/sdl2/include/SDL_test_harness.h index 74c0950..8641e0a 100644 --- a/#ThirdParty/libSDL/include/SDL_test_harness.h +++ b/third-party/sdl2/include/SDL_test_harness.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ Based on original GSOC code by Markus Kauppila */ -#ifndef _SDL_test_harness_h -#define _SDL_test_harness_h +#ifndef SDL_test_h_arness_h +#define SDL_test_h_arness_h #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -98,6 +98,17 @@ typedef struct SDLTest_TestSuiteReference { } SDLTest_TestSuiteReference; +/** + * \brief Generates a random run seed string for the harness. The generated seed will contain alphanumeric characters (0-9A-Z). + * + * Note: The returned string needs to be deallocated by the caller. + * + * \param length The length of the seed string to generate + * + * \returns The generated seed string + */ +char *SDLTest_GenerateRunSeed(const int length); + /** * \brief Execute a test suite using the given run seed and execution key. * @@ -118,6 +129,6 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user #endif #include "close_code.h" -#endif /* _SDL_test_harness_h */ +#endif /* SDL_test_h_arness_h */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_test_images.h b/third-party/sdl2/include/SDL_test_images.h similarity index 71% rename from #ThirdParty/libSDL/include/SDL_test_images.h rename to third-party/sdl2/include/SDL_test_images.h index 8c64b4f..9c4dd5b 100644 --- a/#ThirdParty/libSDL/include/SDL_test_images.h +++ b/third-party/sdl2/include/SDL_test_images.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ */ -#ifndef _SDL_test_images_h -#define _SDL_test_images_h +#ifndef SDL_test_images_h_ +#define SDL_test_images_h_ #include "SDL.h" @@ -55,17 +55,17 @@ typedef struct SDLTest_SurfaceImage_s { } SDLTest_SurfaceImage_t; /* Test images */ -SDL_Surface *SDLTest_ImageBlit(); -SDL_Surface *SDLTest_ImageBlitColor(); -SDL_Surface *SDLTest_ImageBlitAlpha(); -SDL_Surface *SDLTest_ImageBlitBlendAdd(); -SDL_Surface *SDLTest_ImageBlitBlend(); -SDL_Surface *SDLTest_ImageBlitBlendMod(); -SDL_Surface *SDLTest_ImageBlitBlendNone(); -SDL_Surface *SDLTest_ImageBlitBlendAll(); -SDL_Surface *SDLTest_ImageFace(); -SDL_Surface *SDLTest_ImagePrimitives(); -SDL_Surface *SDLTest_ImagePrimitivesBlend(); +SDL_Surface *SDLTest_ImageBlit(void); +SDL_Surface *SDLTest_ImageBlitColor(void); +SDL_Surface *SDLTest_ImageBlitAlpha(void); +SDL_Surface *SDLTest_ImageBlitBlendAdd(void); +SDL_Surface *SDLTest_ImageBlitBlend(void); +SDL_Surface *SDLTest_ImageBlitBlendMod(void); +SDL_Surface *SDLTest_ImageBlitBlendNone(void); +SDL_Surface *SDLTest_ImageBlitBlendAll(void); +SDL_Surface *SDLTest_ImageFace(void); +SDL_Surface *SDLTest_ImagePrimitives(void); +SDL_Surface *SDLTest_ImagePrimitivesBlend(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus @@ -73,6 +73,6 @@ SDL_Surface *SDLTest_ImagePrimitivesBlend(); #endif #include "close_code.h" -#endif /* _SDL_test_images_h */ +#endif /* SDL_test_images_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_test_log.h b/third-party/sdl2/include/SDL_test_log.h similarity index 92% rename from #ThirdParty/libSDL/include/SDL_test_log.h rename to third-party/sdl2/include/SDL_test_log.h index 73a5c01..ebd44fb 100644 --- a/#ThirdParty/libSDL/include/SDL_test_log.h +++ b/third-party/sdl2/include/SDL_test_log.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ * */ -#ifndef _SDL_test_log_h -#define _SDL_test_log_h +#ifndef SDL_test_log_h_ +#define SDL_test_log_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -62,6 +62,6 @@ void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_ #endif #include "close_code.h" -#endif /* _SDL_test_log_h */ +#endif /* SDL_test_log_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_test_md5.h b/third-party/sdl2/include/SDL_test_md5.h similarity index 97% rename from #ThirdParty/libSDL/include/SDL_test_md5.h rename to third-party/sdl2/include/SDL_test_md5.h index f2d9a7d..0e41057 100644 --- a/#ThirdParty/libSDL/include/SDL_test_md5.h +++ b/third-party/sdl2/include/SDL_test_md5.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -53,8 +53,8 @@ *********************************************************************** */ -#ifndef _SDL_test_md5_h -#define _SDL_test_md5_h +#ifndef SDL_test_md5_h_ +#define SDL_test_md5_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -124,6 +124,6 @@ extern "C" { #endif #include "close_code.h" -#endif /* _SDL_test_md5_h */ +#endif /* SDL_test_md5_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_blendmode.h b/third-party/sdl2/include/SDL_test_memory.h similarity index 51% rename from #ThirdParty/libSDL/include/SDL_blendmode.h rename to third-party/sdl2/include/SDL_test_memory.h index 56d8ad6..4827ae6 100644 --- a/#ThirdParty/libSDL/include/SDL_blendmode.h +++ b/third-party/sdl2/include/SDL_test_memory.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,13 +20,15 @@ */ /** - * \file SDL_blendmode.h + * \file SDL_test_memory.h * - * Header file declaring the SDL_BlendMode enumeration + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. */ -#ifndef _SDL_blendmode_h -#define _SDL_blendmode_h +#ifndef SDL_test_memory_h_ +#define SDL_test_memory_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -34,23 +36,21 @@ extern "C" { #endif + /** - * \brief The blend mode used in SDL_RenderCopy() and drawing operations. + * \brief Start tracking SDL memory allocations + * + * \note This should be called before any other SDL functions for complete tracking coverage */ -typedef enum -{ - SDL_BLENDMODE_NONE = 0x00000000, /**< no blending - dstRGBA = srcRGBA */ - SDL_BLENDMODE_BLEND = 0x00000001, /**< alpha blending - dstRGB = (srcRGB * srcA) + (dstRGB * (1-srcA)) - dstA = srcA + (dstA * (1-srcA)) */ - SDL_BLENDMODE_ADD = 0x00000002, /**< additive blending - dstRGB = (srcRGB * srcA) + dstRGB - dstA = dstA */ - SDL_BLENDMODE_MOD = 0x00000004 /**< color modulate - dstRGB = srcRGB * dstRGB - dstA = dstA */ -} SDL_BlendMode; +int SDLTest_TrackAllocations(); + +/** + * \brief Print a log of any outstanding allocations + * + * \note This can be called after SDL_Quit() + */ +void SDLTest_LogAllocations(); + /* Ends C function definitions when using C++ */ #ifdef __cplusplus @@ -58,6 +58,6 @@ typedef enum #endif #include "close_code.h" -#endif /* _SDL_blendmode_h */ +#endif /* SDL_test_memory_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_test_random.h b/third-party/sdl2/include/SDL_test_random.h similarity index 95% rename from #ThirdParty/libSDL/include/SDL_test_random.h rename to third-party/sdl2/include/SDL_test_random.h index 91c3652..0eb414f 100644 --- a/#ThirdParty/libSDL/include/SDL_test_random.h +++ b/third-party/sdl2/include/SDL_test_random.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,8 +37,8 @@ */ -#ifndef _SDL_test_random_h -#define _SDL_test_random_h +#ifndef SDL_test_random_h_ +#define SDL_test_random_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -110,6 +110,6 @@ extern "C" { #endif #include "close_code.h" -#endif /* _SDL_test_random_h */ +#endif /* SDL_test_random_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_thread.h b/third-party/sdl2/include/SDL_thread.h similarity index 70% rename from #ThirdParty/libSDL/include/SDL_thread.h rename to third-party/sdl2/include/SDL_thread.h index 377e6c7..554dd0b 100644 --- a/#ThirdParty/libSDL/include/SDL_thread.h +++ b/third-party/sdl2/include/SDL_thread.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_thread_h -#define _SDL_thread_h +#ifndef SDL_thread_h_ +#define SDL_thread_h_ /** * \file SDL_thread.h @@ -54,12 +54,13 @@ typedef unsigned int SDL_TLSID; /** * The SDL thread priority. * - * \note On many systems you require special privileges to set high priority. + * \note On many systems you require special privileges to set high or time critical priority. */ typedef enum { SDL_THREAD_PRIORITY_LOW, SDL_THREAD_PRIORITY_NORMAL, - SDL_THREAD_PRIORITY_HIGH + SDL_THREAD_PRIORITY_HIGH, + SDL_THREAD_PRIORITY_TIME_CRITICAL } SDL_ThreadPriority; /** @@ -74,15 +75,15 @@ typedef int (SDLCALL * SDL_ThreadFunction) (void *data); * * We compile SDL into a DLL. This means, that it's the DLL which * creates a new thread for the calling process with the SDL_CreateThread() - * API. There is a problem with this, that only the RTL of the SDL.DLL will + * API. There is a problem with this, that only the RTL of the SDL2.DLL will * be initialized for those threads, and not the RTL of the calling * application! * * To solve this, we make a little hack here. * * We'll always use the caller's _beginthread() and _endthread() APIs to - * start a new thread. This way, if it's the SDL.DLL which uses this API, - * then the RTL of SDL.DLL will be used to create the new thread, and if it's + * start a new thread. This way, if it's the SDL2.DLL which uses this API, + * then the RTL of SDL2.DLL will be used to create the new thread, and if it's * the application, then the RTL of the application will be used. * * So, in short: @@ -90,14 +91,11 @@ typedef int (SDLCALL * SDL_ThreadFunction) (void *data); * library! */ #define SDL_PASSED_BEGINTHREAD_ENDTHREAD -#include /* This has _beginthread() and _endthread() defined! */ +#include /* _beginthreadex() and _endthreadex() */ -typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned, - unsigned (__stdcall * - func) (void - *), - void *arg, unsigned, - unsigned *threadID); +typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) + (void *, unsigned, unsigned (__stdcall *func)(void *), + void * /*arg*/, unsigned, unsigned * /* threadID */); typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code); /** @@ -108,18 +106,68 @@ SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread); +extern DECLSPEC SDL_Thread *SDLCALL +SDL_CreateThreadWithStackSize(int (SDLCALL * fn) (void *), + const char *name, const size_t stacksize, void *data, + pfnSDL_CurrentBeginThread pfnBeginThread, + pfnSDL_CurrentEndThread pfnEndThread); + + /** * Create a thread. */ #if defined(SDL_CreateThread) && SDL_DYNAMIC_API #undef SDL_CreateThread #define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) +#undef SDL_CreateThreadWithStackSize +#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) #else #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) +#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) +#endif + +#elif defined(__OS2__) +/* + * just like the windows case above: We compile SDL2 + * into a dll with Watcom's runtime statically linked. + */ +#define SDL_PASSED_BEGINTHREAD_ENDTHREAD +#ifndef __EMX__ +#include +#else +#include +#endif +typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void * /*arg*/); +typedef void (*pfnSDL_CurrentEndThread)(void); +extern DECLSPEC SDL_Thread *SDLCALL +SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, + pfnSDL_CurrentBeginThread pfnBeginThread, + pfnSDL_CurrentEndThread pfnEndThread); +extern DECLSPEC SDL_Thread *SDLCALL +SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data, + pfnSDL_CurrentBeginThread pfnBeginThread, + pfnSDL_CurrentEndThread pfnEndThread); +#if defined(SDL_CreateThread) && SDL_DYNAMIC_API +#undef SDL_CreateThread +#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread) +#undef SDL_CreateThreadWithStackSize +#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread) +#else +#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread) +#define SDL_CreateThreadWithStackSize(fn, name, stacksize, data) SDL_CreateThreadWithStackSize(fn, name, stacksize, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread) #endif #else +/** + * Create a thread with a default stack size. + * + * This is equivalent to calling: + * SDL_CreateThreadWithStackSize(fn, name, 0, data); + */ +extern DECLSPEC SDL_Thread *SDLCALL +SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data); + /** * Create a thread. * @@ -137,9 +185,17 @@ SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, * If a system imposes requirements, SDL will try to munge the string for * it (truncate, etc), but the original string contents will be available * from SDL_GetThreadName(). + * + * The size (in bytes) of the new stack can be specified. Zero means "use + * the system default" which might be wildly different between platforms + * (x86 Linux generally defaults to eight megabytes, an embedded device + * might be a few kilobytes instead). + * + * In SDL 2.1, stacksize will be folded into the original SDL_CreateThread + * function. */ extern DECLSPEC SDL_Thread *SDLCALL -SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data); +SDL_CreateThreadWithStackSize(SDL_ThreadFunction fn, const char *name, const size_t stacksize, void *data); #endif @@ -273,7 +329,7 @@ extern DECLSPEC void * SDLCALL SDL_TLSGet(SDL_TLSID id); * \sa SDL_TLSCreate() * \sa SDL_TLSGet() */ -extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (*destructor)(void*)); +extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void*)); /* Ends C function definitions when using C++ */ @@ -282,6 +338,6 @@ extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (*d #endif #include "close_code.h" -#endif /* _SDL_thread_h */ +#endif /* SDL_thread_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_timer.h b/third-party/sdl2/include/SDL_timer.h similarity index 96% rename from #ThirdParty/libSDL/include/SDL_timer.h rename to third-party/sdl2/include/SDL_timer.h index e0d3785..5600618 100644 --- a/#ThirdParty/libSDL/include/SDL_timer.h +++ b/third-party/sdl2/include/SDL_timer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_timer_h -#define _SDL_timer_h +#ifndef SDL_timer_h_ +#define SDL_timer_h_ /** * \file SDL_timer.h @@ -110,6 +110,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID id); #endif #include "close_code.h" -#endif /* _SDL_timer_h */ +#endif /* SDL_timer_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_touch.h b/third-party/sdl2/include/SDL_touch.h similarity index 94% rename from #ThirdParty/libSDL/include/SDL_touch.h rename to third-party/sdl2/include/SDL_touch.h index 2643e36..f4075e7 100644 --- a/#ThirdParty/libSDL/include/SDL_touch.h +++ b/third-party/sdl2/include/SDL_touch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL touch event handling. */ -#ifndef _SDL_touch_h -#define _SDL_touch_h +#ifndef SDL_touch_h_ +#define SDL_touch_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -81,6 +81,6 @@ extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int #endif #include "close_code.h" -#endif /* _SDL_touch_h */ +#endif /* SDL_touch_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_types.h b/third-party/sdl2/include/SDL_types.h similarity index 94% rename from #ThirdParty/libSDL/include/SDL_types.h rename to third-party/sdl2/include/SDL_types.h index 5118af2..4ac248c 100644 --- a/#ThirdParty/libSDL/include/SDL_types.h +++ b/third-party/sdl2/include/SDL_types.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/#ThirdParty/libSDL/include/SDL_version.h b/third-party/sdl2/include/SDL_version.h similarity index 96% rename from #ThirdParty/libSDL/include/SDL_version.h rename to third-party/sdl2/include/SDL_version.h index de1f160..31443e1 100644 --- a/#ThirdParty/libSDL/include/SDL_version.h +++ b/third-party/sdl2/include/SDL_version.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * This header defines the current SDL version. */ -#ifndef _SDL_version_h -#define _SDL_version_h +#ifndef SDL_version_h_ +#define SDL_version_h_ #include "SDL_stdinc.h" @@ -59,7 +59,7 @@ typedef struct SDL_version */ #define SDL_MAJOR_VERSION 2 #define SDL_MINOR_VERSION 0 -#define SDL_PATCHLEVEL 4 +#define SDL_PATCHLEVEL 9 /** * \brief Macro to determine SDL version program was compiled against. @@ -157,6 +157,6 @@ extern DECLSPEC int SDLCALL SDL_GetRevisionNumber(void); #endif #include "close_code.h" -#endif /* _SDL_version_h */ +#endif /* SDL_version_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/#ThirdParty/libSDL/include/SDL_video.h b/third-party/sdl2/include/SDL_video.h similarity index 81% rename from #ThirdParty/libSDL/include/SDL_video.h rename to third-party/sdl2/include/SDL_video.h index 52dbbc7..461f138 100644 --- a/#ThirdParty/libSDL/include/SDL_video.h +++ b/third-party/sdl2/include/SDL_video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Header file for SDL video functions. */ -#ifndef _SDL_video_h -#define _SDL_video_h +#ifndef SDL_video_h_ +#define SDL_video_h_ #include "SDL_stdinc.h" #include "SDL_pixels.h" @@ -83,6 +83,7 @@ typedef struct * \sa SDL_SetWindowPosition() * \sa SDL_SetWindowSize() * \sa SDL_SetWindowBordered() + * \sa SDL_SetWindowResizable() * \sa SDL_SetWindowTitle() * \sa SDL_ShowWindow() */ @@ -95,6 +96,7 @@ typedef struct SDL_Window SDL_Window; */ typedef enum { + /* !!! FIXME: change this to name = (1<0. * \param h The height of the window, in screen coordinates. Must be >0. * - * \note You can't change the size of a fullscreen window, it automatically - * matches the size of the display mode. + * \note Fullscreen windows automatically match the size of the display mode, + * and you should use SDL_SetWindowDisplayMode() to change their size. * * The window size in screen coordinates may differ from the size in pixels, if * the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with @@ -563,6 +642,7 @@ extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window, * SDL_GetRendererOutputSize() to get the real client area size in pixels. * * \sa SDL_GetWindowSize() + * \sa SDL_SetWindowDisplayMode() */ extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w, int h); @@ -586,6 +666,25 @@ extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w, extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w, int *h); +/** + * \brief Get the size of a window's borders (decorations) around the client area. + * + * \param window The window to query. + * \param top Pointer to variable for storing the size of the top border. NULL is permitted. + * \param left Pointer to variable for storing the size of the left border. NULL is permitted. + * \param bottom Pointer to variable for storing the size of the bottom border. NULL is permitted. + * \param right Pointer to variable for storing the size of the right border. NULL is permitted. + * + * \return 0 on success, or -1 if getting this information is not supported. + * + * \note if this function fails (returns -1), the size values will be + * initialized to 0, 0, 0, 0 (if a non-NULL pointer is provided), as + * if the window in question was borderless. + */ +extern DECLSPEC int SDLCALL SDL_GetWindowBordersSize(SDL_Window * window, + int *top, int *left, + int *bottom, int *right); + /** * \brief Set the minimum size of a window's client area. * @@ -661,6 +760,23 @@ extern DECLSPEC void SDLCALL SDL_GetWindowMaximumSize(SDL_Window * window, extern DECLSPEC void SDLCALL SDL_SetWindowBordered(SDL_Window * window, SDL_bool bordered); +/** + * \brief Set the user-resizable state of a window. + * + * This will add or remove the window's SDL_WINDOW_RESIZABLE flag and + * allow/disallow user resizing of the window. This is a no-op if the + * window's resizable state already matches the requested state. + * + * \param window The window of which to change the resizable state. + * \param resizable SDL_TRUE to allow resizing, SDL_FALSE to disallow. + * + * \note You can't change the resizable state of a fullscreen window. + * + * \sa SDL_GetWindowFlags() + */ +extern DECLSPEC void SDLCALL SDL_SetWindowResizable(SDL_Window * window, + SDL_bool resizable); + /** * \brief Show a window. * @@ -744,7 +860,7 @@ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window * window); * \return 0 on success, or -1 on error. * * \sa SDL_GetWindowSurface() - * \sa SDL_UpdateWindowSurfaceRect() + * \sa SDL_UpdateWindowSurface() */ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window * window, const SDL_Rect * rects, @@ -801,6 +917,58 @@ extern DECLSPEC int SDLCALL SDL_SetWindowBrightness(SDL_Window * window, float b */ extern DECLSPEC float SDLCALL SDL_GetWindowBrightness(SDL_Window * window); +/** + * \brief Set the opacity for a window + * + * \param window The window which will be made transparent or opaque + * \param opacity Opacity (0.0f - transparent, 1.0f - opaque) This will be + * clamped internally between 0.0f and 1.0f. + * + * \return 0 on success, or -1 if setting the opacity isn't supported. + * + * \sa SDL_GetWindowOpacity() + */ +extern DECLSPEC int SDLCALL SDL_SetWindowOpacity(SDL_Window * window, float opacity); + +/** + * \brief Get the opacity of a window. + * + * If transparency isn't supported on this platform, opacity will be reported + * as 1.0f without error. + * + * \param window The window in question. + * \param out_opacity Opacity (0.0f - transparent, 1.0f - opaque) + * + * \return 0 on success, or -1 on error (invalid window, etc). + * + * \sa SDL_SetWindowOpacity() + */ +extern DECLSPEC int SDLCALL SDL_GetWindowOpacity(SDL_Window * window, float * out_opacity); + +/** + * \brief Sets the window as a modal for another window (TODO: reconsider this function and/or its name) + * + * \param modal_window The window that should be modal + * \param parent_window The parent window + * + * \return 0 on success, or -1 otherwise. + */ +extern DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window * modal_window, SDL_Window * parent_window); + +/** + * \brief Explicitly sets input focus to the window. + * + * You almost certainly want SDL_RaiseWindow() instead of this function. Use + * this with caution, as you might give focus to a window that's completely + * obscured by other windows. + * + * \param window The window that should get the input focus + * + * \return 0 on success, or -1 otherwise. + * \sa SDL_RaiseWindow() + */ +extern DECLSPEC int SDLCALL SDL_SetWindowInputFocus(SDL_Window * window); + /** * \brief Set the gamma ramp for a window. * @@ -920,7 +1088,7 @@ extern DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window * window); /** - * \brief Returns whether the screensaver is currently enabled (default on). + * \brief Returns whether the screensaver is currently enabled (default off). * * \sa SDL_EnableScreenSaver() * \sa SDL_DisableScreenSaver() @@ -995,11 +1163,16 @@ extern DECLSPEC void SDLCALL SDL_GL_ResetAttributes(void); /** * \brief Set an OpenGL window attribute before window creation. + * + * \return 0 on success, or -1 if the attribute could not be set. */ extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value); /** * \brief Get the actual value for an attribute from the current context. + * + * \return 0 on success, or -1 if the attribute could not be retrieved. + * The integer at \c value will be modified in either case. */ extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value); @@ -1098,6 +1271,6 @@ extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context); #endif #include "close_code.h" -#endif /* _SDL_video_h */ +#endif /* SDL_video_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/third-party/sdl2/include/SDL_vulkan.h b/third-party/sdl2/include/SDL_vulkan.h new file mode 100644 index 0000000..972cca4 --- /dev/null +++ b/third-party/sdl2/include/SDL_vulkan.h @@ -0,0 +1,278 @@ +/* + Simple DirectMedia Layer + Copyright (C) 2017, Mark Callow + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_vulkan.h + * + * Header file for functions to creating Vulkan surfaces on SDL windows. + */ + +#ifndef SDL_vulkan_h_ +#define SDL_vulkan_h_ + +#include "SDL_video.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Avoid including vulkan.h, don't define VkInstance if it's already included */ +#ifdef VULKAN_H_ +#define NO_SDL_VULKAN_TYPEDEFS +#endif +#ifndef NO_SDL_VULKAN_TYPEDEFS +#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object; + +#if defined(__LP64__) || defined(_WIN64) || defined(__x86_64__) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__) +#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object; +#else +#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object; +#endif + +VK_DEFINE_HANDLE(VkInstance) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR) + +#endif /* !NO_SDL_VULKAN_TYPEDEFS */ + +typedef VkInstance SDL_vulkanInstance; +typedef VkSurfaceKHR SDL_vulkanSurface; /* for compatibility with Tizen */ + +/** + * \name Vulkan support functions + * + * \note SDL_Vulkan_GetInstanceExtensions & SDL_Vulkan_CreateSurface API + * is compatable with Tizen's implementation of Vulkan in SDL. + */ +/* @{ */ + +/** + * \brief Dynamically load a Vulkan loader library. + * + * \param [in] path The platform dependent Vulkan loader library name, or + * \c NULL. + * + * \return \c 0 on success, or \c -1 if the library couldn't be loaded. + * + * If \a path is NULL SDL will use the value of the environment variable + * \c SDL_VULKAN_LIBRARY, if set, otherwise it loads the default Vulkan + * loader library. + * + * This should be called after initializing the video driver, but before + * creating any Vulkan windows. If no Vulkan loader library is loaded, the + * default library will be loaded upon creation of the first Vulkan window. + * + * \note It is fairly common for Vulkan applications to link with \a libvulkan + * instead of explicitly loading it at run time. This will work with + * SDL provided the application links to a dynamic library and both it + * and SDL use the same search path. + * + * \note If you specify a non-NULL \c path, an application should retrieve all + * of the Vulkan functions it uses from the dynamic library using + * \c SDL_Vulkan_GetVkGetInstanceProcAddr() unless you can guarantee + * \c path points to the same vulkan loader library the application + * linked to. + * + * \note On Apple devices, if \a path is NULL, SDL will attempt to find + * the vkGetInstanceProcAddr address within all the mach-o images of + * the current process. This is because it is fairly common for Vulkan + * applications to link with libvulkan (and historically MoltenVK was + * provided as a static library). If it is not found then, on macOS, SDL + * will attempt to load \c vulkan.framework/vulkan, \c libvulkan.1.dylib, + * \c MoltenVK.framework/MoltenVK and \c libMoltenVK.dylib in that order. + * On iOS SDL will attempt to load \c libMoltenVK.dylib. Applications + * using a dynamic framework or .dylib must ensure it is included in its + * application bundle. + * + * \note On non-Apple devices, application linking with a static libvulkan is + * not supported. Either do not link to the Vulkan loader or link to a + * dynamic library version. + * + * \note This function will fail if there are no working Vulkan drivers + * installed. + * + * \sa SDL_Vulkan_GetVkGetInstanceProcAddr() + * \sa SDL_Vulkan_UnloadLibrary() + */ +extern DECLSPEC int SDLCALL SDL_Vulkan_LoadLibrary(const char *path); + +/** + * \brief Get the address of the \c vkGetInstanceProcAddr function. + * + * \note This should be called after either calling SDL_Vulkan_LoadLibrary + * or creating an SDL_Window with the SDL_WINDOW_VULKAN flag. + */ +extern DECLSPEC void *SDLCALL SDL_Vulkan_GetVkGetInstanceProcAddr(void); + +/** + * \brief Unload the Vulkan loader library previously loaded by + * \c SDL_Vulkan_LoadLibrary(). + * + * \sa SDL_Vulkan_LoadLibrary() + */ +extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void); + +/** + * \brief Get the names of the Vulkan instance extensions needed to create + * a surface with \c SDL_Vulkan_CreateSurface(). + * + * \param [in] \c NULL or window Window for which the required Vulkan instance + * extensions should be retrieved + * \param [in,out] pCount pointer to an \c unsigned related to the number of + * required Vulkan instance extensions + * \param [out] pNames \c NULL or a pointer to an array to be filled with the + * required Vulkan instance extensions + * + * \return \c SDL_TRUE on success, \c SDL_FALSE on error. + * + * If \a pNames is \c NULL, then the number of required Vulkan instance + * extensions is returned in pCount. Otherwise, \a pCount must point to a + * variable set to the number of elements in the \a pNames array, and on + * return the variable is overwritten with the number of names actually + * written to \a pNames. If \a pCount is less than the number of required + * extensions, at most \a pCount structures will be written. If \a pCount + * is smaller than the number of required extensions, \c SDL_FALSE will be + * returned instead of \c SDL_TRUE, to indicate that not all the required + * extensions were returned. + * + * \note If \c window is not NULL, it will be checked against its creation + * flags to ensure that the Vulkan flag is present. This parameter + * will be removed in a future major release. + * + * \note The returned list of extensions will contain \c VK_KHR_surface + * and zero or more platform specific extensions + * + * \note The extension names queried here must be enabled when calling + * VkCreateInstance, otherwise surface creation will fail. + * + * \note \c window should have been created with the \c SDL_WINDOW_VULKAN flag + * or be \c NULL + * + * \code + * unsigned int count; + * // get count of required extensions + * if(!SDL_Vulkan_GetInstanceExtensions(NULL, &count, NULL)) + * handle_error(); + * + * static const char *const additionalExtensions[] = + * { + * VK_EXT_DEBUG_REPORT_EXTENSION_NAME, // example additional extension + * }; + * size_t additionalExtensionsCount = sizeof(additionalExtensions) / sizeof(additionalExtensions[0]); + * size_t extensionCount = count + additionalExtensionsCount; + * const char **names = malloc(sizeof(const char *) * extensionCount); + * if(!names) + * handle_error(); + * + * // get names of required extensions + * if(!SDL_Vulkan_GetInstanceExtensions(NULL, &count, names)) + * handle_error(); + * + * // copy additional extensions after required extensions + * for(size_t i = 0; i < additionalExtensionsCount; i++) + * names[i + count] = additionalExtensions[i]; + * + * VkInstanceCreateInfo instanceCreateInfo = {}; + * instanceCreateInfo.enabledExtensionCount = extensionCount; + * instanceCreateInfo.ppEnabledExtensionNames = names; + * // fill in rest of instanceCreateInfo + * + * VkInstance instance; + * // create the Vulkan instance + * VkResult result = vkCreateInstance(&instanceCreateInfo, NULL, &instance); + * free(names); + * \endcode + * + * \sa SDL_Vulkan_CreateSurface() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_GetInstanceExtensions( + SDL_Window *window, + unsigned int *pCount, + const char **pNames); + +/** + * \brief Create a Vulkan rendering surface for a window. + * + * \param [in] window SDL_Window to which to attach the rendering surface. + * \param [in] instance handle to the Vulkan instance to use. + * \param [out] surface pointer to a VkSurfaceKHR handle to receive the + * handle of the newly created surface. + * + * \return \c SDL_TRUE on success, \c SDL_FALSE on error. + * + * \code + * VkInstance instance; + * SDL_Window *window; + * + * // create instance and window + * + * // create the Vulkan surface + * VkSurfaceKHR surface; + * if(!SDL_Vulkan_CreateSurface(window, instance, &surface)) + * handle_error(); + * \endcode + * + * \note \a window should have been created with the \c SDL_WINDOW_VULKAN flag. + * + * \note \a instance should have been created with the extensions returned + * by \c SDL_Vulkan_CreateSurface() enabled. + * + * \sa SDL_Vulkan_GetInstanceExtensions() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_CreateSurface( + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR* surface); + +/** + * \brief Get the size of a window's underlying drawable in pixels (for use + * with setting viewport, scissor & etc). + * + * \param window SDL_Window from which the drawable size should be queried + * \param w Pointer to variable for storing the width in pixels, + * may be NULL + * \param h Pointer to variable for storing the height in pixels, + * may be NULL + * + * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI + * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a + * platform with high-DPI support (Apple calls this "Retina"), and not disabled + * by the \c SDL_HINT_VIDEO_HIGHDPI_DISABLED hint. + * + * \note On macOS high-DPI support must be enabled for an application by + * setting NSHighResolutionCapable to true in its Info.plist. + * + * \sa SDL_GetWindowSize() + * \sa SDL_CreateWindow() + */ +extern DECLSPEC void SDLCALL SDL_Vulkan_GetDrawableSize(SDL_Window * window, + int *w, int *h); + +/* @} *//* Vulkan support functions */ + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_vulkan_h_ */ diff --git a/#ThirdParty/libSDL/include/begin_code.h b/third-party/sdl2/include/begin_code.h similarity index 86% rename from #ThirdParty/libSDL/include/begin_code.h rename to third-party/sdl2/include/begin_code.h index 04e78c6..6c21062 100644 --- a/#ThirdParty/libSDL/include/begin_code.h +++ b/third-party/sdl2/include/begin_code.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -61,6 +61,12 @@ # else # define DECLSPEC __declspec(dllexport) # endif +# elif defined(__OS2__) +# ifdef BUILD_SDL +# define DECLSPEC __declspec(dllexport) +# else +# define DECLSPEC +# endif # else # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) @@ -74,6 +80,11 @@ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl +#elif defined(__OS2__) || defined(__EMX__) +#define SDLCALL _System +# if defined (__GNUC__) && !defined(_System) +# define _System /* for old EMX/GCC compat. */ +# endif #else #define SDLCALL #endif @@ -111,7 +122,7 @@ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ - defined(__DECC) + defined(__DECC) || defined(__CC_ARM) #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline @@ -134,6 +145,16 @@ #endif #endif /* SDL_FORCE_INLINE not defined */ +#ifndef SDL_NORETURN +#if defined(__GNUC__) +#define SDL_NORETURN __attribute__((noreturn)) +#elif defined(_MSC_VER) +#define SDL_NORETURN __declspec(noreturn) +#else +#define SDL_NORETURN +#endif +#endif /* SDL_NORETURN not defined */ + /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL diff --git a/#ThirdParty/libSDL/include/close_code.h b/third-party/sdl2/include/close_code.h similarity index 89% rename from #ThirdParty/libSDL/include/close_code.h rename to third-party/sdl2/include/close_code.h index d908b00..b3b70a4 100644 --- a/#ThirdParty/libSDL/include/close_code.h +++ b/third-party/sdl2/include/close_code.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,7 +29,7 @@ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ -#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) +#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif diff --git a/third-party/sdl2/lib/x64/SDL2.dll b/third-party/sdl2/lib/x64/SDL2.dll new file mode 100644 index 0000000..934f809 Binary files /dev/null and b/third-party/sdl2/lib/x64/SDL2.dll differ diff --git a/third-party/sdl2/lib/x64/SDL2.lib b/third-party/sdl2/lib/x64/SDL2.lib new file mode 100644 index 0000000..f4941ae Binary files /dev/null and b/third-party/sdl2/lib/x64/SDL2.lib differ diff --git a/third-party/sdl2/lib/x64/SDL2main.lib b/third-party/sdl2/lib/x64/SDL2main.lib new file mode 100644 index 0000000..6129946 Binary files /dev/null and b/third-party/sdl2/lib/x64/SDL2main.lib differ diff --git a/third-party/sdl2/lib/x64/SDL2test.lib b/third-party/sdl2/lib/x64/SDL2test.lib new file mode 100644 index 0000000..5b03282 Binary files /dev/null and b/third-party/sdl2/lib/x64/SDL2test.lib differ diff --git a/third-party/sdl2/lib/x86/SDL2.dll b/third-party/sdl2/lib/x86/SDL2.dll new file mode 100644 index 0000000..7017790 Binary files /dev/null and b/third-party/sdl2/lib/x86/SDL2.dll differ diff --git a/third-party/sdl2/lib/x86/SDL2.lib b/third-party/sdl2/lib/x86/SDL2.lib new file mode 100644 index 0000000..cef7901 Binary files /dev/null and b/third-party/sdl2/lib/x86/SDL2.lib differ diff --git a/third-party/sdl2/lib/x86/SDL2main.lib b/third-party/sdl2/lib/x86/SDL2main.lib new file mode 100644 index 0000000..55c40c7 Binary files /dev/null and b/third-party/sdl2/lib/x86/SDL2main.lib differ diff --git a/third-party/sdl2/lib/x86/SDL2test.lib b/third-party/sdl2/lib/x86/SDL2test.lib new file mode 100644 index 0000000..d7a395f Binary files /dev/null and b/third-party/sdl2/lib/x86/SDL2test.lib differ