Compare commits
51 Commits
v1200-pre1
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
| c2f795e4ef | |||
| 0c3e74df62 | |||
| 156ecae690 | |||
| 5f62431f61 | |||
| ccc0d14b66 | |||
| 10f664ce85 | |||
| 568aac6175 | |||
| 00ff5e5ef5 | |||
| c4947bd12a | |||
| d7fc9de5e2 | |||
| 0b9792fb81 | |||
| 7f54ca5f55 | |||
| a4bb9f68fe | |||
| 09be5488e1 | |||
| 3afa84df85 | |||
| 077776b704 | |||
| 420744efd4 | |||
| b9a7409457 | |||
| 008eefdc1e | |||
| c9ff5b8ca4 | |||
| 79cc5fae95 | |||
| f713369a01 | |||
| 2196cb8419 | |||
| cc1340190e | |||
| a16218e1d5 | |||
| 28598fae6b | |||
| 0065ff4328 | |||
| 2dbd84c794 | |||
| 24788185aa | |||
| 717609a900 | |||
| e8c8fbd2bf | |||
| 826428bc1a | |||
| 3bc04e1602 | |||
| 86311eccb3 | |||
| c9b41591b3 | |||
| 0ee2e25c0b | |||
| 0f1d127726 | |||
| 737454eeac | |||
| fd25336a16 | |||
| 0f328670be | |||
| 22c38213a0 | |||
| ffccbd5907 | |||
| 7f5d100e51 | |||
| 88f8f50e00 | |||
| f12996997f | |||
| 4ce6f52085 | |||
| 6980081f57 | |||
| 590f4eb155 | |||
| 11cc383e7b | |||
| a5f409755e | |||
| 581c640149 |
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -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 <assert.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <io.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#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;
|
|
||||||
}
|
|
||||||
@@ -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 <iostream.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#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;
|
|
||||||
}
|
|
||||||
@@ -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 <stdio.h>
|
|
||||||
#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 <input file name> <output file name>\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;
|
|
||||||
}
|
|
||||||
@@ -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 <iostream.h>
|
|
||||||
#include <fstream.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#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;
|
|
||||||
|
|
||||||
}
|
|
||||||
-146
@@ -1,146 +0,0 @@
|
|||||||
/*--------------------------------------------------------------------------*\
|
|
||||||
|| fiio_mem.cpp by Ryan Rubley <ryan@lostreality.org> ||
|
|
||||||
|| ||
|
|
||||||
|| (v1.02) 4-28-2004 ||
|
|
||||||
|| FreeImageIO to memory ||
|
|
||||||
|| ||
|
|
||||||
\*--------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#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<count; x++ ) {
|
|
||||||
//if there isnt size bytes left to read, set pos to eof and return a short count
|
|
||||||
if( FIIOMEM(filelen)-FIIOMEM(curpos) < (long)size ) {
|
|
||||||
FIIOMEM(curpos) = FIIOMEM(filelen);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
//copy size bytes count times
|
|
||||||
memcpy( buffer, (char *)FIIOMEM(data) + FIIOMEM(curpos), size );
|
|
||||||
FIIOMEM(curpos) += size;
|
|
||||||
buffer = (char *)buffer + size;
|
|
||||||
}
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned
|
|
||||||
fiio_mem_WriteProc(void *buffer, unsigned size, unsigned count, fi_handle handle) {
|
|
||||||
void *newdata;
|
|
||||||
long newdatalen;
|
|
||||||
//double the data block size if we need to
|
|
||||||
while( FIIOMEM(curpos)+(long)(size*count) >= 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
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
/*--------------------------------------------------------------------------*\
|
|
||||||
|| fiio_mem.h by Ryan Rubley <ryan@lostreality.org> ||
|
|
||||||
|| ||
|
|
||||||
|| (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
|
|
||||||
@@ -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 <assert.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#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 <input file name>\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;
|
|
||||||
}
|
|
||||||
@@ -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 );
|
|
||||||
}
|
|
||||||
@@ -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 <assert.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#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;
|
|
||||||
}
|
|
||||||
@@ -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 <iostream>
|
|
||||||
#include <sstream>
|
|
||||||
#include <fstream>
|
|
||||||
|
|
||||||
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 << "<HTML>\n<BODY>\n<CENTER>\n";
|
|
||||||
ios << "<FONT FACE = \"Arial\">\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Print a HTML footer
|
|
||||||
*/
|
|
||||||
void PrintHTMLFooter(iostream& ios) {
|
|
||||||
ios << "</CENTER>\n</FONT>\n</BODY>\n</HTML>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Print a table header
|
|
||||||
*/
|
|
||||||
void PrintTableHeader(iostream& ios, const char *title) {
|
|
||||||
ios << "<TABLE BORDER=\"1\">\n";
|
|
||||||
ios << "<TR><TD ALIGN=CENTER COLSPAN=\"3\" BGCOLOR=\"#CCCCCC\"><B><font face=\"Arial\">" << title << "</font></B></TD></TR>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Print a table section
|
|
||||||
*/
|
|
||||||
void PrintTableSection(iostream& ios, const char *title) {
|
|
||||||
ios << "<TR><TD ALIGN=CENTER COLSPAN=\"3\" BGCOLOR=\"#FFFFCC\"><B><font face=\"Arial\">" << title << "</font></B></TD></TR>\n";
|
|
||||||
ios << "<TR><TD><B>Tag name</B></TD><TD><B>Tag value</B></TD><TD><B>Description</B></TD></TR>";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Print a table footer
|
|
||||||
*/
|
|
||||||
void PrintTableFooter(iostream& ios) {
|
|
||||||
ios << "</TABLE>\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 << "<TR><TD>" << FreeImage_GetTagKey(tag) << "</TD><TD>" << value << "</TD><TD>" << FreeImage_GetTagDescription(tag) << "</TD></TR>\n";
|
|
||||||
} else {
|
|
||||||
ios << "<TR><TD>" << FreeImage_GetTagKey(tag) << "</TD><TD>" << value << "</TD><TD>" << " " << "</TD></TR>\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 <input file name>\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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-24
@@ -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
|
|
||||||
-100
@@ -1,100 +0,0 @@
|
|||||||
#include <gtk/gtk.h>
|
|
||||||
#include <FreeImage.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
#include <vga.h>
|
|
||||||
#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;
|
|
||||||
}
|
|
||||||
@@ -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<unsigned int, GLuint>::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();
|
|
||||||
}
|
|
||||||
@@ -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 <windows.h>
|
|
||||||
#include <gl/gl.h>
|
|
||||||
#include "FreeImage.h"
|
|
||||||
#include <map>
|
|
||||||
|
|
||||||
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<unsigned int, GLuint> m_texID;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -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!
|
|
||||||
@@ -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 <windows.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#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;
|
|
||||||
}
|
|
||||||
@@ -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
|
|
||||||
Vendored
-236
@@ -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
|
|
||||||
Vendored
-1258
File diff suppressed because it is too large
Load Diff
@@ -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
|
|
||||||
|
|
||||||
-13
@@ -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
|
|
||||||
@@ -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.
|
|
||||||
Binary file not shown.
@@ -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
|
|
||||||
@@ -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.
|
|
||||||
@@ -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.
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 63 KiB |
@@ -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.
|
|
||||||
Binary file not shown.
@@ -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
|
|
||||||
@@ -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
|
|
||||||
@@ -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.
|
|
||||||
@@ -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
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -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.
|
|
||||||
@@ -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.
|
|
||||||
Binary file not shown.
@@ -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
|
|
||||||
@@ -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.
|
|
||||||
@@ -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.
|
|
||||||
-2187
File diff suppressed because it is too large
Load Diff
-1746
File diff suppressed because it is too large
Load Diff
@@ -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.
|
|
||||||
@@ -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}
|
|
||||||
@@ -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("")];
|
|
||||||
|
|
||||||
-69
@@ -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<unsigned char __gc []> 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<unsigned char __gc []> 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
-83
@@ -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 <vcclr.h>
|
|
||||||
#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<System::IO::Stream*> _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);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
-176
@@ -1,176 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="Windows-1252"?>
|
|
||||||
<VisualStudioProject
|
|
||||||
ProjectType="Visual C++"
|
|
||||||
Version="7.10"
|
|
||||||
Name="FreeImageIO.Net"
|
|
||||||
ProjectGUID="{E87923FF-1FBD-450D-9287-539A90DE9776}"
|
|
||||||
RootNamespace="FreeImageIONet"
|
|
||||||
Keyword="ManagedCProj">
|
|
||||||
<Platforms>
|
|
||||||
<Platform
|
|
||||||
Name="Win32"/>
|
|
||||||
</Platforms>
|
|
||||||
<Configurations>
|
|
||||||
<Configuration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(ConfigurationName)"
|
|
||||||
ConfigurationType="2"
|
|
||||||
CharacterSet="2"
|
|
||||||
ManagedExtensions="TRUE">
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalOptions="/Zl"
|
|
||||||
Optimization="0"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG"
|
|
||||||
MinimalRebuild="FALSE"
|
|
||||||
BasicRuntimeChecks="0"
|
|
||||||
RuntimeLibrary="1"
|
|
||||||
UsePrecompiledHeader="3"
|
|
||||||
WarningLevel="3"
|
|
||||||
DebugInformationFormat="3"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
AdditionalOptions="/noentry"
|
|
||||||
AdditionalDependencies="nochkclr.obj mscoree.lib msvcrt.lib FreeImaged.lib"
|
|
||||||
OutputFile="$(OutDir)\$(ProjectName).dll"
|
|
||||||
LinkIncremental="2"
|
|
||||||
GenerateDebugInformation="TRUE"
|
|
||||||
AssemblyDebug="1"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebDeploymentTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedWrapperGeneratorTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Release|Win32"
|
|
||||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(ConfigurationName)"
|
|
||||||
ConfigurationType="2"
|
|
||||||
CharacterSet="2"
|
|
||||||
ManagedExtensions="TRUE">
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalOptions="/Zl"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG"
|
|
||||||
MinimalRebuild="FALSE"
|
|
||||||
RuntimeLibrary="0"
|
|
||||||
UsePrecompiledHeader="3"
|
|
||||||
WarningLevel="3"
|
|
||||||
DebugInformationFormat="3"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
AdditionalOptions="/noentry"
|
|
||||||
AdditionalDependencies="nochkclr.obj mscoree.lib msvcrt.lib FreeImage.lib"
|
|
||||||
OutputFile="$(OutDir)\$(ProjectName).dll"
|
|
||||||
LinkIncremental="1"
|
|
||||||
GenerateDebugInformation="TRUE"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebDeploymentTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedWrapperGeneratorTool"/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
|
||||||
</Configuration>
|
|
||||||
</Configurations>
|
|
||||||
<References>
|
|
||||||
<AssemblyReference
|
|
||||||
RelativePath="mscorlib.dll"/>
|
|
||||||
<AssemblyReference
|
|
||||||
RelativePath="System.dll"/>
|
|
||||||
<AssemblyReference
|
|
||||||
RelativePath="System.Data.dll"/>
|
|
||||||
</References>
|
|
||||||
<Files>
|
|
||||||
<Filter
|
|
||||||
Name="Source Files"
|
|
||||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
|
||||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
|
||||||
<File
|
|
||||||
RelativePath=".\AssemblyInfo.cpp">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\FreeImageIO.Net.cpp">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\Stdafx.cpp">
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32">
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
UsePrecompiledHeader="1"/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32">
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
UsePrecompiledHeader="1"/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
</Filter>
|
|
||||||
<Filter
|
|
||||||
Name="Header Files"
|
|
||||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
|
||||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
|
||||||
<File
|
|
||||||
RelativePath=".\FreeImageIO.Net.h">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\resource.h">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\Stdafx.h">
|
|
||||||
</File>
|
|
||||||
</Filter>
|
|
||||||
<Filter
|
|
||||||
Name="Resource Files"
|
|
||||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
|
||||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
|
|
||||||
<File
|
|
||||||
RelativePath=".\app.ico">
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath=".\app.rc">
|
|
||||||
</File>
|
|
||||||
</Filter>
|
|
||||||
<File
|
|
||||||
RelativePath=".\ReadMe.txt">
|
|
||||||
</File>
|
|
||||||
</Files>
|
|
||||||
<Globals>
|
|
||||||
</Globals>
|
|
||||||
</VisualStudioProject>
|
|
||||||
@@ -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
|
|
||||||
@@ -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.
|
|
||||||
@@ -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"
|
|
||||||
@@ -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
|
|
||||||
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB |
@@ -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
|
|
||||||
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
//{{NO_DEPENDENCIES}}
|
|
||||||
// Microsoft Visual C++ generated include file.
|
|
||||||
// Used by app.rc
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
You may safely delete this file.
|
|
||||||
@@ -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.
|
|
||||||
-41
@@ -1,41 +0,0 @@
|
|||||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
|
||||||
<PropertyGroup>
|
|
||||||
<!-- The configuration and platform will be used to determine which
|
|
||||||
assemblies to include from solution and project documentation
|
|
||||||
sources -->
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
|
||||||
<ProjectGuid>{d68736d0-a80d-453c-a921-6ada865504b5}</ProjectGuid>
|
|
||||||
<SHFBSchemaVersion>1.8.0.0</SHFBSchemaVersion>
|
|
||||||
<!-- AssemblyName, Name, and RootNamespace are not used by SHFB but Visual
|
|
||||||
Studio adds them anyway -->
|
|
||||||
<AssemblyName>Documentation</AssemblyName>
|
|
||||||
<RootNamespace>Documentation</RootNamespace>
|
|
||||||
<Name>Documentation</Name>
|
|
||||||
<!-- SHFB properties -->
|
|
||||||
<OutputPath>.\Out\</OutputPath>
|
|
||||||
<HtmlHelpName>FreeImage.NET</HtmlHelpName>
|
|
||||||
<HelpFileFormat>HtmlHelp1x</HelpFileFormat>
|
|
||||||
<KeepLogFile>False</KeepLogFile>
|
|
||||||
<FooterText>FreeImage - The productivity booster. FreeImage is licensed under the GNU General Public License %28GPL%29 and the FreeImage Public License %28FIPL%29.</FooterText>
|
|
||||||
<HelpTitle>FreeImage .NET Documentation</HelpTitle>
|
|
||||||
<NamingMethod>HashedMemberName</NamingMethod>
|
|
||||||
<SdkLinkType>Msdn</SdkLinkType>
|
|
||||||
<MissingTags>AutoDocumentCtors</MissingTags>
|
|
||||||
<VisibleItems>InheritedMembers, Protected</VisibleItems>
|
|
||||||
<DocumentationSources>
|
|
||||||
<DocumentationSource sourceFile="FreeImageNET.dll" />
|
|
||||||
<DocumentationSource sourceFile="FreeImageNET.xml" /></DocumentationSources>
|
|
||||||
<PlugInConfigurations>
|
|
||||||
</PlugInConfigurations>
|
|
||||||
</PropertyGroup>
|
|
||||||
<!-- There are no properties for these two groups but they need to appear in
|
|
||||||
order for Visual Studio to perform the build. -->
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
</PropertyGroup>
|
|
||||||
<!-- Import the SHFB build targets -->
|
|
||||||
<Import Project="$(SHFBROOT)\SandcastleHelpFileBuilder.targets" />
|
|
||||||
</Project>
|
|
||||||
-41
@@ -1,41 +0,0 @@
|
|||||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
|
||||||
<PropertyGroup>
|
|
||||||
<!-- The configuration and platform will be used to determine which
|
|
||||||
assemblies to include from solution and project documentation
|
|
||||||
sources -->
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
|
||||||
<ProjectGuid>{d68736d0-a80d-453c-a921-6ada865504b5}</ProjectGuid>
|
|
||||||
<SHFBSchemaVersion>1.8.0.0</SHFBSchemaVersion>
|
|
||||||
<!-- AssemblyName, Name, and RootNamespace are not used by SHFB but Visual
|
|
||||||
Studio adds them anyway -->
|
|
||||||
<AssemblyName>Documentation</AssemblyName>
|
|
||||||
<RootNamespace>Documentation</RootNamespace>
|
|
||||||
<Name>Documentation</Name>
|
|
||||||
<!-- SHFB properties -->
|
|
||||||
<OutputPath>.\Out\</OutputPath>
|
|
||||||
<HtmlHelpName>FreeImage.NET</HtmlHelpName>
|
|
||||||
<HelpFileFormat>HtmlHelp1x</HelpFileFormat>
|
|
||||||
<KeepLogFile>False</KeepLogFile>
|
|
||||||
<FooterText>FreeImage - The productivity booster. FreeImage is licensed under the GNU General Public License %28GPL%29 and the FreeImage Public License %28FIPL%29.</FooterText>
|
|
||||||
<HelpTitle>FreeImage .NET Documentation</HelpTitle>
|
|
||||||
<NamingMethod>HashedMemberName</NamingMethod>
|
|
||||||
<SdkLinkType>Msdn</SdkLinkType>
|
|
||||||
<MissingTags>AutoDocumentCtors</MissingTags>
|
|
||||||
<VisibleItems>InheritedMembers, Protected</VisibleItems>
|
|
||||||
<DocumentationSources>
|
|
||||||
<DocumentationSource sourceFile="FreeImageNET.dll" />
|
|
||||||
<DocumentationSource sourceFile="FreeImageNET.xml" /></DocumentationSources>
|
|
||||||
<PlugInConfigurations>
|
|
||||||
</PlugInConfigurations>
|
|
||||||
</PropertyGroup>
|
|
||||||
<!-- There are no properties for these two groups but they need to appear in
|
|
||||||
order for Visual Studio to perform the build. -->
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
</PropertyGroup>
|
|
||||||
<!-- Import the SHFB build targets -->
|
|
||||||
<Import Project="$(SHFBROOT)\SandcastleHelpFileBuilder.targets" />
|
|
||||||
</Project>
|
|
||||||
-41
@@ -1,41 +0,0 @@
|
|||||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
|
||||||
<PropertyGroup>
|
|
||||||
<!-- The configuration and platform will be used to determine which
|
|
||||||
assemblies to include from solution and project documentation
|
|
||||||
sources -->
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
|
||||||
<ProjectGuid>{d68736d0-a80d-453c-a921-6ada865504b5}</ProjectGuid>
|
|
||||||
<SHFBSchemaVersion>1.8.0.0</SHFBSchemaVersion>
|
|
||||||
<!-- AssemblyName, Name, and RootNamespace are not used by SHFB but Visual
|
|
||||||
Studio adds them anyway -->
|
|
||||||
<AssemblyName>Documentation</AssemblyName>
|
|
||||||
<RootNamespace>Documentation</RootNamespace>
|
|
||||||
<Name>Documentation</Name>
|
|
||||||
<!-- SHFB properties -->
|
|
||||||
<OutputPath>.\Out\</OutputPath>
|
|
||||||
<HtmlHelpName>FreeImage.NET</HtmlHelpName>
|
|
||||||
<HelpFileFormat>HtmlHelp1x</HelpFileFormat>
|
|
||||||
<KeepLogFile>False</KeepLogFile>
|
|
||||||
<FooterText>FreeImage - The productivity booster. FreeImage is licensed under the GNU General Public License %28GPL%29 and the FreeImage Public License %28FIPL%29.</FooterText>
|
|
||||||
<HelpTitle>FreeImage .NET Documentation</HelpTitle>
|
|
||||||
<NamingMethod>HashedMemberName</NamingMethod>
|
|
||||||
<SdkLinkType>Msdn</SdkLinkType>
|
|
||||||
<MissingTags>AutoDocumentCtors</MissingTags>
|
|
||||||
<VisibleItems>InheritedMembers, Protected</VisibleItems>
|
|
||||||
<DocumentationSources>
|
|
||||||
<DocumentationSource sourceFile="FreeImageNET.dll" />
|
|
||||||
<DocumentationSource sourceFile="FreeImageNET.xml" /></DocumentationSources>
|
|
||||||
<PlugInConfigurations>
|
|
||||||
</PlugInConfigurations>
|
|
||||||
</PropertyGroup>
|
|
||||||
<!-- There are no properties for these two groups but they need to appear in
|
|
||||||
order for Visual Studio to perform the build. -->
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
</PropertyGroup>
|
|
||||||
<!-- Import the SHFB build targets -->
|
|
||||||
<Import Project="$(SHFBROOT)\SandcastleHelpFileBuilder.targets" />
|
|
||||||
</Project>
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
|
||||||
<PropertyGroup>
|
|
||||||
<!-- The configuration and platform will be used to determine which
|
|
||||||
assemblies to include from solution and project documentation
|
|
||||||
sources -->
|
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
|
||||||
<ProjectGuid>{d68736d0-a80d-453c-a921-6ada865504b5}</ProjectGuid>
|
|
||||||
<SHFBSchemaVersion>1.8.0.0</SHFBSchemaVersion>
|
|
||||||
<!-- AssemblyName, Name, and RootNamespace are not used by SHFB but Visual
|
|
||||||
Studio adds them anyway -->
|
|
||||||
<AssemblyName>Documentation</AssemblyName>
|
|
||||||
<RootNamespace>Documentation</RootNamespace>
|
|
||||||
<Name>Documentation</Name>
|
|
||||||
<!-- SHFB properties -->
|
|
||||||
<OutputPath>.\Out\</OutputPath>
|
|
||||||
<HtmlHelpName>FreeImage.NET</HtmlHelpName>
|
|
||||||
<HelpFileFormat>HtmlHelp1x</HelpFileFormat>
|
|
||||||
<KeepLogFile>False</KeepLogFile>
|
|
||||||
<FooterText>FreeImage - The productivity booster. FreeImage is licensed under the GNU General Public License %28GPL%29 and the FreeImage Public License %28FIPL%29.</FooterText>
|
|
||||||
<HelpTitle>FreeImage .NET Documentation</HelpTitle>
|
|
||||||
<NamingMethod>HashedMemberName</NamingMethod>
|
|
||||||
<SdkLinkType>Msdn</SdkLinkType>
|
|
||||||
<MissingTags>AutoDocumentCtors</MissingTags>
|
|
||||||
<VisibleItems>InheritedMembers, Protected</VisibleItems>
|
|
||||||
<DocumentationSources>
|
|
||||||
<DocumentationSource sourceFile="..\Bin\FreeImageNET.dll" />
|
|
||||||
<DocumentationSource sourceFile="..\Bin\FreeImageNET.xml" />
|
|
||||||
</DocumentationSources>
|
|
||||||
<PlugInConfigurations>
|
|
||||||
<PlugInConfig id="Version Builder" enabled="True">
|
|
||||||
<configuration>
|
|
||||||
<currentProject label="FreeImage.NET" version="3.13.1" />
|
|
||||||
<versions>
|
|
||||||
<version label="FreeImage.NET" version="3.11.0" helpFileProject="3.11.0\FreeImage.NET.shfbproj" />
|
|
||||||
<version label="FreeImage.NET" version="3.12.0" helpFileProject="3.12.0\FreeImage.NET.shfbproj" />
|
|
||||||
<version label="FreeImage.NET" version="3.13.0" helpFileProject="3.13.0\FreeImage.NET.shfbproj" />
|
|
||||||
</versions>
|
|
||||||
</configuration>
|
|
||||||
</PlugInConfig>
|
|
||||||
</PlugInConfigurations>
|
|
||||||
</PropertyGroup>
|
|
||||||
<!-- There are no properties for these two groups but they need to appear in
|
|
||||||
order for Visual Studio to perform the build. -->
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
|
||||||
</PropertyGroup>
|
|
||||||
<!-- Import the SHFB build targets -->
|
|
||||||
<Import Project="$(SHFBROOT)\SandcastleHelpFileBuilder.targets" />
|
|
||||||
</Project>
|
|
||||||
@@ -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
|
|
||||||
@@ -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
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
<NUnitProject>
|
|
||||||
<Settings activeconfig="Debug" />
|
|
||||||
<Config name="Debug" appbase="UnitTest\bin\Debug" binpathtype="Auto">
|
|
||||||
<assembly path="UnitTest.exe" />
|
|
||||||
</Config>
|
|
||||||
<Config name="Release" appbase="UnitTest\bin\Release" binpathtype="Auto">
|
|
||||||
<assembly path="UnitTest.exe" />
|
|
||||||
</Config>
|
|
||||||
</NUnitProject>
|
|
||||||
@@ -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
|
|
||||||
-4378
File diff suppressed because it is too large
Load Diff
-101
@@ -1,101 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
namespace FreeImageAPI
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Class handling non-bitmap related functions.
|
|
||||||
/// </summary>
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal callback
|
|
||||||
/// </summary>
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a value indicating if the FreeImage DLL is available or not.
|
|
||||||
/// </summary>
|
|
||||||
public static bool IsAvailable
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return FreeImage.IsAvailable();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal errors in FreeImage generate a logstring that can be
|
|
||||||
/// captured by this event.
|
|
||||||
/// </summary>
|
|
||||||
public static event OutputMessageFunction Message;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a string containing the current version of the library.
|
|
||||||
/// </summary>
|
|
||||||
public static string Version
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return FreeImage.GetVersion();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a string containing a standard copyright message.
|
|
||||||
/// </summary>
|
|
||||||
public static string CopyrightMessage
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return FreeImage.GetCopyrightMessage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets whether the platform is using Little Endian.
|
|
||||||
/// </summary>
|
|
||||||
public static bool IsLittleEndian
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return FreeImage.IsLittleEndian();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-202
@@ -1,202 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
namespace FreeImageAPI.Plugins
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Class representing a FreeImage format.
|
|
||||||
/// </summary>
|
|
||||||
public sealed class FreeImagePlugin
|
|
||||||
{
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
private readonly FREE_IMAGE_FORMAT fif;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of this class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="fif">The FreeImage format to wrap.</param>
|
|
||||||
internal FreeImagePlugin(FREE_IMAGE_FORMAT fif)
|
|
||||||
{
|
|
||||||
this.fif = fif;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the format of this instance.
|
|
||||||
/// </summary>
|
|
||||||
public FREE_IMAGE_FORMAT FIFormat
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return fif;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets whether this plugin is enabled.
|
|
||||||
/// </summary>
|
|
||||||
public bool Enabled
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return (FreeImage.IsPluginEnabled(fif) == 1);
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
FreeImage.SetPluginEnabled(fif, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a string describing the format.
|
|
||||||
/// </summary>
|
|
||||||
public string Format
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return FreeImage.GetFormatFromFIF(fif);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a comma-delimited file extension list describing the bitmap formats
|
|
||||||
/// this plugin can read and/or write.
|
|
||||||
/// </summary>
|
|
||||||
public string ExtentsionList
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return FreeImage.GetFIFExtensionList(fif);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a descriptive string that describes the bitmap formats
|
|
||||||
/// this plugin can read and/or write.
|
|
||||||
/// </summary>
|
|
||||||
public string Description
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return FreeImage.GetFIFDescription(fif);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns a regular expression string that can be used by
|
|
||||||
/// a regular expression engine to identify the bitmap.
|
|
||||||
/// FreeImageQt makes use of this function.
|
|
||||||
/// </summary>
|
|
||||||
public string RegExpr
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return FreeImage.GetFIFRegExpr(fif);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets whether this plugin can load bitmaps.
|
|
||||||
/// </summary>
|
|
||||||
public bool SupportsReading
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return FreeImage.FIFSupportsReading(fif);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets whether this plugin can save bitmaps.
|
|
||||||
/// </summary>
|
|
||||||
public bool SupportsWriting
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return FreeImage.FIFSupportsWriting(fif);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Checks whether this plugin can save a bitmap in the desired data type.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="type">The desired image type.</param>
|
|
||||||
/// <returns>True if this plugin can save bitmaps as the desired type, else false.</returns>
|
|
||||||
public bool SupportsExportType(FREE_IMAGE_TYPE type)
|
|
||||||
{
|
|
||||||
return FreeImage.FIFSupportsExportType(fif, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Checks whether this plugin can save bitmaps in the desired bit depth.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="bpp">The desired bit depth.</param>
|
|
||||||
/// <returns>True if this plugin can save bitmaps in the desired bit depth, else false.</returns>
|
|
||||||
public bool SupportsExportBPP(int bpp)
|
|
||||||
{
|
|
||||||
return FreeImage.FIFSupportsExportBPP(fif, bpp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets whether this plugin can load or save an ICC profile.
|
|
||||||
/// </summary>
|
|
||||||
public bool SupportsICCProfiles
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return FreeImage.FIFSupportsICCProfiles(fif);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Checks whether an extension is valid for this format.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="extension">The desired extension.</param>
|
|
||||||
/// <returns>True if the extension is valid for this format, false otherwise.</returns>
|
|
||||||
public bool ValidExtension(string extension)
|
|
||||||
{
|
|
||||||
return FreeImage.IsExtensionValidForFIF(fif, extension);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Checks whether an extension is valid for this format.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="extension">The desired extension.</param>
|
|
||||||
/// <param name="comparisonType">The string comparison type.</param>
|
|
||||||
/// <returns>True if the extension is valid for this format, false otherwise.</returns>
|
|
||||||
public bool ValidExtension(string extension, StringComparison comparisonType)
|
|
||||||
{
|
|
||||||
return FreeImage.IsExtensionValidForFIF(fif, extension, comparisonType);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Checks whether a filename is valid for this format.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="filename">The desired filename.</param>
|
|
||||||
/// <returns>True if the filename is valid for this format, false otherwise.</returns>
|
|
||||||
public bool ValidFilename(string filename)
|
|
||||||
{
|
|
||||||
return FreeImage.IsFilenameValidForFIF(fif, filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Checks whether a filename is valid for this format.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="filename">The desired filename.</param>
|
|
||||||
/// <param name="comparisonType">The string comparison type.</param>
|
|
||||||
/// <returns>True if the filename is valid for this format, false otherwise.</returns>
|
|
||||||
public bool ValidFilename(string filename, StringComparison comparisonType)
|
|
||||||
{
|
|
||||||
return FreeImage.IsFilenameValidForFIF(fif, filename, comparisonType);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a descriptive string that describes the bitmap formats
|
|
||||||
/// this plugin can read and/or write.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>A descriptive string that describes the bitmap formats.</returns>
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return Description;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-167
@@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Internal class wrapping stream io functions.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// 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.
|
|
||||||
/// <para/>
|
|
||||||
/// In .NET streams are a common way to handle data. The <b>FreeImageStreamIO</b> class handles
|
|
||||||
/// the loading and saving from and to streams. It implements the funtions FreeImage needs
|
|
||||||
/// to load data from an an arbitrary source.
|
|
||||||
/// <para/>
|
|
||||||
/// The class is for internal use only.
|
|
||||||
/// </remarks>
|
|
||||||
internal static class FreeImageStreamIO
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// <see cref="FreeImageAPI.IO.FreeImageIO"/> structure that can be used to read from streams via
|
|
||||||
/// <see cref="FreeImageAPI.FreeImage.LoadFromHandle(FREE_IMAGE_FORMAT, ref FreeImageIO, fi_handle, FREE_IMAGE_LOAD_FLAGS)"/>.
|
|
||||||
/// </summary>
|
|
||||||
public static readonly FreeImageIO io;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instances which can be used to
|
|
||||||
/// create a FreeImage compatible <see cref="FreeImageAPI.IO.FreeImageIO"/> structure.
|
|
||||||
/// </summary>
|
|
||||||
static FreeImageStreamIO()
|
|
||||||
{
|
|
||||||
io.readProc = new ReadProc(streamRead);
|
|
||||||
io.writeProc = new WriteProc(streamWrite);
|
|
||||||
io.seekProc = new SeekProc(streamSeek);
|
|
||||||
io.tellProc = new TellProc(streamTell);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Reads the requested data from the stream and writes it to the given address.
|
|
||||||
/// </summary>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Reads the given data and writes it into the stream.
|
|
||||||
/// </summary>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Moves the streams position.
|
|
||||||
/// </summary>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the streams current position
|
|
||||||
/// </summary>
|
|
||||||
static int streamTell(fi_handle handle)
|
|
||||||
{
|
|
||||||
Stream stream = handle.GetObject() as Stream;
|
|
||||||
if (stream == null)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return (int)stream.Position;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-131
@@ -1,131 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Drawing;
|
|
||||||
|
|
||||||
namespace FreeImageAPI.Metadata
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Provides additional information specific for GIF files. This class cannot be inherited.
|
|
||||||
/// </summary>
|
|
||||||
public class GifInformation : MDM_ANIMATION
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="GifInformation"/> class
|
|
||||||
/// with the specified <see cref="FreeImageBitmap"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="bitmap">A reference to a <see cref="FreeImageBitmap"/> instance.</param>
|
|
||||||
public GifInformation(FreeImageBitmap bitmap)
|
|
||||||
: base(bitmap.Dib)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets a value indicating whether this frame uses the
|
|
||||||
/// GIF image's global palette. If set to <b>false</b>, this
|
|
||||||
/// frame uses its local palette.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// <b>Handling of null values</b><para/>
|
|
||||||
/// A null value indicates, that the corresponding metadata tag is not
|
|
||||||
/// present in the metadata model.
|
|
||||||
/// Setting this property's value to a non-null reference creates the
|
|
||||||
/// metadata tag if necessary.
|
|
||||||
/// Setting this property's value to a null reference deletes the
|
|
||||||
/// metadata tag from the metadata model.
|
|
||||||
/// </remarks>
|
|
||||||
public bool? UseGlobalPalette
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
byte? useGlobalPalette = GetTagValue<byte>("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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a global palette for the GIF image, intialized with all entries of the
|
|
||||||
/// current local palette.
|
|
||||||
/// The property <see cref="UseGlobalPalette"/> will be set to <b>true</b> when
|
|
||||||
/// invoking this method. This effectively enables the newly created global palette.
|
|
||||||
/// </summary>
|
|
||||||
/// <exception cref="InvalidOperationException">
|
|
||||||
/// The image does not have a palette.
|
|
||||||
/// </exception>
|
|
||||||
public void CreateGlobalPalette()
|
|
||||||
{
|
|
||||||
CreateGlobalPalette(new Palette(dib));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a global palette for the GIF image with the specified size, intialized
|
|
||||||
/// with the first <paramref name="size"/> entries of the current local palette.
|
|
||||||
/// The property <see cref="UseGlobalPalette"/> will be set to <b>true</b> when
|
|
||||||
/// invoking this method. This effectively enables the newly created global palette.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="size">The size of the newly created global palette.</param>
|
|
||||||
/// <exception cref="ArgumentNullException">
|
|
||||||
/// <paramref name="palette"/> is a null reference.</exception>
|
|
||||||
public void CreateGlobalPalette(int size)
|
|
||||||
{
|
|
||||||
CreateGlobalPalette(new Palette(dib), size);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a global palette for the GIF image, intialized with the entries
|
|
||||||
/// of the specified palette.
|
|
||||||
/// The property <see cref="UseGlobalPalette"/> will be set to <b>true</b> when
|
|
||||||
/// invoking this method. This effectively enables the newly created global palette.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="palette">The palette that contains the initial values for
|
|
||||||
/// the newly created global palette.</param>
|
|
||||||
/// <exception cref="ArgumentNullException">
|
|
||||||
/// <paramref name="palette"/> is a null reference.</exception>
|
|
||||||
public void CreateGlobalPalette(Palette palette)
|
|
||||||
{
|
|
||||||
if (palette == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("palette");
|
|
||||||
}
|
|
||||||
|
|
||||||
GlobalPalette = palette;
|
|
||||||
UseGlobalPalette = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a global palette for the GIF image with the specified size, intialized
|
|
||||||
/// with the first <paramref name="size"/> entries of the specified palette.
|
|
||||||
/// The property <see cref="UseGlobalPalette"/> will be set to <b>true</b> when
|
|
||||||
/// invoking this method. This effectively enables the newly created global palette.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="palette">The palette that contains the initial values for
|
|
||||||
/// the newly created global palette.</param>
|
|
||||||
/// <param name="size">The size of the newly created global palette.</param>
|
|
||||||
/// <exception cref="ArgumentNullException">
|
|
||||||
/// <paramref name="palette"/> is a null reference.</exception>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-286
@@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Class handling metadata of a FreeImage bitmap.
|
|
||||||
/// </summary>
|
|
||||||
public class ImageMetadata : IEnumerable, IComparable, IComparable<ImageMetadata>
|
|
||||||
{
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
private readonly List<MetadataModel> data;
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
private readonly FIBITMAP dib;
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
private bool hideEmptyModels;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance based on the specified <see cref="FIBITMAP"/>,
|
|
||||||
/// showing all known models.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dib">Handle to a FreeImage bitmap.</param>
|
|
||||||
public ImageMetadata(FIBITMAP dib) : this(dib, false) { }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance based on the specified <see cref="FIBITMAP"/>,
|
|
||||||
/// showing or hiding empry models.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dib">Handle to a FreeImage bitmap.</param>
|
|
||||||
/// <param name="hideEmptyModels">When <b>true</b>, empty metadata models
|
|
||||||
/// will be hidden until a tag to this model is added.</param>
|
|
||||||
public ImageMetadata(FIBITMAP dib, bool hideEmptyModels)
|
|
||||||
{
|
|
||||||
if (dib.IsNull) throw new ArgumentNullException("dib");
|
|
||||||
data = new List<MetadataModel>(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));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the <see cref="MetadataModel"/> of the specified type.
|
|
||||||
/// <para>In case the getter returns <c>null</c> the model is not contained
|
|
||||||
/// by the list.</para>
|
|
||||||
/// <para><c>null</c> can be used calling the setter to destroy the model.</para>
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model">Type of the model.</param>
|
|
||||||
/// <returns>The <see cref="FreeImageAPI.Metadata.MetadataModel"/> object of the specified type.</returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the <see cref="FreeImageAPI.Metadata.MetadataModel"/> at the specified index.
|
|
||||||
/// <para>In case the getter returns <c>null</c> the model is not contained
|
|
||||||
/// by the list.</para>
|
|
||||||
/// <para><c>null</c> can be used calling the setter to destroy the model.</para>
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="index">Index of the <see cref="FreeImageAPI.Metadata.MetadataModel"/> within
|
|
||||||
/// this instance.</param>
|
|
||||||
/// <returns>The <see cref="FreeImageAPI.Metadata.MetadataModel"/>
|
|
||||||
/// object at the specified index.</returns>
|
|
||||||
public MetadataModel this[int index]
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (index < 0 || index >= data.Count)
|
|
||||||
{
|
|
||||||
throw new ArgumentOutOfRangeException("index");
|
|
||||||
}
|
|
||||||
return (hideEmptyModels && !data[index].Exists) ? null : data[index];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns a list of all visible
|
|
||||||
/// <see cref="FreeImageAPI.Metadata.MetadataModel">MetadataModels</see>.
|
|
||||||
/// </summary>
|
|
||||||
public List<MetadataModel> List
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (hideEmptyModels)
|
|
||||||
{
|
|
||||||
List<MetadataModel> result = new List<MetadataModel>();
|
|
||||||
for (int i = 0; i < data.Count; i++)
|
|
||||||
{
|
|
||||||
if (data[i].Exists)
|
|
||||||
{
|
|
||||||
result.Add(data[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds new tag to the bitmap or updates its value in case it already exists.
|
|
||||||
/// <see cref="FreeImageAPI.Metadata.MetadataTag.Key"/> will be used as key.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="tag">The tag to add or update.</param>
|
|
||||||
/// <returns>Returns true on success, false on failure.</returns>
|
|
||||||
/// <exception cref="ArgumentNullException">
|
|
||||||
/// <paramref name="tag"/> is null.</exception>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the number of visible
|
|
||||||
/// <see cref="FreeImageAPI.Metadata.MetadataModel">MetadataModels</see>.
|
|
||||||
/// </summary>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets whether empty
|
|
||||||
/// <see cref="FreeImageAPI.Metadata.MetadataModel">MetadataModels</see> are hidden.
|
|
||||||
/// </summary>
|
|
||||||
public bool HideEmptyModels
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return hideEmptyModels;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
hideEmptyModels = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Retrieves an object that can iterate through the individual
|
|
||||||
/// <see cref="FreeImageAPI.Metadata.MetadataModel">MetadataModels</see>
|
|
||||||
/// in this <see cref="ImageMetadata"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>An <see cref="IEnumerator"/> for this <see cref="ImageMetadata"/>.</returns>
|
|
||||||
public IEnumerator GetEnumerator()
|
|
||||||
{
|
|
||||||
if (hideEmptyModels)
|
|
||||||
{
|
|
||||||
List<MetadataModel> tempList = new List<MetadataModel>(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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Compares this instance with a specified <see cref="Object"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="obj">An object to compare with this instance.</param>
|
|
||||||
/// <returns>A 32-bit signed integer indicating the lexical relationship between the two comparands.</returns>
|
|
||||||
/// <exception cref="ArgumentException"><paramref name="obj"/> is not a <see cref="ImageMetadata"/>.</exception>
|
|
||||||
public int CompareTo(object obj)
|
|
||||||
{
|
|
||||||
if (obj == null)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (!(obj is ImageMetadata))
|
|
||||||
{
|
|
||||||
throw new ArgumentException("obj");
|
|
||||||
}
|
|
||||||
return CompareTo((ImageMetadata)obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Compares this instance with a specified <see cref="ImageMetadata"/> object.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="other">A <see cref="ImageMetadata"/> to compare.</param>
|
|
||||||
/// <returns>A signed number indicating the relative values of this instance
|
|
||||||
/// and <paramref name="other"/>.</returns>
|
|
||||||
public int CompareTo(ImageMetadata other)
|
|
||||||
{
|
|
||||||
return this.dib.CompareTo(other.dib);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-466
@@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Class representing own FreeImage-Plugins.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// 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.
|
|
||||||
/// <para/>
|
|
||||||
/// 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.
|
|
||||||
/// <para/>
|
|
||||||
/// How to:
|
|
||||||
/// There are two functions that need to be implemented:
|
|
||||||
/// <see cref="FreeImageAPI.Plugins.LocalPlugin.GetImplementedMethods"/> and
|
|
||||||
/// <see cref="FreeImageAPI.Plugins.LocalPlugin.FormatProc"/>.
|
|
||||||
/// <see cref="FreeImageAPI.Plugins.LocalPlugin.GetImplementedMethods"/> 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 <see cref="System.Delegate"/>). In case a function
|
|
||||||
/// is not implemented FreeImage receives an empty <b>delegate</b>). To tell the constructor
|
|
||||||
/// which functions have been implemented the information is represented by a disjunction of
|
|
||||||
/// <see cref="FreeImageAPI.Plugins.LocalPlugin.MethodFlags"/>.
|
|
||||||
/// <para/>
|
|
||||||
/// For example:
|
|
||||||
/// return MethodFlags.LoadProc | MethodFlags.SaveProc;
|
|
||||||
/// <para/>
|
|
||||||
/// 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
|
|
||||||
/// <see cref="FreeImageAPI.Plugins.LocalPlugin.GetImplementedMethods"/> without a real implementation.
|
|
||||||
/// <para/>
|
|
||||||
/// <see cref="FreeImageAPI.Plugins.LocalPlugin.FormatProc"/> is used by some checks of FreeImage and
|
|
||||||
/// must be implemented. <see cref="FreeImageAPI.Plugins.LocalPlugin.LoadProc"/> 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.
|
|
||||||
/// </remarks>
|
|
||||||
public abstract class LocalPlugin
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Struct containing function pointers.
|
|
||||||
/// </summary>
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
private Plugin plugin;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Delegate for register callback by FreeImage.
|
|
||||||
/// </summary>
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
private InitProc initProc;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The format id assiged to the plugin.
|
|
||||||
/// </summary>
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
protected FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_UNKNOWN;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// When true the plugin was registered successfully else false.
|
|
||||||
/// </summary>
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
protected readonly bool registered = false;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A copy of the functions used to register.
|
|
||||||
/// </summary>
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
protected readonly MethodFlags implementedMethods;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// MethodFlags defines values to fill a bitfield telling which
|
|
||||||
/// functions have been implemented by a plugin.
|
|
||||||
/// </summary>
|
|
||||||
[Flags]
|
|
||||||
protected enum MethodFlags
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// No mothods implemented.
|
|
||||||
/// </summary>
|
|
||||||
None = 0x0,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DescriptionProc has been implemented.
|
|
||||||
/// </summary>
|
|
||||||
DescriptionProc = 0x1,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ExtensionListProc has been implemented.
|
|
||||||
/// </summary>
|
|
||||||
ExtensionListProc = 0x2,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// RegExprProc has been implemented.
|
|
||||||
/// </summary>
|
|
||||||
RegExprProc = 0x4,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// OpenProc has been implemented.
|
|
||||||
/// </summary>
|
|
||||||
OpenProc = 0x8,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// CloseProc has been implemented.
|
|
||||||
/// </summary>
|
|
||||||
CloseProc = 0x10,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// PageCountProc has been implemented.
|
|
||||||
/// </summary>
|
|
||||||
PageCountProc = 0x20,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// PageCapabilityProc has been implemented.
|
|
||||||
/// </summary>
|
|
||||||
PageCapabilityProc = 0x40,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// LoadProc has been implemented.
|
|
||||||
/// </summary>
|
|
||||||
LoadProc = 0x80,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// SaveProc has been implemented.
|
|
||||||
/// </summary>
|
|
||||||
SaveProc = 0x100,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ValidateProc has been implemented.
|
|
||||||
/// </summary>
|
|
||||||
ValidateProc = 0x200,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// MimeProc has been implemented.
|
|
||||||
/// </summary>
|
|
||||||
MimeProc = 0x400,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// SupportsExportBPPProc has been implemented.
|
|
||||||
/// </summary>
|
|
||||||
SupportsExportBPPProc = 0x800,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// SupportsExportTypeProc has been implemented.
|
|
||||||
/// </summary>
|
|
||||||
SupportsExportTypeProc = 0x1000,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// SupportsICCProfilesProc has been implemented.
|
|
||||||
/// </summary>
|
|
||||||
SupportsICCProfilesProc = 0x2000
|
|
||||||
}
|
|
||||||
|
|
||||||
// Functions that must be implemented.
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Function that returns a bitfield containing the
|
|
||||||
/// implemented methods.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Bitfield of the implemented methods.</returns>
|
|
||||||
protected abstract MethodFlags GetImplementedMethods();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Implementation of <b>FormatProc</b>
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>A string containing the plugins format.</returns>
|
|
||||||
protected abstract string FormatProc();
|
|
||||||
|
|
||||||
// Functions that can be implemented.
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Function that can be implemented.
|
|
||||||
/// </summary>
|
|
||||||
protected virtual string DescriptionProc() { return ""; }
|
|
||||||
/// <summary>
|
|
||||||
/// Function that can be implemented.
|
|
||||||
/// </summary>
|
|
||||||
protected virtual string ExtensionListProc() { return ""; }
|
|
||||||
/// <summary>
|
|
||||||
/// Function that can be implemented.
|
|
||||||
/// </summary>
|
|
||||||
protected virtual string RegExprProc() { return ""; }
|
|
||||||
/// <summary>
|
|
||||||
/// Function that can be implemented.
|
|
||||||
/// </summary>
|
|
||||||
protected virtual IntPtr OpenProc(ref FreeImageIO io, fi_handle handle, bool read) { return IntPtr.Zero; }
|
|
||||||
/// <summary>
|
|
||||||
/// Function that can be implemented.
|
|
||||||
/// </summary>
|
|
||||||
protected virtual void CloseProc(ref FreeImageIO io, fi_handle handle, IntPtr data) { }
|
|
||||||
/// <summary>
|
|
||||||
/// Function that can be implemented.
|
|
||||||
/// </summary>
|
|
||||||
protected virtual int PageCountProc(ref FreeImageIO io, fi_handle handle, IntPtr data) { return 0; }
|
|
||||||
/// <summary>
|
|
||||||
/// Function that can be implemented.
|
|
||||||
/// </summary>
|
|
||||||
protected virtual int PageCapabilityProc(ref FreeImageIO io, fi_handle handle, IntPtr data) { return 0; }
|
|
||||||
/// <summary>
|
|
||||||
/// Function that can be implemented.
|
|
||||||
/// </summary>
|
|
||||||
protected virtual FIBITMAP LoadProc(ref FreeImageIO io, fi_handle handle, int page, int flags, IntPtr data) { return FIBITMAP.Zero; }
|
|
||||||
/// <summary>
|
|
||||||
/// Function that can be implemented.
|
|
||||||
/// </summary>
|
|
||||||
protected virtual bool SaveProc(ref FreeImageIO io, FIBITMAP dib, fi_handle handle, int page, int flags, IntPtr data) { return false; }
|
|
||||||
/// <summary>
|
|
||||||
/// Function that can be implemented.
|
|
||||||
/// </summary>
|
|
||||||
protected virtual bool ValidateProc(ref FreeImageIO io, fi_handle handle) { return false; }
|
|
||||||
/// <summary>
|
|
||||||
/// Function that can be implemented.
|
|
||||||
/// </summary>
|
|
||||||
protected virtual string MimeProc() { return ""; }
|
|
||||||
/// <summary>
|
|
||||||
/// Function that can be implemented.
|
|
||||||
/// </summary>
|
|
||||||
protected virtual bool SupportsExportBPPProc(int bpp) { return false; }
|
|
||||||
/// <summary>
|
|
||||||
/// Function that can be implemented.
|
|
||||||
/// </summary>
|
|
||||||
protected virtual bool SupportsExportTypeProc(FREE_IMAGE_TYPE type) { return false; }
|
|
||||||
/// <summary>
|
|
||||||
/// Function that can be implemented.
|
|
||||||
/// </summary>
|
|
||||||
protected virtual bool SupportsICCProfilesProc() { return false; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 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.
|
|
||||||
/// </summary>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets if the plugin is enabled.
|
|
||||||
/// </summary>
|
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets if the plugin was registered successfully.
|
|
||||||
/// </summary>
|
|
||||||
public bool Registered
|
|
||||||
{
|
|
||||||
get { return registered; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the <see cref="FREE_IMAGE_FORMAT"/> FreeImage assigned to this plugin.
|
|
||||||
/// </summary>
|
|
||||||
public FREE_IMAGE_FORMAT Format
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return format;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Reads from an unmanaged stream.
|
|
||||||
/// </summary>
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Reads a single byte from an unmanaged stream.
|
|
||||||
/// </summary>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Writes to an unmanaged stream.
|
|
||||||
/// </summary>
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Writes a single byte to an unmanaged stream.
|
|
||||||
/// </summary>
|
|
||||||
protected unsafe int WriteByte(FreeImageIO io, fi_handle handle, byte value)
|
|
||||||
{
|
|
||||||
return (int)io.writeProc(new IntPtr(&value), 1, 1, handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Seeks in an unmanaged stream.
|
|
||||||
/// </summary>
|
|
||||||
protected int Seek(FreeImageIO io, fi_handle handle, int offset, SeekOrigin origin)
|
|
||||||
{
|
|
||||||
return io.seekProc(handle, offset, origin);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Retrieves the position of an unmanaged stream.
|
|
||||||
/// </summary>
|
|
||||||
protected int Tell(FreeImageIO io, fi_handle handle)
|
|
||||||
{
|
|
||||||
return io.tellProc(handle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-828
@@ -1,828 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
namespace FreeImageAPI
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Represents unmanaged memory, containing an array of a given structure.
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="T">Structuretype represented by the instance.</typeparam>
|
|
||||||
/// <remarks>
|
|
||||||
/// <see cref="System.Boolean"/> and <see cref="System.Char"/> can not be marshalled.
|
|
||||||
/// <para/>
|
|
||||||
/// Use <see cref="System.Int32"/> instead of <see cref="System.Boolean"/> and
|
|
||||||
/// <see cref="System.Byte"/> instead of <see cref="System.Char"/>.
|
|
||||||
/// </remarks>
|
|
||||||
public unsafe class MemoryArray<T> : IDisposable, ICloneable, ICollection, IEnumerable<T>, IEquatable<MemoryArray<T>> where T : struct
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Baseaddress of the wrapped memory.
|
|
||||||
/// </summary>
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
protected byte* baseAddress;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Number of elements being wrapped.
|
|
||||||
/// </summary>
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
protected int length;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Size, in bytes, of each element.
|
|
||||||
/// </summary>
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
private static readonly int size;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Array of <b>T</b> containing a single element.
|
|
||||||
/// The array is used as a workaround, because there are no pointer for generic types.
|
|
||||||
/// </summary>
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
protected T[] buffer;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Pointer to the element of <b>buffer</b>.
|
|
||||||
/// </summary>
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
protected byte* ptr;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Handle for pinning <b>buffer</b>.
|
|
||||||
/// </summary>
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
protected GCHandle handle;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Indicates whether the wrapped memory is handled like a bitfield.
|
|
||||||
/// </summary>
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
protected readonly bool isOneBit;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Indicates whther the wrapped memory is handles like 4-bit blocks.
|
|
||||||
/// </summary>
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
protected readonly bool isFourBit;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// An object that can be used to synchronize access to the <see cref="MemoryArray<T>"/>.
|
|
||||||
/// </summary>
|
|
||||||
[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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance.
|
|
||||||
/// </summary>
|
|
||||||
protected MemoryArray()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="MemoryArray<T>"/> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="baseAddress">Address of the memory block.</param>
|
|
||||||
/// <param name="length">Length of the array.</param>
|
|
||||||
/// <exception cref="ArgumentNullException">
|
|
||||||
/// <paramref name="baseAddress"/> is null.</exception>
|
|
||||||
/// <exception cref="ArgumentOutOfRangeException">
|
|
||||||
/// <paramref name="length"/> is less or equal zero.</exception>
|
|
||||||
/// <exception cref="NotSupportedException">
|
|
||||||
/// The type is not supported.</exception>
|
|
||||||
public MemoryArray(IntPtr baseAddress, int length)
|
|
||||||
: this(baseAddress.ToPointer(), length)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="MemoryArray<T>"/> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="baseAddress">Address of the memory block.</param>
|
|
||||||
/// <param name="length">Length of the array.</param>
|
|
||||||
/// <exception cref="ArgumentNullException">
|
|
||||||
/// <paramref name="baseAddress"/> is null.</exception>
|
|
||||||
/// <exception cref="ArgumentOutOfRangeException">
|
|
||||||
/// <paramref name="length"/> is less or equal zero.</exception>
|
|
||||||
/// <exception cref="NotSupportedException">
|
|
||||||
/// The type is not supported.</exception>
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Frees the allocated <see cref="System.Runtime.InteropServices.GCHandle"/>.
|
|
||||||
/// </summary>
|
|
||||||
~MemoryArray()
|
|
||||||
{
|
|
||||||
Dispose(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Tests whether two specified <see cref="MemoryArray<T>"/> structures are equivalent.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="left">The <see cref="MemoryArray<T>"/> that is to the left of the equality operator.</param>
|
|
||||||
/// <param name="right">The <see cref="MemoryArray<T>"/> that is to the right of the equality operator.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// <b>true</b> if the two <see cref="MemoryArray<T>"/> structures are equal; otherwise, <b>false</b>.
|
|
||||||
/// </returns>
|
|
||||||
public static bool operator ==(MemoryArray<T> left, MemoryArray<T> 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Tests whether two specified <see cref="MemoryArray<T>"/> structures are different.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="left">The <see cref="MemoryArray<T>"/> that is to the left of the inequality operator.</param>
|
|
||||||
/// <param name="right">The <see cref="MemoryArray<T>"/> that is to the right of the inequality operator.</param>
|
|
||||||
/// <returns>
|
|
||||||
/// <b>true</b> if the two <see cref="MemoryArray<T>"/> structures are different; otherwise, <b>false</b>.
|
|
||||||
/// </returns>
|
|
||||||
public static bool operator !=(MemoryArray<T> left, MemoryArray<T> right)
|
|
||||||
{
|
|
||||||
return (!(left == right));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the value at the specified position.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="index">A 32-bit integer that represents the position
|
|
||||||
/// of the array element to get.</param>
|
|
||||||
/// <returns>The value at the specified position.</returns>
|
|
||||||
/// <exception cref="ArgumentOutOfRangeException">
|
|
||||||
/// <paramref name="index"/> is outside the range of valid indexes
|
|
||||||
/// for the unmanaged array.</exception>
|
|
||||||
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];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sets a value to the element at the specified position.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="value">The new value for the specified element.</param>
|
|
||||||
/// <param name="index">A 32-bit integer that represents the
|
|
||||||
/// position of the array element to set.</param>
|
|
||||||
/// <exception cref="ArgumentOutOfRangeException">
|
|
||||||
/// <paramref name="index"/> is outside the range of valid indexes
|
|
||||||
/// for the unmanaged array.</exception>
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the values at the specified position and length.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="index">A 32-bit integer that represents the position
|
|
||||||
/// of the array elements to get.</param>
|
|
||||||
/// <param name="length"> A 32-bit integer that represents the length
|
|
||||||
/// of the array elements to get.</param>
|
|
||||||
/// <returns>The values at the specified position and length.</returns>
|
|
||||||
/// <exception cref="ArgumentOutOfRangeException">
|
|
||||||
/// <paramref name="index"/> is outside the range of valid indexes
|
|
||||||
/// for the unmanaged array or <paramref name="length"/> is greater than the number of elements
|
|
||||||
/// from <paramref name="index"/> to the end of the unmanaged array.</exception>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sets the values at the specified position.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="values">An array containing the new values for the specified elements.</param>
|
|
||||||
/// <param name="index">A 32-bit integer that represents the position
|
|
||||||
/// of the array elements to set.</param>
|
|
||||||
/// <exception cref="ArgumentNullException">
|
|
||||||
/// <paramref name="values"/> is a null reference (Nothing in Visual Basic).</exception>
|
|
||||||
/// <exception cref="ArgumentOutOfRangeException">
|
|
||||||
/// <paramref name="index"/> is outside the range of valid indexes
|
|
||||||
/// for the unmanaged array or <paramref name="values.Length"/> is greater than the number of elements
|
|
||||||
/// from <paramref name="index"/> to the end of the array.</exception>
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Copies the entire array to a compatible one-dimensional <see cref="System.Array"/>,
|
|
||||||
/// starting at the specified index of the target array.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="array">The one-dimensional <see cref="System.Array"/> that is the destination
|
|
||||||
/// of the elements copied from <see cref="MemoryArray<T>"/>.
|
|
||||||
/// The <see cref="System.Array"/> must have zero-based indexing.</param>
|
|
||||||
/// <param name="index">The zero-based index in <paramref name="array"/>
|
|
||||||
/// at which copying begins.</param>
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Copies a range of elements from the unmanaged array starting at the specified
|
|
||||||
/// <typeparamref name="sourceIndex"/> and pastes them to <paramref name="array"/>
|
|
||||||
/// starting at the specified <paramref name="destinationIndex"/>.
|
|
||||||
/// The length and the indexes are specified as 32-bit integers.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="array">The array that receives the data.</param>
|
|
||||||
/// <param name="sourceIndex">A 32-bit integer that represents the index
|
|
||||||
/// in the unmanaged array at which copying begins.</param>
|
|
||||||
/// <param name="destinationIndex">A 32-bit integer that represents the index in
|
|
||||||
/// the destination array at which storing begins.</param>
|
|
||||||
/// <param name="length">A 32-bit integer that represents the number of elements to copy.</param>
|
|
||||||
/// <exception cref="ArgumentNullException">
|
|
||||||
/// <paramref name="array"/> is a null reference (Nothing in Visual Basic).</exception>
|
|
||||||
/// <exception cref="ArgumentOutOfRangeException">
|
|
||||||
/// <paramref name="sourceIndex"/> is outside the range of valid indexes
|
|
||||||
/// for the unmanaged array or <paramref name="length"/> is greater than the number of elements
|
|
||||||
/// from <paramref name="index"/> to the end of the unmanaged array
|
|
||||||
/// <para>-or-</para>
|
|
||||||
/// <paramref name="destinationIndex"/> is outside the range of valid indexes
|
|
||||||
/// for the array or <paramref name="length"/> is greater than the number of elements
|
|
||||||
/// from <paramref name="index"/> to the end of the array.
|
|
||||||
/// </exception>
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Copies a range of elements from the array starting at the specified
|
|
||||||
/// <typeparamref name="sourceIndex"/> and pastes them to the unmanaged array
|
|
||||||
/// starting at the specified <paramref name="destinationIndex"/>.
|
|
||||||
/// The length and the indexes are specified as 32-bit integers.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="array">The array that holds the data.</param>
|
|
||||||
/// <param name="sourceIndex">A 32-bit integer that represents the index
|
|
||||||
/// in the array at which copying begins.</param>
|
|
||||||
/// <param name="destinationIndex">A 32-bit integer that represents the index in
|
|
||||||
/// the unmanaged array at which storing begins.</param>
|
|
||||||
/// <param name="length">A 32-bit integer that represents the number of elements to copy.</param>
|
|
||||||
/// <exception cref="ArgumentNullException">
|
|
||||||
/// <paramref name="array"/> is a null reference (Nothing in Visual Basic).</exception>
|
|
||||||
/// <exception cref="ArgumentOutOfRangeException">
|
|
||||||
/// <paramref name="sourceIndex"/> is outside the range of valid indexes
|
|
||||||
/// for the array or <paramref name="length"/> is greater than the number of elements
|
|
||||||
/// from <paramref name="index"/> to the end of the array
|
|
||||||
/// <para>-or-</para>
|
|
||||||
/// <paramref name="destinationIndex"/> is outside the range of valid indexes
|
|
||||||
/// for the unmanaged array or <paramref name="length"/> is greater than the number of elements
|
|
||||||
/// from <paramref name="index"/> to the end of the unmanaged array.
|
|
||||||
/// </exception>
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the represented block of memory as an array of <see cref="Byte"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>The represented block of memory.</returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the value at the specified position in the array.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="index">A 32-bit integer that represents the position
|
|
||||||
/// of the array element to get.</param>
|
|
||||||
/// <returns>The value at the specified position in the array.</returns>
|
|
||||||
/// <exception cref="ArgumentOutOfRangeException">
|
|
||||||
/// <paramref name="index"/> is outside the range of valid indexes
|
|
||||||
/// for the unmanaged array.</exception>
|
|
||||||
public T this[int index]
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return GetValue(index);
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
SetValue(value, index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the values of the unmanaged array.
|
|
||||||
/// </summary>
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the length of the unmanaged array.
|
|
||||||
/// </summary>
|
|
||||||
public int Length
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
EnsureNotDisposed();
|
|
||||||
return length;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the base address of the represented memory block.
|
|
||||||
/// </summary>
|
|
||||||
public IntPtr BaseAddress
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
EnsureNotDisposed();
|
|
||||||
return new IntPtr(baseAddress);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a shallow copy of the <see cref="MemoryArray<T>"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>A shallow copy of the <see cref="MemoryArray<T>"/>.</returns>
|
|
||||||
public object Clone()
|
|
||||||
{
|
|
||||||
EnsureNotDisposed();
|
|
||||||
return new MemoryArray<T>(baseAddress, length);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a 32-bit integer that represents the total number of elements
|
|
||||||
/// in the <see cref="MemoryArray<T>"/>.
|
|
||||||
/// </summary>
|
|
||||||
public int Count
|
|
||||||
{
|
|
||||||
get { EnsureNotDisposed(); return length; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a value indicating whether access to the <see cref="MemoryArray<T>"/>
|
|
||||||
/// is synchronized (thread safe).
|
|
||||||
/// </summary>
|
|
||||||
public bool IsSynchronized
|
|
||||||
{
|
|
||||||
get { EnsureNotDisposed(); return false; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets an object that can be used to synchronize access to the <see cref="MemoryArray<T>"/>.
|
|
||||||
/// </summary>
|
|
||||||
public object SyncRoot
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
EnsureNotDisposed();
|
|
||||||
if (syncRoot == null)
|
|
||||||
{
|
|
||||||
System.Threading.Interlocked.CompareExchange(ref syncRoot, new object(), null);
|
|
||||||
}
|
|
||||||
return syncRoot;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Retrieves an object that can iterate through the individual
|
|
||||||
/// elements in this <see cref="MemoryArray<T>"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>An <see cref="IEnumerator"/> for the <see cref="MemoryArray<T>"/>.</returns>
|
|
||||||
public IEnumerator GetEnumerator()
|
|
||||||
{
|
|
||||||
EnsureNotDisposed();
|
|
||||||
T[] values = GetValues(0, length);
|
|
||||||
for (int i = 0; i != values.Length; i++)
|
|
||||||
{
|
|
||||||
yield return values[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Retrieves an object that can iterate through the individual
|
|
||||||
/// elements in this <see cref="MemoryArray<T>"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>An <see cref="IEnumerator<T>"/> for the <see cref="MemoryArray<T>"/>.</returns>
|
|
||||||
IEnumerator<T> IEnumerable<T>.GetEnumerator()
|
|
||||||
{
|
|
||||||
EnsureNotDisposed();
|
|
||||||
T[] values = GetValues(0, length);
|
|
||||||
for (int i = 0; i != values.Length; i++)
|
|
||||||
{
|
|
||||||
yield return values[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Releases all ressources.
|
|
||||||
/// </summary>
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
Dispose(true);
|
|
||||||
GC.SuppressFinalize(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Releases allocated handles associated with this instance.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing"><b>true</b> to release managed resources.</param>
|
|
||||||
protected virtual void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (baseAddress != null)
|
|
||||||
{
|
|
||||||
if (handle.IsAllocated)
|
|
||||||
handle.Free();
|
|
||||||
baseAddress = null;
|
|
||||||
buffer = null;
|
|
||||||
length = 0;
|
|
||||||
syncRoot = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Throws an <see cref="ObjectDisposedException"/> if
|
|
||||||
/// this instance is disposed.
|
|
||||||
/// </summary>
|
|
||||||
protected virtual void EnsureNotDisposed()
|
|
||||||
{
|
|
||||||
if (baseAddress == null)
|
|
||||||
throw new ObjectDisposedException("This instance is disposed.");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Tests whether the specified <see cref="MemoryArray<T>"/> structure is equivalent to this
|
|
||||||
/// <see cref="MemoryArray<T>"/> structure.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="obj">The structure to test.</param>
|
|
||||||
/// <returns><b>true</b> if <paramref name="obj"/> is a <see cref="MemoryArray<T>"/>
|
|
||||||
/// instance equivalent to this <see cref="MemoryArray<T>"/> structure; otherwise,
|
|
||||||
/// <b>false</b>.</returns>
|
|
||||||
public override bool Equals(object obj)
|
|
||||||
{
|
|
||||||
EnsureNotDisposed();
|
|
||||||
return ((obj is MemoryArray<T>) && Equals((MemoryArray<T>)obj));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Tests whether the specified <see cref="MemoryArray<T>"/> structure is equivalent to this
|
|
||||||
/// <see cref="MemoryArray<T>"/> structure.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="other">The structure to test.</param>
|
|
||||||
/// <returns><b>true</b> if <paramref name="other"/> is equivalent to this
|
|
||||||
/// <see cref="MemoryArray<T>"/> structure; otherwise,
|
|
||||||
/// <b>false</b>.</returns>
|
|
||||||
public bool Equals(MemoryArray<T> other)
|
|
||||||
{
|
|
||||||
EnsureNotDisposed();
|
|
||||||
return ((this.baseAddress == other.baseAddress) && (this.length == other.length));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Serves as a hash function for a particular type.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>A hash code for the current <see cref="MemoryArray<T>"/>.</returns>
|
|
||||||
public override int GetHashCode()
|
|
||||||
{
|
|
||||||
EnsureNotDisposed();
|
|
||||||
return (int)baseAddress ^ length;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Copies a block of memory from one location to another.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dest">Pointer to the starting address of the copy destination.</param>
|
|
||||||
/// <param name="src">Pointer to the starting address of the block of memory to be copied.</param>
|
|
||||||
/// <param name="len">Size of the block of memory to copy, in bytes.</param>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-941
@@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Base class that represents a collection of all tags contained in a metadata model.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// The <b>MetedataModel</b> class is an abstract base class, which is inherited by
|
|
||||||
/// several derived classes, one for each existing metadata model.
|
|
||||||
/// </remarks>
|
|
||||||
public abstract class MetadataModel : IEnumerable
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Handle to the encapsulated FreeImage-bitmap.
|
|
||||||
/// </summary>
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
protected readonly FIBITMAP dib;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of this class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dib">Handle to a FreeImage bitmap.</param>
|
|
||||||
/// <exception cref="ArgumentNullException">
|
|
||||||
/// <paramref name="dib"/> is null.</exception>
|
|
||||||
protected MetadataModel(FIBITMAP dib)
|
|
||||||
{
|
|
||||||
if (dib.IsNull)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("dib");
|
|
||||||
}
|
|
||||||
this.dib = dib;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Retrieves the datamodel that this instance represents.
|
|
||||||
/// </summary>
|
|
||||||
public abstract FREE_IMAGE_MDMODEL Model
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds new tag to the bitmap or updates its value in case it already exists.
|
|
||||||
/// <see cref="FreeImageAPI.Metadata.MetadataTag.Key"/> will be used as key.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="tag">The tag to add or update.</param>
|
|
||||||
/// <returns>Returns true on success, false on failure.</returns>
|
|
||||||
/// <exception cref="ArgumentNullException">
|
|
||||||
/// <paramref name="tag"/> is null.</exception>
|
|
||||||
/// <exception cref="ArgumentException">
|
|
||||||
/// The tags model differs from this instances model.</exception>
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds a list of tags to the bitmap or updates their values in case they already exist.
|
|
||||||
/// <see cref="FreeImageAPI.Metadata.MetadataTag.Key"/> will be used as key.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="list">A list of tags to add or update.</param>
|
|
||||||
/// <returns>Returns the number of successfully added tags.</returns>
|
|
||||||
/// <exception cref="ArgumentNullException">
|
|
||||||
/// <paramref name="list"/> is null.</exception>
|
|
||||||
public int AddTag(IEnumerable<MetadataTag> 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Removes the specified tag from the bitmap.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="key">The key of the tag.</param>
|
|
||||||
/// <returns>Returns true on success, false on failure.</returns>
|
|
||||||
/// <exception cref="ArgumentNullException">
|
|
||||||
/// <paramref name="key"/> is null.</exception>
|
|
||||||
public bool RemoveTag(string key)
|
|
||||||
{
|
|
||||||
if (key == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("key");
|
|
||||||
}
|
|
||||||
return FreeImage.SetMetadata(Model, dib, key, FITAG.Zero);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Destroys the metadata model
|
|
||||||
/// which will remove all tags of this model from the bitmap.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Returns true on success, false on failure.</returns>
|
|
||||||
public bool DestoryModel()
|
|
||||||
{
|
|
||||||
return FreeImage.SetMetadata(Model, dib, null, FITAG.Zero);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the specified metadata tag.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="key">The key of the tag.</param>
|
|
||||||
/// <returns>The metadata tag.</returns>
|
|
||||||
/// <exception cref="ArgumentNullException">
|
|
||||||
/// <paramref name="key"/> is null.</exception>
|
|
||||||
public MetadataTag GetTag(string key)
|
|
||||||
{
|
|
||||||
if (key == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("key");
|
|
||||||
}
|
|
||||||
MetadataTag tag;
|
|
||||||
return FreeImage.GetMetadata(Model, dib, key, out tag) ? tag : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns whether the specified tag exists.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="key">The key of the tag.</param>
|
|
||||||
/// <returns>True in case the tag exists, else false.</returns>
|
|
||||||
/// <exception cref="ArgumentNullException">
|
|
||||||
/// <paramref name="key"/> is null.</exception>
|
|
||||||
public bool TagExists(string key)
|
|
||||||
{
|
|
||||||
if (key == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("key");
|
|
||||||
}
|
|
||||||
MetadataTag tag;
|
|
||||||
return FreeImage.GetMetadata(Model, dib, key, out tag);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns a list of all metadata tags this instance represents.
|
|
||||||
/// </summary>
|
|
||||||
public List<MetadataTag> List
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
List<MetadataTag> list = new List<MetadataTag>((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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the tag at the given index.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="index">Index of the tag to return.</param>
|
|
||||||
/// <returns>The tag at the given index.</returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the metadata tag at the given index. This operation is slow when accessing all tags.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="index">Index of the tag.</param>
|
|
||||||
/// <returns>The metadata tag.</returns>
|
|
||||||
/// <exception cref="ArgumentOutOfRangeException">
|
|
||||||
/// <paramref name="index"/> is greater or equal <b>Count</b>
|
|
||||||
/// or index is less than zero.</exception>
|
|
||||||
public MetadataTag this[int index]
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return GetTagFromIndex(index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Retrieves an object that can iterate through the individual MetadataTags in this MetadataModel.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>An <see cref="IEnumerator"/> for the
|
|
||||||
/// <see cref="FreeImageAPI.Metadata.MetadataModel"/>.</returns>
|
|
||||||
public IEnumerator GetEnumerator()
|
|
||||||
{
|
|
||||||
return List.GetEnumerator();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the number of metadata tags this instance represents.
|
|
||||||
/// </summary>
|
|
||||||
public int Count
|
|
||||||
{
|
|
||||||
get { return (int)FreeImage.GetMetadataCount(Model, dib); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns whether this model exists in the bitmaps metadata structure.
|
|
||||||
/// </summary>
|
|
||||||
public bool Exists
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Count > 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Searches for a pattern in each metadata tag and returns the result as a list.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="searchPattern">The regular expression to use for the search.</param>
|
|
||||||
/// <param name="flags">A bitfield that controls which fields should be searched in.</param>
|
|
||||||
/// <returns>A list containing all found metadata tags.</returns>
|
|
||||||
/// <exception cref="ArgumentNullException">
|
|
||||||
/// <typeparamref name="searchPattern"/> is null.</exception>
|
|
||||||
/// <exception cref="ArgumentException">
|
|
||||||
/// <typeparamref name="searchPattern"/> is empty.</exception>
|
|
||||||
public List<MetadataTag> 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<MetadataTag> result = new List<MetadataTag>(Count);
|
|
||||||
Regex regex = new Regex(searchPattern);
|
|
||||||
List<MetadataTag> 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the value of the specified tag.
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="T">Type of the tag's data.</typeparam>
|
|
||||||
/// <param name="key">The key of the tag.</param>
|
|
||||||
/// <returns>The value of the specified tag.</returns>
|
|
||||||
protected T? GetTagValue<T>(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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns an array containing the data of the specified tag.
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="T">The type of the tag's data.</typeparam>
|
|
||||||
/// <param name="key">The key of the tag.</param>
|
|
||||||
/// <returns>An array containing the data of the specified tag.</returns>
|
|
||||||
protected T[] GetTagArray<T>(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[];
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the string contained by the specified tag.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="key">The key of the tag.</param>
|
|
||||||
/// <returns>The string contained by the specified tag.</returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns an array containg the data of the specified tag
|
|
||||||
/// as unsigned 32bit integer.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="key">The key of the tag.</param>
|
|
||||||
/// <returns>An array containg the data of the specified tag
|
|
||||||
/// as unsigned 32bit integer.</returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the value of the tag as unsigned 32bit integer.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="key">The key of the tag.</param>
|
|
||||||
/// <returns>The value of the tag as unsigned 32bit integer.</returns>
|
|
||||||
protected uint? GetUInt32Value(string key)
|
|
||||||
{
|
|
||||||
uint[] value = GetUInt32Array(key);
|
|
||||||
return value == null ? default(uint?) : value[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sets the value of the specified tag.
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="T">The type of the tag's data.</typeparam>
|
|
||||||
/// <param name="key">The key of the tag.</param>
|
|
||||||
/// <param name="value">The new value of the specified tag or null.</param>
|
|
||||||
protected void SetTagValue<T>(string key, T? value) where T : struct
|
|
||||||
{
|
|
||||||
SetTagValue(key, value.HasValue ? new T[] { value.Value } : null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sets the value of the specified tag.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="key">The key of the tag.</param>
|
|
||||||
/// <param name="value">The new value of the specified tag or null.</param>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sets the value of the specified tag as undefined.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="key">The key of the tag.</param>
|
|
||||||
/// <param name="value">The new value of the specified tag or null.</param>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the equivalent <see cref="DirectionReference"/> for the
|
|
||||||
/// specified <see cref="String"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="s">The string containing the <see cref="DirectionReference"/>.</param>
|
|
||||||
/// <returns>The equivalent <see cref="DirectionReference"/> for the
|
|
||||||
/// specified <see cref="String"/>.</returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the equivalent <see cref="String"/> for the
|
|
||||||
/// specified <see cref="DirectionReference"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="type">The <see cref="DirectionReference"/> to convert.</param>
|
|
||||||
/// <returns>The equivalent <see cref="String"/> for the
|
|
||||||
/// specified <see cref="DirectionReference"/>.</returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the equivalent <see cref="VelocityUnit"/> for the
|
|
||||||
/// specified <see cref="String"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="s">The string containing the <see cref="VelocityUnit"/>.</param>
|
|
||||||
/// <returns>The equivalent <see cref="VelocityUnit"/> for the
|
|
||||||
/// specified <see cref="String"/>.</returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the equivalent <see cref="String"/> for the
|
|
||||||
/// specified <see cref="VelocityUnit"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="type">The <see cref="VelocityUnit"/> to convert.</param>
|
|
||||||
/// <returns>The equivalent <see cref="String"/> for the
|
|
||||||
/// specified <see cref="VelocityUnit"/>.</returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the equivalent <see cref="LongitudeType"/> for the
|
|
||||||
/// specified <see cref="String"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="s">The string containing the <see cref="LongitudeType"/>.</param>
|
|
||||||
/// <returns>The equivalent <see cref="LongitudeType"/> for the
|
|
||||||
/// specified <see cref="String"/>.</returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the equivalent <see cref="String"/> for the
|
|
||||||
/// specified <see cref="LongitudeType"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="type">The <see cref="LongitudeType"/> to convert.</param>
|
|
||||||
/// <returns>The equivalent <see cref="String"/> for the
|
|
||||||
/// specified <see cref="LongitudeType"/>.</returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the equivalent <see cref="LatitudeType"/> for the
|
|
||||||
/// specified <see cref="String"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="s">The string containing the <see cref="LatitudeType"/>.</param>
|
|
||||||
/// <returns>The equivalent <see cref="LatitudeType"/> for the
|
|
||||||
/// specified <see cref="String"/>.</returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the equivalent <see cref="String"/> for the
|
|
||||||
/// specified <see cref="LatitudeType"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="type">The <see cref="LatitudeType"/> to convert.</param>
|
|
||||||
/// <returns>The equivalent <see cref="String"/> for the
|
|
||||||
/// specified <see cref="LatitudeType"/>.</returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the equivalent <see cref="InteroperabilityMode"/> for the
|
|
||||||
/// specified <see cref="String"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="s">The string containing the <see cref="InteroperabilityMode"/>.</param>
|
|
||||||
/// <returns>The equivalent <see cref="InteroperabilityMode"/> for the
|
|
||||||
/// specified <see cref="String"/>.</returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the equivalent <see cref="String"/> for the
|
|
||||||
/// specified <see cref="InteroperabilityMode"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="type">The <see cref="InteroperabilityMode"/> to convert.</param>
|
|
||||||
/// <returns>The equivalent <see cref="String"/> for the
|
|
||||||
/// specified <see cref="InteroperabilityMode"/>.</returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Specified different unit types.
|
|
||||||
/// </summary>
|
|
||||||
public enum VelocityUnit
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// No or unknown type.
|
|
||||||
/// </summary>
|
|
||||||
Undefinied,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Kilometers per hour.
|
|
||||||
/// </summary>
|
|
||||||
Kilometers,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Miles per hour.
|
|
||||||
/// </summary>
|
|
||||||
Miles,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Knots.
|
|
||||||
/// </summary>
|
|
||||||
Knots,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Specifies different direction types.
|
|
||||||
/// </summary>
|
|
||||||
public enum DirectionReference
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// No or unknown direction type.
|
|
||||||
/// </summary>
|
|
||||||
Undefined,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// True direction.
|
|
||||||
/// </summary>
|
|
||||||
TrueDirection,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Magnatic direction.
|
|
||||||
/// </summary>
|
|
||||||
MagneticDirection,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Specifies the type of a latitude value.
|
|
||||||
/// </summary>
|
|
||||||
public enum LatitudeType
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// No or unknown type.
|
|
||||||
/// </summary>
|
|
||||||
Undefined,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// North.
|
|
||||||
/// </summary>
|
|
||||||
North,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// South.
|
|
||||||
/// </summary>
|
|
||||||
South,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Specifies the type of a longitude value.
|
|
||||||
/// </summary>
|
|
||||||
public enum LongitudeType
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// No or unknown type.
|
|
||||||
/// </summary>
|
|
||||||
Undefined,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// East.
|
|
||||||
/// </summary>
|
|
||||||
East,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// West.
|
|
||||||
/// </summary>
|
|
||||||
West,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Specifies different altitude types.
|
|
||||||
/// </summary>
|
|
||||||
public enum AltitudeType
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// No or unknown type.
|
|
||||||
/// </summary>
|
|
||||||
Undefined,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// East.
|
|
||||||
/// </summary>
|
|
||||||
AboveSeaLevel,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// West.
|
|
||||||
/// </summary>
|
|
||||||
BelowSeaLevel,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Specifies interoperability types.
|
|
||||||
/// </summary>
|
|
||||||
public enum InteroperabilityMode
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// No or unknown type.
|
|
||||||
/// </summary>
|
|
||||||
Undefined,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 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.
|
|
||||||
/// </summary>
|
|
||||||
R98,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Indicates a file conforming to DCF thumbnail file stipulated by Design
|
|
||||||
/// rule for Camera File System.
|
|
||||||
/// </summary>
|
|
||||||
THM,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Specifies orientation of images.
|
|
||||||
/// </summary>
|
|
||||||
public enum ExifImageOrientation : ushort
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Undefinied orientation.
|
|
||||||
/// </summary>
|
|
||||||
Undefined,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// TopLeft.
|
|
||||||
/// </summary>
|
|
||||||
TopLeft = 1,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// TopRight.
|
|
||||||
/// </summary>
|
|
||||||
TopRight,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// BottomRight.
|
|
||||||
/// </summary>
|
|
||||||
BottomRight,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// BottomLeft.
|
|
||||||
/// </summary>
|
|
||||||
BottomLeft,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// LeftTop.
|
|
||||||
/// </summary>
|
|
||||||
LeftTop,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// RightTop.
|
|
||||||
/// </summary>
|
|
||||||
RightTop,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// RightBottom.
|
|
||||||
/// </summary>
|
|
||||||
RightBottom,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// LeftBottom.
|
|
||||||
/// </summary>
|
|
||||||
LeftBottom,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Converts the model of the MetadataModel object to its equivalent string representation.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>The string representation of the value of this instance.</returns>
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return Model.ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-6724
File diff suppressed because it is too large
Load Diff
-757
@@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Manages metadata objects and operations.
|
|
||||||
/// </summary>
|
|
||||||
public sealed class MetadataTag : IComparable, IComparable<MetadataTag>, ICloneable, IEquatable<MetadataTag>, IDisposable
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The encapsulated FreeImage-tag.
|
|
||||||
/// </summary>
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
internal FITAG tag;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The metadata model of <see cref="tag"/>.
|
|
||||||
/// </summary>
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
private FREE_IMAGE_MDMODEL model;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Indicates whether this instance has already been disposed.
|
|
||||||
/// </summary>
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
private bool disposed = false;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Indicates whether this instance was created by FreeImage or
|
|
||||||
/// by the user.
|
|
||||||
/// </summary>
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
private bool selfCreated;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// List linking metadata-model and Type.
|
|
||||||
/// </summary>
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
private static readonly Dictionary<FREE_IMAGE_MDTYPE, Type> idList;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// List linking Type and metadata-model.
|
|
||||||
/// </summary>
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
private static readonly Dictionary<Type, FREE_IMAGE_MDTYPE> typeList;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of this class.
|
|
||||||
/// </summary>
|
|
||||||
private MetadataTag()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of this class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model">The new model the tag should be of.</param>
|
|
||||||
public MetadataTag(FREE_IMAGE_MDMODEL model)
|
|
||||||
{
|
|
||||||
this.model = model;
|
|
||||||
tag = FreeImage.CreateTag();
|
|
||||||
selfCreated = true;
|
|
||||||
|
|
||||||
if (model == FREE_IMAGE_MDMODEL.FIMD_XMP)
|
|
||||||
{
|
|
||||||
Key = "XMLPacket";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of this class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="tag">The <see cref="FITAG"/> to represent.</param>
|
|
||||||
/// <param name="dib">The bitmap <paramref name="tag"/> was extracted from.</param>
|
|
||||||
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";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of this class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="tag">The <see cref="FITAG"/> to represent.</param>
|
|
||||||
/// <param name="model">The model of <paramref name="tag"/>.</param>
|
|
||||||
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<FREE_IMAGE_MDTYPE, Type>();
|
|
||||||
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<Type, FREE_IMAGE_MDTYPE>();
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Releases all resources used by the instance.
|
|
||||||
/// </summary>
|
|
||||||
~MetadataTag()
|
|
||||||
{
|
|
||||||
Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Determines whether two specified <see cref="MetadataTag"/> objects have the same value.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="left">A <see cref="MetadataTag"/> or a null reference (<b>Nothing</b> in Visual Basic).</param>
|
|
||||||
/// <param name="right">A <see cref="MetadataTag"/> or a null reference (<b>Nothing</b> in Visual Basic).</param>
|
|
||||||
/// <returns>
|
|
||||||
/// <b>true</b> if the value of left is the same as the value of right; otherwise, <b>false</b>.
|
|
||||||
/// </returns>
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Determines whether two specified <see cref="MetadataTag"/> objects have different values.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="left">A <see cref="MetadataTag"/> or a null reference (<b>Nothing</b> in Visual Basic).</param>
|
|
||||||
/// <param name="right">A <see cref="MetadataTag"/> or a null reference (<b>Nothing</b> in Visual Basic).</param>
|
|
||||||
/// <returns>
|
|
||||||
/// true if the value of left is different from the value of right; otherwise, <b>false</b>.
|
|
||||||
/// </returns>
|
|
||||||
public static bool operator !=(MetadataTag left, MetadataTag right)
|
|
||||||
{
|
|
||||||
return !(left == right);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Extracts the value of a <see cref="MetadataTag"/> instance to a <see cref="FITAG"/> handle.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="value">A <see cref="MetadataTag"/> instance.</param>
|
|
||||||
/// <returns>A new instance of <see cref="FITAG"/> initialized to <paramref name="value"/>.</returns>
|
|
||||||
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'");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the model of the metadata.
|
|
||||||
/// </summary>
|
|
||||||
public FREE_IMAGE_MDMODEL Model
|
|
||||||
{
|
|
||||||
get { CheckDisposed(); return model; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the key of the metadata.
|
|
||||||
/// </summary>
|
|
||||||
public string Key
|
|
||||||
{
|
|
||||||
get { CheckDisposed(); return FreeImage.GetTagKey(tag); }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
CheckDisposed();
|
|
||||||
if ((model != FREE_IMAGE_MDMODEL.FIMD_XMP) || (value == "XMLPacket"))
|
|
||||||
{
|
|
||||||
FreeImage.SetTagKey(tag, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the description of the metadata.
|
|
||||||
/// </summary>
|
|
||||||
public string Description
|
|
||||||
{
|
|
||||||
get { CheckDisposed(); return FreeImage.GetTagDescription(tag); }
|
|
||||||
set { CheckDisposed(); FreeImage.SetTagDescription(tag, value); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the ID of the metadata.
|
|
||||||
/// </summary>
|
|
||||||
public ushort ID
|
|
||||||
{
|
|
||||||
get { CheckDisposed(); return FreeImage.GetTagID(tag); }
|
|
||||||
set { CheckDisposed(); FreeImage.SetTagID(tag, value); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the type of the metadata.
|
|
||||||
/// </summary>
|
|
||||||
public FREE_IMAGE_MDTYPE Type
|
|
||||||
{
|
|
||||||
get { CheckDisposed(); return FreeImage.GetTagType(tag); }
|
|
||||||
internal set { FreeImage.SetTagType(tag, value); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the number of elements the metadata object contains.
|
|
||||||
/// </summary>
|
|
||||||
public uint Count
|
|
||||||
{
|
|
||||||
get { CheckDisposed(); return FreeImage.GetTagCount(tag); }
|
|
||||||
private set { FreeImage.SetTagCount(tag, value); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the length of the value in bytes.
|
|
||||||
/// </summary>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the value of the metadata.
|
|
||||||
/// </summary>
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sets the value of the metadata.
|
|
||||||
/// <para> In case value is of byte or byte[] <see cref="FREE_IMAGE_MDTYPE.FIDT_UNDEFINED"/> is assumed.</para>
|
|
||||||
/// <para> In case value is of uint or uint[] <see cref="FREE_IMAGE_MDTYPE.FIDT_LONG"/> is assumed.</para>
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="value">New data of the metadata.</param>
|
|
||||||
/// <returns>True on success, false on failure.</returns>
|
|
||||||
/// <exception cref="NotSupportedException">
|
|
||||||
/// The data format is not supported.</exception>
|
|
||||||
/// <exception cref="ArgumentNullException">
|
|
||||||
/// <paramref name="value"/> is null.</exception>
|
|
||||||
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]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sets the value of the metadata.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="value">New data of the metadata.</param>
|
|
||||||
/// <param name="type">Type of the data.</param>
|
|
||||||
/// <returns>True on success, false on failure.</returns>
|
|
||||||
/// <exception cref="NotSupportedException">
|
|
||||||
/// The data type is not supported.</exception>
|
|
||||||
/// <exception cref="ArgumentNullException">
|
|
||||||
/// <paramref name="value"/> is null.</exception>
|
|
||||||
/// <exception cref="ArgumentException">
|
|
||||||
/// <paramref name="value"/> and <paramref name="type"/> to not fit.</exception>
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sets the value of this tag to the value of <paramref name="value"/>
|
|
||||||
/// using the given type.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="value">New value of the tag.</param>
|
|
||||||
/// <param name="type">Data-type of the tag.</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
/// <exception cref="ArgumentNullException">
|
|
||||||
/// <paramref name="value"/> is a null reference.
|
|
||||||
/// </exception>
|
|
||||||
/// <exception cref="ArgumentException">
|
|
||||||
/// <paramref name="type"/> is FIDT_ASCII and
|
|
||||||
/// <paramref name="value"/> is not String.
|
|
||||||
/// <paramref name="type"/> is not FIDT_ASCII and
|
|
||||||
/// <paramref name="value"/> is not Array.</exception>
|
|
||||||
/// <exception cref="NotSupportedException">
|
|
||||||
/// <paramref name="type"/> is FIDT_NOTYPE.</exception>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Add this metadata to an image.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dib">Handle to a FreeImage bitmap.</param>
|
|
||||||
/// <returns>True on success, false on failure.</returns>
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a .NET PropertyItem for this metadata tag.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>The .NET PropertyItem.</returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Converts the value of the <see cref="MetadataTag"/> object
|
|
||||||
/// to its equivalent string representation.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>The string representation of the value of this instance.</returns>
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
CheckDisposed();
|
|
||||||
string fiString = FreeImage.TagToString(model, tag, 0);
|
|
||||||
|
|
||||||
if (String.IsNullOrEmpty(fiString))
|
|
||||||
{
|
|
||||||
return tag.ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return fiString;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a deep copy of this <see cref="MetadataTag"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>A deep copy of this <see cref="MetadataTag"/>.</returns>
|
|
||||||
public object Clone()
|
|
||||||
{
|
|
||||||
CheckDisposed();
|
|
||||||
MetadataTag clone = new MetadataTag();
|
|
||||||
clone.model = model;
|
|
||||||
clone.tag = FreeImage.CloneTag(tag);
|
|
||||||
clone.selfCreated = true;
|
|
||||||
return clone;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Tests whether the specified object is a <see cref="MetadataTag"/> instance
|
|
||||||
/// and is equivalent to this <see cref="MetadataTag"/> instance.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="obj">The object to test.</param>
|
|
||||||
/// <returns><b>true</b> if <paramref name="obj"/> is a <see cref="MetadataTag"/> instance
|
|
||||||
/// equivalent to this <see cref="MetadataTag"/> instance; otherwise, <b>false</b>.</returns>
|
|
||||||
public override bool Equals(object obj)
|
|
||||||
{
|
|
||||||
return ((obj is MetadataTag) && (Equals((MetadataTag)obj)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Tests whether the specified <see cref="MetadataTag"/> instance is equivalent to this <see cref="MetadataTag"/> instance.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="other">A <see cref="MetadataTag"/> instance to compare to this instance.</param>
|
|
||||||
/// <returns><b>true</b> if <paramref name="obj"/> equivalent to this <see cref="MetadataTag"/> instance;
|
|
||||||
/// otherwise, <b>false</b>.</returns>
|
|
||||||
public bool Equals(MetadataTag other)
|
|
||||||
{
|
|
||||||
return (this == other);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns a hash code for this <see cref="MetadataTag"/> structure.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>An integer value that specifies the hash code for this <see cref="MetadataTag"/>.</returns>
|
|
||||||
public override int GetHashCode()
|
|
||||||
{
|
|
||||||
return tag.GetHashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Compares this instance with a specified <see cref="Object"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="obj">An object to compare with this instance.</param>
|
|
||||||
/// <returns>A 32-bit signed integer indicating the lexical relationship between the two comparands.</returns>
|
|
||||||
/// <exception cref="ArgumentException"><paramref name="obj"/> is not a <see cref="MetadataTag"/>.</exception>
|
|
||||||
public int CompareTo(object obj)
|
|
||||||
{
|
|
||||||
if (obj == null)
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (!(obj is MetadataTag))
|
|
||||||
{
|
|
||||||
throw new ArgumentException("obj");
|
|
||||||
}
|
|
||||||
return CompareTo((MetadataTag)obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Compares the current instance with another object of the same type.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="other">An object to compare with this instance.</param>
|
|
||||||
/// <returns>A 32-bit signed integer that indicates the relative order of the objects being compared.</returns>
|
|
||||||
public int CompareTo(MetadataTag other)
|
|
||||||
{
|
|
||||||
CheckDisposed();
|
|
||||||
other.CheckDisposed();
|
|
||||||
return tag.CompareTo(other.tag);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Releases all resources used by the instance.
|
|
||||||
/// </summary>
|
|
||||||
public void Dispose()
|
|
||||||
{
|
|
||||||
if (!disposed)
|
|
||||||
{
|
|
||||||
disposed = true;
|
|
||||||
if (selfCreated)
|
|
||||||
{
|
|
||||||
FreeImage.DeleteTag(tag);
|
|
||||||
tag = FITAG.Zero;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets whether this instance has already been disposed.
|
|
||||||
/// </summary>
|
|
||||||
public bool Disposed
|
|
||||||
{
|
|
||||||
get { return disposed; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Throwns an <see cref="ObjectDisposedException"/> in case
|
|
||||||
/// this instance has already been disposed.
|
|
||||||
/// </summary>
|
|
||||||
private void CheckDisposed()
|
|
||||||
{
|
|
||||||
if (disposed)
|
|
||||||
{
|
|
||||||
throw new ObjectDisposedException("The object has already been disposed.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Provides methods for working with the standard bitmap palette.
|
|
||||||
/// </summary>
|
|
||||||
public sealed class Palette : MemoryArray<RGBQUAD>
|
|
||||||
{
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
private GCHandle paletteHandle;
|
|
||||||
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
private RGBQUAD[] array;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance for the given FreeImage bitmap.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dib">Handle to a FreeImage bitmap.</param>
|
|
||||||
/// <exception cref="ArgumentNullException"><paramref name="dib"/> is null.</exception>
|
|
||||||
/// <exception cref="ArgumentException"><paramref name="dib"/> is not
|
|
||||||
/// <see cref="FREE_IMAGE_TYPE.FIT_BITMAP"/><para/>-or-<para/>
|
|
||||||
/// <paramref name="dib"/> has more than 8bpp.</exception>
|
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance for the given FITAG that contains
|
|
||||||
/// a palette.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="tag">The tag containing the palette.</param>
|
|
||||||
/// <exception cref="ArgumentNullException"><paramref name="tag"/> is null.</exception>
|
|
||||||
/// <exception cref="ArgumentException"><paramref name="tag"/> is not
|
|
||||||
/// <see cref="FREE_IMAGE_MDTYPE.FIDT_PALETTE"/>.</exception>
|
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance for the given MetadataTag that contains
|
|
||||||
/// a palette.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="tag">The tag containing the palette.</param>
|
|
||||||
/// <exception cref="ArgumentNullException"><paramref name="dib"/> is null.</exception>
|
|
||||||
/// <exception cref="ArgumentException"><paramref name="tag"/> is not
|
|
||||||
/// <see cref="FREE_IMAGE_MDTYPE.FIDT_PALETTE"/>.</exception>
|
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance for the given array of <see cref="RGBQUAD"/> that contains
|
|
||||||
/// a palette.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="palette">A RGBQUAD array containing the palette data to initialize this instance.</param>
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance for the given array of <see cref="Color"/> that contains
|
|
||||||
/// a palette.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="palette">A Color array containing the palette data to initialize this instance.</param>
|
|
||||||
public Palette(Color[] palette)
|
|
||||||
: this(RGBQUAD.ToRGBQUAD(palette))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance with the specified size.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="size">The size of the palette.</param>
|
|
||||||
public Palette(int size)
|
|
||||||
: this(new RGBQUAD[size])
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the palette through an array of <see cref="RGBQUAD"/>.
|
|
||||||
/// </summary>
|
|
||||||
public RGBQUAD[] AsArray
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return Data;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
Data = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get an array of <see cref="System.Drawing.Color"/> that the block of memory represents.
|
|
||||||
/// This property is used for internal palette operations.
|
|
||||||
/// </summary>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the palette as an array of <see cref="RGBQUAD"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>The palette as an array of <see cref="RGBQUAD"/>.</returns>
|
|
||||||
public RGBQUAD[] ToArray()
|
|
||||||
{
|
|
||||||
return Data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a linear palette based on the provided <paramref name="color"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="color">The <see cref="System.Drawing.Color"/> used to colorize the palette.</param>
|
|
||||||
/// <remarks>
|
|
||||||
/// Only call this method on linear palettes.
|
|
||||||
/// </remarks>
|
|
||||||
public void Colorize(Color color)
|
|
||||||
{
|
|
||||||
Colorize(color, 0.5d);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a linear palette based on the provided <paramref name="color"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="color">The <see cref="System.Drawing.Color"/> used to colorize the palette.</param>
|
|
||||||
/// <param name="splitSize">The position of the color within the new palette.
|
|
||||||
/// 0 < <paramref name="splitSize"/> < 1.</param>
|
|
||||||
/// <remarks>
|
|
||||||
/// Only call this method on linear palettes.
|
|
||||||
/// </remarks>
|
|
||||||
public void Colorize(Color color, double splitSize)
|
|
||||||
{
|
|
||||||
Colorize(color, (int)(length * splitSize));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a linear palette based on the provided <paramref name="color"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="color">The <see cref="System.Drawing.Color"/> used to colorize the palette.</param>
|
|
||||||
/// <param name="splitSize">The position of the color within the new palette.
|
|
||||||
/// 0 < <paramref name="splitSize"/> < <see cref="MemoryArray<T>.Length"/>.</param>
|
|
||||||
/// <remarks>
|
|
||||||
/// Only call this method on linear palettes.
|
|
||||||
/// </remarks>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a linear grayscale palette.
|
|
||||||
/// </summary>
|
|
||||||
public void CreateGrayscalePalette()
|
|
||||||
{
|
|
||||||
Colorize(Color.White, length - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a linear grayscale palette.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="inverse"><b>true</b> to create an inverse grayscale palette.</param>
|
|
||||||
public void CreateGrayscalePalette(bool inverse)
|
|
||||||
{
|
|
||||||
Colorize(Color.White, inverse ? 0 : length - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a linear palette with the specified <see cref="Color"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// 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.
|
|
||||||
/// </remarks>
|
|
||||||
/// <param name="color">The <see cref="Color"/> used to create the palette.</param>
|
|
||||||
/// <param name="inverse"><b>true</b> to create an inverse palette.</param>
|
|
||||||
public void CreateGrayscalePalette(Color color, bool inverse)
|
|
||||||
{
|
|
||||||
Colorize(color, inverse ? 0 : length - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Reverses the palette.
|
|
||||||
/// </summary>
|
|
||||||
public void Reverse()
|
|
||||||
{
|
|
||||||
EnsureNotDisposed();
|
|
||||||
if (array != null)
|
|
||||||
{
|
|
||||||
Array.Reverse(array);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RGBQUAD[] localArray = Data;
|
|
||||||
Array.Reverse(localArray);
|
|
||||||
Data = localArray;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Copies the values from the specified <see cref="Palette"/> to this instance.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="palette">The palette to copy from.</param>
|
|
||||||
/// <exception cref="ArgumentNullException">
|
|
||||||
/// <paramref name="palette"/> is a null reference.</exception>
|
|
||||||
public void CopyFrom(Palette palette)
|
|
||||||
{
|
|
||||||
EnsureNotDisposed();
|
|
||||||
if (palette == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("palette");
|
|
||||||
}
|
|
||||||
CopyFrom(palette.Data, 0, 0, Math.Min(palette.Length, this.Length));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Copies the values from the specified <see cref="Palette"/> to this instance,
|
|
||||||
/// starting at the specified <paramref name="offset"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="palette">The palette to copy from.</param>
|
|
||||||
/// <param name="offset">The position in this instance where the values
|
|
||||||
/// will be copied to.</param>
|
|
||||||
/// <exception cref="ArgumentNullException">
|
|
||||||
/// <paramref name="palette"/> is a null reference.</exception>
|
|
||||||
/// <exception cref="ArgumentOutOfRangeException">
|
|
||||||
/// <paramref name="offset"/> is outside the range of valid indexes.</exception>
|
|
||||||
public void CopyFrom(Palette palette, int offset)
|
|
||||||
{
|
|
||||||
EnsureNotDisposed();
|
|
||||||
CopyFrom(palette.Data, 0, offset, Math.Min(palette.Length, this.Length - offset));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Saves this <see cref="Palette"/> to the specified file.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="filename">
|
|
||||||
/// A string that contains the name of the file to which to save this <see cref="Palette"/>.
|
|
||||||
/// </param>
|
|
||||||
public void Save(string filename)
|
|
||||||
{
|
|
||||||
using (Stream stream = new FileStream(filename, FileMode.Create, FileAccess.Write))
|
|
||||||
{
|
|
||||||
Save(stream);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Saves this <see cref="Palette"/> to the specified stream.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="stream">
|
|
||||||
/// The <see cref="Stream"/> where the image will be saved.
|
|
||||||
/// </param>
|
|
||||||
public void Save(Stream stream)
|
|
||||||
{
|
|
||||||
Save(new BinaryWriter(stream));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Saves this <see cref="Palette"/> using the specified writer.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="writer">
|
|
||||||
/// The <see cref="BinaryWriter"/> used to save the image.
|
|
||||||
/// </param>
|
|
||||||
public void Save(BinaryWriter writer)
|
|
||||||
{
|
|
||||||
EnsureNotDisposed();
|
|
||||||
writer.Write(ToByteArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Loads a palette from the specified file.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="filename">The name of the palette file.</param>
|
|
||||||
public void Load(string filename)
|
|
||||||
{
|
|
||||||
using (Stream stream = new FileStream(filename, FileMode.Open, FileAccess.Read))
|
|
||||||
{
|
|
||||||
Load(stream);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Loads a palette from the specified stream.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="stream">The stream to load the palette from.</param>
|
|
||||||
public void Load(Stream stream)
|
|
||||||
{
|
|
||||||
Load(new BinaryReader(stream));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Loads a palette from the reader.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="reader">The reader to load the palette from.</param>
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Releases allocated handles associated with this instance.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing"><b>true</b> to release managed resources.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (paletteHandle.IsAllocated)
|
|
||||||
paletteHandle.Free();
|
|
||||||
array = null;
|
|
||||||
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-449
@@ -1,449 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Diagnostics;
|
|
||||||
|
|
||||||
namespace FreeImageAPI.Plugins
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Class representing all registered <see cref="FreeImageAPI.Plugins.FreeImagePlugin"/> in FreeImage.
|
|
||||||
/// </summary>
|
|
||||||
public static class PluginRepository
|
|
||||||
{
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
private static readonly List<FreeImagePlugin> plugins = null;
|
|
||||||
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
private static readonly List<FreeImagePlugin> localPlugins = null;
|
|
||||||
|
|
||||||
static PluginRepository()
|
|
||||||
{
|
|
||||||
plugins = new List<FreeImagePlugin>(FreeImage.GetFIFCount());
|
|
||||||
localPlugins = new List<FreeImagePlugin>(0);
|
|
||||||
for (int i = 0; i < plugins.Capacity; i++)
|
|
||||||
{
|
|
||||||
plugins.Add(new FreeImagePlugin((FREE_IMAGE_FORMAT)i));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds local plugin to this class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="localPlugin">The registered plugin.</param>
|
|
||||||
internal static void RegisterLocalPlugin(LocalPlugin localPlugin)
|
|
||||||
{
|
|
||||||
FreeImagePlugin plugin = new FreeImagePlugin(localPlugin.Format);
|
|
||||||
plugins.Add(plugin);
|
|
||||||
localPlugins.Add(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns an instance of <see cref="FreeImageAPI.Plugins.FreeImagePlugin"/>, representing the given format.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="fif">The representing format.</param>
|
|
||||||
/// <returns>An instance of <see cref="FreeImageAPI.Plugins.FreeImagePlugin"/>.</returns>
|
|
||||||
public static FreeImagePlugin Plugin(FREE_IMAGE_FORMAT fif)
|
|
||||||
{
|
|
||||||
return Plugin((int)fif);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns an instance of <see cref="FreeImageAPI.Plugins.FreeImagePlugin"/>,
|
|
||||||
/// representing the format at the given index.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="index">The index of the representing format.</param>
|
|
||||||
/// <returns>An instance of <see cref="FreeImagePlugin"/>.</returns>
|
|
||||||
public static FreeImagePlugin Plugin(int index)
|
|
||||||
{
|
|
||||||
return (index >= 0) ? plugins[index] : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns an instance of <see cref="FreeImageAPI.Plugins.FreeImagePlugin"/>.
|
|
||||||
/// <typeparamref name="expression"/> is searched in:
|
|
||||||
/// <c>Format</c>, <c>RegExpr</c>,
|
|
||||||
/// <c>ValidExtension</c> and <c>ValidFilename</c>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="expression">The expression to search for.</param>
|
|
||||||
/// <returns>An instance of <see cref="FreeImageAPI.Plugins.FreeImagePlugin"/>.</returns>
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns an instance of <see cref="FreeImageAPI.Plugins.FreeImagePlugin"/> for the given format.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="format">The format of the Plugin.</param>
|
|
||||||
/// <returns>An instance of <see cref="FreeImageAPI.Plugins.FreeImagePlugin"/>.</returns>
|
|
||||||
public static FreeImagePlugin PluginFromFormat(string format)
|
|
||||||
{
|
|
||||||
return Plugin(FreeImage.GetFIFFromFormat(format));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns an instance of <see cref="FreeImageAPI.Plugins.FreeImagePlugin"/> for the given filename.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="filename">The valid filename for the plugin.</param>
|
|
||||||
/// <returns>An instance of <see cref="FreeImageAPI.Plugins.FreeImagePlugin"/>.</returns>
|
|
||||||
public static FreeImagePlugin PluginFromFilename(string filename)
|
|
||||||
{
|
|
||||||
return Plugin(FreeImage.GetFIFFromFilename(filename));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns an instance of <see cref="FreeImageAPI.Plugins.FreeImagePlugin"/> for the given mime.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="mime">The valid mime for the plugin.</param>
|
|
||||||
/// <returns>An instance of <see cref="FreeImageAPI.Plugins.FreeImagePlugin"/>.</returns>
|
|
||||||
public static FreeImagePlugin PluginFromMime(string mime)
|
|
||||||
{
|
|
||||||
return Plugin(FreeImage.GetFIFFromMime(mime));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the number of registered plugins.
|
|
||||||
/// </summary>
|
|
||||||
public static int FIFCount
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return FreeImage.GetFIFCount();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a readonly collection of all plugins.
|
|
||||||
/// </summary>
|
|
||||||
public static ReadOnlyCollection<FreeImagePlugin> PluginList
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return plugins.AsReadOnly();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a list of plugins that are only able to
|
|
||||||
/// read but not to write.
|
|
||||||
/// </summary>
|
|
||||||
public static List<FreeImagePlugin> ReadOnlyPlugins
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
List<FreeImagePlugin> list = new List<FreeImagePlugin>();
|
|
||||||
foreach (FreeImagePlugin p in plugins)
|
|
||||||
{
|
|
||||||
if (p.SupportsReading && !p.SupportsWriting)
|
|
||||||
{
|
|
||||||
list.Add(p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a list of plugins that are only able to
|
|
||||||
/// write but not to read.
|
|
||||||
/// </summary>
|
|
||||||
public static List<FreeImagePlugin> WriteOnlyPlugins
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
List<FreeImagePlugin> list = new List<FreeImagePlugin>();
|
|
||||||
foreach (FreeImagePlugin p in plugins)
|
|
||||||
{
|
|
||||||
if (!p.SupportsReading && p.SupportsWriting)
|
|
||||||
{
|
|
||||||
list.Add(p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a list of plugins that are not able to
|
|
||||||
/// read or write.
|
|
||||||
/// </summary>
|
|
||||||
public static List<FreeImagePlugin> StupidPlugins
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
List<FreeImagePlugin> list = new List<FreeImagePlugin>();
|
|
||||||
foreach (FreeImagePlugin p in plugins)
|
|
||||||
{
|
|
||||||
if (!p.SupportsReading && !p.SupportsWriting)
|
|
||||||
{
|
|
||||||
list.Add(p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a list of plugins that are able to read.
|
|
||||||
/// </summary>
|
|
||||||
public static List<FreeImagePlugin> ReadablePlugins
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
List<FreeImagePlugin> list = new List<FreeImagePlugin>();
|
|
||||||
foreach (FreeImagePlugin p in plugins)
|
|
||||||
{
|
|
||||||
if (p.SupportsReading)
|
|
||||||
{
|
|
||||||
list.Add(p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a list of plugins that are able to write.
|
|
||||||
/// </summary>
|
|
||||||
public static List<FreeImagePlugin> WriteablePlugins
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
List<FreeImagePlugin> list = new List<FreeImagePlugin>();
|
|
||||||
foreach (FreeImagePlugin p in plugins)
|
|
||||||
{
|
|
||||||
if (p.SupportsWriting)
|
|
||||||
{
|
|
||||||
list.Add(p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a list of local plugins.
|
|
||||||
/// </summary>
|
|
||||||
public static ReadOnlyCollection<FreeImagePlugin> LocalPlugins
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return localPlugins.AsReadOnly();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets a list of built-in plugins.
|
|
||||||
/// </summary>
|
|
||||||
public static List<FreeImagePlugin> BuiltInPlugins
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
List<FreeImagePlugin> list = new List<FreeImagePlugin>();
|
|
||||||
foreach (FreeImagePlugin p in plugins)
|
|
||||||
{
|
|
||||||
if (!localPlugins.Contains(p))
|
|
||||||
{
|
|
||||||
list.Add(p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Windows or OS/2 Bitmap File (*.BMP)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin BMP { get { return plugins[0]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Independent JPEG Group (*.JPG, *.JIF, *.JPEG, *.JPE)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin ICO { get { return plugins[1]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Independent JPEG Group (*.JPG, *.JIF, *.JPEG, *.JPE)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin JPEG { get { return plugins[2]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// JPEG Network Graphics (*.JNG)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin JNG { get { return plugins[3]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Commodore 64 Koala format (*.KOA)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin KOALA { get { return plugins[4]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Amiga IFF (*.IFF, *.LBM)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin LBM { get { return plugins[5]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Amiga IFF (*.IFF, *.LBM)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin IFF { get { return plugins[5]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Multiple Network Graphics (*.MNG)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin MNG { get { return plugins[6]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Portable Bitmap (ASCII) (*.PBM)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin PBM { get { return plugins[7]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Portable Bitmap (BINARY) (*.PBM)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin PBMRAW { get { return plugins[8]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Kodak PhotoCD (*.PCD)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin PCD { get { return plugins[9]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Zsoft Paintbrush PCX bitmap format (*.PCX)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin PCX { get { return plugins[10]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Portable Graymap (ASCII) (*.PGM)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin PGM { get { return plugins[11]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Portable Graymap (BINARY) (*.PGM)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin PGMRAW { get { return plugins[12]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Portable Network Graphics (*.PNG)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin PNG { get { return plugins[13]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Portable Pixelmap (ASCII) (*.PPM)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin PPM { get { return plugins[14]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Portable Pixelmap (BINARY) (*.PPM)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin PPMRAW { get { return plugins[15]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sun Rasterfile (*.RAS)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin RAS { get { return plugins[16]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// truevision Targa files (*.TGA, *.TARGA)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin TARGA { get { return plugins[17]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Tagged Image File Format (*.TIF, *.TIFF)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin TIFF { get { return plugins[18]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Wireless Bitmap (*.WBMP)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin WBMP { get { return plugins[19]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adobe Photoshop (*.PSD)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin PSD { get { return plugins[20]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Dr. Halo (*.CUT)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin CUT { get { return plugins[21]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// X11 Bitmap Format (*.XBM)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin XBM { get { return plugins[22]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// X11 Pixmap Format (*.XPM)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin XPM { get { return plugins[23]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DirectDraw Surface (*.DDS)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin DDS { get { return plugins[24]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Graphics Interchange Format (*.GIF)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin GIF { get { return plugins[25]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// High Dynamic Range (*.HDR)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin HDR { get { return plugins[26]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Raw Fax format CCITT G3 (*.G3)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin FAXG3 { get { return plugins[27]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Silicon Graphics SGI image format (*.SGI)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin SGI { get { return plugins[28]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// OpenEXR format (*.EXR)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin EXR { get { return plugins[29]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// JPEG-2000 format (*.J2K, *.J2C)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin J2K { get { return plugins[30]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// JPEG-2000 format (*.JP2)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin JP2 { get { return plugins[31]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Portable FloatMap (*.PFM)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin PFM { get { return plugins[32]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Macintosh PICT (*.PICT)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin PICT { get { return plugins[33]; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// RAW camera image (*.*)
|
|
||||||
/// </summary>
|
|
||||||
public static FreeImagePlugin RAW { get { return plugins[34]; } }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
|
|
||||||
namespace FreeImageAPI
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Provides methods for working with generic bitmap scanlines.
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="T">Type of the bitmaps' scanlines.</typeparam>
|
|
||||||
public sealed class Scanline<T> : MemoryArray<T> where T : struct
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance based on the specified FreeImage bitmap.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dib">Handle to a FreeImage bitmap.</param>
|
|
||||||
public Scanline(FIBITMAP dib)
|
|
||||||
: this(dib, 0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance based on the specified FreeImage bitmap.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dib">Handle to a FreeImage bitmap.</param>
|
|
||||||
/// <param name="scanline">Index of the zero based scanline.</param>
|
|
||||||
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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-312
@@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Class wrapping streams, implementing a buffer for read data,
|
|
||||||
/// so that seek operations can be made.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// 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.
|
|
||||||
/// <b>StreamWrapper</b> 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.
|
|
||||||
/// </remarks>
|
|
||||||
internal class StreamWrapper : Stream
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The stream to wrap
|
|
||||||
/// </summary>
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
private readonly Stream stream;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The caching stream
|
|
||||||
/// </summary>
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
private MemoryStream memoryStream = new MemoryStream();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Indicates if the wrapped stream reached its end
|
|
||||||
/// </summary>
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
private bool eos = false;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Tells the wrapper to block readings or not
|
|
||||||
/// </summary>
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
private bool blocking = false;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Indicates if the wrapped stream is disposed or not
|
|
||||||
/// </summary>
|
|
||||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
|
||||||
private bool disposed = false;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance based on the specified <see cref="Stream"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="stream">The stream to wrap.</param>
|
|
||||||
/// <param name="blocking">When true the wrapper always tries to read the requested
|
|
||||||
/// amount of data from the wrapped stream.</param>
|
|
||||||
public StreamWrapper(Stream stream, bool blocking)
|
|
||||||
{
|
|
||||||
if (!stream.CanRead)
|
|
||||||
{
|
|
||||||
throw new ArgumentException("stream is not capable of reading.");
|
|
||||||
}
|
|
||||||
this.stream = stream;
|
|
||||||
this.blocking = blocking;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Releases all resources used by the instance.
|
|
||||||
/// </summary>
|
|
||||||
~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");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Delegate for capturing FreeImage error messages.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="fif">The format of the image.</param>
|
|
||||||
/// <param name="message">The errormessage.</param>
|
|
||||||
// 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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Delegate to the C++ function <b>fread</b>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="buffer">Pointer to read from.</param>
|
|
||||||
/// <param name="size">Item size in bytes.</param>
|
|
||||||
/// <param name="count">Maximum number of items to be read.</param>
|
|
||||||
/// <param name="handle">Handle/stream to read from.</param>
|
|
||||||
/// <returns>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.</returns>
|
|
||||||
public delegate uint ReadProc(IntPtr buffer, uint size, uint count, fi_handle handle);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Delegate to the C++ function <b>fwrite</b>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="buffer">Pointer to data to be written.</param>
|
|
||||||
/// <param name="size">Item size in bytes.</param>
|
|
||||||
/// <param name="count">Maximum number of items to be written.</param>
|
|
||||||
/// <param name="handle">Handle/stream to write to.</param>
|
|
||||||
/// <returns>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.</returns>
|
|
||||||
public delegate uint WriteProc(IntPtr buffer, uint size, uint count, fi_handle handle);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Delegate to the C++ function <b>fseek</b>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="handle">Handle/stream to seek in.</param>
|
|
||||||
/// <param name="offset">Number of bytes from origin.</param>
|
|
||||||
/// <param name="origin">Initial position.</param>
|
|
||||||
/// <returns>If successful 0 is returned; otherwise a nonzero value. </returns>
|
|
||||||
public delegate int SeekProc(fi_handle handle, int offset, SeekOrigin origin);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Delegate to the C++ function <b>ftell</b>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="handle">Handle/stream to retrieve its currents position from.</param>
|
|
||||||
/// <returns>The current position.</returns>
|
|
||||||
public delegate int TellProc(fi_handle handle);
|
|
||||||
|
|
||||||
// Delegates used by 'Plugin' structure
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace FreeImageAPI.Plugins
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Delegate to a function that returns a string which describes
|
|
||||||
/// the plugins format.
|
|
||||||
/// </summary>
|
|
||||||
public delegate string FormatProc();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Delegate to a function that returns a string which contains
|
|
||||||
/// a more detailed description.
|
|
||||||
/// </summary>
|
|
||||||
public delegate string DescriptionProc();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Delegate to a function that returns a comma seperated list
|
|
||||||
/// of file extensions the plugin can read or write.
|
|
||||||
/// </summary>
|
|
||||||
public delegate string ExtensionListProc();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Delegate to a function that returns a regular expression that
|
|
||||||
/// can be used to idientify whether a file can be handled by the plugin.
|
|
||||||
/// </summary>
|
|
||||||
public delegate string RegExprProc();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Delegate to a function that opens a file.
|
|
||||||
/// </summary>
|
|
||||||
public delegate IntPtr OpenProc(ref FreeImageIO io, fi_handle handle, bool read);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Delegate to a function that closes a previosly opened file.
|
|
||||||
/// </summary>
|
|
||||||
public delegate void CloseProc(ref FreeImageIO io, fi_handle handle, IntPtr data);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Delegate to a function that returns the number of pages of a multipage
|
|
||||||
/// bitmap if the plugin is capable of handling multipage bitmaps.
|
|
||||||
/// </summary>
|
|
||||||
public delegate int PageCountProc(ref FreeImageIO io, fi_handle handle, IntPtr data);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// UNKNOWN
|
|
||||||
/// </summary>
|
|
||||||
public delegate int PageCapabilityProc(ref FreeImageIO io, fi_handle handle, IntPtr data);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Delegate to a function that loads and decodes a bitmap into memory.
|
|
||||||
/// </summary>
|
|
||||||
public delegate FIBITMAP LoadProc(ref FreeImageIO io, fi_handle handle, int page, int flags, IntPtr data);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Delegate to a function that saves a bitmap.
|
|
||||||
/// </summary>
|
|
||||||
public delegate bool SaveProc(ref FreeImageIO io, FIBITMAP dib, fi_handle handle, int page, int flags, IntPtr data);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Delegate to a function that determines whether the source defined
|
|
||||||
/// by <param name="io"/> and <param name="handle"/> is a valid image.
|
|
||||||
/// </summary>
|
|
||||||
public delegate bool ValidateProc(ref FreeImageIO io, fi_handle handle);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Delegate to a function that returns a string which contains
|
|
||||||
/// the plugin's mime type.
|
|
||||||
/// </summary>
|
|
||||||
public delegate string MimeProc();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Delegate to a function that returns whether the plugin can handle the
|
|
||||||
/// specified color depth.
|
|
||||||
/// </summary>
|
|
||||||
public delegate bool SupportsExportBPPProc(int bpp);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Delegate to a function that returns whether the plugin can handle the
|
|
||||||
/// specified image type.
|
|
||||||
/// </summary>
|
|
||||||
public delegate bool SupportsExportTypeProc(FREE_IMAGE_TYPE type);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Delegate to a function that returns whether the plugin can handle
|
|
||||||
/// ICC-Profiles.
|
|
||||||
/// </summary>
|
|
||||||
public delegate bool SupportsICCProfilesProc();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Callback function used by FreeImage to register plugins.
|
|
||||||
/// </summary>
|
|
||||||
public delegate void InitProc(ref Plugin plugin, int format_id);
|
|
||||||
}
|
|
||||||
-33
@@ -1,33 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace FreeImageAPI.Metadata
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Specifies how a single frame will be handled after being displayed.
|
|
||||||
/// </summary>
|
|
||||||
public enum DisposalMethodType : byte
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Same behavior as <see cref="DisposalMethodType.Leave"/> but should not be used.
|
|
||||||
/// </summary>
|
|
||||||
Unspecified,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The image is left in place and will be overdrawn by the next image.
|
|
||||||
/// </summary>
|
|
||||||
Leave,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The area of the image will be blanked out by its background.
|
|
||||||
/// </summary>
|
|
||||||
Background,
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Restores the the area of the image to the state it was before it
|
|
||||||
/// has been dawn.
|
|
||||||
/// </summary>
|
|
||||||
Previous,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Vendored
-84
@@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Color channels. Constants used in color manipulation routines.
|
|
||||||
/// </summary>
|
|
||||||
public enum FREE_IMAGE_COLOR_CHANNEL
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Use red, green and blue channels
|
|
||||||
/// </summary>
|
|
||||||
FICC_RGB = 0,
|
|
||||||
/// <summary>
|
|
||||||
/// Use red channel
|
|
||||||
/// </summary>
|
|
||||||
FICC_RED = 1,
|
|
||||||
/// <summary>
|
|
||||||
/// Use green channel
|
|
||||||
/// </summary>
|
|
||||||
FICC_GREEN = 2,
|
|
||||||
/// <summary>
|
|
||||||
/// Use blue channel
|
|
||||||
/// </summary>
|
|
||||||
FICC_BLUE = 3,
|
|
||||||
/// <summary>
|
|
||||||
/// Use alpha channel
|
|
||||||
/// </summary>
|
|
||||||
FICC_ALPHA = 4,
|
|
||||||
/// <summary>
|
|
||||||
/// Use black channel
|
|
||||||
/// </summary>
|
|
||||||
FICC_BLACK = 5,
|
|
||||||
/// <summary>
|
|
||||||
/// Complex images: use real part
|
|
||||||
/// </summary>
|
|
||||||
FICC_REAL = 6,
|
|
||||||
/// <summary>
|
|
||||||
/// Complex images: use imaginary part
|
|
||||||
/// </summary>
|
|
||||||
FICC_IMAG = 7,
|
|
||||||
/// <summary>
|
|
||||||
/// Complex images: use magnitude
|
|
||||||
/// </summary>
|
|
||||||
FICC_MAG = 8,
|
|
||||||
/// <summary>
|
|
||||||
/// Complex images: use phase
|
|
||||||
/// </summary>
|
|
||||||
FICC_PHASE = 9
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Vendored
-105
@@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Enumeration used for color conversions.
|
|
||||||
/// FREE_IMAGE_COLOR_DEPTH contains several colors to convert to.
|
|
||||||
/// The default value 'FICD_AUTO'.
|
|
||||||
/// </summary>
|
|
||||||
[System.Flags]
|
|
||||||
public enum FREE_IMAGE_COLOR_DEPTH
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Unknown.
|
|
||||||
/// </summary>
|
|
||||||
FICD_UNKNOWN = 0,
|
|
||||||
/// <summary>
|
|
||||||
/// Auto selected by the used algorithm.
|
|
||||||
/// </summary>
|
|
||||||
FICD_AUTO = FICD_UNKNOWN,
|
|
||||||
/// <summary>
|
|
||||||
/// 1-bit.
|
|
||||||
/// </summary>
|
|
||||||
FICD_01_BPP = 1,
|
|
||||||
/// <summary>
|
|
||||||
/// 1-bit using dithering.
|
|
||||||
/// </summary>
|
|
||||||
FICD_01_BPP_DITHER = FICD_01_BPP,
|
|
||||||
/// <summary>
|
|
||||||
/// 1-bit using threshold.
|
|
||||||
/// </summary>
|
|
||||||
FICD_01_BPP_THRESHOLD = FICD_01_BPP | 2,
|
|
||||||
/// <summary>
|
|
||||||
/// 4-bit.
|
|
||||||
/// </summary>
|
|
||||||
FICD_04_BPP = 4,
|
|
||||||
/// <summary>
|
|
||||||
/// 8-bit.
|
|
||||||
/// </summary>
|
|
||||||
FICD_08_BPP = 8,
|
|
||||||
/// <summary>
|
|
||||||
/// 16-bit 555 (1 bit remains unused).
|
|
||||||
/// </summary>
|
|
||||||
FICD_16_BPP_555 = FICD_16_BPP | 2,
|
|
||||||
/// <summary>
|
|
||||||
/// 16-bit 565 (all bits are used).
|
|
||||||
/// </summary>
|
|
||||||
FICD_16_BPP = 16,
|
|
||||||
/// <summary>
|
|
||||||
/// 24-bit.
|
|
||||||
/// </summary>
|
|
||||||
FICD_24_BPP = 24,
|
|
||||||
/// <summary>
|
|
||||||
/// 32-bit.
|
|
||||||
/// </summary>
|
|
||||||
FICD_32_BPP = 32,
|
|
||||||
/// <summary>
|
|
||||||
/// Reorder palette (make it linear). Only affects 1-, 4- and 8-bit images.
|
|
||||||
/// <para>The palette is only reordered in case the image is greyscale
|
|
||||||
/// (all palette entries have the same red, green and blue value).</para>
|
|
||||||
/// </summary>
|
|
||||||
FICD_REORDER_PALETTE = 1024,
|
|
||||||
/// <summary>
|
|
||||||
/// Converts the image to greyscale.
|
|
||||||
/// </summary>
|
|
||||||
FICD_FORCE_GREYSCALE = 2048,
|
|
||||||
/// <summary>
|
|
||||||
/// Flag to mask out all non color depth flags.
|
|
||||||
/// </summary>
|
|
||||||
FICD_COLOR_MASK = FICD_01_BPP | FICD_04_BPP | FICD_08_BPP | FICD_16_BPP | FICD_24_BPP | FICD_32_BPP
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Vendored
-68
@@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Constants used in color filling routines.
|
|
||||||
/// </summary>
|
|
||||||
public enum FREE_IMAGE_COLOR_OPTIONS
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Default value.
|
|
||||||
/// </summary>
|
|
||||||
FICO_DEFAULT = 0x0,
|
|
||||||
/// <summary>
|
|
||||||
/// <see cref="RGBQUAD"/> color is RGB color (contains no valid alpha channel).
|
|
||||||
/// </summary>
|
|
||||||
FICO_RGB = 0x0,
|
|
||||||
/// <summary>
|
|
||||||
/// <see cref="RGBQUAD"/> color is RGBA color (contains a valid alpha channel).
|
|
||||||
/// </summary>
|
|
||||||
FICO_RGBA = 0x1,
|
|
||||||
/// <summary>
|
|
||||||
/// Lookup nearest RGB color from palette.
|
|
||||||
/// </summary>
|
|
||||||
FICO_NEAREST_COLOR = 0x0,
|
|
||||||
/// <summary>
|
|
||||||
/// Lookup equal RGB color from palette.
|
|
||||||
/// </summary>
|
|
||||||
FICO_EQUAL_COLOR = 0x2,
|
|
||||||
/// <summary>
|
|
||||||
/// <see cref="RGBQUAD.rgbReserved"/> contains the palette index to be used.
|
|
||||||
/// </summary>
|
|
||||||
FICO_ALPHA_IS_INDEX = 0x4,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Vendored
-68
@@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Image color types used in FreeImage.
|
|
||||||
/// </summary>
|
|
||||||
public enum FREE_IMAGE_COLOR_TYPE
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// min value is white
|
|
||||||
/// </summary>
|
|
||||||
FIC_MINISWHITE = 0,
|
|
||||||
/// <summary>
|
|
||||||
/// min value is black
|
|
||||||
/// </summary>
|
|
||||||
FIC_MINISBLACK = 1,
|
|
||||||
/// <summary>
|
|
||||||
/// RGB color model
|
|
||||||
/// </summary>
|
|
||||||
FIC_RGB = 2,
|
|
||||||
/// <summary>
|
|
||||||
/// color map indexed
|
|
||||||
/// </summary>
|
|
||||||
FIC_PALETTE = 3,
|
|
||||||
/// <summary>
|
|
||||||
/// RGB color model with alpha channel
|
|
||||||
/// </summary>
|
|
||||||
FIC_RGBALPHA = 4,
|
|
||||||
/// <summary>
|
|
||||||
/// CMYK color model
|
|
||||||
/// </summary>
|
|
||||||
FIC_CMYK = 5
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Vendored
-65
@@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// List of combinable compare modes.
|
|
||||||
/// </summary>
|
|
||||||
[System.Flags]
|
|
||||||
public enum FREE_IMAGE_COMPARE_FLAGS
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Compare headers.
|
|
||||||
/// </summary>
|
|
||||||
HEADER = 0x1,
|
|
||||||
/// <summary>
|
|
||||||
/// Compare palettes.
|
|
||||||
/// </summary>
|
|
||||||
PALETTE = 0x2,
|
|
||||||
/// <summary>
|
|
||||||
/// Compare pixel data.
|
|
||||||
/// </summary>
|
|
||||||
DATA = 0x4,
|
|
||||||
/// <summary>
|
|
||||||
/// Compare meta data.
|
|
||||||
/// </summary>
|
|
||||||
METADATA = 0x8,
|
|
||||||
/// <summary>
|
|
||||||
/// Compare everything.
|
|
||||||
/// </summary>
|
|
||||||
COMPLETE = (HEADER | PALETTE | DATA | METADATA)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-73
@@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Dithering algorithms.
|
|
||||||
/// Constants used in FreeImage_Dither.
|
|
||||||
/// </summary>
|
|
||||||
public enum FREE_IMAGE_DITHER
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Floyd and Steinberg error diffusion
|
|
||||||
/// </summary>
|
|
||||||
FID_FS = 0,
|
|
||||||
/// <summary>
|
|
||||||
/// Bayer ordered dispersed dot dithering (order 2 dithering matrix)
|
|
||||||
/// </summary>
|
|
||||||
FID_BAYER4x4 = 1,
|
|
||||||
/// <summary>
|
|
||||||
/// Bayer ordered dispersed dot dithering (order 3 dithering matrix)
|
|
||||||
/// </summary>
|
|
||||||
FID_BAYER8x8 = 2,
|
|
||||||
/// <summary>
|
|
||||||
/// Ordered clustered dot dithering (order 3 - 6x6 matrix)
|
|
||||||
/// </summary>
|
|
||||||
FID_CLUSTER6x6 = 3,
|
|
||||||
/// <summary>
|
|
||||||
/// Ordered clustered dot dithering (order 4 - 8x8 matrix)
|
|
||||||
/// </summary>
|
|
||||||
FID_CLUSTER8x8 = 4,
|
|
||||||
/// <summary>
|
|
||||||
/// Ordered clustered dot dithering (order 8 - 16x16 matrix)
|
|
||||||
/// </summary>
|
|
||||||
FID_CLUSTER16x16 = 5,
|
|
||||||
/// <summary>
|
|
||||||
/// Bayer ordered dispersed dot dithering (order 4 dithering matrix)
|
|
||||||
/// </summary>
|
|
||||||
FID_BAYER16x16 = 6
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-68
@@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Upsampling / downsampling filters. Constants used in FreeImage_Rescale.
|
|
||||||
/// </summary>
|
|
||||||
public enum FREE_IMAGE_FILTER
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Box, pulse, Fourier window, 1st order (constant) b-spline
|
|
||||||
/// </summary>
|
|
||||||
FILTER_BOX = 0,
|
|
||||||
/// <summary>
|
|
||||||
/// Mitchell and Netravali's two-param cubic filter
|
|
||||||
/// </summary>
|
|
||||||
FILTER_BICUBIC = 1,
|
|
||||||
/// <summary>
|
|
||||||
/// Bilinear filter
|
|
||||||
/// </summary>
|
|
||||||
FILTER_BILINEAR = 2,
|
|
||||||
/// <summary>
|
|
||||||
/// 4th order (cubic) b-spline
|
|
||||||
/// </summary>
|
|
||||||
FILTER_BSPLINE = 3,
|
|
||||||
/// <summary>
|
|
||||||
/// Catmull-Rom spline, Overhauser spline
|
|
||||||
/// </summary>
|
|
||||||
FILTER_CATMULLROM = 4,
|
|
||||||
/// <summary>
|
|
||||||
/// Lanczos3 filter
|
|
||||||
/// </summary>
|
|
||||||
FILTER_LANCZOS3 = 5
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-192
@@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// I/O image format identifiers.
|
|
||||||
/// </summary>
|
|
||||||
public enum FREE_IMAGE_FORMAT
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Unknown format (returned value only, never use it as input value)
|
|
||||||
/// </summary>
|
|
||||||
FIF_UNKNOWN = -1,
|
|
||||||
/// <summary>
|
|
||||||
/// Windows or OS/2 Bitmap File (*.BMP)
|
|
||||||
/// </summary>
|
|
||||||
FIF_BMP = 0,
|
|
||||||
/// <summary>
|
|
||||||
/// Windows Icon (*.ICO)
|
|
||||||
/// </summary>
|
|
||||||
FIF_ICO = 1,
|
|
||||||
/// <summary>
|
|
||||||
/// Independent JPEG Group (*.JPG, *.JIF, *.JPEG, *.JPE)
|
|
||||||
/// </summary>
|
|
||||||
FIF_JPEG = 2,
|
|
||||||
/// <summary>
|
|
||||||
/// JPEG Network Graphics (*.JNG)
|
|
||||||
/// </summary>
|
|
||||||
FIF_JNG = 3,
|
|
||||||
/// <summary>
|
|
||||||
/// Commodore 64 Koala format (*.KOA)
|
|
||||||
/// </summary>
|
|
||||||
FIF_KOALA = 4,
|
|
||||||
/// <summary>
|
|
||||||
/// Amiga IFF (*.IFF, *.LBM)
|
|
||||||
/// </summary>
|
|
||||||
FIF_LBM = 5,
|
|
||||||
/// <summary>
|
|
||||||
/// Amiga IFF (*.IFF, *.LBM)
|
|
||||||
/// </summary>
|
|
||||||
FIF_IFF = 5,
|
|
||||||
/// <summary>
|
|
||||||
/// Multiple Network Graphics (*.MNG)
|
|
||||||
/// </summary>
|
|
||||||
FIF_MNG = 6,
|
|
||||||
/// <summary>
|
|
||||||
/// Portable Bitmap (ASCII) (*.PBM)
|
|
||||||
/// </summary>
|
|
||||||
FIF_PBM = 7,
|
|
||||||
/// <summary>
|
|
||||||
/// Portable Bitmap (BINARY) (*.PBM)
|
|
||||||
/// </summary>
|
|
||||||
FIF_PBMRAW = 8,
|
|
||||||
/// <summary>
|
|
||||||
/// Kodak PhotoCD (*.PCD)
|
|
||||||
/// </summary>
|
|
||||||
FIF_PCD = 9,
|
|
||||||
/// <summary>
|
|
||||||
/// Zsoft Paintbrush PCX bitmap format (*.PCX)
|
|
||||||
/// </summary>
|
|
||||||
FIF_PCX = 10,
|
|
||||||
/// <summary>
|
|
||||||
/// Portable Graymap (ASCII) (*.PGM)
|
|
||||||
/// </summary>
|
|
||||||
FIF_PGM = 11,
|
|
||||||
/// <summary>
|
|
||||||
/// Portable Graymap (BINARY) (*.PGM)
|
|
||||||
/// </summary>
|
|
||||||
FIF_PGMRAW = 12,
|
|
||||||
/// <summary>
|
|
||||||
/// Portable Network Graphics (*.PNG)
|
|
||||||
/// </summary>
|
|
||||||
FIF_PNG = 13,
|
|
||||||
/// <summary>
|
|
||||||
/// Portable Pixelmap (ASCII) (*.PPM)
|
|
||||||
/// </summary>
|
|
||||||
FIF_PPM = 14,
|
|
||||||
/// <summary>
|
|
||||||
/// Portable Pixelmap (BINARY) (*.PPM)
|
|
||||||
/// </summary>
|
|
||||||
FIF_PPMRAW = 15,
|
|
||||||
/// <summary>
|
|
||||||
/// Sun Rasterfile (*.RAS)
|
|
||||||
/// </summary>
|
|
||||||
FIF_RAS = 16,
|
|
||||||
/// <summary>
|
|
||||||
/// truevision Targa files (*.TGA, *.TARGA)
|
|
||||||
/// </summary>
|
|
||||||
FIF_TARGA = 17,
|
|
||||||
/// <summary>
|
|
||||||
/// Tagged Image File Format (*.TIF, *.TIFF)
|
|
||||||
/// </summary>
|
|
||||||
FIF_TIFF = 18,
|
|
||||||
/// <summary>
|
|
||||||
/// Wireless Bitmap (*.WBMP)
|
|
||||||
/// </summary>
|
|
||||||
FIF_WBMP = 19,
|
|
||||||
/// <summary>
|
|
||||||
/// Adobe Photoshop (*.PSD)
|
|
||||||
/// </summary>
|
|
||||||
FIF_PSD = 20,
|
|
||||||
/// <summary>
|
|
||||||
/// Dr. Halo (*.CUT)
|
|
||||||
/// </summary>
|
|
||||||
FIF_CUT = 21,
|
|
||||||
/// <summary>
|
|
||||||
/// X11 Bitmap Format (*.XBM)
|
|
||||||
/// </summary>
|
|
||||||
FIF_XBM = 22,
|
|
||||||
/// <summary>
|
|
||||||
/// X11 Pixmap Format (*.XPM)
|
|
||||||
/// </summary>
|
|
||||||
FIF_XPM = 23,
|
|
||||||
/// <summary>
|
|
||||||
/// DirectDraw Surface (*.DDS)
|
|
||||||
/// </summary>
|
|
||||||
FIF_DDS = 24,
|
|
||||||
/// <summary>
|
|
||||||
/// Graphics Interchange Format (*.GIF)
|
|
||||||
/// </summary>
|
|
||||||
FIF_GIF = 25,
|
|
||||||
/// <summary>
|
|
||||||
/// High Dynamic Range (*.HDR)
|
|
||||||
/// </summary>
|
|
||||||
FIF_HDR = 26,
|
|
||||||
/// <summary>
|
|
||||||
/// Raw Fax format CCITT G3 (*.G3)
|
|
||||||
/// </summary>
|
|
||||||
FIF_FAXG3 = 27,
|
|
||||||
/// <summary>
|
|
||||||
/// Silicon Graphics SGI image format (*.SGI)
|
|
||||||
/// </summary>
|
|
||||||
FIF_SGI = 28,
|
|
||||||
/// <summary>
|
|
||||||
/// OpenEXR format (*.EXR)
|
|
||||||
/// </summary>
|
|
||||||
FIF_EXR = 29,
|
|
||||||
/// <summary>
|
|
||||||
/// JPEG-2000 format (*.J2K, *.J2C)
|
|
||||||
/// </summary>
|
|
||||||
FIF_J2K = 30,
|
|
||||||
/// <summary>
|
|
||||||
/// JPEG-2000 format (*.JP2)
|
|
||||||
/// </summary>
|
|
||||||
FIF_JP2 = 31,
|
|
||||||
/// <summary>
|
|
||||||
/// Portable FloatMap (*.PFM)
|
|
||||||
/// </summary>
|
|
||||||
FIF_PFM = 32,
|
|
||||||
/// <summary>
|
|
||||||
/// Macintosh PICT (*.PICT)
|
|
||||||
/// </summary>
|
|
||||||
FIF_PICT = 33,
|
|
||||||
/// <summary>
|
|
||||||
/// RAW camera image (*.*)
|
|
||||||
/// </summary>
|
|
||||||
FIF_RAW = 34,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Vendored
-76
@@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Lossless JPEG transformations constants used in FreeImage_JPEGTransform.
|
|
||||||
/// </summary>
|
|
||||||
public enum FREE_IMAGE_JPEG_OPERATION
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// no transformation
|
|
||||||
/// </summary>
|
|
||||||
FIJPEG_OP_NONE = 0,
|
|
||||||
/// <summary>
|
|
||||||
/// horizontal flip
|
|
||||||
/// </summary>
|
|
||||||
FIJPEG_OP_FLIP_H = 1,
|
|
||||||
/// <summary>
|
|
||||||
/// vertical flip
|
|
||||||
/// </summary>
|
|
||||||
FIJPEG_OP_FLIP_V = 2,
|
|
||||||
/// <summary>
|
|
||||||
/// transpose across UL-to-LR axis
|
|
||||||
/// </summary>
|
|
||||||
FIJPEG_OP_TRANSPOSE = 3,
|
|
||||||
/// <summary>
|
|
||||||
/// transpose across UR-to-LL axis
|
|
||||||
/// </summary>
|
|
||||||
FIJPEG_OP_TRANSVERSE = 4,
|
|
||||||
/// <summary>
|
|
||||||
/// 90-degree clockwise rotation
|
|
||||||
/// </summary>
|
|
||||||
FIJPEG_OP_ROTATE_90 = 5,
|
|
||||||
/// <summary>
|
|
||||||
/// 180-degree rotation
|
|
||||||
/// </summary>
|
|
||||||
FIJPEG_OP_ROTATE_180 = 6,
|
|
||||||
/// <summary>
|
|
||||||
/// 270-degree clockwise (or 90 ccw)
|
|
||||||
/// </summary>
|
|
||||||
FIJPEG_OP_ROTATE_270 = 7
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Vendored
-111
@@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Flags used in load functions.
|
|
||||||
/// </summary>
|
|
||||||
[System.Flags]
|
|
||||||
public enum FREE_IMAGE_LOAD_FLAGS
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Default option for all types.
|
|
||||||
/// </summary>
|
|
||||||
DEFAULT = 0,
|
|
||||||
/// <summary>
|
|
||||||
/// Load the image as a 256 color image with ununsed palette entries, if it's 16 or 2 color.
|
|
||||||
/// </summary>
|
|
||||||
GIF_LOAD256 = 1,
|
|
||||||
/// <summary>
|
|
||||||
/// 'Play' the GIF to generate each frame (as 32bpp) instead of returning raw frame data when loading.
|
|
||||||
/// </summary>
|
|
||||||
GIF_PLAYBACK = 2,
|
|
||||||
/// <summary>
|
|
||||||
/// Convert to 32bpp and create an alpha channel from the AND-mask when loading.
|
|
||||||
/// </summary>
|
|
||||||
ICO_MAKEALPHA = 1,
|
|
||||||
/// <summary>
|
|
||||||
/// Load the file as fast as possible, sacrificing some quality.
|
|
||||||
/// </summary>
|
|
||||||
JPEG_FAST = 0x0001,
|
|
||||||
/// <summary>
|
|
||||||
/// Load the file with the best quality, sacrificing some speed.
|
|
||||||
/// </summary>
|
|
||||||
JPEG_ACCURATE = 0x0002,
|
|
||||||
/// <summary>
|
|
||||||
/// Load separated CMYK "as is" (use | to combine with other load flags).
|
|
||||||
/// </summary>
|
|
||||||
JPEG_CMYK = 0x0004,
|
|
||||||
/// <summary>
|
|
||||||
/// Load and rotate according to Exif 'Orientation' tag if available.
|
|
||||||
/// </summary>
|
|
||||||
JPEG_EXIFROTATE = 0x0008,
|
|
||||||
/// <summary>
|
|
||||||
/// Load the bitmap sized 768 x 512.
|
|
||||||
/// </summary>
|
|
||||||
PCD_BASE = 1,
|
|
||||||
/// <summary>
|
|
||||||
/// Load the bitmap sized 384 x 256.
|
|
||||||
/// </summary>
|
|
||||||
PCD_BASEDIV4 = 2,
|
|
||||||
/// <summary>
|
|
||||||
/// Load the bitmap sized 192 x 128.
|
|
||||||
/// </summary>
|
|
||||||
PCD_BASEDIV16 = 3,
|
|
||||||
/// <summary>
|
|
||||||
/// Avoid gamma correction.
|
|
||||||
/// </summary>
|
|
||||||
PNG_IGNOREGAMMA = 1,
|
|
||||||
/// <summary>
|
|
||||||
/// If set the loader converts RGB555 and ARGB8888 -> RGB888.
|
|
||||||
/// </summary>
|
|
||||||
TARGA_LOAD_RGB888 = 1,
|
|
||||||
/// <summary>
|
|
||||||
/// Reads tags for separated CMYK.
|
|
||||||
/// </summary>
|
|
||||||
TIFF_CMYK = 0x0001,
|
|
||||||
/// <summary>
|
|
||||||
/// 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.
|
|
||||||
/// </summary>
|
|
||||||
RAW_PREVIEW = 0x1,
|
|
||||||
/// <summary>
|
|
||||||
/// Loads the image as RGB 24-bit.
|
|
||||||
/// </summary>
|
|
||||||
RAW_DISPLAY = 0x2,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-92
@@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Metadata models supported by FreeImage.
|
|
||||||
/// </summary>
|
|
||||||
public enum FREE_IMAGE_MDMODEL
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// No data
|
|
||||||
/// </summary>
|
|
||||||
FIMD_NODATA = -1,
|
|
||||||
/// <summary>
|
|
||||||
/// single comment or keywords
|
|
||||||
/// </summary>
|
|
||||||
FIMD_COMMENTS = 0,
|
|
||||||
/// <summary>
|
|
||||||
/// Exif-TIFF metadata
|
|
||||||
/// </summary>
|
|
||||||
FIMD_EXIF_MAIN = 1,
|
|
||||||
/// <summary>
|
|
||||||
/// Exif-specific metadata
|
|
||||||
/// </summary>
|
|
||||||
FIMD_EXIF_EXIF = 2,
|
|
||||||
/// <summary>
|
|
||||||
/// Exif GPS metadata
|
|
||||||
/// </summary>
|
|
||||||
FIMD_EXIF_GPS = 3,
|
|
||||||
/// <summary>
|
|
||||||
/// Exif maker note metadata
|
|
||||||
/// </summary>
|
|
||||||
FIMD_EXIF_MAKERNOTE = 4,
|
|
||||||
/// <summary>
|
|
||||||
/// Exif interoperability metadata
|
|
||||||
/// </summary>
|
|
||||||
FIMD_EXIF_INTEROP = 5,
|
|
||||||
/// <summary>
|
|
||||||
/// IPTC/NAA metadata
|
|
||||||
/// </summary>
|
|
||||||
FIMD_IPTC = 6,
|
|
||||||
/// <summary>
|
|
||||||
/// Abobe XMP metadata
|
|
||||||
/// </summary>
|
|
||||||
FIMD_XMP = 7,
|
|
||||||
/// <summary>
|
|
||||||
/// GeoTIFF metadata
|
|
||||||
/// </summary>
|
|
||||||
FIMD_GEOTIFF = 8,
|
|
||||||
/// <summary>
|
|
||||||
/// Animation metadata
|
|
||||||
/// </summary>
|
|
||||||
FIMD_ANIMATION = 9,
|
|
||||||
/// <summary>
|
|
||||||
/// Used to attach other metadata types to a dib
|
|
||||||
/// </summary>
|
|
||||||
FIMD_CUSTOM = 10
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-105
@@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Tag data type information (based on TIFF specifications)
|
|
||||||
/// Note: RATIONALs are the ratio of two 32-bit integer values.
|
|
||||||
/// </summary>
|
|
||||||
public enum FREE_IMAGE_MDTYPE
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// placeholder
|
|
||||||
/// </summary>
|
|
||||||
FIDT_NOTYPE = 0,
|
|
||||||
/// <summary>
|
|
||||||
/// 8-bit unsigned integer
|
|
||||||
/// </summary>
|
|
||||||
FIDT_BYTE = 1,
|
|
||||||
/// <summary>
|
|
||||||
/// 8-bit bytes w/ last byte null
|
|
||||||
/// </summary>
|
|
||||||
FIDT_ASCII = 2,
|
|
||||||
/// <summary>
|
|
||||||
/// 16-bit unsigned integer
|
|
||||||
/// </summary>
|
|
||||||
FIDT_SHORT = 3,
|
|
||||||
/// <summary>
|
|
||||||
/// 32-bit unsigned integer
|
|
||||||
/// </summary>
|
|
||||||
FIDT_LONG = 4,
|
|
||||||
/// <summary>
|
|
||||||
/// 64-bit unsigned fraction
|
|
||||||
/// </summary>
|
|
||||||
FIDT_RATIONAL = 5,
|
|
||||||
/// <summary>
|
|
||||||
/// 8-bit signed integer
|
|
||||||
/// </summary>
|
|
||||||
FIDT_SBYTE = 6,
|
|
||||||
/// <summary>
|
|
||||||
/// 8-bit untyped data
|
|
||||||
/// </summary>
|
|
||||||
FIDT_UNDEFINED = 7,
|
|
||||||
/// <summary>
|
|
||||||
/// 16-bit signed integer
|
|
||||||
/// </summary>
|
|
||||||
FIDT_SSHORT = 8,
|
|
||||||
/// <summary>
|
|
||||||
/// 32-bit signed integer
|
|
||||||
/// </summary>
|
|
||||||
FIDT_SLONG = 9,
|
|
||||||
/// <summary>
|
|
||||||
/// 64-bit signed fraction
|
|
||||||
/// </summary>
|
|
||||||
FIDT_SRATIONAL = 10,
|
|
||||||
/// <summary>
|
|
||||||
/// 32-bit IEEE floating point
|
|
||||||
/// </summary>
|
|
||||||
FIDT_FLOAT = 11,
|
|
||||||
/// <summary>
|
|
||||||
/// 64-bit IEEE floating point
|
|
||||||
/// </summary>
|
|
||||||
FIDT_DOUBLE = 12,
|
|
||||||
/// <summary>
|
|
||||||
/// 32-bit unsigned integer (offset)
|
|
||||||
/// </summary>
|
|
||||||
FIDT_IFD = 13,
|
|
||||||
/// <summary>
|
|
||||||
/// 32-bit RGBQUAD
|
|
||||||
/// </summary>
|
|
||||||
FIDT_PALETTE = 14
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Vendored
-56
@@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Flags for copying data from a bitmap to another.
|
|
||||||
/// </summary>
|
|
||||||
public enum FREE_IMAGE_METADATA_COPY
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Exisiting metadata will remain unchanged.
|
|
||||||
/// </summary>
|
|
||||||
KEEP_EXISITNG = 0x0,
|
|
||||||
/// <summary>
|
|
||||||
/// Existing metadata will be cleared.
|
|
||||||
/// </summary>
|
|
||||||
CLEAR_EXISTING = 0x1,
|
|
||||||
/// <summary>
|
|
||||||
/// Existing metadata will be overwritten.
|
|
||||||
/// </summary>
|
|
||||||
REPLACE_EXISTING = 0x2
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-53
@@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Color quantization algorithms.
|
|
||||||
/// Constants used in FreeImage_ColorQuantize.
|
|
||||||
/// </summary>
|
|
||||||
public enum FREE_IMAGE_QUANTIZE
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Xiaolin Wu color quantization algorithm
|
|
||||||
/// </summary>
|
|
||||||
FIQ_WUQUANT = 0,
|
|
||||||
/// <summary>
|
|
||||||
/// NeuQuant neural-net quantization algorithm by Anthony Dekker
|
|
||||||
/// </summary>
|
|
||||||
FIQ_NNQUANT = 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Vendored
-191
@@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Flags used in save functions.
|
|
||||||
/// </summary>
|
|
||||||
[System.Flags]
|
|
||||||
public enum FREE_IMAGE_SAVE_FLAGS
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Default option for all types.
|
|
||||||
/// </summary>
|
|
||||||
DEFAULT = 0,
|
|
||||||
/// <summary>
|
|
||||||
/// Save with run length encoding.
|
|
||||||
/// </summary>
|
|
||||||
BMP_SAVE_RLE = 1,
|
|
||||||
/// <summary>
|
|
||||||
/// Save data as float instead of as half (not recommended).
|
|
||||||
/// </summary>
|
|
||||||
EXR_FLOAT = 0x0001,
|
|
||||||
/// <summary>
|
|
||||||
/// Save with no compression.
|
|
||||||
/// </summary>
|
|
||||||
EXR_NONE = 0x0002,
|
|
||||||
/// <summary>
|
|
||||||
/// Save with zlib compression, in blocks of 16 scan lines.
|
|
||||||
/// </summary>
|
|
||||||
EXR_ZIP = 0x0004,
|
|
||||||
/// <summary>
|
|
||||||
/// Save with piz-based wavelet compression.
|
|
||||||
/// </summary>
|
|
||||||
EXR_PIZ = 0x0008,
|
|
||||||
/// <summary>
|
|
||||||
/// Save with lossy 24-bit float compression.
|
|
||||||
/// </summary>
|
|
||||||
EXR_PXR24 = 0x0010,
|
|
||||||
/// <summary>
|
|
||||||
/// Save with lossy 44% float compression - goes to 22% when combined with EXR_LC.
|
|
||||||
/// </summary>
|
|
||||||
EXR_B44 = 0x0020,
|
|
||||||
/// <summary>
|
|
||||||
/// Save images with one luminance and two chroma channels, rather than as RGB (lossy compression).
|
|
||||||
/// </summary>
|
|
||||||
EXR_LC = 0x0040,
|
|
||||||
/// <summary>
|
|
||||||
/// Save with superb quality (100:1).
|
|
||||||
/// </summary>
|
|
||||||
JPEG_QUALITYSUPERB = 0x80,
|
|
||||||
/// <summary>
|
|
||||||
/// Save with good quality (75:1).
|
|
||||||
/// </summary>
|
|
||||||
JPEG_QUALITYGOOD = 0x0100,
|
|
||||||
/// <summary>
|
|
||||||
/// Save with normal quality (50:1).
|
|
||||||
/// </summary>
|
|
||||||
JPEG_QUALITYNORMAL = 0x0200,
|
|
||||||
/// <summary>
|
|
||||||
/// Save with average quality (25:1).
|
|
||||||
/// </summary>
|
|
||||||
JPEG_QUALITYAVERAGE = 0x0400,
|
|
||||||
/// <summary>
|
|
||||||
/// Save with bad quality (10:1).
|
|
||||||
/// </summary>
|
|
||||||
JPEG_QUALITYBAD = 0x0800,
|
|
||||||
/// <summary>
|
|
||||||
/// Save as a progressive-JPEG (use | to combine with other save flags).
|
|
||||||
/// </summary>
|
|
||||||
JPEG_PROGRESSIVE = 0x2000,
|
|
||||||
/// <summary>
|
|
||||||
/// Save with high 4x1 chroma subsampling (4:1:1).
|
|
||||||
/// </summary>
|
|
||||||
JPEG_SUBSAMPLING_411 = 0x1000,
|
|
||||||
/// <summary>
|
|
||||||
/// Save with medium 2x2 medium chroma (4:2:0).
|
|
||||||
/// </summary>
|
|
||||||
JPEG_SUBSAMPLING_420 = 0x4000,
|
|
||||||
/// <summary>
|
|
||||||
/// Save with low 2x1 chroma subsampling (4:2:2).
|
|
||||||
/// </summary>
|
|
||||||
JPEG_SUBSAMPLING_422 = 0x8000,
|
|
||||||
/// <summary>
|
|
||||||
/// Save with no chroma subsampling (4:4:4).
|
|
||||||
/// </summary>
|
|
||||||
JPEG_SUBSAMPLING_444 = 0x10000,
|
|
||||||
/// <summary>
|
|
||||||
/// On saving, compute optimal Huffman coding tables (can reduce a few percent of file size).
|
|
||||||
/// </summary>
|
|
||||||
JPEG_OPTIMIZE = 0x20000,
|
|
||||||
/// <summary>
|
|
||||||
/// save basic JPEG, without metadata or any markers.
|
|
||||||
/// </summary>
|
|
||||||
JPEG_BASELINE = 0x40000,
|
|
||||||
/// <summary>
|
|
||||||
/// Save using ZLib level 1 compression flag
|
|
||||||
/// (default value is <see cref="PNG_Z_DEFAULT_COMPRESSION"/>).
|
|
||||||
/// </summary>
|
|
||||||
PNG_Z_BEST_SPEED = 0x0001,
|
|
||||||
/// <summary>
|
|
||||||
/// Save using ZLib level 6 compression flag (default recommended value).
|
|
||||||
/// </summary>
|
|
||||||
PNG_Z_DEFAULT_COMPRESSION = 0x0006,
|
|
||||||
/// <summary>
|
|
||||||
/// save using ZLib level 9 compression flag
|
|
||||||
/// (default value is <see cref="PNG_Z_DEFAULT_COMPRESSION"/>).
|
|
||||||
/// </summary>
|
|
||||||
PNG_Z_BEST_COMPRESSION = 0x0009,
|
|
||||||
/// <summary>
|
|
||||||
/// Save without ZLib compression.
|
|
||||||
/// </summary>
|
|
||||||
PNG_Z_NO_COMPRESSION = 0x0100,
|
|
||||||
/// <summary>
|
|
||||||
/// Save using Adam7 interlacing (use | to combine with other save flags).
|
|
||||||
/// </summary>
|
|
||||||
PNG_INTERLACED = 0x0200,
|
|
||||||
/// <summary>
|
|
||||||
/// If set the writer saves in ASCII format (i.e. P1, P2 or P3).
|
|
||||||
/// </summary>
|
|
||||||
PNM_SAVE_ASCII = 1,
|
|
||||||
/// <summary>
|
|
||||||
/// Stores tags for separated CMYK (use | to combine with compression flags).
|
|
||||||
/// </summary>
|
|
||||||
TIFF_CMYK = 0x0001,
|
|
||||||
/// <summary>
|
|
||||||
/// Save using PACKBITS compression.
|
|
||||||
/// </summary>
|
|
||||||
TIFF_PACKBITS = 0x0100,
|
|
||||||
/// <summary>
|
|
||||||
/// Save using DEFLATE compression (a.k.a. ZLIB compression).
|
|
||||||
/// </summary>
|
|
||||||
TIFF_DEFLATE = 0x0200,
|
|
||||||
/// <summary>
|
|
||||||
/// Save using ADOBE DEFLATE compression.
|
|
||||||
/// </summary>
|
|
||||||
TIFF_ADOBE_DEFLATE = 0x0400,
|
|
||||||
/// <summary>
|
|
||||||
/// Save without any compression.
|
|
||||||
/// </summary>
|
|
||||||
TIFF_NONE = 0x0800,
|
|
||||||
/// <summary>
|
|
||||||
/// Save using CCITT Group 3 fax encoding.
|
|
||||||
/// </summary>
|
|
||||||
TIFF_CCITTFAX3 = 0x1000,
|
|
||||||
/// <summary>
|
|
||||||
/// Save using CCITT Group 4 fax encoding.
|
|
||||||
/// </summary>
|
|
||||||
TIFF_CCITTFAX4 = 0x2000,
|
|
||||||
/// <summary>
|
|
||||||
/// Save using LZW compression.
|
|
||||||
/// </summary>
|
|
||||||
TIFF_LZW = 0x4000,
|
|
||||||
/// <summary>
|
|
||||||
/// Save using JPEG compression.
|
|
||||||
/// </summary>
|
|
||||||
TIFF_JPEG = 0x8000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-56
@@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Tone mapping operators. Constants used in FreeImage_ToneMapping.
|
|
||||||
/// </summary>
|
|
||||||
public enum FREE_IMAGE_TMO
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Adaptive logarithmic mapping (F. Drago, 2003)
|
|
||||||
/// </summary>
|
|
||||||
FITMO_DRAGO03 = 0,
|
|
||||||
/// <summary>
|
|
||||||
/// Dynamic range reduction inspired by photoreceptor physiology (E. Reinhard, 2005)
|
|
||||||
/// </summary>
|
|
||||||
FITMO_REINHARD05 = 1,
|
|
||||||
/// <summary>
|
|
||||||
/// Gradient domain high dynamic range compression (R. Fattal, 2002)
|
|
||||||
/// </summary>
|
|
||||||
FITMO_FATTAL02
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user